diff --git a/.gitmodules b/.gitmodules index bd4620625cf..f7632c4abbd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -18,3 +18,7 @@ path = tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter url = https://github.com/Microsoft/TypeScript-WeChat-Starter.git ignore = all +[submodule "tests/cases/user/webpack/webpack"] + path = tests/cases/user/webpack/webpack + url = https://github.com/webpack/webpack.git + ignore = all diff --git a/Gulpfile.ts b/Gulpfile.ts index 1c6cfdd7ed1..26622f36fe8 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -362,20 +362,11 @@ const builtGeneratedDiagnosticMessagesJSON = path.join(builtLocalDirectory, "dia // processDiagnosticMessages script gulp.task(processDiagnosticMessagesJs, /*help*/ false, [], () => { - const settings: tsc.Settings = getCompilerSettings({ - target: "es5", - declaration: false, - removeComments: true, - noResolve: false, - stripInternal: false, - outFile: processDiagnosticMessagesJs - }, /*useBuiltCompiler*/ false); - return gulp.src(processDiagnosticMessagesTs) + const diagsProject = tsc.createProject('./scripts/processDiagnosticMessages.tsconfig.json'); + return diagsProject.src() .pipe(newer(processDiagnosticMessagesJs)) - .pipe(sourcemaps.init()) - .pipe(tsc(settings)) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(".")); + .pipe(diagsProject()) + .pipe(gulp.dest(scriptsDirectory)); }); // The generated diagnostics map; built for the compiler and for the "generate-diagnostics" task diff --git a/Jakefile.js b/Jakefile.js index d570a7cfc3d..bda270b0b4c 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -87,93 +87,10 @@ var typingsInstallerSources = filesFromConfig(path.join(serverDirectory, "typing var watchGuardSources = filesFromConfig(path.join(serverDirectory, "watchGuard/tsconfig.json")); var serverSources = filesFromConfig(path.join(serverDirectory, "tsconfig.json")); var languageServiceLibrarySources = filesFromConfig(path.join(serverDirectory, "tsconfig.library.json")); +var harnessSources = filesFromConfig("./src/harness/tsconfig.json"); var typesMapOutputPath = path.join(builtLocalDirectory, 'typesMap.json'); -var harnessCoreSources = [ - "harness.ts", - "virtualFileSystem.ts", - "virtualFileSystemWithWatch.ts", - "sourceMapRecorder.ts", - "harnessLanguageService.ts", - "fourslash.ts", - "runnerbase.ts", - "compilerRunner.ts", - "typeWriter.ts", - "fourslashRunner.ts", - "projectsRunner.ts", - "loggedIO.ts", - "rwcRunner.ts", - "externalCompileRunner.ts", - "test262Runner.ts", - "./parallel/shared.ts", - "./parallel/host.ts", - "./parallel/worker.ts", - "runner.ts" -].map(function (f) { - return path.join(harnessDirectory, f); -}); - -var harnessSources = harnessCoreSources.concat([ - "base64.ts", - "incrementalParser.ts", - "jsDocParsing.ts", - "services/colorization.ts", - "services/documentRegistry.ts", - "services/preProcessFile.ts", - "services/patternMatcher.ts", - "session.ts", - "versionCache.ts", - "convertToBase64.ts", - "transpile.ts", - "reuseProgramStructure.ts", - "textStorage.ts", - "moduleResolution.ts", - "tsconfigParsing.ts", - "asserts.ts", - "builder.ts", - "commandLineParsing.ts", - "configurationExtension.ts", - "convertCompilerOptionsFromJson.ts", - "convertTypeAcquisitionFromJson.ts", - "tsserverProjectSystem.ts", - "tscWatchMode.ts", - "compileOnSave.ts", - "typingsInstaller.ts", - "projectErrors.ts", - "matchFiles.ts", - "organizeImports.ts", - "initializeTSConfig.ts", - "extractConstants.ts", - "extractFunctions.ts", - "extractRanges.ts", - "extractTestHelpers.ts", - "printer.ts", - "textChanges.ts", - "telemetry.ts", - "transform.ts", - "customTransforms.ts", - "programMissingFiles.ts", - "programNoParseFalsyFileNames.ts", - "symbolWalker.ts", - "languageService.ts", - "publicApi.ts", - "hostNewLineSupport.ts", -].map(function (f) { - return path.join(unittestsDirectory, f); -})).concat([ - "protocol.ts", - "utilities.ts", - "scriptVersionCache.ts", - "scriptInfo.ts", - "project.ts", - "typingsCache.ts", - "editorServices.ts", - "session.ts", -].map(function (f) { - return path.join(serverDirectory, f); -})); - var es2015LibrarySources = [ "es2015.core.d.ts", "es2015.collection.d.ts", @@ -451,6 +368,8 @@ task("lib", libraryTargets); // Generate diagnostics var processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnosticMessages.js"); var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnosticMessages.ts"); +var processDiagnosticMessagesSources = filesFromConfig("./scripts/processDiagnosticMessages.tsconfig.json"); + var diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json"); var diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts"); var generatedDiagnosticMessagesJSON = path.join(compilerDirectory, "diagnosticMessages.generated.json"); @@ -460,8 +379,8 @@ file(processDiagnosticMessagesTs); // processDiagnosticMessages script compileFile(processDiagnosticMessagesJs, - [processDiagnosticMessagesTs], - [processDiagnosticMessagesTs], + processDiagnosticMessagesSources, + processDiagnosticMessagesSources, [], /*useBuiltCompiler*/ false); diff --git a/lib/cs/diagnosticMessages.generated.json b/lib/cs/diagnosticMessages.generated.json index 8ea577e3aa4..923ad9fc07f 100644 --- a/lib/cs/diagnosticMessages.generated.json +++ b/lib/cs/diagnosticMessages.generated.json @@ -94,12 +94,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "Přístupové objekty jsou dostupné, jenom když je cílem ECMAScript 5 a vyšší verze.", "Accessors_must_both_be_abstract_or_non_abstract_2676": "Přistupující objekty musí být abstraktní nebo neabstraktní.", "Add_0_to_existing_import_declaration_from_1_90015": "Přidat {0} k existující deklaraci importu z {1}", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "Přidat modifikátor async do obsahující funkce", "Add_definite_assignment_assertion_to_property_0_95020": "Přidat kontrolní výraz jednoznačného přiřazení k vlastnosti {0}", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "Přidat signaturu indexu pro vlastnost {0}", "Add_initializer_to_property_0_95019": "Přidat inicializační výraz k vlastnosti {0}", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "Přidat chybějící volání metody super()", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "Přidat k nerozpoznané proměnné this.", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "Přidat typ undefined k vlastnosti {0}", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Přidání souboru tsconfig.json vám pomůže uspořádat projekty, které obsahují jak soubory TypeScript, tak soubory JavaScript. Další informace najdete na adrese https://aka.ms/tsconfig.", "Additional_Checks_6176": "Další kontroly", @@ -156,6 +165,7 @@ "An_object_member_cannot_be_declared_optional_1162": "Člen objektu nemůže být deklarovaný jako nepovinný.", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "Signatura přetížení nemůže být deklarovaný jako generátor.", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "Unární výraz s operátorem {0} se na levé straně výrazu umocnění nepovoluje. Zvažte možnost uzavření výrazu do závorek.", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "Přidat poznámku s typem z JSDoc", "Annotate_with_types_from_JSDoc_95010": "Přidat poznámky s typy z JSDoc", "Argument_expression_expected_1135": "Očekává se výraz argumentu.", @@ -223,6 +233,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "Proměnná klauzule catch nemůže mít anotaci typu.", "Catch_clause_variable_cannot_have_an_initializer_1197": "Proměnná klauzule catch nemůže mít inicializátor.", "Change_0_to_1_90014": "Změnit {0} na {1}", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "Změnit extends na implements", "Change_spelling_to_0_90022": "Změnit pravopis na {0}", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "Kontroluje se, jestli je {0} nejdelší odpovídající předpona pro {1}–{2}.", @@ -256,6 +269,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "Konstruktor třídy {0} je chráněný a dostupný jenom v rámci deklarace třídy.", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "Konstruktory odvozených tříd musí obsahovat volání příkazu super.", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "Není zadaný obsažený soubor a nedá se určit kořenový adresář – přeskakuje se vyhledávání ve složce node_modules.", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "Převést funkci {0} na třídu", "Convert_function_to_an_ES2015_class_95001": "Převést funkci na třídu ES2015", "Convert_to_ES6_module_95017": "Převést na modul ES6", @@ -274,6 +289,7 @@ "Decorators_are_not_valid_here_1206": "Dekorátory tady nejsou platné.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Dekorátory nejde použít na víc přístupových objektů get/set se stejným názvem.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Výchozí export modulu má nebo používá privátní název {0}.", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Zastaralé] Použijte místo toho --jsxFactory. Určí objekt vyvolaný pro createElement při cílení na generování JSX react.", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Zastaralé] Použijte místo toho --outFile. Zřetězí a vygeneruje výstup do jednoho souboru.", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Zastaralé] Použijte místo toho --skipLibCheck. Přeskočí kontrolu typů výchozích souborů deklarací knihovny.", @@ -388,6 +404,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "Název souboru {0} má příponu {1} – odstraňuje se", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "Specifikace souboru nemůže obsahovat nadřazený adresář (..), který se vyskytuje za rekurzivním zástupným znakem adresáře (**): {0}.", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "Specifikace souboru nemůže končit rekurzivním zástupným znakem adresáře (**): {0}.", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "Soubor package.json se našel v {0}.", "Found_package_json_at_0_Package_ID_is_1_6190": "V {0} se našel soubor package.json. ID balíčku je {1}.", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "Deklarace funkcí nejsou povolené uvnitř bloků ve striktním režimu, pokud je cíl ES3 nebo ES5.", @@ -400,6 +417,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Ve funkci chybí koncový návratový příkaz a návratový typ neobsahuje undefined.", "Function_overload_must_be_static_2387": "Přetížení funkce musí být statické.", "Function_overload_must_not_be_static_2388": "Přetížení funkce nesmí být statické.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Pro každý odpovídající soubor .d.ts vygeneruje sourcemap.", "Generates_corresponding_d_ts_file_6002": "Generuje odpovídající soubor .d.ts.", "Generates_corresponding_map_file_6043": "Generuje odpovídající soubor .map.", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Generátor má implicitně typ {0}, protože nevydává žádné hodnoty. Zvažte možnost přidání návratového typu.", @@ -421,6 +439,8 @@ "Identifier_expected_1003": "Očekával se identifikátor.", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "Očekává se identifikátor. __esModule je při transformaci modulů ECMAScript rezervované jako označení exportu.", "Ignore_this_error_message_90019": "Ignorovat tuto chybovou zprávu", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "Implementovat zděděnou abstraktní třídu", "Implement_interface_0_90006": "Implementovat rozhraní {0}", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "Klauzule implements exportované třídy {0} má nebo používá privátní název {1}.", @@ -441,6 +461,7 @@ "Index_signature_is_missing_in_type_0_2329": "V typu {0} chybí signatura indexu.", "Index_signatures_are_incompatible_2330": "Signatury indexu jsou nekompatibilní.", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "Jednotlivé deklarace ve sloučené deklaraci {0} musí být všechny exportované nebo všechny místní.", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "Odvodit typy parametrů z využití", "Infer_type_of_0_from_usage_95011": "Odvodit typ {0} z využití", "Initialize_property_0_in_the_constructor_90020": "Inicializovat vlastnost {0} v konstruktoru", @@ -452,6 +473,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "Inicializuje projekt TypeScript a vytvoří soubor tsconfig.json.", "Insert_command_line_options_and_files_from_a_file_6030": "Vložte parametry příkazového řádku a soubory ze souboru.", "Install_0_95014": "Nainstalovat {0}", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "Rozhraní {0} nemůže současně rozšiřovat typ {1} i {2}.", "Interface_0_incorrectly_extends_interface_1_2430": "Rozhraní {0} nesprávně rozšiřuje rozhraní {1}.", "Interface_declaration_cannot_have_implements_clause_1176": "Deklarace rozhraní nemůže obsahovat klauzuli implements.", @@ -504,6 +526,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "Národní prostředí musí mít tvar nebo . Třeba {0} nebo {1}.", "Longest_matching_prefix_for_0_is_1_6108": "Nejdelší odpovídající předpona pro {0} je {1}.", "Looking_up_in_node_modules_folder_initial_location_0_6125": "Hledání ve složce node_modules, počáteční umístění {0}", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "Nastavit volání metody super() jako první příkaz v konstruktoru", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Typu mapovaného objektu má implicitně typ šablony any.", "Member_0_implicitly_has_an_1_type_7008": "Člen {0} má implicitně typ {1}.", @@ -566,6 +589,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "Možnost {0} jde použít jenom při zadání možnosti --inlineSourceMap nebo možnosti --sourceMap.", "Option_0_cannot_be_specified_with_option_1_5053": "Možnosti {0} a {1} nejde zadat zároveň.", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "Možnost {0} nejde zadat bez možnosti {1}.", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Možnost {0} nejde zadat bez možnosti {1} nebo {2}.", "Option_0_should_have_array_of_strings_as_a_value_6103": "Hodnota možnosti {0} by měla být pole řetězců.", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "Možnost isolatedModules jde použít jenom v případě, že je poskytnutá možnost --module nebo že možnost target je ES2015 nebo vyšší verze.", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Možnost paths se nedá použít bez zadání možnosti --baseUrl.", @@ -610,6 +634,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "Parsovat ve striktním režimu a generovat striktní používání pro každý zdrojový soubor", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "Vzor {0} může obsahovat nanejvýš jeden znak * (hvězdička).", "Prefix_0_with_an_underscore_90025": "Předpona {0} s podtržítkem", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "Část kompilace, při které se vypisují názvy souborů", "Print_names_of_generated_files_part_of_the_compilation_6154": "Část kompilace, při které se vypisují názvy generovaných souborů", "Print_the_compiler_s_version_6019": "Vytisknout verzi kompilátoru", @@ -708,6 +733,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "Návratový typ veřejné statické metody z exportované třídy má nebo používá privátní název {0}.", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "Znovu se používají vyhodnocení modulu z {0}, protože vyhodnocení se oproti původnímu programu nezměnila.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "Znovu se používá vyhodnocení modulu {0} do souboru {1} z původního programu.", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "Přepsat jako indexovaný typ přístupu {0}", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "Nedá se určit kořenový adresář, přeskakují se primární cesty hledání.", "STRATEGY_6039": "STRATEGIE", diff --git a/lib/de/diagnosticMessages.generated.json b/lib/de/diagnosticMessages.generated.json index a8a0fbcccdb..4db9a07d7ef 100644 --- a/lib/de/diagnosticMessages.generated.json +++ b/lib/de/diagnosticMessages.generated.json @@ -66,6 +66,7 @@ "A_rest_parameter_cannot_have_an_initializer_1048": "Ein rest-Parameter darf keinen Initialisierer aufweisen.", "A_rest_parameter_must_be_last_in_a_parameter_list_1014": "Ein rest-Parameter muss in einer Parameterliste der letzte Eintrag sein.", "A_rest_parameter_must_be_of_an_array_type_2370": "Ein rest-Parameter muss ein Arraytyp sein.", + "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013": "A rest parameter or binding pattern may not have a trailing comma.", "A_return_statement_can_only_be_used_within_a_function_body_1108": "Eine return-Anweisung kann nur in einem Funktionstext verwendet werden.", "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167": "Eine Reihe von Einträgen, die Importe zum Nachschlagen von Speicherorten in Bezug auf die \"baseUrl\" neu zuordnen.", "A_set_accessor_cannot_have_a_return_type_annotation_1095": "Eine set-Zugriffsmethode darf keine Rückgabetypanmerkung aufweisen.", @@ -94,12 +95,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "Zugriffsmethoden sind nur verfügbar, wenn das Ziel ECMAScript 5 oder höher ist.", "Accessors_must_both_be_abstract_or_non_abstract_2676": "Beide Accessoren müssen abstrakt oder nicht abstrakt sein.", "Add_0_to_existing_import_declaration_from_1_90015": "\"{0}\" der vorhandenen Importdeklaration aus \"{1}\" hinzufügen", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "Async-Modifizierer zur enthaltenden Funktion hinzufügen", "Add_definite_assignment_assertion_to_property_0_95020": "Definitive Zuweisungsassertion zu Eigenschaft \"{0}\" hinzufügen", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "Indexsignatur für die Eigenschaft \"{0}\" hinzufügen", "Add_initializer_to_property_0_95019": "Initialisierer zu Eigenschaft \"{0}\" hinzufügen", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "Fehlenden super()-Aufruf hinzufügen", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "Der nicht aufgelösten Variablen \"this.\" hinzufügen", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "undefined-Typ zu Eigenschaft \"{0}\" hinzufügen", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Das Hinzufügen einer \"tsconfig.json\"-Datei erleichtert die Organisation von Projekten, die sowohl TypeScript- als auch JavaScript-Dateien enthalten. Weitere Informationen finden Sie unter https://aka.ms/tsconfig.", "Additional_Checks_6176": "Zusätzliche Überprüfungen", @@ -156,6 +166,7 @@ "An_object_member_cannot_be_declared_optional_1162": "Ein Objektmember darf nicht als optional deklariert werden.", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "Eine Überladungssignatur darf nicht als ein Generator deklariert werden.", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "Unäre Ausdrücke mit dem Operator \"{0}\" sind auf der linken Seite von Potenzierungsausdrücken nicht zulässig. Erwägen Sie, den Ausdruck in Klammern zu setzen.", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "Mit Typ aus JSDoc kommentieren", "Annotate_with_types_from_JSDoc_95010": "Mit Typen aus JSDoc kommentieren", "Argument_expression_expected_1135": "Es wurde ein Argumentausdruck erwartet.", @@ -223,6 +234,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "Die Variable der Catch-Klausel darf keine Typanmerkung aufweisen.", "Catch_clause_variable_cannot_have_an_initializer_1197": "Die Variable der Catch-Klausel darf keinen Initialisierer aufweisen.", "Change_0_to_1_90014": "\"{0}\" in \"{1}\" ändern", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "\"extends\" in \"implements\" ändern", "Change_spelling_to_0_90022": "Schreibweise in \"{0}\" ändern", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "Es wird überprüft, ob \"{0}\" das längste übereinstimmende Präfix für \"{1}\"–\"{2}\" ist.", @@ -256,6 +270,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "Der Konstruktor der Klasse \"{0}\" ist geschützt. Auf ihn kann nur innerhalb der Klassendeklaration zugegriffen werden.", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "Konstruktoren für abgeleitete Klassen müssen einen Aufruf \"super\" enthalten.", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "Die enthaltene Datei wird nicht angegeben, und das Stammverzeichnis kann nicht ermittelt werden. Die Suche im Ordner \"node_modules\" wird übersprungen.", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "Funktion \"{0}\" in Klasse konvertieren", "Convert_function_to_an_ES2015_class_95001": "Funktion in eine ES2015-Klasse konvertieren", "Convert_to_ES6_module_95017": "In ES6-Modul konvertieren", @@ -274,6 +290,7 @@ "Decorators_are_not_valid_here_1206": "Decorators sind hier ungültig.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Decorators dürfen nicht auf mehrere get-/set-Zugriffsmethoden mit dem gleichen Namen angewendet werden.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Der Standardexport des Moduls besitzt oder verwendet den privaten Namen \"{0}\".", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Veraltet] Verwenden Sie stattdessen \"--jsxFactory\". Geben Sie das Objekt an, das für \"createElement\" aufgerufen wurde, wenn das Ziel die JSX-Ausgabe \"react\" ist.", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Veraltet] Verwenden Sie stattdessen \"--outFile\". Verketten und Ausgeben in eine einzige Datei", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Veraltet] Verwenden Sie stattdessen \"--skipLibCheck\". Überspringen Sie die Typüberprüfung der Standardbibliothek-Deklarationsdateien.", @@ -388,6 +405,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "Der Dateiname \"{0}\" weist eine Erweiterung \"{1}\" auf. Diese wird entfernt.", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "Die Dateispezifikation darf kein übergeordnetes Verzeichnis (\"..\") enthalten, das nach einem rekursiven Verzeichnisplatzhalter (\"**\") angegeben wird: \"{0}\".", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "Die Dateispezifikation darf nicht mit einem rekursiven Verzeichnisplatzhalter (\"**\") enden: \"{0}\".", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "\"package.json\" wurde unter \"{0}\" gefunden.", "Found_package_json_at_0_Package_ID_is_1_6190": "\"Package.json\" unter \"{0}\" gefunden. Paket-ID: \"{1}\".", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "Funktionsdeklarationen sind in Blöcken im Strict-Modus unzulässig, wenn das Ziel \"ES3\" oder \"ES5\" ist.", @@ -400,6 +418,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Der Funktion fehlt die abschließende return-Anweisung, und der Rückgabetyp enthält nicht \"undefined\".", "Function_overload_must_be_static_2387": "Die Funktionsüberladung muss statisch sein.", "Function_overload_must_not_be_static_2388": "Die Funktionsüberladung darf nicht statisch sein.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Generiert eine sourcemap für jede entsprechende .d.ts-Datei.", "Generates_corresponding_d_ts_file_6002": "Generiert die entsprechende .d.ts-Datei.", "Generates_corresponding_map_file_6043": "Generiert die entsprechende MAP-Datei.", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Der Generator weist implizit den Typ \"{0}\" auf, weil er keine Werte ausgibt. Sie können ggf. einen Rückgabetyp angeben.", @@ -421,6 +440,8 @@ "Identifier_expected_1003": "Es wurde ein Bezeichner erwartet.", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "Bezeichner erwartet. \"__esModule\" ist als exportierter Marker für die Umwandlung von ECMAScript-Modulen reserviert.", "Ignore_this_error_message_90019": "Diese Fehlermeldung ignorieren", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "Geerbte abstrakte Klasse implementieren", "Implement_interface_0_90006": "Schnittstelle \"{0}\" implementieren", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "Die implements-Klausel der exportierten Klasse \"{0}\" besitzt oder verwendet den privaten Namen \"{1}\".", @@ -441,6 +462,7 @@ "Index_signature_is_missing_in_type_0_2329": "Die Indexsignatur fehlt im Typ \"{0}\".", "Index_signatures_are_incompatible_2330": "Die Indexsignaturen sind nicht kompatibel.", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "Einzelne Deklarationen in der gemergten Deklaration \"{0}\" müssen alle exportiert oder alle lokal sein.", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "Parametertypen aus der Nutzung ableiten", "Infer_type_of_0_from_usage_95011": "Typ von \"{0}\" aus der Nutzung ableiten", "Initialize_property_0_in_the_constructor_90020": "Eigenschaft \"{0}\" im Konstruktor initialisieren", @@ -452,6 +474,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "Initialisiert ein TypeScript-Projekt und erstellt eine Datei \"tsconfig.json\".", "Insert_command_line_options_and_files_from_a_file_6030": "Fügt Befehlszeilenoptionen und Dateien aus einer Datei ein.", "Install_0_95014": "\"{0}\" installieren", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "Die Schnittstelle \"{0}\" kann die Typen \"{1}\" und \"{2}\" nicht gleichzeitig erweitern.", "Interface_0_incorrectly_extends_interface_1_2430": "Die Schnittstelle \"{0}\" erweitert fälschlicherweise die Schnittstelle \"{1}\".", "Interface_declaration_cannot_have_implements_clause_1176": "Die Schnittstellendeklarationen darf keine implements-Klausel aufweisen.", @@ -504,6 +527,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "Für das Gebietsschema ist das Format oder - erforderlich, z. B. \"{0}\" oder \"{1}\".", "Longest_matching_prefix_for_0_is_1_6108": "Das längste übereinstimmende Präfix für \"{0}\" ist \"{1}\".", "Looking_up_in_node_modules_folder_initial_location_0_6125": "Die Suche erfolgt im Ordner \"node_modules\". Anfangsspeicherort \"{0}\".", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "super()-Aufruf als erste Anweisung im Konstruktor festlegen", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Der zugeordnete Objekttyp weist implizit einen any-Vorlagentyp auf.", "Member_0_implicitly_has_an_1_type_7008": "Der Member \"{0}\" weist implizit den Typ \"{1}\" auf.", @@ -514,6 +538,8 @@ "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101": "Die Methode \"{0}\" der exportierten Schnittstelle besitzt oder verwendet den Namen \"{1}\" aus dem privaten Modul \"{2}\".", "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102": "Die Methode \"{0}\" der exportierten Schnittstelle besitzt oder verwendet den privaten Namen \"{1}\".", "Modifiers_cannot_appear_here_1184": "Modifizierer dürfen hier nicht enthalten sein.", + "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340": "Module '{0}' does not refer to a type, but is used as a type here.", + "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339": "Module '{0}' does not refer to a value, but is used as a value here.", "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "Das Modul \"{0}\" hat bereits einen Member mit dem Namen \"{1}\" exportiert. Erwägen Sie, ihn explizit erneut zu exportieren, um die Mehrdeutigkeit zu vermeiden.", "Module_0_has_no_default_export_1192": "Das Modul \"{0}\" weist keinen Standardexport auf.", "Module_0_has_no_exported_member_1_2305": "Das Modul \"{0}\" weist keinen exportierten Member \"{1}\" auf.", @@ -566,6 +592,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "Die Option \"{0}\" kann nur verwendet werden, wenn die Option \"-inlineSourceMap\" oder \"-sourceMap\" angegeben wird.", "Option_0_cannot_be_specified_with_option_1_5053": "Die Option \"{0}\" darf nicht zusammen mit der Option \"{1}\" angegeben werden.", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "Die Option \"{0}\" darf nicht ohne die Option \"{1}\" angegeben werden.", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Die Option \"{0}\" kann nicht ohne die Option \"{1}\" oder \"{2}\" angegeben werden.", "Option_0_should_have_array_of_strings_as_a_value_6103": "Die Option \"{0}\" muss ein Zeichenfolgenarray als Wert aufweisen.", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "Die Option \"isolatedModules\" kann nur verwendet werden, wenn entweder die Option \"--module\" angegeben ist oder die Option \"target\" den Wert \"ES2015\" oder höher aufweist.", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Die \"path\"-Option kann nicht ohne Angabe der \"-baseUrl\"-Option angegeben werden.", @@ -610,6 +637,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "Im Strict-Modus analysieren und \"use strict\" für jede Quelldatei ausgeben.", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "Das Muster \"{0}\" darf höchstens ein Zeichen \"*\" aufweisen.", "Prefix_0_with_an_underscore_90025": "\"{0}\" einen Unterstrich voranstellen", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "Drucknamen des Dateiteils der Kompilierung.", "Print_names_of_generated_files_part_of_the_compilation_6154": "Drucknamen des generierten Dateiteils der Kompilierung.", "Print_the_compiler_s_version_6019": "Die Version des Compilers ausgeben.", @@ -708,6 +736,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "Der Rückgabetyp der öffentlichen statischen Methode aus der exportierten Klasse besitzt oder verwendet den privaten Namen \"{0}\".", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "Modulauflösungen aus \"{0}\" werden wiederverwendet, da Auflösungen aus dem alten Programm nicht geändert wurden.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "Die Auflösung des Moduls \"{0}\" in die Datei \"{1}\" aus dem alten Programm wird wiederverwendet.", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "Als indizierten Zugriffstyp \"{0}\" neu schreiben", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "Das Stammverzeichnis kann nicht ermittelt werden. Die primären Suchpfade werden übersprungen.", "STRATEGY_6039": "STRATEGIE", @@ -788,7 +817,7 @@ "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236": "Der Rückgabetyp einer Eigenschaften-Decorator-Funktion muss \"void\" oder \"any\" sein.", "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058": "Der Rückgabetyp einer asynchronen Funktion muss entweder eine gültige Zusage sein oder darf keinen aufrufbaren \"then\"-Member enthalten.", "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064": "Der Rückgabetyp einer asynchronen Funktion oder Methode muss der globale Typ \"Promise\" sein.", - "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407": "Die rechte Seite einer for...in-Anweisung muss den Typ \"any\" aufweisen oder ein Objekttyp bzw. ein Typparameter sein.", + "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363": "Die rechte Seite einer arithmetischen Operation muss den Typ \"any\" oder \"number\" aufweisen oder ein Enumerationstyp sein.", "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361": "Die rechte Seite eines in-Ausdrucks muss den Typ \"any\" aufweisen oder ein Objekttyp bzw. ein Typparameter 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.", @@ -823,13 +852,17 @@ "Type_0_is_not_a_constructor_function_type_2507": "Der Typ \"{0}\" ist kein Konstruktorfunktionstyp.", "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055": "Der Typ \"{0}\" ist in ES5/ES3 kein gültiger Rückgabetyp einer asynchronen Funktion, weil er nicht auf einen Promise-kompatiblen Konstruktorwert verweist.", "Type_0_is_not_an_array_type_2461": "Der Typ \"{0}\" ist kein Arraytyp.", + "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568": "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_2495": "Der Typ \"{0}\" ist kein Array- oder Zeichenfolgentyp.", + "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569": "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549": "Typ \"{0}\" ist kein Array-Typ oder Zeichenfolgentyp oder weist keine \"[Symbol.iterator]()\"-Methode auf, die einen Iterator zurückgibt.", "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548": "Typ \"{0}\" ist kein Array-Typ oder weist keine \"[Symbol.iterator]()\"-Methode auf, die einen Iterator zurückgibt.", "Type_0_is_not_assignable_to_type_1_2322": "Der Typ \"{0}\" kann dem Typ \"{1}\" nicht zugewiesen werden.", "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719": "Der Typ \"{0}\" kann dem Typ \"{1}\" nicht zugewiesen werden. Es sind zwei verschiedene Typen mit diesem Namen vorhanden, diese sind jedoch nicht verwandt.", "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_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.", + "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator.", "Type_0_provides_no_match_for_the_signature_1_2658": "Der Typ \"{0}\" enthält keine Entsprechung für die Signatur \"{1}\".", "Type_0_recursively_references_itself_as_a_base_type_2310": "Der Typ \"{0}\" verweist rekursiv auf sich selbst als ein Basistyp.", "Type_alias_0_circularly_references_itself_2456": "Der Typalias \"{0}\" verweist zirkulär auf sich selbst.", @@ -838,11 +871,10 @@ "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455": "Der Typargumentkandidat \"{1}\" ist kein gültiges Typargument, weil er kein Obertyp des Kandidaten \"{0}\" ist.", "Type_argument_expected_1140": "Ein Typargument wurde erwartet.", "Type_argument_list_cannot_be_empty_1099": "Die Typargumentliste darf nicht leer sein.", + "Type_arguments_cannot_be_used_here_1342": "Type arguments cannot be used here.", "Type_declaration_files_to_be_included_in_compilation_6124": "Typdeklarationsdateien, die in die Kompilierung eingeschlossen werden sollen.", "Type_expected_1110": "Es wurde ein Typ erwartet.", "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062": "Auf den Typ wird direkt oder indirekt im Erfüllungsrückruf der eigenen \"then\"-Methode verwiesen.", - "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Der Typ muss eine \"[Symbol.asyncIterator]()\"-Methode aufweisen, die einen Async-Iterator zurückgibt.", - "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Der Typ muss über eine Methode \"[Symbol.iterator]()\" verfügen, die einen Iterator zurückgibt.", "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320": "Der Typ des \"await\"-Operanden muss entweder eine gültige Zusage sein oder darf keinen aufrufbaren \"then\"-Member enthalten.", "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "Der Typ iterierter Elemente eines \"yield*\"-Operanden muss entweder eine gültige Zusage sein oder darf keinen aufrufbaren \"then\"-Member enthalten.", "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "Der Typ eines \"yield\"-Operanden in einem asynchronen Generator muss entweder eine gültige Zusage sein oder darf keinen aufrufbaren \"then\"-Member enthalten.", diff --git a/lib/enu/diagnosticMessages.generated.json.lcg b/lib/enu/diagnosticMessages.generated.json.lcg index 14d9bbb94b0..4a4d1282c02 100644 --- a/lib/enu/diagnosticMessages.generated.json.lcg +++ b/lib/enu/diagnosticMessages.generated.json.lcg @@ -411,6 +411,12 @@ + + + + + + @@ -3237,6 +3243,18 @@ + + + + + + + + + + + + @@ -4899,9 +4917,9 @@ - + - + @@ -5109,12 +5127,24 @@ + + + + + + + + + + + + @@ -5151,6 +5181,18 @@ + + + + + + + + + + + + @@ -5199,6 +5241,12 @@ + + + + + + @@ -5217,18 +5265,6 @@ - - - - - - - - - - - - diff --git a/lib/es/diagnosticMessages.generated.json b/lib/es/diagnosticMessages.generated.json index 2d687fe0dd0..03b4db325b2 100644 --- a/lib/es/diagnosticMessages.generated.json +++ b/lib/es/diagnosticMessages.generated.json @@ -66,6 +66,7 @@ "A_rest_parameter_cannot_have_an_initializer_1048": "Un parámetro rest no puede tener un inicializador.", "A_rest_parameter_must_be_last_in_a_parameter_list_1014": "Un parámetro rest debe ser el último de una lista de parámetros.", "A_rest_parameter_must_be_of_an_array_type_2370": "Un parámetro rest debe ser de un tipo de matriz.", + "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013": "A rest parameter or binding pattern may not have a trailing comma.", "A_return_statement_can_only_be_used_within_a_function_body_1108": "Una instrucción \"return\" solo se puede usar en el cuerpo de una función.", "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167": "Serie de entradas que reasigna las importaciones a ubicaciones de búsqueda relativas a \"baseUrl\".", "A_set_accessor_cannot_have_a_return_type_annotation_1095": "Un descriptor de acceso \"set\" no puede tener una anotación de tipo de valor devuelto.", @@ -94,12 +95,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "Los descriptores de acceso solo están disponibles cuando el destino es ECMAScript 5 y versiones posteriores.", "Accessors_must_both_be_abstract_or_non_abstract_2676": "Los descriptores de acceso deben ser los dos abstractos o los dos no abstractos.", "Add_0_to_existing_import_declaration_from_1_90015": "Agregar \"{0}\" a una declaración de importación existente desde \"{1}\"", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "Agregar el modificador async a la función contenedora", "Add_definite_assignment_assertion_to_property_0_95020": "Agregar aserción de asignación definitiva a la propiedad \"{0}\"", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "Agregar una signatura de índice para la propiedad \"{0}\"", "Add_initializer_to_property_0_95019": "Agregar inicializador a la propiedad \"{0}\"", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "Agregar la llamada a \"super()\" que falta", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "Agregar \"this.\" a una variable no resuelta", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "Agregar un tipo \"undefined\" a la propiedad \"{0}\"", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Agregar un archivo tsconfig.json ayuda a organizar los proyectos que contienen archivos TypeScript y JavaScript. Más información en https://aka.ms/tsconfig.", "Additional_Checks_6176": "Comprobaciones adicionales", @@ -156,6 +166,7 @@ "An_object_member_cannot_be_declared_optional_1162": "Un miembro de objeto no se puede declarar como opcional.", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "Una signatura de sobrecarga no se puede declarar como generador.", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "No se admite una expresión unaria con el operador '{0}' en el lado izquierdo de una expresión de exponenciación. Considere la posibilidad de incluir la expresión entre paréntesis.", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "Anotar con tipo de JSDoc", "Annotate_with_types_from_JSDoc_95010": "Anotar con tipos de JSDoc", "Argument_expression_expected_1135": "Se esperaba una expresión de argumento.", @@ -223,6 +234,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "La variable de la cláusula catch no puede tener una anotación de tipo.", "Catch_clause_variable_cannot_have_an_initializer_1197": "La variable de la cláusula catch no puede tener un inicializador.", "Change_0_to_1_90014": "Cambiar \"{0}\" a \"{1}\"", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "Cambiar \"extends\" a \"implements\"", "Change_spelling_to_0_90022": "Cambiar la ortografía a \"{0}\"", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "Comprobando si '{0}' es el prefijo coincidente más largo para '{1}' - '{2}'.", @@ -256,6 +270,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "El constructor de la clase '{0}' está protegido y solo es accesible desde la declaración de la clase.", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "Los constructores de las clases derivadas deben contener una llamada a \"super\".", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "El archivo contenedor no se ha especificado y no se puede determinar el directorio raíz. Se omitirá la búsqueda en la carpeta 'node_modules'.", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "Convertir la función \"{0}\" en una clase", "Convert_function_to_an_ES2015_class_95001": "Convertir la función en una clase ES2015", "Convert_to_ES6_module_95017": "Convertir en módulo ES6", @@ -274,6 +290,7 @@ "Decorators_are_not_valid_here_1206": "Los elementos Decorator no son válidos aquí.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "No se pueden aplicar elementos Decorator a varios descriptores de acceso get o set con el mismo nombre.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "La exportación predeterminada del módulo tiene o usa el nombre privado '{0}'.", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[En desuso] Use \"--jsxFactory\" en su lugar. Especifique el objeto invocado para createElement cuando el destino sea la emisión de JSX \"react\"", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[En desuso] Use \"--outFile\" en su lugar. Concatena y emite la salida en un solo archivo.", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[En desuso] Use \"--skipLibCheck\" en su lugar. Omite la comprobación de tipos de los archivos de declaración de biblioteca predeterminados.", @@ -388,6 +405,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "El nombre de archivo \"{0}\" tiene una extensión \"{1}\" y se va a quitar.", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "La especificación del archivo no puede contener un directorio primario ('..') que aparezca después de un comodín de directorios recursivo ('**'): '{0}'.", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "La especificación de archivo no puede finalizar en un comodín de directorio recursivo ('**'): '{0}'.", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "Se encontró 'package.json' en '{0}'.", "Found_package_json_at_0_Package_ID_is_1_6190": "Se encontró \"package.json\" en \"{0}\". El identificador de paquete es \"{1}\".", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "No se permiten declaraciones de función en bloques en modo strict cuando el destino es 'ES3' o 'ES5'.", @@ -400,6 +418,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Falta la instrucción return final en la función y el tipo de valor devuelto no incluye 'undefined'.", "Function_overload_must_be_static_2387": "La sobrecarga de función debe ser estática.", "Function_overload_must_not_be_static_2388": "La sobrecarga de función no debe ser estática.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Genera un mapa de origen para cada archivo \".d.ts\" correspondiente.", "Generates_corresponding_d_ts_file_6002": "Genera el archivo \".d.ts\" correspondiente.", "Generates_corresponding_map_file_6043": "Genera el archivo \".map\" correspondiente.", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "El generador tiene el tipo '{0}' implícitamente porque no produce ningún valor. Considere la posibilidad de proporcionar un tipo de valor devuelto.", @@ -421,6 +440,8 @@ "Identifier_expected_1003": "Se esperaba un identificador.", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "Identificador esperado. \"__esModule\" está reservado como marcador exportado al transformar módulos ECMAScript.", "Ignore_this_error_message_90019": "Ignorar este mensaje de error", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "Implementar clase abstracta heredada", "Implement_interface_0_90006": "Implementar la interfaz \"{0}\"", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "La cláusula implements de la clase '{0}' exportada tiene o usa el nombre privado '{1}'.", @@ -441,6 +462,7 @@ "Index_signature_is_missing_in_type_0_2329": "Falta la signatura de índice en el tipo '{0}'.", "Index_signatures_are_incompatible_2330": "Las signaturas de índice no son compatibles.", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "Las declaraciones individuales de la declaración '{0}' combinada deben ser todas exportadas o todas locales.", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "Deducir los tipos de parámetro del uso", "Infer_type_of_0_from_usage_95011": "Deducir el tipo de \"{0}\" del uso", "Initialize_property_0_in_the_constructor_90020": "Inicializar la propiedad \"{0}\" en el constructor", @@ -452,6 +474,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "Inicializa un proyecto de TypeScript y crea un archivo tsconfig.json.", "Insert_command_line_options_and_files_from_a_file_6030": "Inserte opciones de la línea de comandos y archivos desde un archivo.", "Install_0_95014": "Instalar \"{0}\"", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "La interfaz '{0}' no puede extender los tipos '{1}' y '{2}' simultáneamente.", "Interface_0_incorrectly_extends_interface_1_2430": "La interfaz '{0}' extiende la interfaz '{1}' de forma incorrecta.", "Interface_declaration_cannot_have_implements_clause_1176": "La declaración de interfaz no puede tener una cláusula \"implements\".", @@ -504,6 +527,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "La configuración regional debe tener el formato o -. Por ejemplo, '{0}' o '{1}'.", "Longest_matching_prefix_for_0_is_1_6108": "El prefijo coincidente más largo para \"{0}\" es \"{1}\".", "Looking_up_in_node_modules_folder_initial_location_0_6125": "Buscando en la carpeta \"node_modules\", ubicación inicial: \"{0}\".", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "Hacer que la llamada a \"super()\" sea la primera instrucción del constructor", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "El tipo de objeto asignado tiene implícitamente un tipo de plantilla \"any\".", "Member_0_implicitly_has_an_1_type_7008": "El miembro '{0}' tiene un tipo '{1}' implícitamente.", @@ -514,6 +538,8 @@ "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101": "El método \"{0}\" de la interfaz exportada tiene o usa el nombre \"{1}\" del módulo privado \"{2}\".", "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102": "El método \"{0}\" de la interfaz exportada tiene o usa el nombre privado \"{1}\".", "Modifiers_cannot_appear_here_1184": "Los modificadores no pueden aparecer aquí.", + "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340": "Module '{0}' does not refer to a type, but is used as a type here.", + "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339": "Module '{0}' does not refer to a value, but is used as a value here.", "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "El módulo {0} ya ha exportado un miembro denominado '{1}'. Considere la posibilidad de volver a exportarlo de forma explícita para resolver la ambigüedad.", "Module_0_has_no_default_export_1192": "El módulo '{0}' no tiene ninguna exportación predeterminada.", "Module_0_has_no_exported_member_1_2305": "El módulo '{0}' no tiene ningún miembro '{1}' exportado.", @@ -566,6 +592,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "La opción '{0}' solo se puede usar cuando se proporciona '--inlineSourceMap' o '--sourceMap'.", "Option_0_cannot_be_specified_with_option_1_5053": "La opción '{0}' no se puede especificar con la opción '{1}'.", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "La opción '{0}' no se puede especificar sin la opción '{1}'.", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "La opción \"{0}\" no se puede especificar sin la opción \"{1}\" o la opción \"{2}\".", "Option_0_should_have_array_of_strings_as_a_value_6103": "La opción '{0}' debe tener una matriz de cadenas como valor.", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "La opción \"isolatedModules\" solo se puede usar cuando se proporciona la opción \"--module\" o si la opción \"target\" es \"ES2015\" o una versión posterior.", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "La opción 'paths' no se puede usar sin especificar la opción '--baseUrl'.", @@ -610,6 +637,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "Analiza en modo strict y emite \"use strict\" para cada archivo de código fuente.", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "El patrón \"{0}\" puede tener un carácter '*' como máximo.", "Prefix_0_with_an_underscore_90025": "Prefijo \"{0}\" con guion bajo", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "Imprimir los nombres de los archivos que forman parte de la compilación.", "Print_names_of_generated_files_part_of_the_compilation_6154": "Imprimir los nombres de los archivos generados que forman parte de la compilación.", "Print_the_compiler_s_version_6019": "Imprima la versión del compilador.", @@ -708,6 +736,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "El tipo de valor devuelto del método estático público de la clase exportada tiene o usa el nombre privado '{0}'.", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "Las resoluciones de módulo cuyo origen es \"{0}\" se reutilizan, ya que las resoluciones no varían respecto al programa anterior.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "Reutilizando la resolución del módulo \"{0}\" en el archivo \"{1}\" del programa anterior.", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "Reescribir como tipo de acceso indexado \"{0}\"", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "No se puede determinar el directorio raíz, se omitirán las rutas de búsqueda principales.", "STRATEGY_6039": "ESTRATEGIA", @@ -788,7 +817,7 @@ "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236": "El tipo de valor devuelto de una función Decorator de propiedad debe ser \"void\" o \"any\".", "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058": "El tipo de valor devuelto de una función asincrónica debe ser una promesa válida o no debe contener un miembro \"then\" invocable.", "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064": "El tipo de valor devuelto de una función o un método asincrónicos debe ser el tipo Promise global.", - "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_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.", + "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363": "La parte derecha de una operación aritmética debe ser de tipo \"any\", \"number\" o un tipo de enumeración.", "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361": "La parte derecha de una expresión \"in\" debe ser de tipo \"any\", un tipo de objeto o un parámetro de tipo.", "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\".", @@ -823,13 +852,17 @@ "Type_0_is_not_a_constructor_function_type_2507": "El tipo '{0}' no es un tipo de función de constructor.", "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055": "El tipo '{0}' no es un tipo de valor devuelto válido para una función asincrónica en ES5/ES3, porque no hace referencia a un valor de constructor compatible con promesas.", "Type_0_is_not_an_array_type_2461": "'{0}' no es un tipo de matriz.", + "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568": "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_2495": "'{0}' no es un tipo de matriz o un tipo de cadena.", + "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569": "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549": "El tipo \"{0}\" no es un tipo de matriz o un tipo de cadena o no tiene un método \"[Symbol.iterator]()\" que devuelve un iterador.", "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548": "El tipo \"{0}\" no es un tipo de matriz o no tiene un método \"[Symbol.iterator]()\" que devuelve un iterador.", "Type_0_is_not_assignable_to_type_1_2322": "El tipo '{0}' no se puede asignar al tipo '{1}'.", "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719": "El tipo \"{0}\" no se puede asignar al tipo \"{1}\". Existen dos tipos distintos con este nombre, pero no están relacionados.", "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_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.", + "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator.", "Type_0_provides_no_match_for_the_signature_1_2658": "El tipo \"{0}\" no proporciona ninguna coincidencia para la signatura \"{1}\".", "Type_0_recursively_references_itself_as_a_base_type_2310": "El tipo '{0}' se hace referencia a sí mismo de forma recursiva como tipo base.", "Type_alias_0_circularly_references_itself_2456": "El alias de tipo '{0}' se hace referencia a sí mismo de forma circular.", @@ -838,11 +871,10 @@ "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455": "El candidato de argumento de tipo '{1}' no es un argumento de tipo válido porque no es un supertipo del candidato '{0}'.", "Type_argument_expected_1140": "Se esperaba un argumento de tipo.", "Type_argument_list_cannot_be_empty_1099": "La lista de argumentos de tipo no puede estar vacía.", + "Type_arguments_cannot_be_used_here_1342": "Type arguments cannot be used here.", "Type_declaration_files_to_be_included_in_compilation_6124": "Archivos de declaración de tipos que se incluirán en la compilación.", "Type_expected_1110": "Se esperaba un tipo.", "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062": "Se hace referencia al tipo directa o indirectamente en la devolución de llamada de entrega de su propio método \"then\".", - "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "El tipo debe tener un método \"[Symbol.asyncIterator]()\" que devuelve un iterador de asincronía.", - "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "El tipo debe tener un método \"[Symbol.iterator]()\" que devuelva un iterador.", "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320": "El tipo de operando \"await\" debe ser una promesa válida o no debe contener un miembro \"then\" invocable.", "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "El tipo de elementos iterados de un operando \"yield*\" debe ser una promesa válida o no debe contener un miembro \"then\" invocable.", "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "El tipo de operando \"yield\" en un generador asincrónico debe ser una promesa válida o no debe contener un miembro \"then\" invocable.", diff --git a/lib/fr/diagnosticMessages.generated.json b/lib/fr/diagnosticMessages.generated.json index 1491f536b91..01b232a75c1 100644 --- a/lib/fr/diagnosticMessages.generated.json +++ b/lib/fr/diagnosticMessages.generated.json @@ -66,6 +66,7 @@ "A_rest_parameter_cannot_have_an_initializer_1048": "Un paramètre rest ne peut pas avoir d'initialiseur.", "A_rest_parameter_must_be_last_in_a_parameter_list_1014": "Un paramètre rest doit être le dernier dans une liste de paramètres.", "A_rest_parameter_must_be_of_an_array_type_2370": "Un paramètre rest doit être de type tableau.", + "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013": "A rest parameter or binding pattern may not have a trailing comma.", "A_return_statement_can_only_be_used_within_a_function_body_1108": "Une instruction 'return' peut être utilisée uniquement dans un corps de fonction.", "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167": "Série d'entrées qui remappent les importations aux emplacements de recherche en fonction de 'baseUrl'.", "A_set_accessor_cannot_have_a_return_type_annotation_1095": "Un accesseur 'set' ne peut pas avoir d'annotation de type de retour.", @@ -94,12 +95,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "Les accesseurs sont uniquement disponibles quand EcmaScript 5 ou version supérieure est ciblé.", "Accessors_must_both_be_abstract_or_non_abstract_2676": "Les accesseurs doivent être abstraits ou non abstraits.", "Add_0_to_existing_import_declaration_from_1_90015": "Ajouter '{0}' à la déclaration d'importation existante de \"{1}\"", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "Ajouter le modificateur async dans la fonction conteneur", "Add_definite_assignment_assertion_to_property_0_95020": "Ajouter une assertion d'assignation définie à la propriété '{0}'", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "Ajouter une signature d'index pour la propriété '{0}'", "Add_initializer_to_property_0_95019": "Ajouter un initialiseur à la propriété '{0}'", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "Ajouter l'appel manquant à 'super()'", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "Ajouter 'this.' à la variable non résolue", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "Ajouter un type 'undefined' à la propriété '{0}'", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "L'ajout d'un fichier tsconfig.json permet d'organiser les projets qui contiennent des fichiers TypeScript et JavaScript. En savoir plus sur https://aka.ms/tsconfig.", "Additional_Checks_6176": "Vérifications supplémentaires", @@ -156,6 +166,7 @@ "An_object_member_cannot_be_declared_optional_1162": "Impossible de déclarer un membre d'objet comme étant facultatif.", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "Une signature de surcharge ne peut pas être déclarée en tant que générateur.", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "Une expression unaire avec l'opérateur '{0}' n'est pas autorisée dans la partie gauche d'une expression d'élévation à une puissance. Mettez l'expression entre parenthèses.", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "Annoter avec le type de JSDoc", "Annotate_with_types_from_JSDoc_95010": "Annoter avec les types de JSDoc", "Argument_expression_expected_1135": "Expression d'argument attendue.", @@ -223,6 +234,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "Une variable de clause catch ne peut pas avoir d'annotation de type.", "Catch_clause_variable_cannot_have_an_initializer_1197": "Une variable de clause catch ne peut pas avoir d'initialiseur.", "Change_0_to_1_90014": "Changer '{0}' en '{1}'", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "Changer 'extends' en 'implements'", "Change_spelling_to_0_90022": "Changer l'orthographe en '{0}'", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "Vérification en cours pour déterminer si '{0}' est le préfixe correspondant le plus long pour '{1}' - '{2}'.", @@ -256,6 +270,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "Le constructeur de la classe '{0}' est protégé et uniquement accessible dans la déclaration de classe.", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "Les constructeurs pour les classes dérivées doivent contenir un appel de 'super'.", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "Fichier conteneur non spécifié et répertoire racine impossible à déterminer. Recherche ignorée dans le dossier 'node_modules'.", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "Convertir la fonction '{0}' en classe", "Convert_function_to_an_ES2015_class_95001": "Convertir la fonction en classe ES2015", "Convert_to_ES6_module_95017": "Convertir en module ES6", @@ -274,6 +290,7 @@ "Decorators_are_not_valid_here_1206": "Les éléments décoratifs ne sont pas valides ici.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Impossible d'appliquer des éléments décoratifs à plusieurs accesseurs get/set du même nom.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "L'exportation par défaut du module a utilisé ou utilise le nom privé '{0}'.", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Déconseillé] Utilisez '--jsxFactory' à la place. Permet de spécifier l'objet appelé pour createElement durant le ciblage de 'react' pour l'émission JSX", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Déconseillé] Utilisez '--outFile' à la place. Permet de concaténer et d'émettre la sortie vers un seul fichier", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Déconseillé] Utilisez '--skipLibCheck' à la place. Permet d'ignorer le contrôle de type des fichiers de déclaration de la bibliothèque par défaut.", @@ -388,6 +405,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "Le nom de fichier '{0}' a une extension '{1}'. Suppression de l'extension.", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "La spécification de fichier ne peut pas contenir un répertoire parent ('..') après un caractère générique de répertoire récursif ('**') : '{0}'.", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "Une spécification de fichier ne peut pas se terminer par un caractère générique de répertoire récursif ('**') : '{0}'.", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "'package.json' trouvé sur '{0}'.", "Found_package_json_at_0_Package_ID_is_1_6190": "'package.json' trouvé sur '{0}'. L'ID de package est '{1}'.", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "Les déclarations de fonction ne sont pas autorisées dans les blocs en mode strict durant le ciblage de la version 'ES3' ou 'ES5'.", @@ -400,6 +418,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "La fonction n'a pas d'instruction return de fin, et le type de retour n'inclut pas 'undefined'.", "Function_overload_must_be_static_2387": "La surcharge de fonction doit être statique.", "Function_overload_must_not_be_static_2388": "La surcharge de fonction ne doit pas être statique.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Génère un mappage de source pour chaque fichier '.d.ts' correspondant.", "Generates_corresponding_d_ts_file_6002": "Génère le fichier '.d.ts' correspondant.", "Generates_corresponding_map_file_6043": "Génère le fichier '.map' correspondant.", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Le générateur a implicitement le type '{0}', car il ne produit aucune valeur. Fournissez plutôt un type de retour.", @@ -421,6 +440,8 @@ "Identifier_expected_1003": "Identificateur attendu.", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "Identificateur attendu. '__esModule' est réservé en tant que marqueur exporté durant la transformation des modules ECMAScript.", "Ignore_this_error_message_90019": "Ignorer ce message d'erreur", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "Implémenter la classe abstraite héritée", "Implement_interface_0_90006": "Implémenter l'interface '{0}'", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "La clause implements de la classe exportée '{0}' possède ou utilise le nom privé '{1}'.", @@ -441,6 +462,7 @@ "Index_signature_is_missing_in_type_0_2329": "Signature d'index manquante dans le type '{0}'.", "Index_signatures_are_incompatible_2330": "Les signatures d'index sont incompatibles.", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "Les déclarations individuelles de la déclaration fusionnée '{0}' doivent toutes être exportées ou locales.", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "Déduire les types des paramètres à partir de l'utilisation", "Infer_type_of_0_from_usage_95011": "Déduire le type de '{0}' à partir de l'utilisation", "Initialize_property_0_in_the_constructor_90020": "Initialiser la propriété '{0}' dans le constructeur", @@ -452,6 +474,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "Initialise un projet TypeScript et crée un fichier tsconfig.json.", "Insert_command_line_options_and_files_from_a_file_6030": "Insérer les options de ligne de commande et les fichiers à partir d'un fichier texte.", "Install_0_95014": "Installer '{0}'", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "L'interface '{0}' ne peut pas étendre simultanément les types '{1}' et '{2}'.", "Interface_0_incorrectly_extends_interface_1_2430": "L'interface '{0}' étend de manière incorrecte l'interface '{1}'.", "Interface_declaration_cannot_have_implements_clause_1176": "Une déclaration d'interface ne peut pas avoir de clause 'implements'.", @@ -504,6 +527,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "Les paramètres régionaux doivent être sous la forme ou -. Par exemple, '{0}' ou '{1}'.", "Longest_matching_prefix_for_0_is_1_6108": "Le préfixe correspondant le plus long pour '{0}' est '{1}'.", "Looking_up_in_node_modules_folder_initial_location_0_6125": "Recherche dans le dossier 'node_modules', emplacement initial '{0}'.", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "Faire de l'appel à 'super()' la première instruction du constructeur", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Le type d'objet mappé a implicitement un type de modèle 'any'.", "Member_0_implicitly_has_an_1_type_7008": "Le membre '{0}' possède implicitement un type '{1}'.", @@ -514,6 +538,8 @@ "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101": "La méthode '{0}' de l'interface exportée comporte ou utilise le nom '{1}' du module privé '{2}'.", "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102": "La méthode '{0}' de l'interface exportée comporte ou utilise le nom privé '{1}'.", "Modifiers_cannot_appear_here_1184": "Les modificateurs ne peuvent pas apparaître ici.", + "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340": "Module '{0}' does not refer to a type, but is used as a type here.", + "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339": "Module '{0}' does not refer to a value, but is used as a value here.", "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "Le module {0} a déjà exporté un membre nommé '{1}'. Effectuez une réexportation explicite pour lever l'ambiguïté.", "Module_0_has_no_default_export_1192": "Le module '{0}' n'a pas d'exportation par défaut.", "Module_0_has_no_exported_member_1_2305": "Le module '{0}' n'a aucun membre exporté '{1}'.", @@ -566,6 +592,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "L'option '{0}' peut être utilisée uniquement quand l'option '--inlineSourceMap' ou l'option '--sourceMap' est spécifiée.", "Option_0_cannot_be_specified_with_option_1_5053": "Impossible de spécifier l'option '{0}' avec l'option '{1}'.", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "Impossible de spécifier l'option '{0}' sans spécifier l'option '{1}'.", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Impossible de spécifier l'option '{0}' sans spécifier l'option '{1}' ou l'option '{2}'.", "Option_0_should_have_array_of_strings_as_a_value_6103": "L'option '{0}' doit avoir un tableau de chaînes en tant que valeur.", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "L'option 'isolatedModules' peut être utilisée seulement quand l'option '--module' est spécifiée, ou quand l'option 'target' a la valeur 'ES2015' ou une version supérieure.", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Impossible d'utiliser l'option 'paths' sans spécifier l'option '--baseUrl'.", @@ -610,6 +637,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "Analyser en mode strict et émettre \"use strict\" pour chaque fichier source.", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "Le modèle '{0}' ne peut avoir qu'un seul caractère '*' au maximum.", "Prefix_0_with_an_underscore_90025": "Faire précéder '{0}' d'un trait de soulignement", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "Imprimez les noms des fichiers faisant partie de la compilation.", "Print_names_of_generated_files_part_of_the_compilation_6154": "Imprimez les noms des fichiers générés faisant partie de la compilation.", "Print_the_compiler_s_version_6019": "Affichez la version du compilateur.", @@ -708,6 +736,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "Le type de retour de la méthode statique publique de la classe exportée possède ou utilise le nom privé '{0}'.", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "Réutilisation des résolutions de module provenant de '{0}', car les résolutions sont inchangées par rapport à l'ancien programme.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "Réutilisation de la résolution du module '{0}' dans le fichier '{1}' à partir de l'ancien programme.", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "Réécrire en tant que type d'accès indexé '{0}'", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "Impossible de déterminer le répertoire racine, chemins de recherche primaires ignorés.", "STRATEGY_6039": "STRATÉGIE", @@ -788,7 +817,7 @@ "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236": "Le type de retour d'une fonction d'élément décoratif de propriété doit être 'void' ou 'any'.", "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058": "Le type de retour d'une fonction asynchrone doit être une promesse valide ou ne doit contenir aucun membre 'then' pouvant être appelé.", "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064": "Le type de retour d'une fonction ou d'une méthode async doit être le type Promise global.", - "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407": "La partie droite d'une instruction 'for...in' doit être de type 'any', un type d'objet ou un paramètre de type.", + "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363": "La partie droite d'une opération arithmétique doit être de type 'any', 'number' ou un type enum.", "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361": "La partie droite d'une expression 'in' doit être de type 'any', un type d'objet ou un paramètre de type.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "La partie droite d'une expression 'instanceof' doit être de type 'any' ou d'un type pouvant être assigné au type d'interface 'Function'.", @@ -823,13 +852,17 @@ "Type_0_is_not_a_constructor_function_type_2507": "Le type '{0}' n'est pas un type de fonction constructeur.", "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055": "Le type '{0}' n'est pas un type de retour de fonction async valide en ES5/ES3, car il ne référence pas une valeur de constructeur compatible avec une promesse.", "Type_0_is_not_an_array_type_2461": "Le type '{0}' n'est pas un type de tableau.", + "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568": "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_2495": "Le type '{0}' n'est pas un type de tableau ou un type de chaîne.", + "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569": "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549": "Le type '{0}' n'est pas un type tableau ou un type chaîne, ou n'a pas de méthode '[Symbol.iterator]()' qui retourne un itérateur.", "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548": "Le type '{0}' n'est pas un type tableau ou n'a pas de méthode '[Symbol.iterator]()' qui retourne un itérateur.", "Type_0_is_not_assignable_to_type_1_2322": "Impossible d'assigner le type '{0}' au type '{1}'.", "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719": "Impossible d'assigner le type '{0}' au type '{1}'. Il existe deux types distincts portant ce nom, mais ils ne sont pas liés.", "Type_0_is_not_comparable_to_type_1_2678": "Le type '{0}' n'est pas comparable au type '{1}'.", "Type_0_is_not_generic_2315": "Le type '{0}' n'est pas générique.", + "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.", + "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator.", "Type_0_provides_no_match_for_the_signature_1_2658": "Le type '{0}' ne fournit aucune correspondance pour la signature '{1}'.", "Type_0_recursively_references_itself_as_a_base_type_2310": "Le type '{0}' fait référence à lui-même de manière récursive en tant que type de base.", "Type_alias_0_circularly_references_itself_2456": "L'alias de type '{0}' fait référence à lui-même de manière circulaire.", @@ -838,11 +871,10 @@ "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455": "Le candidat de l'argument de type '{1}' n'est pas un argument de type valide, car il ne s'agit pas d'un supertype du candidat '{0}'.", "Type_argument_expected_1140": "Argument de type attendu.", "Type_argument_list_cannot_be_empty_1099": "La liste des arguments de type ne peut pas être vide.", + "Type_arguments_cannot_be_used_here_1342": "Type arguments cannot be used here.", "Type_declaration_files_to_be_included_in_compilation_6124": "Fichiers de déclaration de type à inclure dans la compilation.", "Type_expected_1110": "Type attendu.", "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062": "Le type est directement ou indirectement référencé dans le rappel d'exécution de sa propre méthode 'then'.", - "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Le type doit comporter une méthode '[Symbol.asyncIterator]()' qui retourne un itérateur asynchrone.", - "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Le type doit comporter une méthode '[Symbol.iterator]()' qui retourne un itérateur.", "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320": "Le type d'un opérande 'await' doit être une promesse valide ou ne doit contenir aucun membre 'then' pouvant être appelé.", "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "Le type des éléments itérés d'un opérande 'yield*' doit être une promesse valide ou ne doit contenir aucun membre 'then' pouvant être appelé.", "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "Le type d'un opérande 'yield' dans un générateur asynchrone doit être une promesse valide ou ne doit contenir aucun membre 'then' pouvant être appelé.", diff --git a/lib/it/diagnosticMessages.generated.json b/lib/it/diagnosticMessages.generated.json index bb468aa21d1..aa673fb1598 100644 --- a/lib/it/diagnosticMessages.generated.json +++ b/lib/it/diagnosticMessages.generated.json @@ -94,12 +94,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "Le funzioni di accesso sono disponibili solo se destinate a ECMAScript 5 e versioni successive.", "Accessors_must_both_be_abstract_or_non_abstract_2676": "Le funzioni di accesso devono essere tutte astratte o tutte non astratte.", "Add_0_to_existing_import_declaration_from_1_90015": "Aggiungere '{0}' alla dichiarazione di importazione esistente da \"{1}\"", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "Aggiungere il modificatore async alla funzione contenitore", "Add_definite_assignment_assertion_to_property_0_95020": "Aggiungere l'asserzione di assegnazione definita alla proprietà '{0}'", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "Aggiungere la firma dell'indice per la proprietà '{0}'", "Add_initializer_to_property_0_95019": "Aggiungere l'inizializzatore alla proprietà '{0}'", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "Aggiungere la chiamata mancante a 'super()'", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "Aggiungere 'this.' alla variabile non risolta", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "Aggiungere il tipo 'undefined' alla proprietà '{0}'", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Aggiungere un file tsconfig.json per organizzare più facilmente progetti che contengono sia file TypeScript che JavaScript. Per altre informazioni, vedere https://aka.ms/tsconfig.", "Additional_Checks_6176": "Controlli aggiuntivi", @@ -156,6 +165,7 @@ "An_object_member_cannot_be_declared_optional_1162": "Un membro di oggetto non può essere dichiarato come facoltativo.", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "Non è possibile dichiarare come generatore una firma di overload.", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "Nella parte sinistra di un'espressione di elevamento a potenza non è consentita un'espressione unaria con l'operatore '{0}'. Provare a racchiudere l'espressione tra parentesi.", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "Annota con tipo di JSDoc", "Annotate_with_types_from_JSDoc_95010": "Annota con tipi di JSDoc", "Argument_expression_expected_1135": "È prevista l'espressione di argomento.", @@ -223,6 +233,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "La variabile della clausola catch non può contenere un'annotazione di tipo.", "Catch_clause_variable_cannot_have_an_initializer_1197": "La variabile della clausola catch non può contenere un inizializzatore.", "Change_0_to_1_90014": "Modificare '{0}' in '{1}'", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "Cambiare 'extends' in 'implements'", "Change_spelling_to_0_90022": "Modificare l'ortografia in '{0}'", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "Verrà verificato se '{0}' è il prefisso di corrispondenza più lungo per '{1}' - '{2}'.", @@ -256,6 +269,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "Il costruttore della classe '{0}' è protetto e accessibile solo all'interno della dichiarazione di classe.", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "I costruttori di classi derivate devono contenere una chiamata 'super'.", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "Il file contenitore non è specificato e non è possibile determinare la directory radice. La ricerca nella cartella 'node_modules' verrà ignorata.", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "Converti la funzione '{0}' in classe", "Convert_function_to_an_ES2015_class_95001": "Converti la funzione in una classe ES2015", "Convert_to_ES6_module_95017": "Converti in modulo ES6", @@ -274,6 +289,7 @@ "Decorators_are_not_valid_here_1206": "In questo punto le espressioni Decorator non sono valide.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Non è possibile applicare le espressioni Decorator a più funzioni di accesso get/set con lo stesso nome.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "L'esportazione predefinita del modulo contiene o usa il nome privato '{0}'.", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Deprecata] In alternativa, usare '--jsxFactory'. Specifica l'oggetto richiamato per createElement quando la destinazione è la creazione JSX 'react'", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Deprecata] In alternativa, usare '--outFile'. Concatena e crea l'output in un singolo file", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Deprecata] In alternativa, usare '--skipLibCheck'. Ignora il controllo del tipo dei file di dichiarazione delle librerie predefinite.", @@ -388,6 +404,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "L'estensione del nome file '{0}' è '{1}' e verrà rimossa.", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "La specifica del file non può contenere una directory padre ('..') inserita dopo un carattere jolly ('**') di directory ricorsiva: '{0}'.", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "La specifica del file non può terminare con caratteri jolly ('**') di directory ricorsiva: '{0}'.", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "Il file 'package.json' è stato trovato in '{0}'.", "Found_package_json_at_0_Package_ID_is_1_6190": "Il file 'package.json' è stato trovato in '{0}'. L'ID pacchetto è '{1}'.", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "Le dichiarazioni di funzione non sono consentite all'interno di blocchi in modalità strict quando la destinazione è 'ES3' o 'ES5'.", @@ -400,6 +417,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Nella funzione manca l'istruzione return finale e il tipo restituito non include 'undefined'.", "Function_overload_must_be_static_2387": "L'overload della funzione deve essere statico.", "Function_overload_must_not_be_static_2388": "L'overload della funzione non deve essere statico.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Genera un sourcemap per ogni file '.d.ts' corrispondente.", "Generates_corresponding_d_ts_file_6002": "Genera il file '.d.ts' corrispondente.", "Generates_corresponding_map_file_6043": "Genera il file '.map' corrispondente.", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Il tipo del generatore è implicitamente '{0}' perché non contiene alcun valore. Provare a specificare un tipo restituito.", @@ -421,6 +439,8 @@ "Identifier_expected_1003": "È previsto l'identificatore.", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "È previsto un identificatore. '__esModule' è riservato come marcatore esportato durante la trasformazione di moduli ECMAScript.", "Ignore_this_error_message_90019": "Ignorare questo messaggio di errore", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "Implementare la classe astratta ereditata", "Implement_interface_0_90006": "Implementare l'interfaccia '{0}'", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "La clausola implements della classe esportata '{0}' contiene o usa il nome privato '{1}'.", @@ -441,6 +461,7 @@ "Index_signature_is_missing_in_type_0_2329": "Nel tipo '{0}' manca la firma dell'indice.", "Index_signatures_are_incompatible_2330": "Le firme dell'indice sono incompatibili.", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "Le singole dichiarazioni della dichiarazione sottoposta a merge '{0}' devono essere tutte esportate o tutte locali.", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "Derivare i tipi di parametro dall'utilizzo", "Infer_type_of_0_from_usage_95011": "Derivare il tipo di '{0}' dall'utilizzo", "Initialize_property_0_in_the_constructor_90020": "Inizializzare la proprietà '{0}' nel costruttore", @@ -452,6 +473,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "Inizializza un progetto TypeScript e crea un file tsconfig.json.", "Insert_command_line_options_and_files_from_a_file_6030": "Inserisce i file e le opzioni della riga di comando da un file.", "Install_0_95014": "Installa '{0}'", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "L'interfaccia '{0}' non può estendere simultaneamente i tipi '{1}' e '{2}'.", "Interface_0_incorrectly_extends_interface_1_2430": "L'interfaccia '{0}' estende in modo errato l'interfaccia '{1}'.", "Interface_declaration_cannot_have_implements_clause_1176": "La dichiarazione di interfaccia non può avere una clausola 'implements'.", @@ -504,6 +526,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "Le impostazioni locali devono essere nel formato o -, ad esempio, '{0}' o '{1}'.", "Longest_matching_prefix_for_0_is_1_6108": "Il prefisso di corrispondenza più lungo per '{0}' è '{1}'.", "Looking_up_in_node_modules_folder_initial_location_0_6125": "Verrà eseguita la ricerca nella cartella 'node_modules'. Percorso iniziale: '{0}'.", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "Impostare la chiamata a 'super()' come prima istruzione nel costruttore", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Il tipo di oggetto con mapping contiene implicitamente un tipo di modello 'any'.", "Member_0_implicitly_has_an_1_type_7008": "Il membro '{0}' contiene implicitamente un tipo '{1}'.", @@ -566,6 +589,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "L'opzione '{0}' può essere usata solo quando si specifica l'opzione '--inlineSourceMap' o '--sourceMap'.", "Option_0_cannot_be_specified_with_option_1_5053": "Non è possibile specificare l'opzione '{0}' insieme all'opzione '{1}'.", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "Non è possibile specificare l'opzione '{0}' senza l'opzione '{1}'.", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Non è possibile specificare l'opzione '{0}' senza l'opzione'{1}' o '{2}'.", "Option_0_should_have_array_of_strings_as_a_value_6103": "Il valore dell'opzione '{0}' deve essere una matrice di stringhe.", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "L'opzione 'isolatedModules' può essere usata solo quando si specifica l'opzione '--module' oppure il valore dell'opzione 'target' è 'ES2015' o maggiore.", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Non è possibile usare l'opzione 'paths' senza specificare l'opzione '--baseUrl'.", @@ -610,6 +634,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "Esegue l'analisi in modalità strict e crea la direttiva \"use strict\" per ogni file di origine.", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "Il criterio '{0}' deve contenere al massimo un carattere '*'.", "Prefix_0_with_an_underscore_90025": "Anteporre un carattere di sottolineatura a '{0}'", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "Stampa i nomi dei file che fanno parte della compilazione.", "Print_names_of_generated_files_part_of_the_compilation_6154": "Stampa i nomi dei file generati che fanno parte della compilazione.", "Print_the_compiler_s_version_6019": "Stampa la versione del compilatore.", @@ -708,6 +733,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "Il tipo restituito del metodo statico pubblico della classe esportata contiene o usa il nome privato '{0}'.", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "Le risoluzioni dei moduli con origine in '{0}' verranno riutilizzate perché sono invariate rispetto al vecchio programma.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "La risoluzione del modulo '{0}' del vecchio programma verrà riutilizzata nel file '{1}'.", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "Riscrivere come tipo di accesso indicizzato '{0}'", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "Non è possibile determinare la directory radice. I percorsi di ricerca primaria verranno ignorati.", "STRATEGY_6039": "STRATEGIA", diff --git a/lib/ja/diagnosticMessages.generated.json b/lib/ja/diagnosticMessages.generated.json index 4c6ab38c57a..27fc337cdb5 100644 --- a/lib/ja/diagnosticMessages.generated.json +++ b/lib/ja/diagnosticMessages.generated.json @@ -66,6 +66,7 @@ "A_rest_parameter_cannot_have_an_initializer_1048": "rest パラメーターに初期化子を指定することはできません。", "A_rest_parameter_must_be_last_in_a_parameter_list_1014": "rest パラメーターはパラメーター リストの最後に指定する必要があります。", "A_rest_parameter_must_be_of_an_array_type_2370": "rest パラメーターは配列型でなければなりません。", + "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013": "A rest parameter or binding pattern may not have a trailing comma.", "A_return_statement_can_only_be_used_within_a_function_body_1108": "'return' ステートメントは、関数本体でのみ使用できます。", "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167": "'baseUrl' の相対的な場所を検索するためにインポートを再マップする一連のエントリ。", "A_set_accessor_cannot_have_a_return_type_annotation_1095": "'set' アクセサーに、戻り値の型の注釈を指定することはできません。", @@ -94,12 +95,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "アクセサーは ECMAScript 5 以上をターゲットにする場合にのみ使用できます。", "Accessors_must_both_be_abstract_or_non_abstract_2676": "アクセサーはどちらも抽象または非抽象である必要があります。", "Add_0_to_existing_import_declaration_from_1_90015": "\"{1}\" から既存のインポート宣言に '{0}' を追加する", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "含まれている関数に async 修飾子を追加します", "Add_definite_assignment_assertion_to_property_0_95020": "プロパティ '{0}' に限定代入アサーションを追加します", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "プロパティ '{0}' のインデックス シグネチャを追加する", "Add_initializer_to_property_0_95019": "プロパティ '{0}' に初期化子を追加します", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "欠落している 'super()' 呼び出しを追加する", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "'this.' を未解決の変数に追加する", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "プロパティ '{0}' に '未定義' の型を追加します", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "tsconfig.json ファイルを追加すると、TypeScript ファイルと JavaScript ファイルの両方を含むプロジェクトを整理できます。詳細については、https://aka.ms/tsconfig をご覧ください。", "Additional_Checks_6176": "追加のチェック", @@ -156,6 +166,7 @@ "An_object_member_cannot_be_declared_optional_1162": "オブジェクト メンバーを省略可能として宣言することはできません。", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "オーバーロード シグネチャをジェネレーターとして宣言することはできません。", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "累乗式の左辺で '{0}' 演算子を含む単項式を使用することはできません。式を括弧で囲むことを検討してください。", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "JSDoc の型で注釈を付けます", "Annotate_with_types_from_JSDoc_95010": "JSDoc の型で注釈を付けます", "Argument_expression_expected_1135": "引数式が必要です。", @@ -223,6 +234,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "catch 句の変数に型の注釈を指定することはできません。", "Catch_clause_variable_cannot_have_an_initializer_1197": "catch 句の変数に初期化子を指定することはできません。", "Change_0_to_1_90014": "'{0}' を '{1}' に変更する", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "'extends' を 'implements' に変更する", "Change_spelling_to_0_90022": "スペルを '{0}' に変更する", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "'{0}' が '{1}' - '{2}' の最長一致のプレフィックスであるかを確認しています。", @@ -256,6 +270,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "クラス '{0}' のコンストラクターは保護されており、クラス宣言内でのみアクセス可能です。", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "派生クラスのコンストラクターには 'super' の呼び出しを含める必要があります。", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "包含するファイルが指定されていないため、ルート ディレクトリを決定できません。'node_modules' フォルダーのルックアップをスキップします。", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "関数 '{0}' をクラスに変換します", "Convert_function_to_an_ES2015_class_95001": "関数を ES2015 クラスに変換します", "Convert_to_ES6_module_95017": "ES6 モジュールに変換します", @@ -274,6 +290,7 @@ "Decorators_are_not_valid_here_1206": "デコレーターはここでは無効です。", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "デコレーターを同じ名前の複数の get/set アクセサーに適用することはできません。", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "モジュールの既定エクスポートがプライベート名 '{0}' を持っているか、使用しています。", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[非推奨] 代わりに '--jsxFactory' を使います。'react' JSX 発行を対象とするときに、createElement に対して呼び出されたオブジェクトを指定します", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[非推奨] 代わりに '--outFile' を使います。出力を連結して 1 つのファイルを生成します", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[非推奨] 代わりに '--skipLibCheck' を使います。既定のライブラリ宣言ファイルの型チェックをスキップします。", @@ -388,6 +405,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "ファイル名 '{0}' に '{1}' 拡張子が使われています - 削除しています。", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "ファイルの指定で再帰ディレクトリのワイルドカード ('**') の後に親ディレクトリ ('..') を指定することはできません: '{0}'。", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "ファイルの指定の末尾を再帰的なディレクトリのワイルドカード ('**') にすることはできません: '{0}'。", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "'{0}' で 'package.json' が見つかりました。", "Found_package_json_at_0_Package_ID_is_1_6190": "'{0}' で 'package.json' が見つかりました。パッケージ ID は、'{1}' です。", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "'ES3' または 'ES5' を対象としている場合、関数宣言は厳格モードのブロック内では許可されていません。", @@ -400,6 +418,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "関数に終了の return ステートメントがないため、戻り値の型には 'undefined' が含まれません。", "Function_overload_must_be_static_2387": "関数のオーバーロードは静的でなければなりません。", "Function_overload_must_not_be_static_2388": "関数のオーバーロードは静的にはできせん。", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "対応する各 '.d.ts' ファイルに sourcemap を生成します。", "Generates_corresponding_d_ts_file_6002": "対応する '.d.ts' ファイルを生成します。", "Generates_corresponding_map_file_6043": "対応する '.map' ファイルを生成します。", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "ジェネレーターは値を生成しないため、暗黙的に型 '{0}' になります。戻り値の型を指定することを検討してください。", @@ -421,6 +440,8 @@ "Identifier_expected_1003": "識別子が必要です。", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "識別子が必要です。'__esModule' は、ECMAScript モジュールを変換するときのエクスポート済みマーカーとして予約されています。", "Ignore_this_error_message_90019": "このエラー メッセージを無視する", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "継承抽象クラスを実装する", "Implement_interface_0_90006": "インターフェイス '{0}' を実装する", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "エクスポートされたクラス '{0}' の Implements 句がプライベート名 '{1}' を持っているか、使用しています。", @@ -441,6 +462,7 @@ "Index_signature_is_missing_in_type_0_2329": "型 '{0}' のインデックス シグネチャがありません。", "Index_signatures_are_incompatible_2330": "インデックスの署名に互換性がありません。", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "マージされた宣言 '{0}' の個々の宣言はすべてエクスポートされるか、すべてローカルであるかのどちらかである必要があります。", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "使用状況からパラメーターの型を推論する", "Infer_type_of_0_from_usage_95011": "使用状況から '{0}' の型を推論する", "Initialize_property_0_in_the_constructor_90020": "コンストラクターのプロパティ '{0}' を初期化する", @@ -452,6 +474,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "TypeScript プロジェクトを初期化して、tsconfig.json ファイルを作成します。", "Insert_command_line_options_and_files_from_a_file_6030": "コマンド ライン オプションとファイルをファイルから挿入します。", "Install_0_95014": "'{0}' のインストール", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "インターフェイス '{0}' で型 '{1}' と型 '{2}' を同時には拡張できません。", "Interface_0_incorrectly_extends_interface_1_2430": "インターフェイス '{0}' はインターフェイス '{1}' を正しく拡張していません。", "Interface_declaration_cannot_have_implements_clause_1176": "インターフェイス宣言に 'implements' 句を指定することはできません。", @@ -504,6 +527,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "ロケールは または - の形式で指定する必要があります (例: '{0}'、'{1}')。", "Longest_matching_prefix_for_0_is_1_6108": "'{0}' の一致する最長プレフィックスは '{1}' です。", "Looking_up_in_node_modules_folder_initial_location_0_6125": "'node_modules' フォルダーを検索しています。最初の場所は '{0}' です。", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "'super()' 呼び出しをコンストラクター内の最初のステートメントにする", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "マップされたオブジェクト型のテンプレートの型は暗黙的に 'any' になります。", "Member_0_implicitly_has_an_1_type_7008": "メンバー '{0}' の型は暗黙的に '{1}' になります。", @@ -514,6 +538,8 @@ "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101": "エクスポートされたインターフェイスのメソッド '{0}' が、プライベート モジュール '{2}' の名前 '{1}' を持っているか、使用しています。", "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102": "エクスポートされたインターフェイスのメソッド '{0}' がプライベート名 '{1}' を持っているか、使用しています。", "Modifiers_cannot_appear_here_1184": "ここで修飾子を使用することはできません。", + "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340": "Module '{0}' does not refer to a type, but is used as a type here.", + "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339": "Module '{0}' does not refer to a value, but is used as a value here.", "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "モジュール {0} は既に '{1}' という名前のメンバーをエクスポートしています。あいまいさを解決するため、明示的にもう一度エクスポートすることを検討してください。", "Module_0_has_no_default_export_1192": "モジュール '{0}' に既定エクスポートがありません。", "Module_0_has_no_exported_member_1_2305": "モジュール '{0}' にエクスポートされたメンバー '{1}' がありません。", @@ -566,6 +592,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "オプション '{0} を使用できるのは、オプション '--inlineSourceMap' またはオプション '--sourceMap' のいずれかを指定した場合のみです。", "Option_0_cannot_be_specified_with_option_1_5053": "オプション '{0}' をオプション '{1}' とともに指定することはできません。", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "オプション '{1}' を指定せずに、オプション '{0}' を指定することはできません。", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "オプション '{1}' またはオプション '{2}' を指定せずに、オプション '{0}' を指定することはできません。", "Option_0_should_have_array_of_strings_as_a_value_6103": "オプション '{0}' には、値として文字列の配列を指定する必要があります。", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "オプション 'isolatedModules' は、オプション '--module' が指定されているか、オプション 'target' が 'ES2015' 以上であるかのいずれかの場合でのみ使用できます。", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "オプション 'paths' は、'--baseUrl' オプションを指定せずに使用できません。", @@ -610,6 +637,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "厳格モードで解析してソース ファイルごとに \"use strict\" を生成します。", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "パターン '{0}' に使用できる '*' 文字は最大で 1 つです。", "Prefix_0_with_an_underscore_90025": "アンダースコアを含むプレフィックス '{0}'", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "コンパイルの一環としてファイルの名前を書き出します。", "Print_names_of_generated_files_part_of_the_compilation_6154": "コンパイルの一環として生成されたファイル名を書き出します。", "Print_the_compiler_s_version_6019": "コンパイラのバージョンを表示します。", @@ -708,6 +736,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "エクスポートされたクラスのパブリック静的メソッドの戻り値の型が、プライベート名 '{0}' を持っているか、使用しています。", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "'{0}' で生成されたモジュール解決は、前のプログラムから変更されていないため、再利用しています。", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "前のプログラムを再利用して、モジュール '{0}' をファイル '{1}' に解決しています。", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "インデックス付きのアクセスの種類 '{0}' として書き換える", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "ルート ディレクトリを決定できません。プライマリ検索パスをスキップします。", "STRATEGY_6039": "戦略", @@ -788,7 +817,7 @@ "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236": "プロパティ デコレーター関数の戻り値の型は、'void' か 'any' である必要があります。", "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058": "非同期関数の戻り値の型は、有効な Promise であるか、呼び出し可能な 'then' メンバーを含んでいないかのどちらかであることが必要です。", "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064": "非同期関数または非同期メソッドの戻り値の型は、グローバル Promise 型である必要があります。", - "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407": "for...in' ステートメントの右辺には、'any' 型、オブジェクト型、または型パラメーターを指定してください。", + "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363": "算術演算の右辺には、'any' 型、'number' 型、または列挙型を指定してください。", "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361": "'in' 式の右辺は、'any' 型、オブジェクト型、型パラメーターでなければなりません。", "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' インターフェイス型に割り当てることができる型を指定してください。", @@ -823,13 +852,17 @@ "Type_0_is_not_a_constructor_function_type_2507": "型 '{0}' はコンストラクター関数型ではありません。", "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055": "型 '{0}' は Promise と互換性のあるコンストラクター値を参照しないため、ES5/ES3 において有効な非同期関数の戻り値の型ではありません。", "Type_0_is_not_an_array_type_2461": "型 '{0}' は配列型ではありません。", + "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568": "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_2495": "型 '{0}' は配列型でも文字列型でもありません。", + "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569": "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549": "型 '{0}' は、配列型でも文字列型でもないか、反復子を返す '[Symbol.iterator]()' メソッドを持っていません。", "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548": "型 '{0}' は、配列型ではないか、反復子を返す '[Symbol.iterator]()' メソッドを持っていません。", "Type_0_is_not_assignable_to_type_1_2322": "型 '{0}' を型 '{1}' に割り当てることはできません。", "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719": "型 '{0}' は型 '{1}' に割り当てられません。同じ名前で 2 つの異なる型が存在しますが、これは関連していません。", "Type_0_is_not_comparable_to_type_1_2678": "型 '{0}' は型 '{1}' と比較できません。", "Type_0_is_not_generic_2315": "型 '{0}' はジェネリックではありません。", + "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.", + "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator.", "Type_0_provides_no_match_for_the_signature_1_2658": "型 '{0}' にはシグネチャ '{1}' に一致するものがありません。", "Type_0_recursively_references_itself_as_a_base_type_2310": "型 '{0}' が、基本型としてそれ自体を再帰的に参照しています。", "Type_alias_0_circularly_references_itself_2456": "型のエイリアス '{0}' が自身を循環参照しています。", @@ -838,11 +871,10 @@ "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455": "型引数の候補 '{1}' は、候補 '{0}' のスーパータイプではないため、有効な型引数ではありません。", "Type_argument_expected_1140": "型引数が必要です。", "Type_argument_list_cannot_be_empty_1099": "型引数リストを空にすることはできません。", + "Type_arguments_cannot_be_used_here_1342": "Type arguments cannot be used here.", "Type_declaration_files_to_be_included_in_compilation_6124": "コンパイルに含む型宣言ファイル。", "Type_expected_1110": "型が必要です。", "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062": "型は、それ自身の 'then' メソッドのフルフィルメント コールバック内で直接または間接的に参照されます。", - "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "型には、非同期反復子を返す '[Symbol.asyncIterator]()' メソッドが必要です。", - "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "型には、反復子を返す '[Symbol.iterator]()' メソッドが必要です。", "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320": "'await' オペランドの型は、有効な Promise であるか、呼び出し可能な 'then' メンバーを含んでいないかのどちらかであることが必要です。", "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "'yield*' オペランドの反復要素の型は、有効な Promise であるか、呼び出し可能な 'then' メンバーを含んでいないかのどちらかであることが必要です。", "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "非同期ジェネレーター内の 'yield' オペランドの型は、有効な Promise であるか、呼び出し可能な 'then' メンバーを含んでいないかのどちらかであることが必要です。", diff --git a/lib/ko/diagnosticMessages.generated.json b/lib/ko/diagnosticMessages.generated.json index 77ef9cf6408..84914f220f3 100644 --- a/lib/ko/diagnosticMessages.generated.json +++ b/lib/ko/diagnosticMessages.generated.json @@ -66,6 +66,7 @@ "A_rest_parameter_cannot_have_an_initializer_1048": "rest 매개 변수에는 이니셜라이저를 사용할 수 없습니다.", "A_rest_parameter_must_be_last_in_a_parameter_list_1014": "rest 매개 변수는 매개 변수 목록 마지막에 있어야 합니다.", "A_rest_parameter_must_be_of_an_array_type_2370": "rest 매개 변수는 배열 형식이어야 합니다.", + "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013": "rest 매개 변수 또는 바인딩 패턴에 후행 쉼표를 사용할 수 없습니다.", "A_return_statement_can_only_be_used_within_a_function_body_1108": "'return' 문은 함수 본문 내에서만 사용할 수 있습니다.", "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167": "가져오기를 'baseUrl'에 상대적인 조회 위치로 다시 매핑하는 일련의 항목입니다.", "A_set_accessor_cannot_have_a_return_type_annotation_1095": "'set' 접근자에는 반환 형식 주석을 사용할 수 없습니다.", @@ -94,12 +95,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "접근자는 ECMAScript 5 이상을 대상으로 지정할 때만 사용할 수 있습니다.", "Accessors_must_both_be_abstract_or_non_abstract_2676": "접근자는 모두 추상이거나 비추상이어야 합니다.", "Add_0_to_existing_import_declaration_from_1_90015": "\"{1}\"에서 기존 가져오기 선언에 '{0}' 추가", + "Add_all_missing_async_modifiers_95041": "누락된 모든 'async' 한정자 추가", + "Add_all_missing_members_95022": "누락된 모든 멤버 추가", + "Add_all_missing_super_calls_95039": "누락된 모든 super 호출 추가", "Add_async_modifier_to_containing_function_90029": "포함된 함수에 async 한정자 추가", "Add_definite_assignment_assertion_to_property_0_95020": "'{0}' 속성에 한정된 할당 어설션 추가", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "초기화되지 않은 모든 속성에 한정된 할당 어설션 추가", "Add_index_signature_for_property_0_90017": "'{0}' 속성에 대해 인덱스 시그니처 추가", "Add_initializer_to_property_0_95019": "'{0}' 속성에 이니셜라이저 추가", + "Add_initializers_to_all_uninitialized_properties_95027": "초기화되지 않은 모든 속성에 이니셜라이저 추가", "Add_missing_super_call_90001": "누락된 'super()' 호출 추가", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "멤버 이름과 일치하는 모든 확인되지 않은 변수에 'this.' 추가", "Add_this_to_unresolved_variable_90008": "확인되지 않은 변수에 'this.' 추가", + "Add_to_all_uncalled_decorators_95044": "호출되지 않는 모든 데코레이터에 '()' 추가", + "Add_ts_ignore_to_all_error_messages_95042": "모든 오류 메시지에 '@ts-ignore' 추가", + "Add_undefined_type_to_all_uninitialized_properties_95029": "초기화되지 않은 모든 속성에 정의되지 않은 형식 추가", "Add_undefined_type_to_property_0_95018": "'{0}' 속성에 '정의되지 않은' 형식 추가", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "tsconfig.json 파일을 추가하면 TypeScript 파일과 JavaScript 파일이 둘 다 포함된 프로젝트를 정리하는 데 도움이 됩니다. 자세한 내용은 https://aka.ms/tsconfig를 참조하세요.", "Additional_Checks_6176": "추가 검사", @@ -156,6 +166,7 @@ "An_object_member_cannot_be_declared_optional_1162": "개체 멤버는 선택적으로 선언될 수 없습니다.", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "오버로드 시그니처는 생성기로 선언할 수 없습니다.", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "지수 식의 왼쪽에는 '{0}' 연산자가 있는 단항 식을 사용할 수 없습니다. 식을 괄호로 묶는 것이 좋습니다.", + "Annotate_everything_with_types_from_JSDoc_95043": "JSDoc의 형식을 사용하여 모든 항목에 주석 달기", "Annotate_with_type_from_JSDoc_95009": "JSDoc의 형식을 사용하여 주석 추가", "Annotate_with_types_from_JSDoc_95010": "JSDoc의 형식을 사용하여 주석 추가", "Argument_expression_expected_1135": "인수 식이 필요합니다.", @@ -223,6 +234,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "Catch 절 변수에 형식 주석을 사용할 수 없습니다.", "Catch_clause_variable_cannot_have_an_initializer_1197": "Catch 절 변수에 이니셜라이저를 사용할 수 없습니다.", "Change_0_to_1_90014": "'{0}'을(를) '{1}'(으)로 변경", + "Change_all_extended_interfaces_to_implements_95038": "확장된 모든 인터페이스를 'implements'로 변경", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "모든 jsdoc-style 형식을 TypeScript로 변경", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "모든 jsdoc-style 형식을 TypeScript로 변경(그리고 nullable 형식에 '| undefined' 추가)", "Change_extends_to_implements_90003": "'extends'를 'implements'로 변경", "Change_spelling_to_0_90022": "맞춤법을 '{0}'(으)로 변경", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "'{0}'이(가) '{1}' - '{2}'에 대해 일치하는 가장 긴 접두사인지 확인하는 중입니다.", @@ -256,6 +270,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "'{0}' 클래스의 생성자는 protected이며 클래스 선언 내에서만 액세스할 수 있습니다.", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "파생 클래스의 생성자는 'super' 호출을 포함해야 합니다.", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "포함 파일이 지정되지 않았고 루트 디렉터리를 확인할 수 없어 'node_modules' 폴더 조회를 건너뜁니다.", + "Convert_all_constructor_functions_to_classes_95045": "모든 생성자 함수를 클래스로 변환", + "Convert_all_to_default_imports_95035": "모든 항목을 기본 가져오기로 변환", "Convert_function_0_to_class_95002": "'{0}' 함수를 클래스로 변환", "Convert_function_to_an_ES2015_class_95001": "함수를 ES2015 클래스로 변환", "Convert_to_ES6_module_95017": "ES6 모듈로 변환", @@ -274,6 +290,7 @@ "Decorators_are_not_valid_here_1206": "데코레이터는 여기에 사용할 수 없습니다.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "동일한 이름의 여러 get/set 접근자에 데코레이터를 적용할 수 없습니다.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "모듈의 기본 내보내기에서 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", + "Delete_all_unused_declarations_95024": "사용하지 않는 선언 모두 삭제", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[사용되지 않음] 대신 '--jsxFactory'를 사용합니다. 'react' JSX 내보내기를 대상으로 할 경우 createElement에 대해 호출되는 개체를 지정합니다.", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[사용되지 않음] 대신 '--outFile'을 사용합니다. 출력을 연결하고 단일 파일로 내보냅니다.", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[사용되지 않음] 대신 '--skipLibCheck'를 사용합니다. 기본 라이브러리 선언 파일의 형식 검사를 건너뜁니다.", @@ -388,6 +405,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "파일 이름 '{0}'에 '{1}' 확장명이 있어 제거하는 중입니다.", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "파일 사양은 재귀 디렉터리 와일드카드('**') 뒤에 나타나는 부모 디렉터리('..')를 포함할 수 없습니다. '{0}'.", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "파일 사양은 재귀 디렉터리 와일드카드('**')로 끝날 수 없습니다. '{0}'.", + "Fix_all_detected_spelling_errors_95026": "검색된 맞춤법 오류 모두 수정", "Found_package_json_at_0_6099": "'{0}'에서 'package.json'을 찾았습니다.", "Found_package_json_at_0_Package_ID_is_1_6190": "'{0}'에서 'package.json'을 찾았습니다. 패키지 ID는 '{1}'입니다.", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "'ES3' 또는 'ES5'를 대상으로 할 경우 strict 모드의 블록 내에서 함수 선언을 사용할 수 없습니다.", @@ -400,6 +418,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "함수에 끝 return 문이 없으며 반환 형식에 'undefined'가 포함되지 않습니다.", "Function_overload_must_be_static_2387": "함수 오버로드는 정적이어야 합니다.", "Function_overload_must_not_be_static_2388": "함수 오버로드는 정적이 아니어야 합니다.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "해당하는 각 '.d.ts' 파일의 sourcemap을 생성합니다.", "Generates_corresponding_d_ts_file_6002": "해당 '.d.ts' 파일을 생성합니다.", "Generates_corresponding_map_file_6043": "해당 '.map' 파일을 생성합니다.", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "생성기는 값을 생성하지 않으므로 암시적으로 '{0}' 형식입니다. 반환 형식을 제공하세요.", @@ -421,6 +440,8 @@ "Identifier_expected_1003": "식별자가 필요합니다.", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "식별자가 필요합니다. '__esModule'은 ECMAScript 모듈을 변환할 때 내보낸 표식으로 예약되어 있습니다.", "Ignore_this_error_message_90019": "이 오류 메시지 무시", + "Implement_all_inherited_abstract_classes_95040": "상속된 추상 클래스 모두 구현", + "Implement_all_unimplemented_interfaces_95032": "구현되지 않은 인터페이스 모두 구현", "Implement_inherited_abstract_class_90007": "상속된 추상 클래스 구현", "Implement_interface_0_90006": "'{0}' 인터페이스 구현", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "내보낸 클래스 '{0}'의 Implements 절이 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", @@ -441,6 +462,7 @@ "Index_signature_is_missing_in_type_0_2329": "'{0}' 형식에 인덱스 시그니처가 없습니다.", "Index_signatures_are_incompatible_2330": "인덱스 시그니처가 호환되지 않습니다.", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "병합된 선언 '{0}'의 개별 선언은 모두 내보내 졌거나 모두 로컬이어야 합니다.", + "Infer_all_types_from_usage_95023": "사용량에서 모든 형식 유추", "Infer_parameter_types_from_usage_95012": "사용량에서 매개 변수 형식 유추", "Infer_type_of_0_from_usage_95011": "사용량에서 '{0}'의 형식 유추", "Initialize_property_0_in_the_constructor_90020": "생성자에서 속성 '{0}' 초기화", @@ -452,6 +474,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "TypeScript 프로젝트를 초기화하고 tsconfig.json 파일을 만듭니다.", "Insert_command_line_options_and_files_from_a_file_6030": "파일에서 명령줄 옵션 및 파일을 삽입합니다.", "Install_0_95014": "'{0}' 설치", + "Install_all_missing_types_packages_95033": "누락된 형식 패키지 모두 설치", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "'{0}' 인터페이스는 '{1}' 및 '{2}' 형식을 동시에 확장할 수 없습니다.", "Interface_0_incorrectly_extends_interface_1_2430": "'{0}' 인터페이스가 '{1}' 인터페이스를 잘못 확장합니다.", "Interface_declaration_cannot_have_implements_clause_1176": "인터페이스 선언에는 'implements' 절을 사용할 수 없습니다.", @@ -504,6 +527,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "로캘이 또는 - 형식이어야 합니다. 예를 들어 '{0}' 또는 '{1}'입니다.", "Longest_matching_prefix_for_0_is_1_6108": "'{0}'에 대해 일치하는 가장 긴 접두사는 '{1}'입니다.", "Looking_up_in_node_modules_folder_initial_location_0_6125": "'node_modules' 폴더에서 찾고 있습니다. 초기 위치: '{0}'.", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "모든 'super()' 호출을 생성자의 첫 번째 문으로 만들기", "Make_super_call_the_first_statement_in_the_constructor_90002": "생성자의 첫 번째 문을 'super()'로 호출", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "매핑된 개체 형식에는 'any' 템플릿 형식이 암시적으로 포함됩니다.", "Member_0_implicitly_has_an_1_type_7008": "'{0}' 멤버에는 암시적으로 '{1}' 형식이 포함됩니다.", @@ -514,6 +538,8 @@ "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101": "내보낸 인터페이스의 '{0}' 메서드가 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102": "내보낸 인터페이스의 '{0}' 메서드가 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Modifiers_cannot_appear_here_1184": "한정자를 여기에 표시할 수 없습니다.", + "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340": "모듈 '{0}'은(는) 형식을 참조하지 않지만, 여기에서 형식으로 사용됩니다.", + "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339": "모듈 '{0}'은(는) 값을 참조하지 않지만, 여기에서 값으로 사용됩니다.", "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "{0} 모듈에서 '{1}'(이)라는 멤버를 이미 내보냈습니다. 모호성을 해결하려면 명시적으로 다시 내보내는 것이 좋습니다.", "Module_0_has_no_default_export_1192": "모듈 '{0}'에는 기본 내보내기가 없습니다.", "Module_0_has_no_exported_member_1_2305": "'{0}' 모듈에 내보낸 멤버 '{1}'이(가) 없습니다.", @@ -566,6 +592,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "'{0}' 옵션은 '--inlineSourceMap' 옵션 또는 '--sourceMap' 옵션이 제공되는 경우에만 사용할 수 있습니다.", "Option_0_cannot_be_specified_with_option_1_5053": "'{0}' 옵션은 '{1}' 옵션과 함께 지정할 수 없습니다.", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "'{1}' 옵션을 지정하지 않고 '{0}' 옵션을 지정할 수 없습니다.", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "'{1}' 또는 '{2}' 옵션을 지정하지 않고 '{0}' 옵션을 지정할 수 없습니다.", "Option_0_should_have_array_of_strings_as_a_value_6103": "'{0}' 옵션은 문자열 배열 값을 사용해야 합니다.", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "'isolatedModules' 옵션은 '--module' 옵션을 지정하거나 'target' 옵션이 'ES2015' 이상인 경우에만 사용할 수 있습니다.", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "'paths' 옵션은 '--baseUrl' 옵션을 지정하지 않고 사용할 수 없습니다.", @@ -610,6 +637,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "strict 모드에서 구문 분석하고 각 소스 파일에 대해 \"use strict\"를 내보냅니다.", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "'{0}' 패턴에는 '*' 문자를 최대 하나만 사용할 수 있습니다.", "Prefix_0_with_an_underscore_90025": "'{0}' 앞에 밑줄 추가", + "Prefix_all_unused_declarations_with_where_possible_95025": "가능한 경우 사용하지 않는 모든 선언에 '_'을 접두사로 추가", "Print_names_of_files_part_of_the_compilation_6155": "컴파일의 일부인 파일의 이름을 인쇄합니다.", "Print_names_of_generated_files_part_of_the_compilation_6154": "컴파일의 일부인 생성된 파일의 이름을 인쇄합니다.", "Print_the_compiler_s_version_6019": "컴파일러 버전을 인쇄합니다.", @@ -708,6 +736,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "내보낸 클래스에 있는 공용 정적 메서드의 반환 형식이 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "이전 프로그램에서 변경되지 않았으므로 '{0}'에서 발생하는 모듈 확인을 다시 사용합니다.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "'{0}' 모듈 확인을 이전 프로그램의 '{1}' 파일에 다시 사용합니다.", + "Rewrite_all_as_indexed_access_types_95034": "인덱싱된 액세스 형식으로 모두 다시 작성", "Rewrite_as_the_indexed_access_type_0_90026": "인덱싱된 액세스 형식 '{0}'(으)로 다시 작성", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "루트 디렉터리를 확인할 수 없어 기본 검색 경로를 건너뜁니다.", "STRATEGY_6039": "전략", @@ -788,7 +817,7 @@ "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236": "속성 데코레이터 함수의 반환 형식은 'void' 또는 'any'여야 합니다.", "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058": "비동기 함수의 반환 형식은 유효한 프라미스여야 하거나 호출 가능 'then' 멤버를 포함하지 않아야 합니다.", "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064": "비동기 함수 또는 메서드의 반환 형식은 전역 Promise 형식이어야 합니다.", - "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407": "'for...in' 문 오른쪽은 'any' 형식, 개체 형식 또는 형식 매개 변수여야 합니다.", + "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_or_an_enum_type_2363": "산술 연산 오른쪽은 'any', 'number' 또는 열거형 형식이어야 합니다.", "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361": "'in' 식의 오른쪽은 'any' 형식, 개체 형식 또는 형식 매개 변수여야 합니다.", "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' 인터페이스 형식에 할당할 수 있는 형식이어야 합니다.", @@ -823,13 +852,17 @@ "Type_0_is_not_a_constructor_function_type_2507": "'{0}' 형식은 생성자 함수 형식이 아닙니다.", "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055": "'{0}' 형식은 Promise 호환 생성자 값을 참조하지 않으므로 ES5/ES3에서 유효한 비동기 함수 반환 형식이 아닙니다.", "Type_0_is_not_an_array_type_2461": "'{0}' 형식은 배열 형식이 아닙니다.", + "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568": "'{0}' 형식이 배열 형식이 아닙니다. 컴파일러 옵션 '-downlevelIteration'을 사용하여 반복기의 반복을 허용하세요.", "Type_0_is_not_an_array_type_or_a_string_type_2495": "'{0}' 형식은 배열 형식 또는 문자열 형식이 아닙니다.", + "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569": "'{0}' 형식이 배열 형식 또는 문자열 형식이 아닙니다. 컴파일러 옵션 '-downlevelIteration'을 사용하여 반복기의 반복을 허용하세요.", "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549": "'{0}' 형식은 배열 형식 또는 문자열 형식이 아니거나, 반복기를 반환하는 '[Symbol.iterator]()' 메서드가 없습니다.", "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548": "'{0}' 형식은 배열 형식이 아니거나 반복기를 반환하는 '[Symbol.iterator]()' 메서드가 없습니다.", "Type_0_is_not_assignable_to_type_1_2322": "'{0}' 형식은 '{1}' 형식에 할당할 수 없습니다.", "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719": "'{0}' 형식을 '{1}' 형식에 할당할 수 없습니다. 이름이 같은 2개의 서로 다른 형식이 있지만 서로 관련은 없습니다.", "Type_0_is_not_comparable_to_type_1_2678": "'{0}' 형식을 '{1}' 형식과 비교할 수 없습니다.", "Type_0_is_not_generic_2315": "'{0}' 형식이 제네릭이 아닙니다.", + "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}' 시그니처에 대한 일치하는 항목을 제공하지 않습니다.", "Type_0_recursively_references_itself_as_a_base_type_2310": "Type '{0}' 형식은 자기 자신을 기본 형식으로 재귀적으로 참조합니다.", "Type_alias_0_circularly_references_itself_2456": "'{0}' 형식 별칭은 순환적으로 자신을 참조합니다.", @@ -838,11 +871,10 @@ "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455": "형식 인수 후보 '{1}'은(는) '{0}' 후보의 상위 형식이 아니므로 유효한 형식 인수가 아닙니다.", "Type_argument_expected_1140": "형식 인수가 필요합니다.", "Type_argument_list_cannot_be_empty_1099": "형식 인수 목록은 비워 둘 수 없습니다.", + "Type_arguments_cannot_be_used_here_1342": "형식 인수를 여기에 사용할 수 없습니다.", "Type_declaration_files_to_be_included_in_compilation_6124": "컴파일에 포함할 선언 파일을 입력하세요.", "Type_expected_1110": "형식이 필요합니다.", "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062": "형식은 자체 'then' 메서드의 처리 콜백에서 직간접적으로 참조됩니다.", - "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "형식에는 비동기 반복기를 반환하는 '[Symbol.asyncIterator]()' 메서드가 있어야 합니다.", - "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "형식에는 반복기를 반환하는 '[Symbol.iterator]()' 메서드가 있어야 합니다.", "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320": "'await' 형식의 피연산자는 유효한 프라미스여야 하거나 호출 가능 'then' 멤버를 포함하지 않아야 합니다.", "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "'yield*'의 반복되는 요소 형식의 피연산자는 유효한 프라미스여야 하거나 호출 가능 'then' 멤버를 포함하지 않아야 합니다.", "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "비동기 생성기에 있는 'yield' 형식의 피연산자는 유효한 프라미스여야 하거나 호출 가능 'then' 멤버를 포함하지 않아야 합니다.", diff --git a/lib/lib.d.ts b/lib/lib.d.ts index d266bf37851..ab4f15d9c4d 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -8879,12 +8879,12 @@ interface FileReaderEventMap { interface FileReader extends EventTarget { readonly error: DOMException | null; - onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; - onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; - onload: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; - onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + onabort: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onerror: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onload: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadend: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadstart: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onprogress: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; readonly readyState: number; readonly result: any; abort(): void; @@ -8909,6 +8909,10 @@ declare var FileReader: { readonly LOADING: number; }; +interface FileReaderProgressEvent extends ProgressEvent { + readonly target: FileReader | null; +} + interface FocusEvent extends UIEvent { readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; @@ -13029,6 +13033,7 @@ declare var MediaEncryptedEvent: { interface MediaError { readonly code: number; + readonly message: string; readonly msExtendedCode: number; readonly MEDIA_ERR_ABORTED: number; readonly MEDIA_ERR_DECODE: number; @@ -13511,6 +13516,7 @@ interface Node extends EventTarget { readonly baseURI: string | null; readonly childNodes: NodeListOf; readonly firstChild: Node | null; + readonly isConnected: boolean; readonly lastChild: Node | null; readonly localName: string | null; readonly namespaceURI: string | null; @@ -13838,6 +13844,12 @@ declare var PannerNode: { new(): PannerNode; }; +interface ParentNode { + readonly childElementCount: number; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; +} + interface ParentNode { readonly children: HTMLCollection; querySelector(selectors: K): HTMLElementTagNameMap[K] | null; @@ -13848,12 +13860,6 @@ interface ParentNode { querySelectorAll(selectors: string): NodeListOf; } -interface ParentNode { - readonly childElementCount: number; - readonly firstElementChild: Element | null; - readonly lastElementChild: Element | null; -} - interface Path2D extends CanvasPathMethods { } @@ -18115,24 +18121,24 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform1fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform1iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform2fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform2iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform3fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform3iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform4fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; + uniform4iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; + uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; useProgram(program: WebGLProgram | null): void; validateProgram(program: WebGLProgram | null): void; vertexAttrib1f(indx: number, x: number): void; @@ -19176,7 +19182,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onvrdisplaypointerunrestricted: ((this: Window, ev: Event) => any) | null; onvrdisplaypresentchange: ((this: Window, ev: Event) => any) | null; onwaiting: ((this: Window, ev: Event) => any) | null; - readonly opener: any; + opener: any; readonly orientation: string | number; readonly outerHeight: number; readonly outerWidth: number; diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 44bcc45d6f3..362c69de421 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -4742,12 +4742,12 @@ interface FileReaderEventMap { interface FileReader extends EventTarget { readonly error: DOMException | null; - onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; - onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; - onload: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; - onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + onabort: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onerror: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onload: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadend: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadstart: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onprogress: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; readonly readyState: number; readonly result: any; abort(): void; @@ -4772,6 +4772,10 @@ declare var FileReader: { readonly LOADING: number; }; +interface FileReaderProgressEvent extends ProgressEvent { + readonly target: FileReader | null; +} + interface FocusEvent extends UIEvent { readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; @@ -8892,6 +8896,7 @@ declare var MediaEncryptedEvent: { interface MediaError { readonly code: number; + readonly message: string; readonly msExtendedCode: number; readonly MEDIA_ERR_ABORTED: number; readonly MEDIA_ERR_DECODE: number; @@ -9374,6 +9379,7 @@ interface Node extends EventTarget { readonly baseURI: string | null; readonly childNodes: NodeListOf; readonly firstChild: Node | null; + readonly isConnected: boolean; readonly lastChild: Node | null; readonly localName: string | null; readonly namespaceURI: string | null; @@ -9701,6 +9707,12 @@ declare var PannerNode: { new(): PannerNode; }; +interface ParentNode { + readonly childElementCount: number; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; +} + interface ParentNode { readonly children: HTMLCollection; querySelector(selectors: K): HTMLElementTagNameMap[K] | null; @@ -9711,12 +9723,6 @@ interface ParentNode { querySelectorAll(selectors: string): NodeListOf; } -interface ParentNode { - readonly childElementCount: number; - readonly firstElementChild: Element | null; - readonly lastElementChild: Element | null; -} - interface Path2D extends CanvasPathMethods { } @@ -13978,24 +13984,24 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform1fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform1iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform2fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform2iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform3fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform3iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform4fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; + uniform4iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; + uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; useProgram(program: WebGLProgram | null): void; validateProgram(program: WebGLProgram | null): void; vertexAttrib1f(indx: number, x: number): void; @@ -15039,7 +15045,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onvrdisplaypointerunrestricted: ((this: Window, ev: Event) => any) | null; onvrdisplaypresentchange: ((this: Window, ev: Event) => any) | null; onwaiting: ((this: Window, ev: Event) => any) | null; - readonly opener: any; + opener: any; readonly orientation: string | number; readonly outerHeight: number; readonly outerWidth: number; diff --git a/lib/lib.es2015.collection.d.ts b/lib/lib.es2015.collection.d.ts index 84b9ad6c0ef..a6bb70e1023 100644 --- a/lib/lib.es2015.collection.d.ts +++ b/lib/lib.es2015.collection.d.ts @@ -30,7 +30,7 @@ interface Map { interface MapConstructor { new (): Map; - new (entries?: ReadonlyArray<[K, V]>): Map; + new (entries?: ReadonlyArray<[K, V]> | null): Map; readonly prototype: Map; } declare var Map: MapConstructor; @@ -51,7 +51,7 @@ interface WeakMap { interface WeakMapConstructor { new (): WeakMap; - new (entries?: ReadonlyArray<[K, V]>): WeakMap; + new (entries?: ReadonlyArray<[K, V]> | null): WeakMap; readonly prototype: WeakMap; } declare var WeakMap: WeakMapConstructor; @@ -67,7 +67,7 @@ interface Set { interface SetConstructor { new (): Set; - new (values?: ReadonlyArray): Set; + new (values?: ReadonlyArray | null): Set; readonly prototype: Set; } declare var Set: SetConstructor; @@ -86,7 +86,7 @@ interface WeakSet { interface WeakSetConstructor { new (): WeakSet; - new (values?: ReadonlyArray): WeakSet; + new (values?: ReadonlyArray | null): WeakSet; readonly prototype: WeakSet; } declare var WeakSet: WeakSetConstructor; diff --git a/lib/lib.es2016.full.d.ts b/lib/lib.es2016.full.d.ts index cc696316bcc..6edbefd3ae1 100644 --- a/lib/lib.es2016.full.d.ts +++ b/lib/lib.es2016.full.d.ts @@ -4745,12 +4745,12 @@ interface FileReaderEventMap { interface FileReader extends EventTarget { readonly error: DOMException | null; - onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; - onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; - onload: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; - onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + onabort: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onerror: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onload: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadend: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadstart: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onprogress: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; readonly readyState: number; readonly result: any; abort(): void; @@ -4775,6 +4775,10 @@ declare var FileReader: { readonly LOADING: number; }; +interface FileReaderProgressEvent extends ProgressEvent { + readonly target: FileReader | null; +} + interface FocusEvent extends UIEvent { readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; @@ -8895,6 +8899,7 @@ declare var MediaEncryptedEvent: { interface MediaError { readonly code: number; + readonly message: string; readonly msExtendedCode: number; readonly MEDIA_ERR_ABORTED: number; readonly MEDIA_ERR_DECODE: number; @@ -9377,6 +9382,7 @@ interface Node extends EventTarget { readonly baseURI: string | null; readonly childNodes: NodeListOf; readonly firstChild: Node | null; + readonly isConnected: boolean; readonly lastChild: Node | null; readonly localName: string | null; readonly namespaceURI: string | null; @@ -9704,6 +9710,12 @@ declare var PannerNode: { new(): PannerNode; }; +interface ParentNode { + readonly childElementCount: number; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; +} + interface ParentNode { readonly children: HTMLCollection; querySelector(selectors: K): HTMLElementTagNameMap[K] | null; @@ -9714,12 +9726,6 @@ interface ParentNode { querySelectorAll(selectors: string): NodeListOf; } -interface ParentNode { - readonly childElementCount: number; - readonly firstElementChild: Element | null; - readonly lastElementChild: Element | null; -} - interface Path2D extends CanvasPathMethods { } @@ -13981,24 +13987,24 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform1fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform1iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform2fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform2iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform3fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform3iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform4fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; + uniform4iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; + uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; useProgram(program: WebGLProgram | null): void; validateProgram(program: WebGLProgram | null): void; vertexAttrib1f(indx: number, x: number): void; @@ -15042,7 +15048,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onvrdisplaypointerunrestricted: ((this: Window, ev: Event) => any) | null; onvrdisplaypresentchange: ((this: Window, ev: Event) => any) | null; onwaiting: ((this: Window, ev: Event) => any) | null; - readonly opener: any; + opener: any; readonly orientation: string | number; readonly outerHeight: number; readonly outerWidth: number; diff --git a/lib/lib.es2017.full.d.ts b/lib/lib.es2017.full.d.ts index 1208629b219..b5dd366b413 100644 --- a/lib/lib.es2017.full.d.ts +++ b/lib/lib.es2017.full.d.ts @@ -4750,12 +4750,12 @@ interface FileReaderEventMap { interface FileReader extends EventTarget { readonly error: DOMException | null; - onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; - onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; - onload: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; - onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + onabort: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onerror: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onload: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadend: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadstart: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onprogress: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; readonly readyState: number; readonly result: any; abort(): void; @@ -4780,6 +4780,10 @@ declare var FileReader: { readonly LOADING: number; }; +interface FileReaderProgressEvent extends ProgressEvent { + readonly target: FileReader | null; +} + interface FocusEvent extends UIEvent { readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; @@ -8900,6 +8904,7 @@ declare var MediaEncryptedEvent: { interface MediaError { readonly code: number; + readonly message: string; readonly msExtendedCode: number; readonly MEDIA_ERR_ABORTED: number; readonly MEDIA_ERR_DECODE: number; @@ -9382,6 +9387,7 @@ interface Node extends EventTarget { readonly baseURI: string | null; readonly childNodes: NodeListOf; readonly firstChild: Node | null; + readonly isConnected: boolean; readonly lastChild: Node | null; readonly localName: string | null; readonly namespaceURI: string | null; @@ -9709,6 +9715,12 @@ declare var PannerNode: { new(): PannerNode; }; +interface ParentNode { + readonly childElementCount: number; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; +} + interface ParentNode { readonly children: HTMLCollection; querySelector(selectors: K): HTMLElementTagNameMap[K] | null; @@ -9719,12 +9731,6 @@ interface ParentNode { querySelectorAll(selectors: string): NodeListOf; } -interface ParentNode { - readonly childElementCount: number; - readonly firstElementChild: Element | null; - readonly lastElementChild: Element | null; -} - interface Path2D extends CanvasPathMethods { } @@ -13986,24 +13992,24 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform1fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform1iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform2fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform2iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform3fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform3iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform4fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; + uniform4iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; + uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; useProgram(program: WebGLProgram | null): void; validateProgram(program: WebGLProgram | null): void; vertexAttrib1f(indx: number, x: number): void; @@ -15047,7 +15053,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onvrdisplaypointerunrestricted: ((this: Window, ev: Event) => any) | null; onvrdisplaypresentchange: ((this: Window, ev: Event) => any) | null; onwaiting: ((this: Window, ev: Event) => any) | null; - readonly opener: any; + opener: any; readonly orientation: string | number; readonly outerHeight: number; readonly outerWidth: number; diff --git a/lib/lib.es2018.full.d.ts b/lib/lib.es2018.full.d.ts index 716d022c2ff..9fa3c918179 100644 --- a/lib/lib.es2018.full.d.ts +++ b/lib/lib.es2018.full.d.ts @@ -4746,12 +4746,12 @@ interface FileReaderEventMap { interface FileReader extends EventTarget { readonly error: DOMException | null; - onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; - onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; - onload: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; - onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + onabort: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onerror: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onload: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadend: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadstart: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onprogress: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; readonly readyState: number; readonly result: any; abort(): void; @@ -4776,6 +4776,10 @@ declare var FileReader: { readonly LOADING: number; }; +interface FileReaderProgressEvent extends ProgressEvent { + readonly target: FileReader | null; +} + interface FocusEvent extends UIEvent { readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; @@ -8896,6 +8900,7 @@ declare var MediaEncryptedEvent: { interface MediaError { readonly code: number; + readonly message: string; readonly msExtendedCode: number; readonly MEDIA_ERR_ABORTED: number; readonly MEDIA_ERR_DECODE: number; @@ -9378,6 +9383,7 @@ interface Node extends EventTarget { readonly baseURI: string | null; readonly childNodes: NodeListOf; readonly firstChild: Node | null; + readonly isConnected: boolean; readonly lastChild: Node | null; readonly localName: string | null; readonly namespaceURI: string | null; @@ -9705,6 +9711,12 @@ declare var PannerNode: { new(): PannerNode; }; +interface ParentNode { + readonly childElementCount: number; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; +} + interface ParentNode { readonly children: HTMLCollection; querySelector(selectors: K): HTMLElementTagNameMap[K] | null; @@ -9715,12 +9727,6 @@ interface ParentNode { querySelectorAll(selectors: string): NodeListOf; } -interface ParentNode { - readonly childElementCount: number; - readonly firstElementChild: Element | null; - readonly lastElementChild: Element | null; -} - interface Path2D extends CanvasPathMethods { } @@ -13982,24 +13988,24 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform1fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform1iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform2fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform2iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform3fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform3iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform4fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; + uniform4iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; + uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; useProgram(program: WebGLProgram | null): void; validateProgram(program: WebGLProgram | null): void; vertexAttrib1f(indx: number, x: number): void; @@ -15043,7 +15049,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onvrdisplaypointerunrestricted: ((this: Window, ev: Event) => any) | null; onvrdisplaypresentchange: ((this: Window, ev: Event) => any) | null; onwaiting: ((this: Window, ev: Event) => any) | null; - readonly opener: any; + opener: any; readonly orientation: string | number; readonly outerHeight: number; readonly outerWidth: number; diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 132323e4eb8..df63d17f3d3 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -4695,7 +4695,7 @@ interface Map { interface MapConstructor { new (): Map; - new (entries?: ReadonlyArray<[K, V]>): Map; + new (entries?: ReadonlyArray<[K, V]> | null): Map; readonly prototype: Map; } declare var Map: MapConstructor; @@ -4716,7 +4716,7 @@ interface WeakMap { interface WeakMapConstructor { new (): WeakMap; - new (entries?: ReadonlyArray<[K, V]>): WeakMap; + new (entries?: ReadonlyArray<[K, V]> | null): WeakMap; readonly prototype: WeakMap; } declare var WeakMap: WeakMapConstructor; @@ -4732,7 +4732,7 @@ interface Set { interface SetConstructor { new (): Set; - new (values?: ReadonlyArray): Set; + new (values?: ReadonlyArray | null): Set; readonly prototype: Set; } declare var Set: SetConstructor; @@ -4751,7 +4751,7 @@ interface WeakSet { interface WeakSetConstructor { new (): WeakSet; - new (values?: ReadonlyArray): WeakSet; + new (values?: ReadonlyArray | null): WeakSet; readonly prototype: WeakSet; } declare var WeakSet: WeakSetConstructor; @@ -10590,12 +10590,12 @@ interface FileReaderEventMap { interface FileReader extends EventTarget { readonly error: DOMException | null; - onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; - onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; - onload: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; - onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + onabort: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onerror: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onload: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadend: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadstart: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onprogress: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; readonly readyState: number; readonly result: any; abort(): void; @@ -10620,6 +10620,10 @@ declare var FileReader: { readonly LOADING: number; }; +interface FileReaderProgressEvent extends ProgressEvent { + readonly target: FileReader | null; +} + interface FocusEvent extends UIEvent { readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; @@ -14740,6 +14744,7 @@ declare var MediaEncryptedEvent: { interface MediaError { readonly code: number; + readonly message: string; readonly msExtendedCode: number; readonly MEDIA_ERR_ABORTED: number; readonly MEDIA_ERR_DECODE: number; @@ -15222,6 +15227,7 @@ interface Node extends EventTarget { readonly baseURI: string | null; readonly childNodes: NodeListOf; readonly firstChild: Node | null; + readonly isConnected: boolean; readonly lastChild: Node | null; readonly localName: string | null; readonly namespaceURI: string | null; @@ -15549,6 +15555,12 @@ declare var PannerNode: { new(): PannerNode; }; +interface ParentNode { + readonly childElementCount: number; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; +} + interface ParentNode { readonly children: HTMLCollection; querySelector(selectors: K): HTMLElementTagNameMap[K] | null; @@ -15559,12 +15571,6 @@ interface ParentNode { querySelectorAll(selectors: string): NodeListOf; } -interface ParentNode { - readonly childElementCount: number; - readonly firstElementChild: Element | null; - readonly lastElementChild: Element | null; -} - interface Path2D extends CanvasPathMethods { } @@ -19826,24 +19832,24 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform1fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform1iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform2fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform2iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform3fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform3iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform4fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; + uniform4iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; + uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; useProgram(program: WebGLProgram | null): void; validateProgram(program: WebGLProgram | null): void; vertexAttrib1f(indx: number, x: number): void; @@ -20887,7 +20893,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onvrdisplaypointerunrestricted: ((this: Window, ev: Event) => any) | null; onvrdisplaypresentchange: ((this: Window, ev: Event) => any) | null; onwaiting: ((this: Window, ev: Event) => any) | null; - readonly opener: any; + opener: any; readonly orientation: string | number; readonly outerHeight: number; readonly outerWidth: number; diff --git a/lib/lib.esnext.full.d.ts b/lib/lib.esnext.full.d.ts index 0723e558ee8..0dd37e1d9cf 100644 --- a/lib/lib.esnext.full.d.ts +++ b/lib/lib.esnext.full.d.ts @@ -4747,12 +4747,12 @@ interface FileReaderEventMap { interface FileReader extends EventTarget { readonly error: DOMException | null; - onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; - onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; - onload: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; - onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + onabort: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onerror: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onload: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadend: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadstart: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onprogress: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; readonly readyState: number; readonly result: any; abort(): void; @@ -4777,6 +4777,10 @@ declare var FileReader: { readonly LOADING: number; }; +interface FileReaderProgressEvent extends ProgressEvent { + readonly target: FileReader | null; +} + interface FocusEvent extends UIEvent { readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; @@ -8897,6 +8901,7 @@ declare var MediaEncryptedEvent: { interface MediaError { readonly code: number; + readonly message: string; readonly msExtendedCode: number; readonly MEDIA_ERR_ABORTED: number; readonly MEDIA_ERR_DECODE: number; @@ -9379,6 +9384,7 @@ interface Node extends EventTarget { readonly baseURI: string | null; readonly childNodes: NodeListOf; readonly firstChild: Node | null; + readonly isConnected: boolean; readonly lastChild: Node | null; readonly localName: string | null; readonly namespaceURI: string | null; @@ -9706,6 +9712,12 @@ declare var PannerNode: { new(): PannerNode; }; +interface ParentNode { + readonly childElementCount: number; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; +} + interface ParentNode { readonly children: HTMLCollection; querySelector(selectors: K): HTMLElementTagNameMap[K] | null; @@ -9716,12 +9728,6 @@ interface ParentNode { querySelectorAll(selectors: string): NodeListOf; } -interface ParentNode { - readonly childElementCount: number; - readonly firstElementChild: Element | null; - readonly lastElementChild: Element | null; -} - interface Path2D extends CanvasPathMethods { } @@ -13983,24 +13989,24 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform1fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform1iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform2fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform2iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform3fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; + uniform3iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | ArrayLike): void; + uniform4fv(location: WebGLUniformLocation | null, v: Float32Array | ArrayLike): void; uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | ArrayLike): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | ArrayLike): void; + uniform4iv(location: WebGLUniformLocation | null, v: Int32Array | ArrayLike): void; + uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; + uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: boolean, value: Float32Array | ArrayLike): void; useProgram(program: WebGLProgram | null): void; validateProgram(program: WebGLProgram | null): void; vertexAttrib1f(indx: number, x: number): void; @@ -15044,7 +15050,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onvrdisplaypointerunrestricted: ((this: Window, ev: Event) => any) | null; onvrdisplaypresentchange: ((this: Window, ev: Event) => any) | null; onwaiting: ((this: Window, ev: Event) => any) | null; - readonly opener: any; + opener: any; readonly orientation: string | number; readonly outerHeight: number; readonly outerWidth: number; diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index e9c42de786c..68a80021d50 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -608,12 +608,12 @@ interface FileReaderEventMap { interface FileReader extends EventTarget { readonly error: DOMException | null; - onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; - onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; - onload: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; - onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + onabort: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onerror: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onload: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadend: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadstart: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onprogress: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; readonly readyState: number; readonly result: any; abort(): void; @@ -638,6 +638,10 @@ declare var FileReader: { readonly LOADING: number; }; +interface FileReaderProgressEvent extends ProgressEvent { + readonly target: FileReader | null; +} + interface FileReaderSync { readAsArrayBuffer(blob: Blob): any; readAsBinaryString(blob: Blob): void; diff --git a/lib/pl/diagnosticMessages.generated.json b/lib/pl/diagnosticMessages.generated.json index bd93858ddfd..1d128c42ce5 100644 --- a/lib/pl/diagnosticMessages.generated.json +++ b/lib/pl/diagnosticMessages.generated.json @@ -94,12 +94,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "Metody dostępu są dostępne tylko wtedy, gdy jest używany język ECMAScript 5 lub nowszy.", "Accessors_must_both_be_abstract_or_non_abstract_2676": "Obie metody dostępu muszą być abstrakcyjne lub nieabstrakcyjne.", "Add_0_to_existing_import_declaration_from_1_90015": "Dodaj element „{0}” do istniejącej deklaracji importu z elementu „{1}”", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "Dodaj modyfikator asynchroniczny do funkcji zawierającej", "Add_definite_assignment_assertion_to_property_0_95020": "Dodaj asercję określonego przypisania do właściwości „{0}”", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "Dodaj sygnaturę indeksu dla właściwości „{0}”", "Add_initializer_to_property_0_95019": "Dodaj inicjator do właściwości „{0}”", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "Dodaj brakujące wywołanie „super()”", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "Dodaj „this.” do nierozpoznanej zmiennej", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "Dodaj typ „undefined” do właściwości „{0}”", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Dodanie pliku tsconfig.json pomoże w organizowaniu projektów, które zawierają pliki TypeScript i JavaScript. Dowiedz się więcej: https://aka.ms/tsconfig.", "Additional_Checks_6176": "Dodatkowe kontrole", @@ -156,6 +165,7 @@ "An_object_member_cannot_be_declared_optional_1162": "Składowa obiektu nie może być zadeklarowana jako opcjonalna.", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "Sygnatura przeciążenia nie może być zadeklarowana jako generator.", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "Wyrażenie jednoargumentowe z operatorem „{0}” jest niedozwolone po lewej stronie wyrażenia potęgowania. Zastanów się nad zamknięciem wyrażenia w nawiasach.", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "Dodaj adnotację z typem z danych JSDoc", "Annotate_with_types_from_JSDoc_95010": "Dodaj adnotację z typami z danych JSDoc", "Argument_expression_expected_1135": "Oczekiwano wyrażenia argumentu.", @@ -223,6 +233,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "Zmienna klauzuli catch nie może mieć adnotacji typu.", "Catch_clause_variable_cannot_have_an_initializer_1197": "Zmienna klauzuli catch nie może mieć inicjatora.", "Change_0_to_1_90014": "Zmień element „{0}” na „{1}”", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "Zmień atrybut „extends” na „implements”", "Change_spelling_to_0_90022": "Zmień pisownię na „{0}”", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "Sprawdzanie, czy „{0}” to najdłuższy zgodny prefiks dla „{1}” — „{2}”.", @@ -256,6 +269,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "Konstruktor klasy „{0}” jest chroniony i dostępny tylko w ramach deklaracji klasy.", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "Konstruktory klas pochodnych muszą zawierać wywołanie „super”.", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "Nie podano pliku zawierającego i nie można określić katalogu głównego. Pomijanie wyszukiwania w folderze „node_modules”.", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "Konwertuj funkcję „{0}” na klasę", "Convert_function_to_an_ES2015_class_95001": "Konwertuj funkcję na klasę ES2015", "Convert_to_ES6_module_95017": "Konwertuj na moduł ES6", @@ -274,6 +289,7 @@ "Decorators_are_not_valid_here_1206": "Elementy Decorator nie są tutaj prawidłowe.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Nie można stosować elementów Decorator do wielu metod dostępu pobierania/ustawiania o takiej samej nazwie.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Domyślny eksport modułu ma nazwę prywatną „{0}” lub używa tej nazwy.", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Przestarzałe] Użyj w zastępstwie opcji „--jsxFactory”. Określ obiekt wywoływany dla elementu createElement przy określaniu jako celu emisji JSX „react”", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Przestarzałe] Użyj w zastępstwie opcji „--outFile”. Połącz dane wyjściowe i wyemituj jako jeden plik", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Przestarzałe] Użyj w zastępstwie opcji „--skipLibCheck”. Pomiń sprawdzanie typów domyślnych plików deklaracji biblioteki.", @@ -388,6 +404,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "Nazwa pliku „{0}” ma rozszerzenie „{1}” — zostanie ono usunięte.", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "Specyfikacja pliku nie może zawierać katalogu nadrzędnego („..”) wyświetlanego po symbolu wieloznacznym katalogu rekursywnego („**”): „{0}”.", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "Specyfikacja pliku nie może kończyć się cyklicznym symbolem wieloznacznym katalogu („**”): „{0}”.", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "Znaleziono plik „package.json” w lokalizacji „{0}”.", "Found_package_json_at_0_Package_ID_is_1_6190": "Znaleziono plik „package.json” w lokalizacji „{0}”. Identyfikator pakietu to „{1}”.", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "Deklaracje funkcji nie są dozwolone wewnątrz bloków w trybie z ograniczeniami, jeśli elementem docelowym jest „ES3” lub „ES5”.", @@ -400,6 +417,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Funkcja nie zawiera końcowej instrukcji „return”, a zwracany typ nie obejmuje wartości „undefined”.", "Function_overload_must_be_static_2387": "Przeciążenie funkcji musi być statyczne.", "Function_overload_must_not_be_static_2388": "Przeciążenie funkcji nie może być statyczne.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Generuje mapę źródła dla każdego odpowiadającego pliku „.d.ts”.", "Generates_corresponding_d_ts_file_6002": "Generuje odpowiadający plik „d.ts”.", "Generates_corresponding_map_file_6043": "Generuje odpowiadający plik „map”.", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Dla generatora niejawnie określono typ „{0}”, ponieważ nie przekazuje on żadnych wartości. Rozważ podanie zwracanego typu.", @@ -421,6 +439,8 @@ "Identifier_expected_1003": "Oczekiwano identyfikatora.", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "Oczekiwano identyfikatora. Ciąg „__esModule” jest zastrzeżony jako eksportowany znacznik podczas transformowania modułów ECMAScript.", "Ignore_this_error_message_90019": "Ignoruj ten komunikat o błędzie", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "Wdróż odziedziczoną klasę abstrakcyjną", "Implement_interface_0_90006": "Implementuj interfejs „{0}”", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "Klauzula implements wyeksportowanej klasy „{0}” ma nazwę prywatną „{1}” lub używa tej nazwy.", @@ -441,6 +461,7 @@ "Index_signature_is_missing_in_type_0_2329": "Brak sygnatury indeksu w typie „{0}”.", "Index_signatures_are_incompatible_2330": "Sygnatury indeksów są niezgodne.", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "Wszystkie poszczególne deklaracje w scalonej deklaracji „{0}” muszą być wyeksportowane lub lokalne.", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "Wnioskuj typy parametrów na podstawie użycia", "Infer_type_of_0_from_usage_95011": "Wnioskuj typ elementu „{0}” na podstawie użycia", "Initialize_property_0_in_the_constructor_90020": "Zainicjuj właściwość „{0}” w konstruktorze", @@ -452,6 +473,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "Inicjuje projekt TypeScript i tworzy plik tsconfig.json.", "Insert_command_line_options_and_files_from_a_file_6030": "Wstaw opcje wiersza polecenia i pliki z pliku.", "Install_0_95014": "Zainstaluj składnik „{0}”", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "Interfejs „{0}” nie może jednocześnie rozszerzać typów „{1}” i „{2}”.", "Interface_0_incorrectly_extends_interface_1_2430": "Interfejs „{0}” niepoprawnie rozszerza interfejs „{1}”.", "Interface_declaration_cannot_have_implements_clause_1176": "Deklaracja interfejsu nie może mieć klauzuli „implements”.", @@ -504,6 +526,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "Ustawienia regionalne muszą mieć postać lub -. Na przykład „{0}” lub „{1}”.", "Longest_matching_prefix_for_0_is_1_6108": "Najdłuższy zgodny prefiks dla „{0}” to „{1}”.", "Looking_up_in_node_modules_folder_initial_location_0_6125": "Wyszukiwanie w folderze „node_modules”, początkowa lokalizacja: „{0}”.", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "Ustaw wywołanie „super()” jako pierwszą instrukcję w konstruktorze", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Zmapowany typ obiektu niejawnie ma typ szablonu „any”.", "Member_0_implicitly_has_an_1_type_7008": "Dla składowej „{0}” niejawnie określono typ „{1}”.", @@ -566,6 +589,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "Opcja „{0}” może być używana tylko w przypadku podania opcji „--inlineSourceMap” lub „--sourceMap”.", "Option_0_cannot_be_specified_with_option_1_5053": "Opcji „{0}” nie można określić razem z opcją „{1}”.", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "Opcji „{0}” nie można określić bez opcji „{1}”.", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Opcji „{0}” nie można określić bez opcji „{1}” lub opcji „{2}”.", "Option_0_should_have_array_of_strings_as_a_value_6103": "Wartość opcji „{0}” powinna być tablicą łańcuchów.", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "Opcji „isolatedModules” można użyć tylko wtedy, gdy podano opcję „--module” lub opcja „target” określa cel „ES2015” lub wyższy.", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Opcji „paths” nie można użyć bez podawania opcji „--baseUrl”.", @@ -610,6 +634,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "Analizuj w trybie z ograniczeniami i emituj ciąg „use strict” dla każdego pliku źródłowego.", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "Wzorzec „{0}” może zawierać maksymalnie jeden znak „*”.", "Prefix_0_with_an_underscore_90025": "Poprzedzaj elementy „{0}” znakiem podkreślenia", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "Drukuj nazwy plików będących częścią kompilacji.", "Print_names_of_generated_files_part_of_the_compilation_6154": "Drukuj nazwy wygenerowanych plików będących częścią kompilacji.", "Print_the_compiler_s_version_6019": "Wypisz wersję kompilatora.", @@ -708,6 +733,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "Zwracany typ publicznej metody statycznej z wyeksportowanej klasy ma nazwę prywatną „{0}” lub używa tej nazwy.", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "Ponownie używane są rozwiązania modułu pochodzące z programu „{0}”, ponieważ rozwiązania nie zmieniły się w stosunku do starej wersji programu.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "Ponownie używane jest rozwiązanie modułu „{0}” do pliku „{1}” ze starej wersji programu.", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "Napisz ponownie jako indeksowany typ dostępu „{0}”", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "Nie można określić katalogu głównego. Pomijanie ścieżek wyszukiwania podstawowego.", "STRATEGY_6039": "STRATEGIA", diff --git a/lib/protocol.d.ts b/lib/protocol.d.ts index b0812b95319..6e7f9417bbd 100644 --- a/lib/protocol.d.ts +++ b/lib/protocol.d.ts @@ -57,7 +57,7 @@ declare namespace ts.server.protocol { GetSupportedCodeFixes = "getSupportedCodeFixes", GetApplicableRefactors = "getApplicableRefactors", GetEditsForRefactor = "getEditsForRefactor", - OrganizeImports = "organizeImports", + OrganizeImports = "organizeImports" } /** * A TypeScript Server message @@ -2047,7 +2047,7 @@ declare namespace ts.server.protocol { const enum IndentStyle { None = "None", Block = "Block", - Smart = "Smart", + Smart = "Smart" } interface EditorSettings { baseIndentSize?: number; @@ -2162,7 +2162,7 @@ declare namespace ts.server.protocol { None = "None", Preserve = "Preserve", ReactNative = "ReactNative", - React = "React", + React = "React" } const enum ModuleKind { None = "None", @@ -2172,15 +2172,15 @@ declare namespace ts.server.protocol { System = "System", ES6 = "ES6", ES2015 = "ES2015", - ESNext = "ESNext", + ESNext = "ESNext" } const enum ModuleResolutionKind { Classic = "Classic", - Node = "Node", + Node = "Node" } const enum NewLineKind { Crlf = "Crlf", - Lf = "Lf", + Lf = "Lf" } const enum ScriptTarget { ES3 = "ES3", @@ -2189,7 +2189,7 @@ declare namespace ts.server.protocol { ES2015 = "ES2015", ES2016 = "ES2016", ES2017 = "ES2017", - ESNext = "ESNext", + ESNext = "ESNext" } } declare namespace ts.server.protocol { diff --git a/lib/pt-BR/diagnosticMessages.generated.json b/lib/pt-BR/diagnosticMessages.generated.json index ea360393853..eb50edc431b 100644 --- a/lib/pt-BR/diagnosticMessages.generated.json +++ b/lib/pt-BR/diagnosticMessages.generated.json @@ -66,6 +66,7 @@ "A_rest_parameter_cannot_have_an_initializer_1048": "Um parâmetro rest não pode ter um inicializador.", "A_rest_parameter_must_be_last_in_a_parameter_list_1014": "Um parâmetro rest deve ser o último em uma lista de parâmetros.", "A_rest_parameter_must_be_of_an_array_type_2370": "Um parâmetro rest deve ser de um tipo de matriz.", + "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013": "A rest parameter or binding pattern may not have a trailing comma.", "A_return_statement_can_only_be_used_within_a_function_body_1108": "Uma instrução 'return' só pode ser usada dentro de um corpo de função.", "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167": "Uma série de entradas que o remapeamento importa para pesquisar locais relativos a 'baseUrl'.", "A_set_accessor_cannot_have_a_return_type_annotation_1095": "Um acessador 'set' não pode ter uma anotação de tipo de retorno.", @@ -94,12 +95,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "Os acessadores somente estão disponíveis no direcionamento para ECMAScript 5 e superior.", "Accessors_must_both_be_abstract_or_non_abstract_2676": "Acessadores devem ser abstratos ou não abstratos.", "Add_0_to_existing_import_declaration_from_1_90015": "Adicionar '{0}' à declaração de importação existente de \"{1}\"", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "Adicione o modificador assíncrono que contém a função", "Add_definite_assignment_assertion_to_property_0_95020": "Adicionar a asserção de atribuição definitiva à propriedade '{0}'", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "Adicionar assinatura de índice para a propriedade '{0}'", "Add_initializer_to_property_0_95019": "Adicionar inicializador à propriedade '{0}'", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "Adicionar chamada 'super()' ausente", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "Adicionar 'this.' a uma variável não resolvida", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "Adicionar tipo 'indefinido' à propriedade '{0}'", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Adicionar um arquivo tsconfig.json ajudará a organizar projetos que contêm arquivos TypeScript e JavaScript. Saiba mais em https://aka.ms/tsconfig.", "Additional_Checks_6176": "Verificações Adicionais", @@ -156,6 +166,7 @@ "An_object_member_cannot_be_declared_optional_1162": "Um membro de objeto não pode ser declarado como opcional.", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "A assinatura de sobrecarga não pode ser declarada como geradora.", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "Uma expressão unária com o operador '{0}' não é permitida no lado esquerdo de uma expressão de exponenciação. Considere delimitar a expressão em parênteses.", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "Anotar com o tipo do JSDoc", "Annotate_with_types_from_JSDoc_95010": "Anotar com os tipos do JSDoc", "Argument_expression_expected_1135": "Expressão de argumento esperada.", @@ -223,6 +234,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "A variável de cláusula catch não pode ter uma anotação de tipo.", "Catch_clause_variable_cannot_have_an_initializer_1197": "A variável de cláusula catch não pode ter um inicializador.", "Change_0_to_1_90014": "Alterar '{0}' para '{1}'", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "Alterar 'extends' para 'implements'", "Change_spelling_to_0_90022": "Alterar ortografia para '{0}'", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "Verificando se '{0}' é o maior prefixo correspondente para '{1}' - '{2}'.", @@ -256,6 +270,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "O construtor de classe '{0}' é protegido e somente acessível na declaração de classe.", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "Construtores para classes derivadas devem conter uma chamada 'super'.", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "O arquivo contido não foi especificado e o diretório raiz não pode ser determinado, ignorando a pesquisa na pasta 'node_modules'.", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "Converter função '{0}' em classe", "Convert_function_to_an_ES2015_class_95001": "Converter função em uma classe ES2015", "Convert_to_ES6_module_95017": "Converter em módulo ES6", @@ -274,6 +290,7 @@ "Decorators_are_not_valid_here_1206": "Os decoradores não são válidos aqui.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Os decoradores não podem ser aplicados a vários acessadores get/set de mesmo nome.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "A exportação padrão do módulo tem ou está usando o nome particular '{0}'.", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Preterido] Use '--jsxFactory' no lugar. Especifique o objeto invocado para createElement ao direcionar uma emissão de JSX 'react'", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Preterido] Use '--outFile' no lugar. Concatene e emita uma saída para um arquivo único", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Preterido] Use '--skipLibCheck' no lugar. Ignore a verificação de tipo dos arquivos de declaração de biblioteca padrão.", @@ -388,6 +405,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "O nome do arquivo '{0}' tem uma extensão '{1}' – remoção.", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "A especificação de arquivo não pode conter um diretório pai ('..') que aparece após um curinga de diretório recursivo ('**'): '{0}'.", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "A especificação de arquivo não pode terminar em um curinga do diretório recursivo ('**'): '{0}'.", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "'package.json' encontrado em '{0}'.", "Found_package_json_at_0_Package_ID_is_1_6190": "'package.json' encontrado em '{0}'. A ID do pacote é '{1}'.", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "Decorações de função não são permitidas dentro de blocos em modo estrito quando o objetivo é 'ES3' ou 'ES5'.", @@ -400,6 +418,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "A função não tem a instrução de retorno final e o tipo de retorno não inclui 'undefined'.", "Function_overload_must_be_static_2387": "A sobrecarga de função deve ser estática.", "Function_overload_must_not_be_static_2388": "A sobrecarga de função não deve ser estática.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Gera um sourcemap para cada arquivo '.d.ts' correspondente.", "Generates_corresponding_d_ts_file_6002": "Gera o arquivo '.d.ts' correspondente.", "Generates_corresponding_map_file_6043": "Gera o arquivo '.map' correspondente.", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Implicitamente, o gerador tem o tipo '{0}' porque não produz nenhum valor. Considere fornecer um tipo de retorno.", @@ -421,6 +440,8 @@ "Identifier_expected_1003": "Identificador esperado.", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "Identificador esperado. '__esModule' é reservado como um marcador exportado ao transformar os módulos ECMAScript.", "Ignore_this_error_message_90019": "Ignorar essa mensagem de erro", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "Implementar classe abstrata herdada", "Implement_interface_0_90006": "Implementar a interface '{0}'", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "A cláusula implements da classe exportada '{0}' tem ou está usando o nome particular '{1}'.", @@ -441,6 +462,7 @@ "Index_signature_is_missing_in_type_0_2329": "Assinatura de índice ausente no tipo '{0}'.", "Index_signatures_are_incompatible_2330": "As assinaturas de índice são incompatíveis.", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "Todas as declarações individuais na declaração mesclada '{0}' devem ser exportadas ou ficar no local.", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "Inferir tipos de parâmetro pelo uso", "Infer_type_of_0_from_usage_95011": "Inferir tipo de '{0}' pelo uso", "Initialize_property_0_in_the_constructor_90020": "Inicializar a propriedade '{0}' no construtor", @@ -452,6 +474,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "Inicializa um projeto TypeScript e cria um arquivo tsconfig.json.", "Insert_command_line_options_and_files_from_a_file_6030": "Inserir opções e arquivos de linha de comando de um arquivo.", "Install_0_95014": "Instalar '{0}'", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "A interface '{0}' não pode estender os tipos '{1}' e '{2}' simultaneamente.", "Interface_0_incorrectly_extends_interface_1_2430": "A interface '{0}' estende incorretamente a interface '{1}'.", "Interface_declaration_cannot_have_implements_clause_1176": "A declaração de interface não pode ter a cláusula 'implements'.", @@ -504,6 +527,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "A localidade deve estar no formato ou -. Por exemplo '{0}' ou '{1}'.", "Longest_matching_prefix_for_0_is_1_6108": "O maior prefixo correspondente para '{0}' é '{1}'.", "Looking_up_in_node_modules_folder_initial_location_0_6125": "Pesquisando na pasta 'node_modules', local inicial '{0}'.", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "Tornar a chamada 'super()' a primeira instrução no construtor", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "O tipo de objeto mapeado implicitamente tem um tipo de modelo 'any'.", "Member_0_implicitly_has_an_1_type_7008": "O membro '{0}' implicitamente tem um tipo '{1}'.", @@ -566,6 +590,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "A opção '{0} só pode ser usada quando qualquer uma das opções '--inlineSourceMap' ou '--sourceMap' é fornecida.", "Option_0_cannot_be_specified_with_option_1_5053": "A opção '{0}' não pode ser especificada com a opção '{1}'.", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "A opção '{0}' não pode ser especificada sem especificar a opção '{1}'.", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "A opção '{0}' não pode ser especificada sem especificar a opção '{1}' ou a opção '{2}'.", "Option_0_should_have_array_of_strings_as_a_value_6103": "A opção '{0}' deve ter matriz de cadeias de um valor.", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "A opção 'isolatedModules' só pode ser usada quando nenhuma opção de '--module' for fornecida ou a opção 'target' for 'ES2015' ou superior.", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "A opção 'paths' não pode ser usada sem se especificar a opção '--baseUrl'.", @@ -610,6 +635,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "Analisar em modo estrito e emitir \"usar estrito\" para cada arquivo de origem.", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "O padrão '{0}' pode ter no máximo um caractere '*'.", "Prefix_0_with_an_underscore_90025": "Prefixo '{0}' com um sublinhado", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "Nomes de impressão das partes dos arquivos da compilação.", "Print_names_of_generated_files_part_of_the_compilation_6154": "Nomes de impressão das partes dos arquivos gerados da compilação.", "Print_the_compiler_s_version_6019": "Imprima a versão do compilador.", @@ -708,6 +734,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "O tipo de retorno do método estático público da classe exportada tem ou está usando o nome particular '{0}'.", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "Reutilizando resoluções de módulo originados em '{0}', já que as resoluções do programa antigo estão inalteradas.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "Reutilizando a resolução do módulo '{0}' para o arquivo '{1}' do programa antigo.", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "Reescrever como o tipo de acesso indexado '{0}'", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "Diretório raiz não pode ser determinado, ignorando caminhos de pesquisa primários.", "STRATEGY_6039": "ESTRATÉGIA", @@ -788,7 +815,7 @@ "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236": "O tipo de retorno de uma função de decorador de propriedade deve ser 'void' ou 'any'.", "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058": "O tipo de retorno de uma função assíncrona deve ser uma promessa válida ou não deve conter um membro \"then\" que pode ser chamado.", "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064": "O tipo de retorno de uma função assíncrona ou método deve ser o tipo Promessa global.", - "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_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.", + "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363": "O lado direito de uma operação aritmética deve ser do tipo 'any', 'number' ou de enumeração.", "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361": "O lado direito de uma expressão 'in' deve ser do tipo 'any', um tipo de objeto ou um parâmetro de tipo.", "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'.", @@ -823,13 +850,17 @@ "Type_0_is_not_a_constructor_function_type_2507": "O tipo '{0}' não é um tipo de função de construtor.", "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055": "O tipo '{0}' não é um tipo de retorno de função assíncrona válido no ES5/ES3, pois não se refere ao valor construtor compatível com a Promessa.", "Type_0_is_not_an_array_type_2461": "O tipo '{0}' não é um tipo de matriz.", + "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568": "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_2495": "O tipo '{0}' não é um tipo de matriz ou de cadeia de caracteres.", + "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569": "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549": "O tipo '{0}' não é um tipo de matriz de um tipo de cadeia ou não tem um método '[Symbol.iterator]()' que retorna um iterador.", "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548": "O tipo '{0}' não é um tipo de matriz ou não tem um método '[Symbol.iterator]()' que retorna um iterador.", "Type_0_is_not_assignable_to_type_1_2322": "O tipo '{0}' não pode ser atribuído ao tipo '{1}'.", "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719": "O tipo '{0}' não é atribuível ao tipo '{1}'. Dois tipos diferentes com esse nome existem, mas eles não estão relacionados.", "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_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.", + "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator.", "Type_0_provides_no_match_for_the_signature_1_2658": "O tipo '{0}' fornece nenhuma correspondência para a assinatura '{1}'.", "Type_0_recursively_references_itself_as_a_base_type_2310": "O tipo '{0}' referencia recursivamente a si próprio como um tipo base.", "Type_alias_0_circularly_references_itself_2456": "O alias de tipo '{0}' referencia circulamente a si próprio.", @@ -841,8 +872,6 @@ "Type_declaration_files_to_be_included_in_compilation_6124": "Arquivos de declaração de tipo a serem incluídos em compilação.", "Type_expected_1110": "Tipo esperado.", "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062": "O tipo é referenciado diretamente ou indiretamente em um retorno de chamada de preenchimento do seu próprio método 'then'.", - "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "O tipo deve ter um método '[Symbol.asyncIterator]()' que retorna um iterador assíncrono.", - "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "O tipo deve ter um método '[Symbol.iterator]()' que retorna um iterador.", "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320": "O tipo de operando \"await\" deve ser uma promessa válida ou não deve conter um membro \"then\" que pode ser chamado.", "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "O tipo de elementos iterados de um operando \"yield*\" deve ser uma promessa válida ou não deve conter um membro \"then\" que pode ser chamado.", "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "O tipo do operando \"yield\" em um gerador assíncrono deve ser uma promessa válida ou não deve conter um membro \"then\" que pode ser chamado.", diff --git a/lib/ru/diagnosticMessages.generated.json b/lib/ru/diagnosticMessages.generated.json index 9f653368ee5..7af7fab5761 100644 --- a/lib/ru/diagnosticMessages.generated.json +++ b/lib/ru/diagnosticMessages.generated.json @@ -94,12 +94,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "Методы доступа доступны только при разработке для ECMAScript 5 и более поздних версий.", "Accessors_must_both_be_abstract_or_non_abstract_2676": "Методы доступа должны быть абстрактными или неабстрактными.", "Add_0_to_existing_import_declaration_from_1_90015": "Добавьте \"{0}\" в существующее объявление импорта из \"{1}\"", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "Добавьте модификатор async в содержащую функцию", "Add_definite_assignment_assertion_to_property_0_95020": "Добавить утверждение определенного присваивания к свойству \"{0}\"", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "Добавьте сигнатуру индекса для свойства \"{0}\"", "Add_initializer_to_property_0_95019": "Добавить инициализатор к свойству \"{0}\"", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "Добавьте отсутствующий вызов \"super()\"", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "Добавьте \"this.\" к неразрешенной переменной", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "Добавить тип \"undefined\" к свойству \"{0}\"", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Добавление файла tsconfig.json поможет организовать проекты, содержащие файлы TypeScript и JavaScript. Дополнительные сведения: https://aka.ms/tsconfig.", "Additional_Checks_6176": "Дополнительные проверки", @@ -156,6 +165,7 @@ "An_object_member_cannot_be_declared_optional_1162": "Элемент объекта не может быть объявлен необязательным.", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "Сигнатура перегрузки не может быть объявлена в качестве генератора.", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "Унарное выражение с оператором \"{0}\" не допускается в левой части выражения, возводимого в степень. Попробуйте заключить выражение в скобки.", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "Заметка с типом из JSDoc", "Annotate_with_types_from_JSDoc_95010": "Заметки с типами из JSDoc", "Argument_expression_expected_1135": "Ожидалось выражение аргумента.", @@ -223,6 +233,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "Переменная оператора catch не может иметь аннотацию типа.", "Catch_clause_variable_cannot_have_an_initializer_1197": "Переменная оператора catch не может иметь инициализатор.", "Change_0_to_1_90014": "Измените \"{0}\" на \"{1}\"", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "Измените \"extends\" на \"implements\"", "Change_spelling_to_0_90022": "Измените написание на \"{0}\"", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "Идет проверка того, является ли \"{0}\" самым длинным соответствующим префиксом для \"{1}\" — \"{2}\".", @@ -256,6 +269,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "Конструктор класса \"{0}\" защищен и доступен только в объявлении класса.", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "Конструкторы производных классов должны содержать вызов super.", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "Содержащий файл не указан, корневой каталог невозможно определить. Выполняется пропуск поиска в папке node_modules.", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "Преобразование функции \"{0}\" в класс", "Convert_function_to_an_ES2015_class_95001": "Преобразование функции в класс ES2015", "Convert_to_ES6_module_95017": "Преобразовать в модуль ES6", @@ -274,6 +289,7 @@ "Decorators_are_not_valid_here_1206": "Декораторы здесь недопустимы.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Декораторы нельзя применять к множественным методам доступа get или set с совпадающим именем.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Экспорт модуля по умолчанию использует или имеет закрытое имя \"{0}\".", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Устарело.] Используйте --jsxFactory. Укажите объект, вызываемый для createElement при целевом порождении JSX react", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Устарело.] Используйте --outFile. Сцепление и порождение выходных данных в одном файле", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Устарело.] Используйте --skipLibCheck. Пропуск проверки типов для файлов объявления библиотеки по умолчанию.", @@ -388,6 +404,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "У имени файла \"{0}\" есть расширение \"{1}\"; расширение удаляется.", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "Спецификация файла не может содержать родительский каталог (\"..\"), который указывается после рекурсивного подстановочного знака каталога (\"**\"): \"{0}\".", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "Спецификация файла не может заканчиваться рекурсивным подстановочным знаком каталога (\"**\"): \"{0}\".", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "Обнаружен package.json в \"{0}\".", "Found_package_json_at_0_Package_ID_is_1_6190": "Найден \"package.json\" в \"{0}\". Идентификатор пакета: \"{1}\".", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "Объявления функций не разрешены в блоках в строгом режиме при нацеливании ES3 или ES5.", @@ -400,6 +417,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "В функции отсутствует завершающий оператор возвращаемого значения, а тип возвращаемого значения не включает undefined.", "Function_overload_must_be_static_2387": "Перегрузка функции должна быть статической.", "Function_overload_must_not_be_static_2388": "Перегрузка функции не должна быть статической.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Создает sourcemap для каждого соответствующего файла \".d.ts\".", "Generates_corresponding_d_ts_file_6002": "Создает соответствующий D.TS-файл.", "Generates_corresponding_map_file_6043": "Создает соответствующий файл с расширением \".map\".", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Генератор неявно имеет тип \"{0}\", поскольку он не предоставляет никаких значений. Рекомендуется указать тип возвращаемого значения.", @@ -421,6 +439,8 @@ "Identifier_expected_1003": "Ожидался идентификатор.", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "Ожидался идентификатор. Значение \"__esModule\" зарезервировано как экспортируемый маркер при преобразовании модулей ECMAScript.", "Ignore_this_error_message_90019": "Пропустите это сообщение об ошибке", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "Реализуйте наследуемый абстрактный класс", "Implement_interface_0_90006": "Реализуйте интерфейс \"{0}\"", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "Предложение Implements экспортированного класса \"{0}\" имеет или использует закрытое имя \"{1}\".", @@ -441,6 +461,7 @@ "Index_signature_is_missing_in_type_0_2329": "В типе \"{0}\" отсутствует сигнатура индекса.", "Index_signatures_are_incompatible_2330": "Сигнатуры индекса несовместимы.", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "Все отдельные объявления в объединенном объявлении \"{0}\" должны быть экспортированными или локальными.", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "Выведите типы параметров на основании их использования", "Infer_type_of_0_from_usage_95011": "Выведите тип \"{0}\" на основании его использования", "Initialize_property_0_in_the_constructor_90020": "Инициализируйте свойство \"{0}\" в конструкторе", @@ -452,6 +473,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "Инициализирует проект TypeScript и создает файл \"tsconfig.json\".", "Insert_command_line_options_and_files_from_a_file_6030": "Вставка параметров командной строки и файлов из файла.", "Install_0_95014": "Установить \"{0}\"", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "Интерфейс \"{0}\" не может одновременно расширить типы \"{1}\" и \"{2}\".", "Interface_0_incorrectly_extends_interface_1_2430": "Интерфейс \"{0}\" неправильно расширяет интерфейс \"{1}\".", "Interface_declaration_cannot_have_implements_clause_1176": "Объявление интерфейса не может иметь предложение implements.", @@ -504,6 +526,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "Языковой стандарт должен иметь форму <язык> или <язык>–<территория>. Например, \"{0}\" или \"{1}\".", "Longest_matching_prefix_for_0_is_1_6108": "Самый длинный соответствующий префикс для \"{0}\": \"{1}\".", "Looking_up_in_node_modules_folder_initial_location_0_6125": "Поиск в папке node_modules; первоначальное расположение: \"{0}\".", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "Сделайте вызов \"super()\" первой инструкцией в конструкторе", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Сопоставленный объект неявно имеет тип шаблона \"любой\".", "Member_0_implicitly_has_an_1_type_7008": "Элемент \"{0}\" неявно имеет тип \"{1}\".", @@ -566,6 +589,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "Параметр \"{0}\" можно использовать только при указании \"--inlineSourceMap\" или \"--sourceMap\".", "Option_0_cannot_be_specified_with_option_1_5053": "Параметр \"{0}\" невозможно указать с помощью параметра \"{1}\".", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "Параметр \"{0}\" невозможно указать без указания параметра \"{1}\".", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Параметр \"{0}\" нельзя указывать без указания параметра \"{1}\" или \"{2}\".", "Option_0_should_have_array_of_strings_as_a_value_6103": "Параметр \"{0}\" должен иметь массив строк в качестве значения.", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "Параметр isolatedModules можно использовать, только если указан параметр --module или если параметр target — ES2015 или выше.", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Параметр paths невозможно использовать без указания параметра \"--baseUrl\".", @@ -610,6 +634,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "Анализ в строгом режиме и создание директивы \"use strict\" для каждого исходного файла.", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "Шаблон \"{0}\" может содержать не больше одного символа \"*\".", "Prefix_0_with_an_underscore_90025": "Добавьте к \"{0}\" префикс — символ подчеркивания", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "Печатать имена файлов, входящих в компиляцию.", "Print_names_of_generated_files_part_of_the_compilation_6154": "Печатать имена создаваемых файлов, входящих в компиляцию.", "Print_the_compiler_s_version_6019": "Печать версии компилятора.", @@ -708,6 +733,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "Тип возвращаемого значения общего статического метода из экспортированного класса имеет или использует закрытое имя \"{0}\".", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "Повторно используются разрешения модулей, унаследованные из \"{0}\", так как они не изменились со старой программы.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "Повторно используется разрешение модуля \"{0}\" в файле \"{1}\" из старой программы.", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "Перезапишите как тип с индексным доступом \"{0}\"", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "Корневой каталог невозможно определить, идет пропуск первичных путей поиска.", "STRATEGY_6039": "СТРАТЕГИЯ", diff --git a/lib/tr/diagnosticMessages.generated.json b/lib/tr/diagnosticMessages.generated.json index 14b0bb7d3ed..5004121a515 100644 --- a/lib/tr/diagnosticMessages.generated.json +++ b/lib/tr/diagnosticMessages.generated.json @@ -94,12 +94,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "Erişimciler yalnızca ECMAScript 5 ve üzeri hedeflenirken kullanılabilir.", "Accessors_must_both_be_abstract_or_non_abstract_2676": "İki erişimci de soyut veya soyut olmayan olmalıdır.", "Add_0_to_existing_import_declaration_from_1_90015": "'{0}' öğesini \"{1}\" konumundaki mevcut içeri aktarma bildirimine ekle", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "İçeren işleve zaman uyumsuz değiştirici ekle", "Add_definite_assignment_assertion_to_property_0_95020": "'{0}' özelliğine belirli atama onayı ekle", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "'{0}' özelliği için dizin imzası ekle", "Add_initializer_to_property_0_95019": "'{0}' özelliğine başlatıcı ekle", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "Eksik 'super()' çağrısını ekle", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "Çözümlenmemiş değişkene 'this.' ekle", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "'{0}' özelliğine 'undefined' türünü ekle", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Bir tsconfig.json dosyası eklemek, hem TypeScript hem de JavaScript dosyaları içeren projeleri düzenlemenize yardımcı olur. Daha fazla bilgi edinmek için bkz. https://aka.ms/tsconfig.", "Additional_Checks_6176": "Ek Denetimler", @@ -156,6 +165,7 @@ "An_object_member_cannot_be_declared_optional_1162": "Nesne üyesi, isteğe bağlı olarak bildirilemez.", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "Aşırı yükleme imzası, bir oluşturucu olarak bildirilemez.", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "Üs ifadesinin sol tarafında '{0}' işlecine sahip bir tek terimli ifadeye izin verilmez. İfadeyi parantez içine yazmayı düşünün.", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "JSDoc türü ile not ekle", "Annotate_with_types_from_JSDoc_95010": "JSDoc türleri ile not ekle", "Argument_expression_expected_1135": "Bağımsız değişken ifadesi bekleniyor.", @@ -223,6 +233,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "Catch yan tümcesi değişkeni bir tür ek açıklamasına sahip olamaz.", "Catch_clause_variable_cannot_have_an_initializer_1197": "Catch yan tümcesi değişkeni bir başlatıcıya sahip olamaz.", "Change_0_to_1_90014": "'{0}' değerini '{1}' olarak değiştir", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "'extends' ifadesini 'implements' olarak değiştirin", "Change_spelling_to_0_90022": "Yazımı '{0}' olarak değiştir", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "'{0}' ön ekinin '{1}' - '{2}' için eşleşen en uzun ön ek olup olmadığı denetleniyor.", @@ -256,6 +269,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "'{0}' sınıfının oluşturucusu korumalı olduğundan, oluşturucuya yalnızca sınıf bildiriminden erişilebilir.", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "Türetilmiş sınıflara ilişkin oluşturucular bir 'super' çağrısı içermelidir.", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "Kapsayıcı dosya belirtilmedi ve kök dizini belirlenemiyor; 'node_modules' klasöründe arama atlanıyor.", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "'{0}' işlevini sınıfa dönüştür", "Convert_function_to_an_ES2015_class_95001": "İşlevi bir ES2015 sınıfına dönüştür", "Convert_to_ES6_module_95017": "ES6 modülüne dönüştür", @@ -274,6 +289,7 @@ "Decorators_are_not_valid_here_1206": "Buradaki dekoratörler geçerli değil.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Dekoratörler aynı ada sahip birden fazla get/set erişimcisine uygulanamaz.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Modülün varsayılan dışarı aktarımı '{0}' özel adına sahip veya bu adı kullanıyor.", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Kullanım Dışı] Bunun yerine '--jsxFactory' kullanın. 'react' JSX gösterimi hedefleniyorsa, createElement için çağrılan nesneyi belirtin", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Kullanım Dışı] Bunun yerine '--outFile' kullanın. Çıkışı tek bir dosya olarak birleştirin ve gösterin", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Kullanım Dışı] Bunun yerine '--skipLibCheck' kullanın. Varsayılan kitaplık bildirim dosyalarının tür denetimini atlayın.", @@ -388,6 +404,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "'{0}' dosya adında '{1}' uzantısı var; uzantı ayrılıyor.", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "Dosya belirtimi, özyinelemeli dizin joker karakterinden ('**') sonra görünen bir üst dizin ('..') içeremez: '{0}'.", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "Dosya belirtimi, özyinelemeli dizin joker karakter ('**') ile bitemez: '{0}'.", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "'{0}' içinde 'package.json' bulundu.", "Found_package_json_at_0_Package_ID_is_1_6190": "'{0}' konumunda 'package.json' bulundu. Paket kimliği '{1}'.", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "Katı modda 'ES3' veya 'ES5' hedeflenirken blokların içinde işlev bildirimlerine izin verilmez.", @@ -400,6 +417,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "İşlevin sonunda return deyimi eksik ve dönüş türü 'undefined' içermiyor.", "Function_overload_must_be_static_2387": "İşlev aşırı yüklemesi statik olmalıdır.", "Function_overload_must_not_be_static_2388": "İşlev aşırı yüklemesi statik olmamalıdır.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Karşılık gelen her '.d.ts' dosyası için bir kaynak eşlemesi oluşturur.", "Generates_corresponding_d_ts_file_6002": "İlgili '.d.ts' dosyasını oluşturur.", "Generates_corresponding_map_file_6043": "İlgili '.map' dosyasını oluşturur.", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Oluşturucu herhangi bir değer içermediğinden örtük olarak '{0}' türüne sahip. Bir dönüş türü sağlamayı göz önünde bulundurun.", @@ -421,6 +439,8 @@ "Identifier_expected_1003": "Tanımlayıcı bekleniyor.", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "Tanımlayıcı bekleniyor. '__esModule', ECMAScript modülleri dönüştürülürken, dışarı aktarılan bir işaretçi olarak ayrılmış.", "Ignore_this_error_message_90019": "Bu hata iletisini yoksay", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "Devralınan soyut sınıfı uygula", "Implement_interface_0_90006": "'{0}' arabirimini uygula", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "'{1}' özel adına sahip veya bu adı kullanan '{0}' dışarı aktarılan sınıfının yan tümcesini uygular.", @@ -441,6 +461,7 @@ "Index_signature_is_missing_in_type_0_2329": "'{0}' türündeki dizin imzası yok.", "Index_signatures_are_incompatible_2330": "Dizin imzaları uyumsuz.", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "'{0}' birleştirilmiş bildirimindeki bildirimlerin tümü dışarı aktarılmış veya yerel olmalıdır.", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "Parametre türleri için kullanımdan çıkarım yap", "Infer_type_of_0_from_usage_95011": "'{0}' türü için kullanımdan çıkarım yap", "Initialize_property_0_in_the_constructor_90020": "Oluşturucu içinde '{0}' özelliğini başlat", @@ -452,6 +473,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "Bir TypeScript projesi başlatır ve bir tsconfig.json dosyası oluşturur.", "Insert_command_line_options_and_files_from_a_file_6030": "Dosyadaki komut satırı seçeneklerini ve dosyaları ekleyin.", "Install_0_95014": "'{0}' yükle", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "'{0}' arabirimi, aynı anda '{1}' ve '{2}' türlerini genişletemez.", "Interface_0_incorrectly_extends_interface_1_2430": "'{0}' arabirimi, '{1}' arabirimini yanlış genişletiyor.", "Interface_declaration_cannot_have_implements_clause_1176": "Arabirim bildirimi, 'implements' yan tümcesine sahip olamaz.", @@ -504,6 +526,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "Yerel ayar, veya - biçiminde olmalıdır. Örneğin, '{0}' veya '{1}'.", "Longest_matching_prefix_for_0_is_1_6108": "'{0}' için eşleşen en uzun ön ek: '{1}'.", "Looking_up_in_node_modules_folder_initial_location_0_6125": "'node_modules' klasöründe aranıyor; ilk konum: '{0}'.", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "Oluşturucudaki ilk deyime 'super()' tarafından çağrı yapılmasını sağla", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Eşleştirilmiş nesne türü örtük olarak 'any' şablon türüne sahip.", "Member_0_implicitly_has_an_1_type_7008": "'{0}' üyesi örtük olarak '{1}' türüne sahip.", @@ -566,6 +589,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "'{0} seçeneği yalnızca '--inlineSourceMap' veya '--sourceMap' seçeneği sağlandığında kullanılabilir.", "Option_0_cannot_be_specified_with_option_1_5053": "'{0}' seçeneği, '{1}' seçeneği ile belirtilemez.", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "'{0}' seçeneği, '{1}' seçeneği belirtilmeden belirtilemez.", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "'{1}' seçeneği veya '{2}' seçeneği belirtilmeden '{0}' seçeneği belirtilemez.", "Option_0_should_have_array_of_strings_as_a_value_6103": "'{0}' seçeneği değer olarak, dizelerden oluşan bir dizi içermelidir.", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "'isolatedModules' seçeneği, yalnızca '--module' sağlandığında veya 'target' seçeneği 'ES2015' veya daha yüksek bir sürüm değerine sahip olduğunda kullanılabilir.", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "'Paths' seçeneği, '--baseUrl' seçeneği belirtilmeden kullanılamaz.", @@ -610,6 +634,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "Katı modda ayrıştırın ve her kaynak dosya için \"use strict\" kullanın.", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "'{0}' deseni en fazla bir adet '*' karakteri içerebilir.", "Prefix_0_with_an_underscore_90025": "'{0}' için ön ek olarak alt çizgi kullan", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "Derlemenin parçası olan dosyaların adlarını yazdırın.", "Print_names_of_generated_files_part_of_the_compilation_6154": "Oluşturulan dosyalardan, derlemenin parçası olanların adlarını yazdırın.", "Print_the_compiler_s_version_6019": "Derleyici sürümünü yazdır.", @@ -708,6 +733,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "Dışarı aktarılan sınıftaki ortak statik metodun dönüş türü, '{0}' özel adına sahip veya bu adı kullanıyor.", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "Eski programdaki çözümlemeler değişmediğinden '{0}' kaynaklı modül çözümlemeleri yeniden kullanılıyor.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "Eski programın '{1}' dosyasında '{0}' modülü çözmesi yeniden kullanılıyor.", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "Dizine eklenmiş erişim türü '{0}' olarak yeniden yaz", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "Kök dizin belirlenemiyor, birincil arama yolları atlanıyor.", "STRATEGY_6039": "STRATEJİ", diff --git a/lib/tsc.js b/lib/tsc.js index 042118cead7..926b3705e9d 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -22,6 +22,10 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { } return t; }; +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; var ts; (function (ts) { var OperationCanceledException = (function () { @@ -1418,7 +1422,7 @@ var ts; ts.compose = compose; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (_match, index) { return Debug.assertDefined(args[+index + baseIndex]); }); } ts.formatStringFromArgs = formatStringFromArgs; function getLocaleSpecificMessage(message) { @@ -2912,10 +2916,13 @@ var ts; } function watchChildDirectories(parentDir, existingChildWatches, callback) { var newChildWatches; - ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? host.getAccessileSortedChildDirectories(parentDir) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(ts.getNormalizedAbsolutePath(child, parentDir), childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); + ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? ts.mapDefined(host.getAccessibleSortedChildDirectories(parentDir), function (child) { + var childFullName = ts.getNormalizedAbsolutePath(child, parentDir); + return host.filePathComparer(childFullName, host.realpath(childFullName)) === 0 ? childFullName : undefined; + }) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); return newChildWatches || ts.emptyArray; function createAndAddChildDirectoryWatcher(childName) { - var result = createDirectoryWatcher(ts.getNormalizedAbsolutePath(childName, parentDir), callback); + var result = createDirectoryWatcher(childName, callback); addChildDirectoryWatcher(result); } function addChildDirectoryWatcher(childWatcher) { @@ -3012,14 +3019,7 @@ var ts; exit: function (exitCode) { process.exit(exitCode); }, - realpath: function (path) { - try { - return _fs.realpathSync(path); - } - catch (_a) { - return path; - } - }, + realpath: realpath, debugMode: ts.some(process.execArgv, function (arg) { return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg); }), tryEnableSourceMapsForHost: function () { try { @@ -3093,8 +3093,9 @@ var ts; var watchDirectoryRecursively = createRecursiveDirectoryWatcher({ filePathComparer: useCaseSensitiveFileNames ? ts.compareStringsCaseSensitive : ts.compareStringsCaseInsensitive, directoryExists: directoryExists, - getAccessileSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, - watchDirectory: watchDirectory + getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, + watchDirectory: watchDirectory, + realpath: realpath }); return function (directoryName, callback, recursive) { if (recursive) { @@ -3346,6 +3347,14 @@ var ts; function getDirectories(path) { return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1); }); } + function realpath(path) { + try { + return _fs.realpathSync(path); + } + catch (_a) { + return path; + } + } function getModifiedTime(path) { try { return _fs.statSync(path).mtime; @@ -3448,6 +3457,7 @@ var ts; Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), Unexpected_token: diag(1012, ts.DiagnosticCategory.Error, "Unexpected_token_1012", "Unexpected token."), + A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma: diag(1013, ts.DiagnosticCategory.Error, "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013", "A rest parameter or binding pattern may not have a trailing comma."), A_rest_parameter_must_be_last_in_a_parameter_list: diag(1014, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."), Parameter_cannot_have_question_mark_and_initializer: diag(1015, ts.DiagnosticCategory.Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."), A_required_parameter_cannot_follow_an_optional_parameter: diag(1016, ts.DiagnosticCategory.Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."), @@ -3679,6 +3689,9 @@ var ts; An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead: diag(1336, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead_1336", "An index signature parameter type cannot be a type alias. Consider writing '[{0}: {1}]: {2}' instead."), An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead: diag(1337, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead_1337", "An index signature parameter type cannot be a union type. Consider using a mapped object type instead."), infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."), + Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."), + Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340", "Module '{0}' does not refer to a type, but is used as a type here."), + Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."), Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."), Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."), @@ -3784,7 +3797,7 @@ var ts; The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."), The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: diag(2405, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."), The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: diag(2406, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."), - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter."), + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."), Setters_cannot_return_a_value: diag(2408, ts.DiagnosticCategory.Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."), Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: diag(2409, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."), The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: diag(2410, ts.DiagnosticCategory.Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."), @@ -3858,7 +3871,7 @@ var ts; The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: diag(2483, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."), Export_declaration_conflicts_with_exported_declaration_of_0: diag(2484, ts.DiagnosticCategory.Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."), The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: diag(2487, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."), - Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type must have a '[Symbol.iterator]()' method that returns an iterator."), + Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."), An_iterator_must_have_a_next_method: diag(2489, ts.DiagnosticCategory.Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."), The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: diag(2490, ts.DiagnosticCategory.Error, "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the 'next()' method of an iterator must have a 'value' property."), The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: diag(2491, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."), @@ -3874,7 +3887,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: diag(2501, ts.DiagnosticCategory.Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."), _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: diag(2502, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."), Cannot_find_namespace_0: diag(2503, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."), - Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), + Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), A_generator_cannot_have_a_void_type_annotation: diag(2505, ts.DiagnosticCategory.Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."), _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: diag(2506, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."), Type_0_is_not_a_constructor_function_type: diag(2507, ts.DiagnosticCategory.Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."), @@ -3938,6 +3951,8 @@ var ts; Property_0_is_used_before_being_assigned: diag(2565, ts.DiagnosticCategory.Error, "Property_0_is_used_before_being_assigned_2565", "Property '{0}' is used before being assigned."), A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."), Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."), + Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2568, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568", "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), + Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."), The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."), JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."), @@ -6305,7 +6320,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 272) { + while (node && node.kind !== 273) { node = node.parent; } return node; @@ -6313,11 +6328,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 211: - case 239: - case 218: + case 212: + case 240: case 219: case 220: + case 221: return true; } return false; @@ -6353,6 +6368,11 @@ var ts; } } ts.getEndLinePosition = getEndLinePosition; + function isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) { + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name); + } + ts.isFileLevelUniqueName = isFileLevelUniqueName; function nodeIsMissing(node) { if (node === undefined) { return true; @@ -6393,7 +6413,7 @@ var ts; if (includeJsDoc && ts.hasJSDocNodes(node)) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 293 && node._children.length > 0) { + if (node.kind === 294 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -6487,7 +6507,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 230 && node.parent.kind === 267; + return node.kind === 231 && node.parent.kind === 268; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -6507,11 +6527,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node && node.kind === 237 && (!node.body); + return node && node.kind === 238 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 272 || - node.kind === 237 || + return node.kind === 273 || + node.kind === 238 || ts.isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -6525,9 +6545,9 @@ var ts; ts.isExternalModuleAugmentation = isExternalModuleAugmentation; function isModuleAugmentationExternal(node) { switch (node.parent.kind) { - case 272: + case 273: return ts.isExternalModule(node.parent); - case 238: + case 239: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -6539,22 +6559,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 272: - case 239: - case 267: - case 237: - case 218: + case 273: + case 240: + case 268: + case 238: case 219: case 220: + case 221: case 154: case 153: case 155: case 156: - case 232: - case 190: + case 233: case 191: + case 192: return true; - case 211: + case 212: return parentNode && !ts.isFunctionLike(parentNode); } return false; @@ -6568,19 +6588,19 @@ var ts; case 159: case 162: case 163: - case 280: - case 233: - case 203: + case 281: case 234: + case 204: case 235: - case 290: - case 232: + case 236: + case 291: + case 233: case 153: case 154: case 155: case 156: - case 190: case 191: + case 192: return true; default: ts.assertTypeIsNever(node); @@ -6590,8 +6610,8 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isAnyImportSyntax(node) { switch (node.kind) { + case 243: case 242: - case 241: return true; default: return false; @@ -6640,7 +6660,7 @@ var ts; return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); case 145: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 183: + case 184: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -6687,7 +6707,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 211) { + if (node.body && node.body.kind === 212) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -6699,29 +6719,29 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 272: + case 273: 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 230: - case 180: - case 233: - case 203: + case 231: + case 181: case 234: + case 204: + case 235: + case 238: case 237: - case 236: - case 271: - case 232: - case 190: + case 272: + case 233: + case 191: case 153: case 155: case 156: - case 235: + case 236: errorNode = node.name; break; - case 191: + case 192: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -6747,7 +6767,7 @@ var ts; } ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isConstEnumDeclaration(node) { - return node.kind === 236 && isConst(node); + return node.kind === 237 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -6760,15 +6780,21 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 185 && n.expression.kind === 97; + return n.kind === 186 && n.expression.kind === 97; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 185 && n.expression.kind === 91; + return n.kind === 186 && n.expression.kind === 91; } ts.isImportCall = isImportCall; + function isLiteralImportTypeNode(n) { + return n.kind === 178 && + n.argument.kind === 177 && + ts.isStringLiteral(n.argument.literal); + } + ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 214 + return node.kind === 215 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -6779,9 +6805,9 @@ var ts; function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 148 || node.kind === 147 || - node.kind === 190 || node.kind === 191 || - node.kind === 189) ? + node.kind === 192 || + node.kind === 190) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); return ts.filter(commentRanges, function (comment) { @@ -6796,7 +6822,7 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (160 <= node.kind && node.kind <= 177) { + if (160 <= node.kind && node.kind <= 178) { return true; } switch (node.kind) { @@ -6809,8 +6835,8 @@ var ts; case 131: return true; case 105: - return node.parent.kind !== 194; - case 205: + return node.parent.kind !== 195; + case 206: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 147: return node.parent.kind === 176 || node.parent.kind === 171; @@ -6818,33 +6844,36 @@ var ts; if (node.parent.kind === 145 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 183 && node.parent.name === node) { + else if (node.parent.kind === 184 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 71 || node.kind === 145 || node.kind === 183, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 71 || node.kind === 145 || node.kind === 184, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); case 145: - case 183: + case 184: case 99: var parent = node.parent; if (parent.kind === 164) { return false; } - if (160 <= parent.kind && parent.kind <= 177) { + if (parent.kind === 178) { + return !parent.isTypeOf; + } + if (160 <= parent.kind && parent.kind <= 178) { return true; } switch (parent.kind) { - case 205: + case 206: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 147: return node === parent.constraint; case 151: case 150: case 148: - case 230: + case 231: return node === parent.type; - case 232: - case 190: + case 233: case 191: + case 192: case 154: case 153: case 152: @@ -6855,12 +6884,12 @@ var ts; case 158: case 159: return node === parent.type; - case 188: + case 189: return node === parent.type; - case 185: case 186: - return ts.contains(parent.typeArguments, node); case 187: + return ts.contains(parent.typeArguments, node); + case 188: return false; } } @@ -6881,23 +6910,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 223: + case 224: return visitor(node); - case 239: - case 211: - case 215: + case 240: + case 212: case 216: case 217: case 218: case 219: case 220: - case 224: + case 221: case 225: - case 264: - case 265: case 226: - case 228: - case 267: + case 265: + case 266: + case 227: + case 229: + case 268: return ts.forEachChild(node, traverse); } } @@ -6907,19 +6936,19 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 201: + case 202: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 236: - case 234: case 237: case 235: - case 233: - case 203: + case 238: + case 236: + case 234: + case 204: return; default: if (ts.isFunctionLike(node)) { @@ -6949,12 +6978,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { + case 235: case 234: - case 233: - case 203: + case 204: case 165: return node.members; - case 182: + case 183: return node.properties; } } @@ -6962,14 +6991,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 180: - case 271: + case 181: + case 272: case 148: - case 268: + case 269: case 151: case 150: - case 269: - case 230: + case 270: + case 231: return true; } } @@ -6981,8 +7010,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 231 - && node.parent.parent.kind === 212; + return node.parent.kind === 232 + && node.parent.parent.kind === 213; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isValidESSymbolDeclaration(node) { @@ -6998,8 +7027,8 @@ var ts; case 154: case 155: case 156: - case 232: - case 190: + case 233: + case 191: return true; } return false; @@ -7010,7 +7039,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 226) { + if (node.statement.kind !== 227) { return node.statement; } node = node.statement; @@ -7018,17 +7047,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 211 && ts.isFunctionLike(node.parent); + return node && node.kind === 212 && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 153 && node.parent.kind === 182; + return node && node.kind === 153 && node.parent.kind === 183; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { return node.kind === 153 && - (node.parent.kind === 182 || - node.parent.kind === 203); + (node.parent.kind === 183 || + node.parent.kind === 204); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -7041,7 +7070,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 268) { + if (property.kind === 269) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -7077,13 +7106,13 @@ var ts; node = node.parent; } break; - case 191: + case 192: if (!includeArrowFunctions) { continue; } - case 232: - case 190: - case 237: + case 233: + case 191: + case 238: case 151: case 150: case 153: @@ -7094,8 +7123,8 @@ var ts; case 157: case 158: case 159: - case 236: - case 272: + case 237: + case 273: return node; } } @@ -7106,8 +7135,8 @@ var ts; if (container) { switch (container.kind) { case 154: - case 232: - case 190: + case 233: + case 191: return container; } } @@ -7124,9 +7153,9 @@ var ts; case 146: node = node.parent; break; - case 232: - case 190: + case 233: case 191: + case 192: if (!stopOnFunctions) { continue; } @@ -7151,14 +7180,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 190 || func.kind === 191) { + if (func.kind === 191 || func.kind === 192) { var prev = func; var parent = func.parent; - while (parent.kind === 189) { + while (parent.kind === 190) { prev = parent; parent = parent.parent; } - if (parent.kind === 185 && parent.expression === prev) { + if (parent.kind === 186 && parent.expression === prev) { return parent; } } @@ -7166,13 +7195,13 @@ var ts; ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; function isSuperProperty(node) { var kind = node.kind; - return (kind === 183 || kind === 184) + return (kind === 184 || kind === 185) && node.expression.kind === 97; } ts.isSuperProperty = isSuperProperty; function isThisProperty(node) { var kind = node.kind; - return (kind === 183 || kind === 184) + return (kind === 184 || kind === 185) && node.expression.kind === 99; } ts.isThisProperty = isThisProperty; @@ -7180,7 +7209,7 @@ var ts; switch (node.kind) { case 161: return node.typeName; - case 205: + case 206: return isEntityNameExpression(node.expression) ? node.expression : undefined; @@ -7193,10 +7222,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 187: + case 188: return node.tag; + case 256: case 255: - case 254: return node.tagName; default: return node.expression; @@ -7205,21 +7234,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node, parent, grandparent) { switch (node.kind) { - case 233: + case 234: return true; case 151: - return parent.kind === 233; + return parent.kind === 234; case 155: case 156: case 153: return node.body !== undefined - && parent.kind === 233; + && parent.kind === 234; case 148: return parent.body !== undefined && (parent.kind === 154 || parent.kind === 153 || parent.kind === 156) - && grandparent.kind === 233; + && grandparent.kind === 234; } return false; } @@ -7235,7 +7264,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 233: + case 234: return ts.forEach(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); case 153: case 156: @@ -7245,9 +7274,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 255 || - parent.kind === 254 || - parent.kind === 256) { + if (parent.kind === 256 || + parent.kind === 255 || + parent.kind === 257) { return parent.tagName === node; } return false; @@ -7260,37 +7289,37 @@ var ts; case 101: case 86: case 12: - case 181: case 182: case 183: case 184: case 185: case 186: case 187: - case 206: case 188: case 207: case 189: + case 208: case 190: - case 203: case 191: - case 194: + case 204: case 192: + case 195: case 193: - case 196: + case 194: case 197: case 198: case 199: - case 202: case 200: - case 13: - case 204: - case 253: - case 254: - case 257: + case 203: case 201: - case 195: - case 208: + case 13: + case 205: + case 254: + case 255: + case 258: + case 202: + case 196: + case 209: return true; case 145: while (node.parent.kind === 145) { @@ -7313,47 +7342,47 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 230: + case 231: case 148: case 151: case 150: - case 271: - case 268: - case 180: + case 272: + case 269: + case 181: return parent.initializer === node; - case 214: case 215: case 216: case 217: - case 223: + case 218: case 224: case 225: - case 264: - case 227: + case 226: + case 265: + case 228: return parent.expression === node; - case 218: + case 219: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 231) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 232) || forStatement.condition === node || forStatement.incrementor === node; - case 219: case 220: + case 221: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 231) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 232) || forInStatement.expression === node; - case 188: - case 206: + case 189: + case 207: return node === parent.expression; - case 209: + case 210: return node === parent.expression; case 146: return node === parent.expression; case 149: + case 264: case 263: - case 262: - case 270: + case 271: return true; - case 205: + case 206: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: return isExpressionNode(parent); @@ -7361,7 +7390,7 @@ var ts; } ts.isInExpressionContext = isInExpressionContext; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 && node.moduleReference.kind === 252; + return node.kind === 242 && node.moduleReference.kind === 253; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7370,7 +7399,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 && node.moduleReference.kind !== 252; + return node.kind === 242 && node.moduleReference.kind !== 253; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7398,7 +7427,7 @@ var ts; } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) { - if (callExpression.kind !== 185) { + if (callExpression.kind !== 186) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -7447,9 +7476,11 @@ var ts; function getJavascriptInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 190 || e.kind === 191 ? initializer : undefined; + return e.kind === 191 || e.kind === 192 ? initializer : undefined; } - if (initializer.kind === 190 || initializer.kind === 203) { + if (initializer.kind === 191 || + initializer.kind === 204 || + initializer.kind === 192) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -7521,7 +7552,7 @@ var ts; return 2; } else if (isEntityNameExpression(lhs.expression)) { - if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(expr.right)) { + if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) { return 6; } else if (isPrototypeAccess(lhs.expression)) { @@ -7542,24 +7573,31 @@ var ts; return 0; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; + function getInitializerOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.right)) { + expr = expr.right; + } + return expr.right; + } + ts.getInitializerOfBinaryExpression = getInitializerOfBinaryExpression; function isPrototypePropertyAssignment(node) { return ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === 3; } ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJavaScriptFile(expr) && - expr.parent && expr.parent.kind === 214 && + expr.parent && expr.parent.kind === 215 && !!ts.getJSDocTypeTag(expr.parent); } ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration; function importFromModuleSpecifier(node) { switch (node.parent.kind) { - case 242: - case 248: + case 243: + case 249: return node.parent; - case 252: + case 253: return node.parent.parent; - case 185: + case 186: return node.parent; default: return ts.Debug.fail(ts.Debug.showSyntaxKind(node)); @@ -7568,11 +7606,13 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 242: - case 248: + case 243: + case 249: return node.moduleSpecifier; - case 241: - return node.moduleReference.kind === 252 ? node.moduleReference.expression : undefined; + case 242: + return node.moduleReference.kind === 253 ? node.moduleReference.expression : undefined; + case 178: + return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; default: return ts.Debug.assertNever(node); } @@ -7580,11 +7620,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 242: + case 243: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 241: + case 242: return node; - case 248: + case 249: return undefined; default: return ts.Debug.assertNever(node); @@ -7592,7 +7632,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 242 && node.importClause && !!node.importClause.name; + return node.kind === 243 && node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function hasQuestionToken(node) { @@ -7601,8 +7641,8 @@ var ts; case 148: case 153: case 152: + case 270: case 269: - case 268: case 151: case 150: return node.questionToken !== undefined; @@ -7612,7 +7652,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 280 && + return node.kind === 281 && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -7634,7 +7674,7 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 212: + case 213: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; case 151: @@ -7647,9 +7687,9 @@ var ts; node.declarationList.declarations[0]; } function getNestedModuleDeclaration(node) { - return node.kind === 237 && + return node.kind === 238 && node.body && - node.body.kind === 237 && + node.body.kind === 238 && node.body; } function getJSDocCommentsAndTags(node) { @@ -7658,7 +7698,10 @@ var ts; return result || ts.emptyArray; function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; - if (parent && (parent.kind === 268 || parent.kind === 151 || getNestedModuleDeclaration(parent))) { + if (parent && + (parent.kind === 269 || + parent.kind === 151 || + getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } if (parent && parent.parent && @@ -7670,7 +7713,8 @@ var ts; getJSDocCommentsAndTagsWorker(parent.parent.parent); } if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 || - node.kind === 183 && node.parent && node.parent.kind === 214) { + parent && ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 || + node.kind === 184 && node.parent && node.parent.kind === 215) { getJSDocCommentsAndTagsWorker(parent); } if (node.kind === 148) { @@ -7713,7 +7757,7 @@ var ts; } ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 282); + ts.Debug.assert(node.parent.kind === 283); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -7729,38 +7773,38 @@ var ts; } ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { - return node.dotDotDotToken !== undefined || node.type && node.type.kind === 281; + return node.dotDotDotToken !== undefined || node.type && node.type.kind === 282; } ts.isRestParameter = isRestParameter; function getAssignmentTargetKind(node) { var parent = node.parent; while (true) { switch (parent.kind) { - case 198: + case 199: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 58 ? 1 : 2 : 0; - case 196: case 197: + case 198: var unaryOperator = parent.operator; return unaryOperator === 43 || unaryOperator === 44 ? 2 : 0; - case 219: case 220: + case 221: return parent.initializer === node ? 1 : 0; - case 189: - case 181: - case 202: - case 207: + case 190: + case 182: + case 203: + case 208: node = parent; break; - case 269: + case 270: if (parent.name !== node) { return 0; } node = parent.parent; break; - case 268: + case 269: if (parent.name === node) { return 0; } @@ -7779,22 +7823,22 @@ var ts; ts.isAssignmentTarget = isAssignmentTarget; function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 211: case 212: - case 224: - case 215: + case 213: case 225: - case 239: - case 264: - case 265: + case 216: case 226: - case 218: + case 240: + case 265: + case 266: + case 227: case 219: case 220: - case 216: + case 221: case 217: - case 228: - case 267: + case 218: + case 229: + case 268: return true; } return false; @@ -7815,22 +7859,22 @@ var ts; } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 189); + return walkUp(node, 190); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; function skipParentheses(node) { - while (node.kind === 189) { + while (node.kind === 190) { node = node.expression; } return node; } ts.skipParentheses = skipParentheses; function isDeleteTarget(node) { - if (node.kind !== 183 && node.kind !== 184) { + if (node.kind !== 184 && node.kind !== 185) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 192; + return node && node.kind === 193; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -7876,36 +7920,36 @@ var ts; case 152: case 155: case 156: - case 271: - case 268: - case 183: + case 272: + case 269: + case 184: return parent.name === node; case 145: if (parent.right === node) { while (parent.kind === 145) { parent = parent.parent; } - return parent.kind === 164; + return parent.kind === 164 || parent.kind === 161; } return false; - case 180: - case 246: + case 181: + case 247: return parent.propertyName === node; - case 250: - case 260: + case 251: + case 261: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 241 || - node.kind === 240 || - node.kind === 243 && !!node.name || - node.kind === 244 || - node.kind === 246 || - node.kind === 250 || - node.kind === 247 && exportAssignmentIsAlias(node); + return node.kind === 242 || + node.kind === 241 || + node.kind === 244 && !!node.name || + node.kind === 245 || + node.kind === 247 || + node.kind === 251 || + node.kind === 248 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -7989,13 +8033,13 @@ var ts; } var flags = 0; switch (node.kind) { - case 232: - case 190: + case 233: + case 191: case 153: if (node.asteriskToken) { flags |= 1; } - case 191: + case 192: if (hasModifier(node, 256)) { flags |= 2; } @@ -8009,9 +8053,9 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 232: - case 190: + case 233: case 191: + case 192: case 153: return node.body !== undefined && node.asteriskToken === undefined @@ -8102,7 +8146,7 @@ var ts; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 180) { + while (node.kind === 181) { node = node.parent.parent; } return node; @@ -8111,14 +8155,14 @@ var ts; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; return kind === 154 - || kind === 190 - || kind === 232 || kind === 191 + || kind === 233 + || kind === 192 || kind === 153 || kind === 155 || kind === 156 - || kind === 237 - || kind === 272; + || kind === 238 + || kind === 273; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -8132,23 +8176,23 @@ var ts; ts.getOriginalSourceFile = getOriginalSourceFile; function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 186: + case 187: return hasArguments ? 0 : 1; - case 196: - case 193: + case 197: case 194: - case 192: case 195: - case 199: - case 201: + case 193: + case 196: + case 200: + case 202: return 1; - case 198: + case 199: switch (operator) { case 40: case 58: @@ -8172,15 +8216,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 198) { + if (expression.kind === 199) { return expression.operatorToken.kind; } - else if (expression.kind === 196 || expression.kind === 197) { + else if (expression.kind === 197 || expression.kind === 198) { return expression.operator; } else { @@ -8190,15 +8234,15 @@ var ts; ts.getOperator = getOperator; function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 296: + case 297: return 0; - case 202: + case 203: return 1; - case 201: + case 202: return 2; - case 199: + case 200: return 4; - case 198: + case 199: switch (operatorKind) { case 26: return 0; @@ -8219,21 +8263,21 @@ var ts; default: return getBinaryOperatorPrecedence(operatorKind); } - case 196: - case 193: - case 194: - case 192: - case 195: - return 16; case 197: + case 194: + case 195: + case 193: + case 196: + return 16; + case 198: return 17; - case 185: - return 18; case 186: - return hasArguments ? 19 : 18; + return 18; case 187: - case 183: + return hasArguments ? 19 : 18; + case 188: case 184: + case 185: return 19; case 99: case 97: @@ -8243,19 +8287,19 @@ var ts; case 86: case 8: case 9: - case 181: case 182: - case 190: + case 183: case 191: - case 203: - case 253: + case 192: + case 204: case 254: - case 257: + case 255: + case 258: case 12: case 13: - case 200: - case 189: - case 204: + case 201: + case 190: + case 205: return 20; default: return -1; @@ -8309,17 +8353,12 @@ var ts; var filesWithDiagnostics = []; var fileDiagnostics = ts.createMap(); var hasReadNonFileDiagnostics = false; - var modificationCount = 0; return { add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount, reattachFileDiagnostics: reattachFileDiagnostics }; - function getModificationCount() { - return modificationCount; - } function reattachFileDiagnostics(newFile) { ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } @@ -8341,7 +8380,6 @@ var ts; diagnostics = nonFileDiagnostics; } ts.insertSorted(diagnostics, diagnostic, ts.compareDiagnostics); - modificationCount++; } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -8919,7 +8957,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 205 && + if (node.kind === 206 && node.parent.token === 85 && ts.isClassLike(node.parent.parent)) { return node.parent.parent; @@ -8937,8 +8975,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, true)) { var kind = node.left.kind; - return kind === 182 - || kind === 181; + return kind === 183 + || kind === 182; } return false; } @@ -8948,7 +8986,7 @@ var ts; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isExpressionWithTypeArgumentsInClassImplementsClause(node) { - return node.kind === 205 + return node.kind === 206 && isEntityNameExpression(node.expression) && node.parent && node.parent.token === 108 @@ -8970,16 +9008,16 @@ var ts; ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { return (node.parent.kind === 145 && node.parent.right === node) || - (node.parent.kind === 183 && node.parent.name === node); + (node.parent.kind === 184 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteral(expression) { - return expression.kind === 182 && + return expression.kind === 183 && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 181 && + return expression.kind === 182 && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -9259,8 +9297,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 236: case 237: + case 238: return parseNode === parseNode.parent.name; } } @@ -9322,20 +9360,20 @@ var ts; if (!parent) return 0; switch (parent.kind) { + case 198: case 197: - case 196: var operator = parent.operator; return operator === 43 || operator === 44 ? writeOrReadWrite() : 0; - case 198: + case 199: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? writeOrReadWrite() : 0; - case 183: + case 184: return parent.name !== node ? 0 : accessKind(parent); default: return 0; } function writeOrReadWrite() { - return parent.parent && parent.parent.kind === 214 ? 1 : 2; + return parent.parent && parent.parent.kind === 215 ? 1 : 2; } } function compareDataObjects(dst, src) { @@ -9592,7 +9630,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 147) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 234) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 235) { return current; } } @@ -9618,7 +9656,7 @@ var ts; } ts.isEmptyBindingElement = isEmptyBindingElement; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 180 || ts.isBindingPattern(node))) { + while (node && (node.kind === 181 || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -9626,14 +9664,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 230) { + if (node.kind === 231) { node = node.parent; } - if (node && node.kind === 231) { + if (node && node.kind === 232) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 212) { + if (node && node.kind === 213) { flags |= ts.getModifierFlags(node); } return flags; @@ -9642,14 +9680,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 230) { + if (node.kind === 231) { node = node.parent; } - if (node && node.kind === 231) { + if (node && node.kind === 232) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 212) { + if (node && node.kind === 213) { flags |= node.flags; } return flags; @@ -9753,17 +9791,17 @@ var ts; return getDeclarationIdentifier(hostNode); } switch (hostNode.kind) { - case 212: + case 213: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } return undefined; - case 214: + case 215: var expr = hostNode.expression; switch (expr.kind) { - case 183: - return expr.name; case 184: + return expr.name; + case 185: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; @@ -9772,10 +9810,10 @@ var ts; return undefined; case 1: return undefined; - case 189: { + case 190: { return getDeclarationIdentifier(hostNode.expression); } - case 226: { + case 227: { if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -9804,15 +9842,15 @@ var ts; switch (declaration.kind) { case 71: return declaration; - case 292: - case 287: { + case 293: + case 288: { var name = declaration.name; if (name.kind === 145) { return name.right; } break; } - case 198: { + case 199: { var expr = declaration; switch (ts.getSpecialPropertyAssignmentKind(expr)) { case 1: @@ -9824,9 +9862,9 @@ var ts; return undefined; } } - case 291: + case 292: return getNameOfJSDocTypedef(declaration); - case 247: { + case 248: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } @@ -10069,480 +10107,480 @@ var ts; } ts.isLiteralTypeNode = isLiteralTypeNode; function isObjectBindingPattern(node) { - return node.kind === 178; + return node.kind === 179; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 179; + return node.kind === 180; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 180; + return node.kind === 181; } ts.isBindingElement = isBindingElement; function isArrayLiteralExpression(node) { - return node.kind === 181; + return node.kind === 182; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 182; + return node.kind === 183; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 183; + return node.kind === 184; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 184; + return node.kind === 185; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 185; + return node.kind === 186; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 186; + return node.kind === 187; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 187; + return node.kind === 188; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertion(node) { - return node.kind === 188; + return node.kind === 189; } ts.isTypeAssertion = isTypeAssertion; function isParenthesizedExpression(node) { - return node.kind === 189; + return node.kind === 190; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295) { + while (node.kind === 296) { node = node.expression; } return node; } ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; function isFunctionExpression(node) { - return node.kind === 190; + return node.kind === 191; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 191; + return node.kind === 192; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 192; + return node.kind === 193; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 193; + return node.kind === 194; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 194; + return node.kind === 195; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 195; + return node.kind === 196; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 196; + return node.kind === 197; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 197; + return node.kind === 198; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 198; + return node.kind === 199; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 199; + return node.kind === 200; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 200; + return node.kind === 201; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 201; + return node.kind === 202; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 202; + return node.kind === 203; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 203; + return node.kind === 204; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 204; + return node.kind === 205; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 205; + return node.kind === 206; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 206; + return node.kind === 207; } ts.isAsExpression = isAsExpression; function isNonNullExpression(node) { - return node.kind === 207; + return node.kind === 208; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 208; + return node.kind === 209; } ts.isMetaProperty = isMetaProperty; function isTemplateSpan(node) { - return node.kind === 209; + return node.kind === 210; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 210; + return node.kind === 211; } ts.isSemicolonClassElement = isSemicolonClassElement; function isBlock(node) { - return node.kind === 211; + return node.kind === 212; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 212; + return node.kind === 213; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 213; + return node.kind === 214; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 214; + return node.kind === 215; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 215; + return node.kind === 216; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 216; + return node.kind === 217; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 217; + return node.kind === 218; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 218; + return node.kind === 219; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 219; + return node.kind === 220; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 220; + return node.kind === 221; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 221; + return node.kind === 222; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 222; + return node.kind === 223; } ts.isBreakStatement = isBreakStatement; function isBreakOrContinueStatement(node) { - return node.kind === 222 || node.kind === 221; + return node.kind === 223 || node.kind === 222; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isReturnStatement(node) { - return node.kind === 223; + return node.kind === 224; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 224; + return node.kind === 225; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 225; + return node.kind === 226; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 226; + return node.kind === 227; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 227; + return node.kind === 228; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 228; + return node.kind === 229; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 229; + return node.kind === 230; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 230; + return node.kind === 231; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 231; + return node.kind === 232; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 232; + return node.kind === 233; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 233; + return node.kind === 234; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 234; + return node.kind === 235; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 235; + return node.kind === 236; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 236; + return node.kind === 237; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 237; + return node.kind === 238; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 238; + return node.kind === 239; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 239; + return node.kind === 240; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 240; + return node.kind === 241; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 241; + return node.kind === 242; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 242; + return node.kind === 243; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 243; + return node.kind === 244; } ts.isImportClause = isImportClause; function isNamespaceImport(node) { - return node.kind === 244; + return node.kind === 245; } ts.isNamespaceImport = isNamespaceImport; function isNamedImports(node) { - return node.kind === 245; + return node.kind === 246; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 246; + return node.kind === 247; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 247; + return node.kind === 248; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 248; + return node.kind === 249; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 249; + return node.kind === 250; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 250; + return node.kind === 251; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 251; + return node.kind === 252; } ts.isMissingDeclaration = isMissingDeclaration; function isExternalModuleReference(node) { - return node.kind === 252; + return node.kind === 253; } ts.isExternalModuleReference = isExternalModuleReference; function isJsxElement(node) { - return node.kind === 253; + return node.kind === 254; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 254; + return node.kind === 255; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 255; + return node.kind === 256; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 256; + return node.kind === 257; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 257; + return node.kind === 258; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 258; + return node.kind === 259; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 259; + return node.kind === 260; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 260; + return node.kind === 261; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 261; + return node.kind === 262; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 262; + return node.kind === 263; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 263; + return node.kind === 264; } ts.isJsxExpression = isJsxExpression; function isCaseClause(node) { - return node.kind === 264; + return node.kind === 265; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 265; + return node.kind === 266; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 266; + return node.kind === 267; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 267; + return node.kind === 268; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 268; + return node.kind === 269; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 269; + return node.kind === 270; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 270; + return node.kind === 271; } ts.isSpreadAssignment = isSpreadAssignment; function isEnumMember(node) { - return node.kind === 271; + return node.kind === 272; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 272; + return node.kind === 273; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 273; + return node.kind === 274; } ts.isBundle = isBundle; function isJSDocTypeExpression(node) { - return node.kind === 274; + return node.kind === 275; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 275; + return node.kind === 276; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 276; + return node.kind === 277; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 277; + return node.kind === 278; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 278; + return node.kind === 279; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 279; + return node.kind === 280; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 280; + return node.kind === 281; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 281; + return node.kind === 282; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 282; + return node.kind === 283; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 285; + return node.kind === 286; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocClassTag(node) { - return node.kind === 286; + return node.kind === 287; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocParameterTag(node) { - return node.kind === 287; + return node.kind === 288; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 288; + return node.kind === 289; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 289; + return node.kind === 290; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 290; + return node.kind === 291; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 291; + return node.kind === 292; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 292; + return node.kind === 293; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 292 || node.kind === 287; + return node.kind === 293 || node.kind === 288; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 283; + return node.kind === 284; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); (function (ts) { function isSyntaxList(n) { - return n.kind === 293; + return n.kind === 294; } ts.isSyntaxList = isSyntaxList; function isNode(node) { @@ -10634,8 +10672,8 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 71 - || kind === 178 - || kind === 179; + || kind === 179 + || kind === 180; } ts.isBindingName = isBindingName; function isFunctionLike(node) { @@ -10648,13 +10686,13 @@ var ts; ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 232: + case 233: case 153: case 154: case 155: case 156: - case 190: case 191: + case 192: return true; default: return false; @@ -10667,7 +10705,7 @@ var ts; case 158: case 159: case 162: - case 280: + case 281: case 163: return true; default: @@ -10687,12 +10725,12 @@ var ts; || kind === 155 || kind === 156 || kind === 159 - || kind === 210 - || kind === 251; + || kind === 211 + || kind === 252; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 233 || node.kind === 203); + return node && (node.kind === 234 || node.kind === 204); } ts.isClassLike = isClassLike; function isAccessor(node) { @@ -10717,22 +10755,22 @@ var ts; || kind === 150 || kind === 152 || kind === 159 - || kind === 251; + || kind === 252; } ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 268 - || kind === 269 + return kind === 269 || kind === 270 + || kind === 271 || kind === 153 || kind === 155 || kind === 156 - || kind === 251; + || kind === 252; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { - return (kind >= 160 && kind <= 177) + return (kind >= 160 && kind <= 178) || kind === 119 || kind === 134 || kind === 135 @@ -10744,14 +10782,14 @@ var ts; || kind === 140 || kind === 95 || kind === 131 - || kind === 205 - || kind === 275 + || kind === 206 || kind === 276 || kind === 277 || kind === 278 || kind === 279 || kind === 280 - || kind === 281; + || kind === 281 + || kind === 282; } function isTypeNode(node) { return isTypeNodeKind(node.kind); @@ -10769,29 +10807,29 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 179 - || kind === 178; + return kind === 180 + || kind === 179; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 181 - || kind === 182; + return kind === 182 + || kind === 183; } ts.isAssignmentPattern = isAssignmentPattern; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 180 - || kind === 204; + return kind === 181 + || kind === 205; } ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 230: + case 231: case 148: - case 180: + case 181: return true; } return false; @@ -10804,8 +10842,8 @@ var ts; ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 178: - case 182: + case 179: + case 183: return true; } return false; @@ -10813,26 +10851,33 @@ var ts; ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 179: - case 181: + case 180: + case 182: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; + function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { + var kind = node.kind; + return kind === 184 + || kind === 145 + || kind === 178; + } + ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 183 + return kind === 184 || kind === 145; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { + case 256: case 255: - case 254: - case 185: case 186: case 187: + case 188: case 149: return true; default: @@ -10841,12 +10886,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 185 || node.kind === 186; + return node.kind === 186 || node.kind === 187; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 200 + return kind === 201 || kind === 13; } ts.isTemplateLiteral = isTemplateLiteral; @@ -10856,32 +10901,32 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 183: case 184: - case 186: case 185: - case 253: - case 254: - case 257: case 187: - case 181: - case 189: + case 186: + case 254: + case 255: + case 258: + case 188: case 182: - case 203: case 190: + case 183: + case 204: + case 191: case 71: case 12: case 8: case 9: case 13: - case 200: + case 201: case 86: case 95: case 99: case 101: case 97: - case 207: case 208: + case 209: case 91: return true; default: @@ -10894,13 +10939,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 196: case 197: - case 192: + case 198: case 193: case 194: case 195: - case 188: + case 196: + case 189: return true; default: return isLeftHandSideExpressionKind(kind); @@ -10908,9 +10953,9 @@ var ts; } function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 197: + case 198: return true; - case 196: + case 197: return expr.operator === 43 || expr.operator === 44; default: @@ -10924,15 +10969,15 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 199: - case 201: - case 191: - case 198: + case 200: case 202: - case 206: - case 204: + case 192: + case 199: + case 203: + case 207: + case 205: + case 297: case 296: - case 295: return true; default: return isUnaryExpressionKind(kind); @@ -10940,16 +10985,16 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 188 - || kind === 206; + return kind === 189 + || kind === 207; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 295; + return node.kind === 296; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 294; + return node.kind === 295; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10959,20 +11004,20 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 218: case 219: case 220: - case 216: + case 221: case 217: + case 218: return true; - case 226: + case 227: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isForInOrOfStatement(node) { - return node.kind === 219 || node.kind === 220; + return node.kind === 220 || node.kind === 221; } ts.isForInOrOfStatement = isForInOrOfStatement; function isConciseBody(node) { @@ -10991,106 +11036,106 @@ var ts; ts.isForInitializer = isForInitializer; function isModuleBody(node) { var kind = node.kind; - return kind === 238 - || kind === 237 + return kind === 239 + || kind === 238 || kind === 71; } ts.isModuleBody = isModuleBody; function isNamespaceBody(node) { var kind = node.kind; - return kind === 238 - || kind === 237; + return kind === 239 + || kind === 238; } ts.isNamespaceBody = isNamespaceBody; function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 71 - || kind === 237; + || kind === 238; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 245 - || kind === 244; + return kind === 246 + || kind === 245; } ts.isNamedImportBindings = isNamedImportBindings; function isModuleOrEnumDeclaration(node) { - return node.kind === 237 || node.kind === 236; + return node.kind === 238 || node.kind === 237; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 191 - || kind === 180 - || kind === 233 - || kind === 203 - || kind === 154 - || kind === 236 - || kind === 271 - || kind === 250 - || kind === 232 - || kind === 190 - || kind === 155 - || kind === 243 - || kind === 241 - || kind === 246 + return kind === 192 + || kind === 181 || kind === 234 - || kind === 260 + || kind === 204 + || kind === 154 + || kind === 237 + || kind === 272 + || kind === 251 + || kind === 233 + || kind === 191 + || kind === 155 + || kind === 244 + || kind === 242 + || kind === 247 + || kind === 235 + || kind === 261 || kind === 153 || kind === 152 - || kind === 237 - || kind === 240 - || kind === 244 + || kind === 238 + || kind === 241 + || kind === 245 || kind === 148 - || kind === 268 + || kind === 269 || kind === 151 || kind === 150 || kind === 156 - || kind === 269 - || kind === 235 + || kind === 270 + || kind === 236 || kind === 147 - || kind === 230 - || kind === 291; + || kind === 231 + || kind === 292; } function isDeclarationStatementKind(kind) { - return kind === 232 - || kind === 251 - || kind === 233 + return kind === 233 + || kind === 252 || kind === 234 || kind === 235 || kind === 236 || kind === 237 + || kind === 238 + || kind === 243 || kind === 242 - || kind === 241 + || kind === 249 || kind === 248 - || kind === 247 - || kind === 240; + || kind === 241; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 222 - || kind === 221 - || kind === 229 - || kind === 216 - || kind === 214 - || kind === 213 - || kind === 219 - || kind === 220 - || kind === 218 - || kind === 215 - || kind === 226 - || kind === 223 - || kind === 225 - || kind === 227 - || kind === 228 - || kind === 212 + return kind === 223 + || kind === 222 + || kind === 230 || kind === 217 + || kind === 215 + || kind === 214 + || kind === 220 + || kind === 221 + || kind === 219 + || kind === 216 + || kind === 227 || kind === 224 - || kind === 294 - || kind === 298 - || kind === 297; + || kind === 226 + || kind === 228 + || kind === 229 + || kind === 213 + || kind === 218 + || kind === 225 + || kind === 295 + || kind === 299 + || kind === 298; } function isDeclaration(node) { if (node.kind === 147) { - return node.parent.kind !== 290 || ts.isInJavaScriptFile(node); + return node.parent.kind !== 291 || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -11111,10 +11156,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 211) + if (node.kind !== 212) return false; if (node.parent !== undefined) { - if (node.parent.kind === 228 || node.parent.kind === 267) { + if (node.parent.kind === 229 || node.parent.kind === 268) { return false; } } @@ -11122,7 +11167,7 @@ var ts; } function isModuleReference(node) { var kind = node.kind; - return kind === 252 + return kind === 253 || kind === 145 || kind === 71; } @@ -11131,52 +11176,52 @@ var ts; var kind = node.kind; return kind === 99 || kind === 71 - || kind === 183; + || kind === 184; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 253 - || kind === 263 - || kind === 254 + return kind === 254 + || kind === 264 + || kind === 255 || kind === 10 - || kind === 257; + || kind === 258; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 260 - || kind === 262; + return kind === 261 + || kind === 263; } ts.isJsxAttributeLike = isJsxAttributeLike; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 263; + || kind === 264; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 255 - || kind === 254; + return kind === 256 + || kind === 255; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 264 - || kind === 265; + return kind === 265 + || kind === 266; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isJSDocNode(node) { - return node.kind >= 274 && node.kind <= 292; + return node.kind >= 275 && node.kind <= 293; } ts.isJSDocNode = isJSDocNode; function isJSDocCommentContainingNode(node) { - return node.kind === 282 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); + return node.kind === 283 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; function isJSDocTag(node) { - return node.kind >= 284 && node.kind <= 292; + return node.kind >= 285 && node.kind <= 293; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -11214,19 +11259,19 @@ var ts; case 172: case 174: case 176: - case 188: - case 190: + case 189: case 191: - case 206: - case 230: - case 232: - case 235: - case 274: - case 277: + case 192: + case 207: + case 231: + case 233: + case 236: + case 275: case 278: case 279: case 280: case 281: + case 282: return true; } return false; @@ -11242,10 +11287,10 @@ var ts; ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { switch (node.kind) { - case 260: - case 262: - case 268: + case 261: + case 263: case 269: + case 270: case 153: case 155: case 156: @@ -11256,7 +11301,7 @@ var ts; } ts.isObjectLiteralElement = isObjectLiteralElement; function isTypeReferenceType(node) { - return node.kind === 161 || node.kind === 205; + return node.kind === 161 || node.kind === 206; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -11295,7 +11340,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 272) { + if (kind === 273) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71) { @@ -11345,14 +11390,14 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 269: + case 270: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 270: + case 271: return visitNode(cbNode, node.expression); case 148: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -11377,20 +11422,20 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 268: + case 269: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.initializer); - case 230: + case 231: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 180: + case 181: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || @@ -11412,9 +11457,9 @@ var ts; case 154: case 155: case 156: - case 190: - case 232: case 191: + case 233: + case 192: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -11449,6 +11494,10 @@ var ts; visitNode(cbNode, node.falseType); case 171: return visitNode(cbNode, node.typeParameter); + case 178: + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); case 172: case 174: return visitNode(cbNode, node.type); @@ -11462,145 +11511,138 @@ var ts; visitNode(cbNode, node.type); case 177: return visitNode(cbNode, node.literal); - case 178: case 179: - return visitNodes(cbNode, cbNodes, node.elements); - case 181: + case 180: return visitNodes(cbNode, cbNodes, node.elements); case 182: - return visitNodes(cbNode, cbNodes, node.properties); + return visitNodes(cbNode, cbNodes, node.elements); case 183: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.name); + return visitNodes(cbNode, cbNodes, node.properties); case 184: return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.argumentExpression); + visitNode(cbNode, node.name); case 185: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); case 186: + case 187: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNodes(cbNode, cbNodes, node.arguments); - case 187: + case 188: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 188: + case 189: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 189: - return visitNode(cbNode, node.expression); - case 192: + case 190: return visitNode(cbNode, node.expression); case 193: return visitNode(cbNode, node.expression); case 194: return visitNode(cbNode, node.expression); - case 196: - return visitNode(cbNode, node.operand); - case 201: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 195: return visitNode(cbNode, node.expression); case 197: return visitNode(cbNode, node.operand); + case 202: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 196: + return visitNode(cbNode, node.expression); case 198: + return visitNode(cbNode, node.operand); + case 199: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 206: + case 207: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 207: - return visitNode(cbNode, node.expression); case 208: + return visitNode(cbNode, node.expression); + case 209: return visitNode(cbNode, node.name); - case 199: + case 200: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 202: + case 203: return visitNode(cbNode, node.expression); - case 211: - case 238: + case 212: + case 239: return visitNodes(cbNode, cbNodes, node.statements); - case 272: + case 273: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 212: + case 213: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 231: + case 232: return visitNodes(cbNode, cbNodes, node.declarations); - case 214: - return visitNode(cbNode, node.expression); case 215: + return visitNode(cbNode, node.expression); + case 216: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 216: + case 217: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 217: + case 218: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218: + case 219: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 219: + case 220: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 220: + case 221: return visitNode(cbNode, node.awaitModifier) || visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 221: case 222: - return visitNode(cbNode, node.label); case 223: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.label); case 224: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression); case 225: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 226: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 239: + case 240: return visitNodes(cbNode, cbNodes, node.clauses); - case 264: + case 265: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 265: + case 266: return visitNodes(cbNode, cbNodes, node.statements); - case 226: + case 227: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 227: - return visitNode(cbNode, node.expression); case 228: + return visitNode(cbNode, node.expression); + case 229: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 267: + case 268: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 149: return visitNode(cbNode, node.expression); - case 233: - case 203: - return visitNodes(cbNode, cbNodes, node.decorators) || - 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 234: + case 204: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || @@ -11612,112 +11654,119 @@ var ts; visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); case 236: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 271: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); case 237: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + case 272: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 238: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 241: + case 242: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 242: + case 243: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 243: + case 244: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 240: - return visitNode(cbNode, node.name); - case 244: + case 241: return visitNode(cbNode, node.name); case 245: - case 249: + return visitNode(cbNode, node.name); + case 246: + case 250: return visitNodes(cbNode, cbNodes, node.elements); - case 248: + case 249: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 246: - case 250: + case 247: + case 251: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 247: + case 248: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 200: + case 201: return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); - case 209: + case 210: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 146: return visitNode(cbNode, node.expression); - case 266: + case 267: return visitNodes(cbNode, cbNodes, node.types); - case 205: + case 206: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); - case 252: - return visitNode(cbNode, node.expression); - case 251: - return visitNodes(cbNode, cbNodes, node.decorators); - case 296: - return visitNodes(cbNode, cbNodes, node.elements); case 253: + return visitNode(cbNode, node.expression); + case 252: + return visitNodes(cbNode, cbNodes, node.decorators); + case 297: + return visitNodes(cbNode, cbNodes, node.elements); + case 254: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 257: + case 258: return visitNode(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingFragment); - case 254: case 255: + case 256: return visitNode(cbNode, node.tagName) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.attributes); - case 261: + case 262: return visitNodes(cbNode, cbNodes, node.properties); - case 260: + case 261: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 262: - return visitNode(cbNode, node.expression); case 263: + return visitNode(cbNode, node.expression); + case 264: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 256: + case 257: return visitNode(cbNode, node.tagName); - case 274: - return visitNode(cbNode, node.type); - case 278: - return visitNode(cbNode, node.type); - case 277: + case 275: return visitNode(cbNode, node.type); case 279: return visitNode(cbNode, node.type); + case 278: + return visitNode(cbNode, node.type); case 280: + return visitNode(cbNode, node.type); + case 281: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 281: - return visitNode(cbNode, node.type); case 282: + return visitNode(cbNode, node.type); + case 283: return visitNodes(cbNode, cbNodes, node.tags); - case 287: - case 292: + case 288: + case 293: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -11726,17 +11775,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 288: - return visitNode(cbNode, node.typeExpression); case 289: return visitNode(cbNode, node.typeExpression); - case 285: - return visitNode(cbNode, node.class); case 290: - return visitNodes(cbNode, cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 286: + return visitNode(cbNode, node.class); case 291: + return visitNodes(cbNode, cbNodes, node.typeParameters); + case 292: if (node.typeExpression && - node.typeExpression.kind === 274) { + node.typeExpression.kind === 275) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -11744,7 +11793,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 283: + case 284: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -11752,7 +11801,7 @@ var ts; } } return; - case 295: + case 296: return visitNode(cbNode, node.expression); } } @@ -11953,7 +12002,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) { - var sourceFile = new SourceFileConstructor(272, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(273, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -12583,7 +12632,7 @@ var ts; case 155: case 156: case 151: - case 210: + case 211: return true; case 153: var methodDeclaration = node; @@ -12597,8 +12646,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 264: case 265: + case 266: return true; } } @@ -12607,42 +12656,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 232: + case 233: + case 213: case 212: - case 211: + case 216: case 215: - case 214: - case 227: + case 228: + case 224: + case 226: case 223: - case 225: case 222: + case 220: case 221: case 219: - case 220: case 218: - case 217: - case 224: - case 213: - case 228: - case 226: - case 216: + case 225: + case 214: case 229: + case 227: + case 217: + case 230: + case 243: case 242: - case 241: + case 249: case 248: - case 247: - case 237: - case 233: + case 238: case 234: - case 236: case 235: + case 237: + case 236: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 271; + return node.kind === 272; } function isReusableTypeMember(node) { if (node) { @@ -12658,7 +12707,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 230) { + if (node.kind !== 231) { return false; } var variableDeclarator = node; @@ -12787,7 +12836,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(200); + var template = createNode(201); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 14, "Template head has wrong token kind"); var list = []; @@ -12799,7 +12848,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(209); + var span = createNode(210); span.expression = allowInAnd(parseExpression); var literal; if (token() === 18) { @@ -12863,9 +12912,9 @@ var ts; return finishNode(node); } function parseJSDocAllType(postFixEquals) { - var result = createNode(275); + var result = createNode(276); if (postFixEquals) { - return createJSDocPostfixType(279, result); + return createJSDocPostfixType(280, result); } else { nextToken(); @@ -12873,7 +12922,7 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(278); + var result = createNode(279); nextToken(); result.type = parseNonArrayType(); return finishNode(result); @@ -12887,18 +12936,18 @@ var ts; token() === 29 || token() === 58 || token() === 49) { - var result = createNode(276, pos); + var result = createNode(277, pos); return finishNode(result); } else { - var result = createNode(277, pos); + var result = createNode(278, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNodeWithJSDoc(280); + var result = createNodeWithJSDoc(281); nextToken(); fillSignature(56, 4 | 32, result); return finishNode(result); @@ -12920,12 +12969,12 @@ var ts; var dotdotdot = parseOptionalToken(24); var type = parseType(); if (dotdotdot) { - var variadic = createNode(281, dotdotdot.pos); + var variadic = createNode(282, dotdotdot.pos); variadic.type = type; type = finishNode(variadic); } if (token() === 58) { - return createJSDocPostfixType(279, type); + return createJSDocPostfixType(280, type); } return type; } @@ -13225,7 +13274,7 @@ var ts; var node = createNode(177); var unaryMinusExpression; if (negative) { - unaryMinusExpression = createNode(196); + unaryMinusExpression = createNode(197); unaryMinusExpression.operator = 38; nextToken(); } @@ -13240,6 +13289,26 @@ var ts; node.literal = expression; return finishNode(node); } + function isStartOfTypeOfImportType() { + nextToken(); + return token() === 91; + } + function parseImportType() { + sourceFile.flags |= 524288; + var node = createNode(178); + if (parseOptional(103)) { + node.isTypeOf = true; + } + parseExpected(91); + parseExpected(19); + node.argument = parseType(); + parseExpected(20); + if (parseOptional(23)) { + node.qualifier = parseEntityName(true, ts.Diagnostics.Type_expected); + } + node.typeArguments = tryParseTypeArguments(); + return finishNode(node); + } function nextTokenIsNumericLiteral() { return nextToken() === 8; } @@ -13285,13 +13354,15 @@ var ts; } } case 103: - return parseTypeQuery(); + return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); case 17: return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); case 21: return parseTupleType(); case 19: return parseParenthesizedType(); + case 91: + return parseImportType(); default: return parseTypeReference(); } @@ -13326,6 +13397,7 @@ var ts; case 51: case 24: case 126: + case 91: return true; case 38: return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral); @@ -13344,13 +13416,13 @@ var ts; while (!scanner.hasPrecedingLineBreak()) { switch (token()) { case 51: - type = createJSDocPostfixType(278, type); + type = createJSDocPostfixType(279, type); break; case 55: if (!(contextFlags & 1048576) && lookAhead(nextTokenIsStartOfType)) { return type; } - type = createJSDocPostfixType(277, type); + type = createJSDocPostfixType(278, type); break; case 21: parseExpected(21); @@ -13620,7 +13692,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(201); + var node = createNode(202); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token() === 39 || isStartOfExpression())) { @@ -13636,11 +13708,11 @@ var ts; ts.Debug.assert(token() === 36, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(191, asyncModifier.pos); + node = createNode(192, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(191, identifier.pos); + node = createNode(192, identifier.pos); } var parameter = createNode(148, identifier.pos); parameter.name = identifier; @@ -13788,7 +13860,7 @@ var ts; return 0; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNodeWithJSDoc(191); + var node = createNodeWithJSDoc(192); node.modifiers = parseModifiersForArrowFunction(); var isAsync = ts.hasModifier(node, 256) ? 2 : 0; fillSignature(56, isAsync | (allowAmbiguity ? 0 : 8), node); @@ -13820,7 +13892,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(199, leftOperand.pos); + var node = createNode(200, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -13872,43 +13944,43 @@ var ts; return ts.getBinaryOperatorPrecedence(token()) > 0; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(198, left.pos); + var node = createNode(199, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(206, left.pos); + var node = createNode(207, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(196); + var node = createNode(197); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(192); - nextToken(); - node.expression = parseSimpleUnaryExpression(); - return finishNode(node); - } - function parseTypeOfExpression() { var node = createNode(193); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } - function parseVoidExpression() { + function parseTypeOfExpression() { var node = createNode(194); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } + function parseVoidExpression() { + var node = createNode(195); + nextToken(); + node.expression = parseSimpleUnaryExpression(); + return finishNode(node); + } function isAwaitExpression() { if (token() === 121) { if (inAwaitContext()) { @@ -13919,7 +13991,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(195); + var node = createNode(196); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -13936,7 +14008,7 @@ var ts; if (token() === 40) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 188) { + if (simpleUnaryExpression.kind === 189) { 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 { @@ -13989,7 +14061,7 @@ var ts; } function parseUpdateExpression() { if (token() === 43 || token() === 44) { - var node = createNode(196); + var node = createNode(197); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -14001,7 +14073,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 43 || token() === 44) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(197, expression.pos); + var node = createNode(198, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -14029,7 +14101,7 @@ var ts; if (token() === 19 || token() === 23 || token() === 21) { return expression; } - var node = createNode(183, expression.pos); + var node = createNode(184, expression.pos); node.expression = expression; parseExpectedToken(23, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -14051,8 +14123,8 @@ var ts; function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 255) { - var node = createNode(253, opening.pos); + if (opening.kind === 256) { + var node = createNode(254, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -14061,22 +14133,22 @@ var ts; } result = finishNode(node); } - else if (opening.kind === 258) { - var node = createNode(257, opening.pos); + else if (opening.kind === 259) { + var node = createNode(258, opening.pos); node.openingFragment = opening; node.children = parseJsxChildren(node.openingFragment); node.closingFragment = parseJsxClosingFragment(inExpressionContext); result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 254); + ts.Debug.assert(opening.kind === 255); result = opening; } if (inExpressionContext && token() === 27) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(198, result.pos); + var badNode = createNode(199, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -14132,7 +14204,7 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(261); + var jsxAttributes = createNode(262); jsxAttributes.properties = parseList(13, parseJsxAttribute); return finishNode(jsxAttributes); } @@ -14140,7 +14212,7 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(27); if (token() === 29) { - var node_1 = createNode(258, fullStart); + var node_1 = createNode(259, fullStart); scanJsxText(); return finishNode(node_1); } @@ -14149,7 +14221,7 @@ var ts; var attributes = parseJsxAttributes(); var node; if (token() === 29) { - node = createNode(255, fullStart); + node = createNode(256, fullStart); scanJsxText(); } else { @@ -14161,7 +14233,7 @@ var ts; parseExpected(29, undefined, false); scanJsxText(); } - node = createNode(254, fullStart); + node = createNode(255, fullStart); } node.tagName = tagName; node.typeArguments = typeArguments; @@ -14173,7 +14245,7 @@ var ts; var expression = token() === 99 ? parseTokenNode() : parseIdentifierName(); while (parseOptional(23)) { - var propertyAccess = createNode(183, expression.pos); + var propertyAccess = createNode(184, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -14181,7 +14253,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(263); + var node = createNode(264); if (!parseExpected(17)) { return undefined; } @@ -14203,7 +14275,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(260); + var node = createNode(261); node.name = parseIdentifierName(); if (token() === 58) { switch (scanJsxAttributeValue()) { @@ -14218,7 +14290,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(262); + var node = createNode(263); parseExpected(17); parseExpected(24); node.expression = parseExpression(); @@ -14226,7 +14298,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(256); + var node = createNode(257); parseExpected(28); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -14239,7 +14311,7 @@ var ts; return finishNode(node); } function parseJsxClosingFragment(inExpressionContext) { - var node = createNode(259); + var node = createNode(260); parseExpected(28); if (ts.tokenIsIdentifierOrKeyword(token())) { parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); @@ -14254,7 +14326,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(188); + var node = createNode(189); parseExpected(27); node.type = parseType(); parseExpected(29); @@ -14265,7 +14337,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(23); if (dotToken) { - var propertyAccess = createNode(183, expression.pos); + var propertyAccess = createNode(184, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -14273,13 +14345,13 @@ var ts; } if (token() === 51 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(207, expression.pos); + var nonNullExpression = createNode(208, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } if (!inDecoratorContext() && parseOptional(21)) { - var indexedAccess = createNode(184, expression.pos); + var indexedAccess = createNode(185, expression.pos); indexedAccess.expression = expression; if (token() !== 22) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -14293,7 +14365,7 @@ var ts; continue; } if (token() === 13 || token() === 14) { - var tagExpression = createNode(187, expression.pos); + var tagExpression = createNode(188, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 13 ? parseLiteralNode() @@ -14312,7 +14384,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(185, expression.pos); + var callExpr = createNode(186, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -14320,7 +14392,7 @@ var ts; continue; } else if (token() === 19) { - var callExpr = createNode(185, expression.pos); + var callExpr = createNode(186, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -14415,28 +14487,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNodeWithJSDoc(189); + var node = createNodeWithJSDoc(190); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); return finishNode(node); } function parseSpreadElement() { - var node = createNode(202); + var node = createNode(203); parseExpected(24); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 24 ? parseSpreadElement() : - token() === 26 ? createNode(204) : + token() === 26 ? createNode(205) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(181); + var node = createNode(182); parseExpected(21); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14448,7 +14520,7 @@ var ts; function parseObjectLiteralElement() { var node = createNodeWithJSDoc(0); if (parseOptionalToken(24)) { - node.kind = 270; + node.kind = 271; node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -14469,7 +14541,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 || token() === 18 || token() === 58); if (isShorthandPropertyAssignment) { - node.kind = 269; + node.kind = 270; var equalsToken = parseOptionalToken(58); if (equalsToken) { node.equalsToken = equalsToken; @@ -14477,14 +14549,14 @@ var ts; } } else { - node.kind = 268; + node.kind = 269; parseExpected(56); node.initializer = allowInAnd(parseAssignmentExpressionOrHigher); } return finishNode(node); } function parseObjectLiteralExpression() { - var node = createNode(182); + var node = createNode(183); parseExpected(17); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14498,7 +14570,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNodeWithJSDoc(190); + var node = createNodeWithJSDoc(191); node.modifiers = parseModifiers(); parseExpected(89); node.asteriskToken = parseOptionalToken(39); @@ -14523,12 +14595,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94); if (parseOptional(23)) { - var node_2 = createNode(208, fullStart); + var node_2 = createNode(209, fullStart); node_2.keywordToken = 94; node_2.name = parseIdentifierName(); return finishNode(node_2); } - var node = createNode(186, fullStart); + var node = createNode(187, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 19) { @@ -14537,7 +14609,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(211); + var node = createNode(212); if (parseExpected(17, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14568,12 +14640,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(213); + var node = createNode(214); parseExpected(25); return finishNode(node); } function parseIfStatement() { - var node = createNode(215); + var node = createNode(216); parseExpected(90); parseExpected(19); node.expression = allowInAnd(parseExpression); @@ -14583,7 +14655,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(216); + var node = createNode(217); parseExpected(81); node.statement = parseStatement(); parseExpected(106); @@ -14594,7 +14666,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(217); + var node = createNode(218); parseExpected(106); parseExpected(19); node.expression = allowInAnd(parseExpression); @@ -14618,7 +14690,7 @@ var ts; } var forOrForInOrForOfStatement; if (awaitToken ? parseExpected(144) : parseOptional(144)) { - var forOfStatement = createNode(220, pos); + var forOfStatement = createNode(221, pos); forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); @@ -14626,14 +14698,14 @@ var ts; forOrForInOrForOfStatement = forOfStatement; } else if (parseOptional(92)) { - var forInStatement = createNode(219, pos); + var forInStatement = createNode(220, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(20); forOrForInOrForOfStatement = forInStatement; } else { - var forStatement = createNode(218, pos); + var forStatement = createNode(219, pos); forStatement.initializer = initializer; parseExpected(25); if (token() !== 25 && token() !== 20) { @@ -14651,7 +14723,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 222 ? 72 : 77); + parseExpected(kind === 223 ? 72 : 77); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -14659,7 +14731,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(223); + var node = createNode(224); parseExpected(96); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -14668,7 +14740,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(224); + var node = createNode(225); parseExpected(107); parseExpected(19); node.expression = allowInAnd(parseExpression); @@ -14677,7 +14749,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(264); + var node = createNode(265); parseExpected(73); node.expression = allowInAnd(parseExpression); parseExpected(56); @@ -14685,7 +14757,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(265); + var node = createNode(266); parseExpected(79); parseExpected(56); node.statements = parseList(3, parseStatement); @@ -14695,12 +14767,12 @@ var ts; return token() === 73 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(225); + var node = createNode(226); parseExpected(98); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); - var caseBlock = createNode(239); + var caseBlock = createNode(240); parseExpected(17); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(18); @@ -14708,14 +14780,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(227); + var node = createNode(228); parseExpected(100); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(228); + var node = createNode(229); parseExpected(102); node.tryBlock = parseBlock(false); node.catchClause = token() === 74 ? parseCatchClause() : undefined; @@ -14726,7 +14798,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(267); + var result = createNode(268); parseExpected(74); if (parseOptional(19)) { result.variableDeclaration = parseVariableDeclaration(); @@ -14739,7 +14811,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(229); + var node = createNode(230); parseExpected(78); parseSemicolon(); return finishNode(node); @@ -14748,12 +14820,12 @@ var ts; var node = createNodeWithJSDoc(0); var expression = allowInAnd(parseExpression); if (expression.kind === 71 && parseOptional(56)) { - node.kind = 226; + node.kind = 227; node.label = expression; node.statement = parseStatement(); } else { - node.kind = 214; + node.kind = 215; node.expression = expression; parseSemicolon(); } @@ -14891,16 +14963,16 @@ var ts; case 17: return parseBlock(false); case 104: - return parseVariableStatement(createNodeWithJSDoc(230)); + return parseVariableStatement(createNodeWithJSDoc(231)); case 110: if (isLetDeclaration()) { - return parseVariableStatement(createNodeWithJSDoc(230)); + return parseVariableStatement(createNodeWithJSDoc(231)); } break; case 89: - return parseFunctionDeclaration(createNodeWithJSDoc(232)); + return parseFunctionDeclaration(createNodeWithJSDoc(233)); case 75: - return parseClassDeclaration(createNodeWithJSDoc(233)); + return parseClassDeclaration(createNodeWithJSDoc(234)); case 90: return parseIfStatement(); case 81: @@ -14910,9 +14982,9 @@ var ts; case 88: return parseForOrForInOrForOfStatement(); case 77: - return parseBreakOrContinueStatement(221); - case 72: return parseBreakOrContinueStatement(222); + case 72: + return parseBreakOrContinueStatement(223); case 96: return parseReturnStatement(); case 107: @@ -15006,7 +15078,7 @@ var ts; } default: if (node.decorators || node.modifiers) { - var missing = createMissingNode(251, true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(252, true, ts.Diagnostics.Declaration_expected); missing.pos = node.pos; missing.decorators = node.decorators; missing.modifiers = node.modifiers; @@ -15027,16 +15099,16 @@ var ts; } function parseArrayBindingElement() { if (token() === 26) { - return createNode(204); + return createNode(205); } - var node = createNode(180); + var node = createNode(181); node.dotDotDotToken = parseOptionalToken(24); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(180); + var node = createNode(181); node.dotDotDotToken = parseOptionalToken(24); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -15052,14 +15124,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(178); + var node = createNode(179); parseExpected(17); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(18); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(179); + var node = createNode(180); parseExpected(21); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(22); @@ -15081,7 +15153,7 @@ var ts; return parseVariableDeclaration(true); } function parseVariableDeclaration(allowExclamation) { - var node = createNode(230); + var node = createNode(231); node.name = parseIdentifierOrPattern(); if (allowExclamation && node.name.kind === 71 && token() === 51 && !scanner.hasPrecedingLineBreak()) { @@ -15094,7 +15166,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(231); + var node = createNode(232); switch (token()) { case 104: break; @@ -15123,13 +15195,13 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 20; } function parseVariableStatement(node) { - node.kind = 212; + node.kind = 213; node.declarationList = parseVariableDeclarationList(false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(node) { - node.kind = 232; + node.kind = 233; parseExpected(89); node.asteriskToken = parseOptionalToken(39); node.name = ts.hasModifier(node, 512) ? parseOptionalIdentifier() : parseIdentifier(); @@ -15272,7 +15344,7 @@ var ts; } function parseClassElement() { if (token() === 25) { - var result = createNode(210); + var result = createNode(211); nextToken(); return finishNode(result); } @@ -15305,10 +15377,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(createNodeWithJSDoc(0), 203); + return parseClassDeclarationOrExpression(createNodeWithJSDoc(0), 204); } function parseClassDeclaration(node) { - return parseClassDeclarationOrExpression(node, 233); + return parseClassDeclarationOrExpression(node, 234); } function parseClassDeclarationOrExpression(node, kind) { node.kind = kind; @@ -15342,7 +15414,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 || tok === 108) { - var node = createNode(266); + var node = createNode(267); node.token = tok; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -15351,7 +15423,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(205); + var node = createNode(206); node.expression = parseLeftHandSideExpressionOrHigher(); node.typeArguments = tryParseTypeArguments(); return finishNode(node); @@ -15368,7 +15440,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(node) { - node.kind = 234; + node.kind = 235; parseExpected(109); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -15377,7 +15449,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(node) { - node.kind = 235; + node.kind = 236; parseExpected(139); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -15387,13 +15459,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNodeWithJSDoc(271); + var node = createNodeWithJSDoc(272); node.name = parsePropertyName(); node.initializer = allowInAnd(parseInitializer); return finishNode(node); } function parseEnumDeclaration(node) { - node.kind = 236; + node.kind = 237; parseExpected(83); node.name = parseIdentifier(); if (parseExpected(17)) { @@ -15406,7 +15478,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(238); + var node = createNode(239); if (parseExpected(17)) { node.statements = parseList(1, parseStatement); parseExpected(18); @@ -15417,7 +15489,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(node, flags) { - node.kind = 237; + node.kind = 238; var namespaceFlag = flags & 16; node.flags |= flags; node.name = parseIdentifier(); @@ -15427,7 +15499,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(node) { - node.kind = 237; + node.kind = 238; if (token() === 143) { node.name = parseIdentifier(); node.flags |= 512; @@ -15471,7 +15543,7 @@ var ts; return nextToken() === 41; } function parseNamespaceExportDeclaration(node) { - node.kind = 240; + node.kind = 241; parseExpected(118); parseExpected(130); node.name = parseIdentifier(); @@ -15488,7 +15560,7 @@ var ts; return parseImportEqualsDeclaration(node, identifier); } } - node.kind = 242; + node.kind = 243; if (identifier || token() === 39 || token() === 17) { @@ -15500,7 +15572,7 @@ var ts; return finishNode(node); } function parseImportEqualsDeclaration(node, identifier) { - node.kind = 241; + node.kind = 242; node.name = identifier; parseExpected(58); node.moduleReference = parseModuleReference(); @@ -15508,13 +15580,13 @@ var ts; return finishNode(node); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(243, fullStart); + var importClause = createNode(244, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(26)) { - importClause.namedBindings = token() === 39 ? parseNamespaceImport() : parseNamedImportsOrExports(245); + importClause.namedBindings = token() === 39 ? parseNamespaceImport() : parseNamedImportsOrExports(246); } return finishNode(importClause); } @@ -15524,7 +15596,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(252); + var node = createNode(253); parseExpected(133); parseExpected(19); node.expression = parseModuleSpecifier(); @@ -15542,7 +15614,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(244); + var namespaceImport = createNode(245); parseExpected(39); parseExpected(118); namespaceImport.name = parseIdentifier(); @@ -15550,14 +15622,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 245 ? parseImportSpecifier : parseExportSpecifier, 17, 18); + node.elements = parseBracketedList(22, kind === 246 ? parseImportSpecifier : parseExportSpecifier, 17, 18); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(250); + return parseImportOrExportSpecifier(251); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(246); + return parseImportOrExportSpecifier(247); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -15576,19 +15648,19 @@ var ts; else { node.name = identifierName; } - if (kind === 246 && checkIdentifierIsKeyword) { + if (kind === 247 && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(node) { - node.kind = 248; + node.kind = 249; if (parseOptional(39)) { parseExpected(142); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(249); + node.exportClause = parseNamedImportsOrExports(250); if (token() === 142 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { parseExpected(142); node.moduleSpecifier = parseModuleSpecifier(); @@ -15598,7 +15670,7 @@ var ts; return finishNode(node); } function parseExportAssignment(node) { - node.kind = 247; + node.kind = 248; if (parseOptional(58)) { node.isExportEquals = true; } @@ -15612,10 +15684,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 241 && node.moduleReference.kind === 252 - || node.kind === 242 - || node.kind === 247 + || node.kind === 242 && node.moduleReference.kind === 253 + || node.kind === 243 || node.kind === 248 + || node.kind === 249 ? node : undefined; }); @@ -15634,7 +15706,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression(mayOmitBraces) { - var result = createNode(274, scanner.getTokenPos()); + var result = createNode(275, scanner.getTokenPos()); var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(17); result.type = doInsideOfContext(1048576, parseJSDocType); if (!mayOmitBraces || hasBrace) { @@ -15779,7 +15851,7 @@ var ts; } } function createJSDocComment() { - var result = createNode(282, start); + var result = createNode(283, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -15897,7 +15969,7 @@ var ts; return comments.length === 0 ? undefined : comments.join(""); } function parseUnknownTag(atToken, tagName) { - var result = createNode(284, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -15951,9 +16023,9 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 ? - createNode(287, atToken.pos) : - createNode(292, atToken.pos); - var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); + createNode(288, atToken.pos) : + createNode(293, atToken.pos); + var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; isNameFirst = true; @@ -15966,18 +16038,20 @@ var ts; result.isBracketed = isBracketed; return finishNode(result); } - function parseNestedTypeLiteral(typeExpression, name) { + function parseNestedTypeLiteral(typeExpression, name, target) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(274, scanner.getTokenPos()); + var typeLiteralExpression = createNode(275, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); var children = void 0; - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(1, name); })) { - children = ts.append(children, child); + while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, name); })) { + if (child.kind === 288 || child.kind === 293) { + children = ts.append(children, child); + } } if (children) { - jsdocTypeLiteral = createNode(283, start_2); + jsdocTypeLiteral = createNode(284, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 166) { jsdocTypeLiteral.isArrayType = true; @@ -15988,27 +16062,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 288; })) { - parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); - } - var result = createNode(288, atToken.pos); - result.atToken = atToken; - result.tagName = tagName; - result.typeExpression = tryParseTypeExpression(); - return finishNode(result); - } - function parseTypeTag(atToken, tagName) { if (ts.forEach(tags, function (t) { return t.kind === 289; })) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } var result = createNode(289, atToken.pos); result.atToken = atToken; result.tagName = tagName; + result.typeExpression = tryParseTypeExpression(); + return finishNode(result); + } + function parseTypeTag(atToken, tagName) { + if (ts.forEach(tags, function (t) { return t.kind === 290; })) { + parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); + } + var result = createNode(290, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(285, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -16016,7 +16090,7 @@ var ts; } function parseExpressionWithTypeArgumentsForAugments() { var usedBrace = parseOptional(17); - var node = createNode(205); + var node = createNode(206); node.expression = parsePropertyAccessEntityNameExpression(); node.typeArguments = tryParseTypeArguments(); var res = finishNode(node); @@ -16028,7 +16102,7 @@ var ts; function parsePropertyAccessEntityNameExpression() { var node = parseJSDocIdentifierName(true); while (parseOptional(23)) { - var prop = createNode(183, node.pos); + var prop = createNode(184, node.pos); prop.expression = node; prop.name = parseJSDocIdentifierName(); node = finishNode(prop); @@ -16036,7 +16110,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(286, atToken.pos); + var tag = createNode(287, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -16044,7 +16118,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(291, atToken.pos); + var typedefTag = createNode(292, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -16065,11 +16139,11 @@ var ts; var jsdocTypeLiteral = void 0; var childTypeTag = void 0; var start_3 = scanner.getStartPos(); - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0); })) { + while (child = tryParse(function () { return parseChildPropertyTag(); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(283, start_3); + jsdocTypeLiteral = createNode(284, start_3); } - if (child.kind === 289) { + if (child.kind === 290) { if (childTypeTag) { break; } @@ -16095,7 +16169,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(23)) { - var jsDocNamespaceNode = createNode(237, pos); + var jsDocNamespaceNode = createNode(238, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -16119,6 +16193,9 @@ var ts; } return a.escapedText === b.escapedText; } + function parseChildPropertyTag() { + return parseChildParameterOrPropertyTag(0); + } function parseChildParameterOrPropertyTag(target, name) { var canParseTag = true; var seenAsterisk = false; @@ -16127,7 +16204,7 @@ var ts; case 57: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 287 && + if (child && child.kind === 288 && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -16211,7 +16288,7 @@ var ts; break; } } - var result = createNode(290, atToken.pos); + var result = createNode(291, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -16760,21 +16837,21 @@ var ts; ts.getModuleInstanceState = getModuleInstanceState; function getModuleInstanceStateWorker(node) { switch (node.kind) { - case 234: case 235: - return 0; case 236: + return 0; + case 237: if (ts.isConst(node)) { return 2; } break; + case 243: case 242: - case 241: if (!(ts.hasModifier(node, 1))) { return 0; } break; - case 238: { + case 239: { var state_1 = 0; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateWorker(n); @@ -16793,7 +16870,7 @@ var ts; }); return state_1; } - case 237: + case 238: return getModuleInstanceState(node); case 71: if (node.isInJSDocNamespace) { @@ -16901,13 +16978,13 @@ var ts; if (symbolFlags & 67216319) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 237)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 238)) { symbol.valueDeclaration = node; } } } function getDeclarationName(node) { - if (node.kind === 247) { + if (node.kind === 248) { return node.isExportEquals ? "export=" : "default"; } var name = ts.getNameOfDeclaration(node); @@ -16937,25 +17014,25 @@ var ts; return "__new"; case 159: return "__index"; - case 248: + case 249: return "__export"; - case 198: + case 199: if (ts.getSpecialPropertyAssignmentKind(node) === 2) { return "export="; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 232: case 233: + case 234: return (ts.hasModifier(node, 512) ? "default" : undefined); - case 280: + case 281: return (ts.isJSDocConstructSignature(node) ? "__new" : "__call"); case 148: - ts.Debug.assert(node.parent.kind === 280, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); + ts.Debug.assert(node.parent.kind === 281, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; - case 291: + case 292: var name_2 = ts.getNameOfJSDocTypedef(node); return typeof name_2 !== "undefined" ? name_2.escapedText : undefined; } @@ -17004,7 +17081,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 247 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 248 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -17029,7 +17106,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 2097152) { - if (node.kind === 250 || (node.kind === 241 && hasExportModifier)) { + if (node.kind === 251 || (node.kind === 242 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -17037,7 +17114,7 @@ var ts; } } else { - if (node.kind === 291) + if (node.kind === 292) ts.Debug.assert(ts.isInJavaScriptFile(node)); var isJSDocTypedefInJSDocNamespace = ts.isJSDocTypedefTag(node) && node.name && node.name.kind === 71 && node.name.isInJSDocNamespace; if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32)) || isJSDocTypedefInJSDocNamespace) { @@ -17057,7 +17134,7 @@ var ts; var saveThisParentContainer = thisParentContainer; var savedBlockScopeContainer = blockScopeContainer; if (containerFlags & 1) { - if (node.kind !== 191) { + if (node.kind !== 192) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -17096,7 +17173,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 272) { + if (node.kind === 273) { node.flags |= emitFlags; } if (currentReturnTarget) { @@ -17145,8 +17222,8 @@ var ts; } } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 232 ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 232 ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 233 ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 233 ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -17192,78 +17269,78 @@ var ts; return; } switch (node.kind) { - case 217: + case 218: bindWhileStatement(node); break; - case 216: + case 217: bindDoStatement(node); break; - case 218: + case 219: bindForStatement(node); break; - case 219: case 220: + case 221: bindForInOrForOfStatement(node); break; - case 215: + case 216: bindIfStatement(node); break; - case 223: - case 227: + case 224: + case 228: bindReturnOrThrow(node); break; + case 223: case 222: - case 221: bindBreakOrContinueStatement(node); break; - case 228: + case 229: bindTryStatement(node); break; - case 225: + case 226: bindSwitchStatement(node); break; - case 239: + case 240: bindCaseBlock(node); break; - case 264: + case 265: bindCaseClause(node); break; - case 226: + case 227: bindLabeledStatement(node); break; - case 196: + case 197: bindPrefixUnaryExpressionFlow(node); break; - case 197: + case 198: bindPostfixUnaryExpressionFlow(node); break; - case 198: + case 199: bindBinaryExpressionFlow(node); break; - case 192: + case 193: bindDeleteExpressionFlow(node); break; - case 199: + case 200: bindConditionalExpressionFlow(node); break; - case 230: + case 231: bindVariableDeclarationFlow(node); break; - case 185: + case 186: bindCallExpressionFlow(node); break; - case 282: + case 283: bindJSDocComment(node); break; - case 291: + case 292: bindJSDocTypedefTag(node); break; - case 272: + case 273: bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; - case 211: - case 238: + case 212: + case 239: bindEachFunctionsFirst(node.statements); break; default: @@ -17275,15 +17352,15 @@ var ts; switch (expr.kind) { case 71: case 99: - case 183: + case 184: return isNarrowableReference(expr); - case 185: + case 186: return hasNarrowableArgument(expr); - case 189: + case 190: return isNarrowingExpression(expr.expression); - case 198: + case 199: return isNarrowingBinaryExpression(expr); - case 196: + case 197: return expr.operator === 51 && isNarrowingExpression(expr.operand); } return false; @@ -17292,7 +17369,7 @@ var ts; return expr.kind === 71 || expr.kind === 99 || expr.kind === 97 || - expr.kind === 183 && isNarrowableReference(expr.expression); + expr.kind === 184 && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -17303,7 +17380,7 @@ var ts; } } } - if (expr.expression.kind === 183 && + if (expr.expression.kind === 184 && isNarrowableReference(expr.expression.expression)) { return true; } @@ -17336,9 +17413,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 189: + case 190: return isNarrowableOperand(expr.expression); - case 198: + case 199: switch (expr.operatorToken.kind) { case 58: return isNarrowableOperand(expr.left); @@ -17415,33 +17492,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 215: - case 217: case 216: - return parent.expression === node; case 218: - case 199: + case 217: + return parent.expression === node; + case 219: + case 200: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 189) { + if (node.kind === 190) { node = node.expression; } - else if (node.kind === 196 && node.operator === 51) { + else if (node.kind === 197 && node.operator === 51) { node = node.operand; } else { - return node.kind === 198 && (node.operatorToken.kind === 53 || + return node.kind === 199 && (node.operatorToken.kind === 53 || node.operatorToken.kind === 54); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 189 || - node.parent.kind === 196 && + while (node.parent.kind === 190 || + node.parent.kind === 197 && node.parent.operator === 51) { node = node.parent; } @@ -17483,7 +17560,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 226 + var enclosingLabeledStatement = node.parent.kind === 227 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -17515,13 +17592,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 220) { + if (node.kind === 221) { bind(node.awaitModifier); } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 231) { + if (node.initializer.kind !== 232) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -17543,7 +17620,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 223) { + if (node.kind === 224) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -17563,7 +17640,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 222 ? breakTarget : continueTarget; + var flowLabel = node.kind === 223 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -17626,7 +17703,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 265; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 266; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -17691,13 +17768,13 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 216) { + if (!node.statement || node.statement.kind !== 217) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 198 && node.operatorToken.kind === 58) { + if (node.kind === 199 && node.operatorToken.kind === 58) { bindAssignmentTargetFlow(node.left); } else { @@ -17708,10 +17785,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 181) { + else if (node.kind === 182) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 202) { + if (e.kind === 203) { bindAssignmentTargetFlow(e.expression); } else { @@ -17719,16 +17796,16 @@ var ts; } } } - else if (node.kind === 182) { + else if (node.kind === 183) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 268) { + if (p.kind === 269) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 269) { + else if (p.kind === 270) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 270) { + else if (p.kind === 271) { bindAssignmentTargetFlow(p.expression); } } @@ -17784,7 +17861,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 58 && node.left.kind === 184) { + if (operator === 58 && node.left.kind === 185) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -17795,7 +17872,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 183) { + if (node.expression.kind === 184) { bindAssignmentTargetFlow(node.expression); } } @@ -17834,7 +17911,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 291) { + if (n.kind !== 292) { bind(n); } }); @@ -17849,10 +17926,10 @@ var ts; } function bindCallExpressionFlow(node) { var expr = node.expression; - while (expr.kind === 189) { + while (expr.kind === 190) { expr = expr.expression; } - if (expr.kind === 190 || expr.kind === 191) { + if (expr.kind === 191 || expr.kind === 192) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -17860,7 +17937,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 183) { + if (node.expression.kind === 184) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -17869,52 +17946,52 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 203: - case 233: - case 236: - case 182: - case 165: - case 283: - case 261: - return 1; + case 204: case 234: - return 1 | 64; case 237: + case 183: + case 165: + case 284: + case 262: + return 1; case 235: + return 1 | 64; + case 238: + case 236: case 176: return 1 | 32; - case 272: + case 273: return 1 | 4 | 32; case 153: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } case 154: - case 232: + case 233: case 152: case 155: case 156: case 157: - case 280: + case 281: case 162: case 158: case 159: case 163: return 1 | 4 | 32 | 8; - case 190: case 191: + case 192: return 1 | 4 | 32 | 8 | 16; - case 238: + case 239: return 4; case 151: return node.initializer ? 4 : 0; - case 267: - case 218: + case 268: case 219: case 220: - case 239: + case 221: + case 240: return 2; - case 211: + case 212: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -17927,20 +18004,20 @@ var ts; } function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 237: + case 238: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 272: + case 273: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 203: - case 233: + case 204: + case 234: return declareClassMember(node, symbolFlags, symbolExcludes); - case 236: + case 237: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 165: - case 283: - case 182: - case 234: - case 261: + case 284: + case 183: + case 235: + case 262: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 162: case 163: @@ -17952,11 +18029,11 @@ var ts; case 154: case 155: case 156: - case 232: - case 190: + case 233: case 191: - case 280: - case 235: + case 192: + case 281: + case 236: case 176: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } @@ -17972,11 +18049,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 272 ? node : node.body; - if (body && (body.kind === 272 || body.kind === 238)) { + var body = node.kind === 273 ? node : node.body; + if (body && (body.kind === 273 || body.kind === 239)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 248 || stat.kind === 247) { + if (stat.kind === 249 || stat.kind === 248) { return true; } } @@ -18044,11 +18121,11 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 270 || prop.name.kind !== 71) { + if (prop.kind === 271 || prop.name.kind !== 71) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 268 || prop.kind === 269 || prop.kind === 153 + var currentKind = prop.kind === 269 || prop.kind === 270 || prop.kind === 153 ? 1 : 2; var existingKind = seen.get(identifier.escapedText); @@ -18079,10 +18156,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 237: + case 238: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 272: + case 273: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -18171,8 +18248,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 272 && - blockScopeContainer.kind !== 237 && + if (blockScopeContainer.kind !== 273 && + blockScopeContainer.kind !== 238 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -18242,7 +18319,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 291) { + if (tag.kind === 292) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -18274,18 +18351,18 @@ var ts; case 71: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 291) { + while (parentNode && parentNode.kind !== 292) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 67901928); break; } case 99: - if (currentFlow && (ts.isExpression(node) || parent.kind === 269)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 270)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 183: + case 184: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } @@ -18293,7 +18370,7 @@ var ts; bindSpecialPropertyDeclaration(node); } break; - case 198: + case 199: var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { case 1: @@ -18320,17 +18397,17 @@ var ts; ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 267: + case 268: return checkStrictModeCatchClause(node); - case 192: + case 193: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 197: + case 198: return checkStrictModePostfixUnaryExpression(node); - case 196: + case 197: return checkStrictModePrefixUnaryExpression(node); - case 224: + case 225: return checkStrictModeWithStatement(node); case 173: seenThisKeyword = true; @@ -18341,18 +18418,18 @@ var ts; return bindTypeParameter(node); case 148: return bindParameter(node); - case 230: + case 231: return bindVariableDeclarationOrBindingElement(node); - case 180: + case 181: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); case 151: case 150: return bindPropertyWorker(node); - case 268: case 269: + case 270: return bindPropertyOrMethodOrAccessor(node, 4, 0); - case 271: + case 272: return bindPropertyOrMethodOrAccessor(node, 8, 68008959); case 157: case 158: @@ -18361,7 +18438,7 @@ var ts; case 153: case 152: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 67208127); - case 232: + case 233: return bindFunctionDeclaration(node); case 154: return declareSymbolAndAddToSymbolTable(node, 16384, 0); @@ -18370,72 +18447,72 @@ var ts; case 156: return bindPropertyOrMethodOrAccessor(node, 65536, 67183551); case 162: - case 280: + case 281: case 163: return bindFunctionOrConstructorType(node); case 165: - case 283: + case 284: case 176: return bindAnonymousTypeWorker(node); - case 182: + case 183: return bindObjectLiteralExpression(node); - case 190: case 191: + case 192: return bindFunctionExpression(node); - case 185: + case 186: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 203: - case 233: + case 204: + case 234: inStrictMode = true; return bindClassLikeDeclaration(node); - case 234: - return bindBlockScopedDeclaration(node, 64, 67901832); case 235: - return bindBlockScopedDeclaration(node, 524288, 67901928); + return bindBlockScopedDeclaration(node, 64, 67901832); case 236: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 524288, 67901928); case 237: + return bindEnumDeclaration(node); + case 238: return bindModuleDeclaration(node); - case 261: + case 262: return bindJsxAttributes(node); - case 260: + case 261: return bindJsxAttribute(node, 4, 0); - case 241: - case 244: - case 246: - case 250: - return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152); - case 240: - return bindNamespaceExportDeclaration(node); - case 243: - return bindImportClause(node); - case 248: - return bindExportDeclaration(node); + case 242: + case 245: case 247: + case 251: + return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152); + case 241: + return bindNamespaceExportDeclaration(node); + case 244: + return bindImportClause(node); + case 249: + return bindExportDeclaration(node); + case 248: return bindExportAssignment(node); - case 272: + case 273: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 211: + case 212: if (!ts.isFunctionLike(node.parent)) { return; } - case 238: + case 239: return updateStrictModeStatementList(node.statements); - case 287: - if (node.parent.kind !== 283) { + case 288: + if (node.parent.kind !== 284) { break; } - case 292: + case 293: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 279 ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 280 ? 4 | 16777216 : 4; return declareSymbolAndAddToSymbolTable(propTag, flags, 0); - case 291: { + case 292: { var fullName = node.fullName; if (!fullName || fullName.kind === 71) { return bindBlockScopedDeclaration(node, 524288, 67901928); @@ -18464,7 +18541,7 @@ var ts; bindAnonymousDeclaration(node, 2097152, getDeclarationName(node)); } else { - var flags = node.kind === 247 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 248 && ts.exportAssignmentIsAlias(node) ? 2097152 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863); @@ -18474,7 +18551,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 272) { + if (node.parent.kind !== 273) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -18541,8 +18618,8 @@ var ts; ts.Debug.assert(ts.isInJavaScriptFile(node)); var thisContainer = ts.getThisContainer(node, false); switch (thisContainer.kind) { - case 232: - case 190: + case 233: + case 191: var constructorSymbol = thisContainer.symbol; if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 58) { var l = thisContainer.parent.left; @@ -18564,7 +18641,7 @@ var ts; var symbolTable = ts.hasModifier(thisContainer, 32) ? containingClass.symbol.exports : containingClass.symbol.members; declareSymbol(symbolTable, containingClass.symbol, node, 4, 0, true); break; - case 272: + case 273: break; default: ts.Debug.fail(ts.Debug.showSyntaxKind(thisContainer)); @@ -18574,7 +18651,7 @@ var ts; if (node.expression.kind === 99) { bindThisPropertyAssignment(node); } - else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 272) { + else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 273) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -18618,9 +18695,9 @@ var ts; function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) { var symbol = getJSInitializerSymbolFromName(name); var isToplevelNamespaceableInitializer = ts.isBinaryExpression(propertyAccess.parent) - ? propertyAccess.parent.parent.parent.kind === 272 && - !!ts.getJavascriptInitializer(propertyAccess.parent.right, ts.isPrototypeAccess(propertyAccess.parent.left)) - : propertyAccess.parent.parent.kind === 272; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 273 && + !!ts.getJavascriptInitializer(ts.getInitializerOfBinaryExpression(propertyAccess.parent), ts.isPrototypeAccess(propertyAccess.parent.left)) + : propertyAccess.parent.parent.kind === 273; if (!isPrototypeProperty && (!symbol || !(symbol.flags & 1920)) && isToplevelNamespaceableInitializer) { var flags_1 = 1536 | 67108864; var excludeFlags_1 = 67215503 & ~67108864; @@ -18640,10 +18717,18 @@ var ts; var symbolTable = isPrototypeProperty ? (symbol.members || (symbol.members = ts.createSymbolTable())) : (symbol.exports || (symbol.exports = ts.createSymbolTable())); - var symbolFlags = 4 | (isToplevelNamespaceableInitializer ? 67108864 : 0); - var symbolExcludes = 0 & ~(isToplevelNamespaceableInitializer ? 67108864 : 0); + var jsContainerFlag = isToplevelNamespaceableInitializer ? 67108864 : 0; + var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(propertyAccess)); + var symbolFlags = (isMethod ? 8192 : 4) | jsContainerFlag; + var symbolExcludes = (isMethod ? 67208127 : 0) & ~jsContainerFlag; declareSymbol(symbolTable, symbol, propertyAccess, symbolFlags, symbolExcludes); } + function getParentOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.parent)) { + expr = expr.parent; + } + return expr.parent; + } function lookupSymbolForPropertyAccess(node, lookupContainer) { if (lookupContainer === void 0) { lookupContainer = container; } if (ts.isIdentifier(node)) { @@ -18673,7 +18758,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 233) { + if (node.kind === 234) { bindBlockScopedDeclaration(node, 32, 68008383); } else { @@ -18806,15 +18891,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 213) || - node.kind === 233 || - (node.kind === 237 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 236 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 214) || + node.kind === 234 || + (node.kind === 238 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 237 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !(node.flags & 2097152) && - (node.kind !== 212 || + (node.kind !== 213 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -18850,43 +18935,43 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 185: - return computeCallExpression(node, subtreeFlags); case 186: + return computeCallExpression(node, subtreeFlags); + case 187: return computeNewExpression(node, subtreeFlags); - case 237: + case 238: return computeModuleDeclaration(node, subtreeFlags); - case 189: + case 190: return computeParenthesizedExpression(node, subtreeFlags); - case 198: + case 199: return computeBinaryExpression(node, subtreeFlags); - case 214: + case 215: return computeExpressionStatement(node, subtreeFlags); case 148: return computeParameter(node, subtreeFlags); - case 191: + case 192: return computeArrowFunction(node, subtreeFlags); - case 190: + case 191: return computeFunctionExpression(node, subtreeFlags); - case 232: - return computeFunctionDeclaration(node, subtreeFlags); - case 230: - return computeVariableDeclaration(node, subtreeFlags); - case 231: - return computeVariableDeclarationList(node, subtreeFlags); - case 212: - return computeVariableStatement(node, subtreeFlags); - case 226: - return computeLabeledStatement(node, subtreeFlags); case 233: + return computeFunctionDeclaration(node, subtreeFlags); + case 231: + return computeVariableDeclaration(node, subtreeFlags); + case 232: + return computeVariableDeclarationList(node, subtreeFlags); + case 213: + return computeVariableStatement(node, subtreeFlags); + case 227: + return computeLabeledStatement(node, subtreeFlags); + case 234: return computeClassDeclaration(node, subtreeFlags); - case 203: + case 204: return computeClassExpression(node, subtreeFlags); - case 266: - return computeHeritageClause(node, subtreeFlags); case 267: + return computeHeritageClause(node, subtreeFlags); + case 268: return computeCatchClause(node, subtreeFlags); - case 205: + case 206: return computeExpressionWithTypeArguments(node, subtreeFlags); case 154: return computeConstructor(node, subtreeFlags); @@ -18897,11 +18982,11 @@ var ts; case 155: case 156: return computeAccessor(node, subtreeFlags); - case 241: + case 242: return computeImportEquals(node, subtreeFlags); - case 183: - return computePropertyAccess(node, subtreeFlags); case 184: + return computePropertyAccess(node, subtreeFlags); + case 185: return computeElementAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -18945,10 +19030,10 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 58 && leftKind === 182) { + if (operatorTokenKind === 58 && leftKind === 183) { transformFlags |= 8 | 192 | 3072; } - else if (operatorTokenKind === 58 && leftKind === 181) { + else if (operatorTokenKind === 58 && leftKind === 182) { transformFlags |= 192 | 3072; } else if (operatorTokenKind === 40 @@ -18986,8 +19071,8 @@ var ts; var expression = node.expression; var expressionKind = expression.kind; var expressionTransformFlags = expression.transformFlags; - if (expressionKind === 206 - || expressionKind === 188) { + if (expressionKind === 207 + || expressionKind === 189) { transformFlags |= 3; } if (expressionTransformFlags & 1024) { @@ -19286,12 +19371,12 @@ var ts; var excludeFlags = 939525441; switch (kind) { case 120: - case 195: + case 196: transformFlags |= 8 | 16; break; - case 188: - case 206: - case 295: + case 189: + case 207: + case 296: transformFlags |= 3; excludeFlags = 536872257; break; @@ -19301,17 +19386,16 @@ var ts; case 117: case 124: case 76: - case 236: - case 271: - case 207: + case 237: + case 272: + case 208: case 132: transformFlags |= 3; break; - case 253: case 254: case 255: - case 10: case 256: + case 10: case 257: case 258: case 259: @@ -19319,17 +19403,18 @@ var ts; case 261: case 262: case 263: + case 264: transformFlags |= 4; break; case 13: case 14: case 15: case 16: - case 200: - case 187: - case 269: + case 201: + case 188: + case 270: case 115: - case 208: + case 209: transformFlags |= 192; break; case 9: @@ -19342,13 +19427,13 @@ var ts; transformFlags |= 192; } break; - case 220: + case 221: if (node.awaitModifier) { transformFlags |= 8; } transformFlags |= 192; break; - case 201: + case 202: transformFlags |= 8 | 192 | 16777216; break; case 119: @@ -19378,14 +19463,14 @@ var ts; case 170: case 171: case 172: - case 234: case 235: + case 236: case 173: case 174: case 175: case 176: case 177: - case 240: + case 241: transformFlags = 3; excludeFlags = -3; break; @@ -19395,10 +19480,10 @@ var ts; transformFlags |= 65536; } break; - case 202: + case 203: transformFlags |= 192 | 524288; break; - case 270: + case 271: transformFlags |= 8 | 1048576; break; case 97: @@ -19408,18 +19493,18 @@ var ts; case 99: transformFlags |= 16384; break; - case 178: + case 179: transformFlags |= 192 | 8388608; if (subtreeFlags & 524288) { transformFlags |= 8 | 1048576; } excludeFlags = 940049729; break; - case 179: + case 180: transformFlags |= 192 | 8388608; excludeFlags = 940049729; break; - case 180: + case 181: transformFlags |= 192; if (node.dotDotDotToken) { transformFlags |= 524288; @@ -19428,7 +19513,7 @@ var ts; case 149: transformFlags |= 3 | 4096; break; - case 182: + case 183: excludeFlags = 942740801; if (subtreeFlags & 2097152) { transformFlags |= 192; @@ -19440,29 +19525,29 @@ var ts; transformFlags |= 8; } break; - case 181: - case 186: + case 182: + case 187: excludeFlags = 940049729; if (subtreeFlags & 524288) { transformFlags |= 192; } break; - case 216: case 217: case 218: case 219: + case 220: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 272: + case 273: if (subtreeFlags & 32768) { transformFlags |= 192; } break; - case 223: - case 221: + case 224: case 222: + case 223: transformFlags |= 33554432; break; } @@ -19470,27 +19555,27 @@ var ts; return transformFlags & ~excludeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 160 && kind <= 177) { + if (kind >= 160 && kind <= 178) { return -3; } switch (kind) { - case 185: case 186: - case 181: + case 187: + case 182: return 940049729; - case 237: + case 238: return 977327425; case 148: return 939525441; - case 191: + case 192: return 1003902273; - case 190: - case 232: - return 1003935041; - case 231: - return 948962625; + case 191: case 233: - case 203: + return 1003935041; + case 232: + return 948962625; + case 234: + case 204: return 942011713; case 154: return 1003668801; @@ -19512,24 +19597,24 @@ var ts; case 157: case 158: case 159: - case 234: case 235: + case 236: return -3; - case 182: + case 183: return 942740801; - case 267: + case 268: return 940574017; - case 178: case 179: + case 180: return 940049729; - case 188: - case 206: - case 295: case 189: + case 207: + case 296: + case 190: case 97: return 536872257; - case 183: case 184: + case 185: return 671089985; default: return 939525441; @@ -20212,6 +20297,7 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); } + ts.Debug.assert(host.fileExists(real), path + " linked to nonexistent file " + real); return real; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { @@ -20784,7 +20870,7 @@ var ts; return node ? getConstantValue(node) : undefined; }, isValidPropertyAccess: function (node, propertyName) { - node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); + node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedNameOrImportTypeNode); return !!node && isValidPropertyAccess(node, ts.escapeLeadingUnderscores(propertyName)); }, isValidPropertyAccessForCompletions: function (node, type, property) { @@ -20851,6 +20937,7 @@ var ts; getAllPossiblePropertiesOfTypes: getAllPossiblePropertiesOfTypes, getSuggestionForNonexistentProperty: function (node, type) { return getSuggestionForNonexistentProperty(node, type); }, getSuggestionForNonexistentSymbol: function (location, name, meaning) { return getSuggestionForNonexistentSymbol(location, ts.escapeLeadingUnderscores(name), meaning); }, + getSuggestionForNonexistentModule: function (node, target) { return getSuggestionForNonexistentModule(node, target); }, getBaseConstraintOfType: getBaseConstraintOfType, getDefaultFromTypeParameter: function (type) { return type && type.flags & 32768 ? getDefaultFromTypeParameter(type) : undefined; }, resolveName: function (name, location, meaning, excludeGlobals) { @@ -21278,7 +21365,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 237 && source.valueDeclaration.kind !== 237))) { + (target.valueDeclaration.kind === 238 && source.valueDeclaration.kind !== 238))) { target.valueDeclaration = source.valueDeclaration; } ts.addRange(target.declarations, source.declarations); @@ -21397,7 +21484,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 }); } function isGlobalSourceFile(node) { - return node.kind === 272 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 273 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -21443,23 +21530,23 @@ var ts; return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile); } if (declaration.pos <= usage.pos) { - if (declaration.kind === 180) { - var errorBindingElement = ts.getAncestor(usage, 180); + if (declaration.kind === 181) { + var errorBindingElement = ts.getAncestor(usage, 181); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 230), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 231), usage); } - else if (declaration.kind === 230) { + else if (declaration.kind === 231) { return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } return true; } - if (usage.parent.kind === 250 || (usage.parent.kind === 247 && usage.parent.isExportEquals)) { + if (usage.parent.kind === 251 || (usage.parent.kind === 248 && usage.parent.isExportEquals)) { return true; } - if (usage.kind === 247 && usage.isExportEquals) { + if (usage.kind === 248 && usage.isExportEquals) { return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -21467,9 +21554,9 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 212: - case 218: - case 220: + case 213: + case 219: + case 221: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } @@ -21522,7 +21609,7 @@ var ts; if (result = lookup(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 67901928 && lastLocation.kind !== 282) { + if (meaning & result.flags & 67901928 && lastLocation.kind !== 283) { useResult = result.flags & 262144 ? lastLocation === location.type || lastLocation.kind === 148 || @@ -21548,13 +21635,13 @@ var ts; } } switch (location.kind) { - case 272: + case 273: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 237: + case 238: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 272 || ts.isAmbientModule(location)) { + if (location.kind === 273 || ts.isAmbientModule(location)) { if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) { @@ -21565,7 +21652,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 && - ts.getDeclarationOfKind(moduleExport, 250)) { + ts.getDeclarationOfKind(moduleExport, 251)) { break; } } @@ -21573,7 +21660,7 @@ var ts; break loop; } break; - case 236: + case 237: if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } @@ -21589,9 +21676,9 @@ var ts; } } break; - case 233: - case 203: case 234: + case 204: + case 235: if (result = lookup(getMembersOfSymbol(getSymbolOfNode(location)), name, meaning & 67901928)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { result = undefined; @@ -21603,7 +21690,7 @@ var ts; } break loop; } - if (location.kind === 203 && meaning & 32) { + if (location.kind === 204 && meaning & 32) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -21611,7 +21698,7 @@ var ts; } } break; - case 205: + case 206: if (lastLocation === location.expression && location.parent.token === 85) { var container = location.parent.parent; if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67901928))) { @@ -21624,7 +21711,7 @@ var ts; break; case 146: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 234) { + if (ts.isClassLike(grandparent) || grandparent.kind === 235) { if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67901928)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -21636,14 +21723,14 @@ var ts; case 154: case 155: case 156: - case 232: - case 191: + case 233: + case 192: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 190: + case 191: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -21671,12 +21758,12 @@ var ts; lastLocation = location; location = location.parent; } - if (isUse && result && nameNotFoundMessage && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { + if (isUse && result && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { result.isReferenced |= meaning; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 272); + ts.Debug.assert(lastLocation.kind === 273); if (lastLocation.commonJsModuleIndicator && name === "exports") { return lastLocation.symbol; } @@ -21722,9 +21809,9 @@ var ts; checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); } } - if (result && isInExternalModule && (meaning & 67216319) === 67216319) { + if (result && isInExternalModule && (meaning & 67216319) === 67216319 && !(originalLocation.flags & 1048576)) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 240) { + if (decls && decls.length === 1 && decls[0].kind === 241) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); } } @@ -21733,12 +21820,12 @@ var ts; } function isSelfReferenceLocation(node) { switch (node.kind) { - case 232: case 233: case 234: - case 236: case 235: case 237: + case 236: + case 238: return true; default: return false; @@ -21796,9 +21883,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 71: - case 183: + case 184: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 205: + case 206: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -21860,7 +21947,7 @@ var ts; } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert(!!(result.flags & 2 || result.flags & 32 || result.flags & 384)); - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 236) ? d : undefined; }); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 237) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); if (!(declaration.flags & 2097152) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { if (result.flags & 2) { @@ -21879,13 +21966,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 241: + case 242: return node; - case 243: - return node.parent; case 244: + return node.parent; + case 245: return node.parent.parent; - case 246: + case 247: return node.parent.parent.parent; default: return undefined; @@ -21895,7 +21982,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { - if (node.moduleReference.kind === 252) { + if (node.moduleReference.kind === 253) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); @@ -21914,8 +22001,8 @@ var ts; return false; } if (!file || file.isDeclarationFile) { - var defaultExportSymbol = resolveExportByName(moduleSymbol, "default", dontResolveAlias); - if (defaultExportSymbol && defaultExportSymbol.valueDeclaration && isSyntacticDefault(defaultExportSymbol.valueDeclaration)) { + var defaultExportSymbol = resolveExportByName(moduleSymbol, "default", true); + if (defaultExportSymbol && ts.some(defaultExportSymbol.declarations, isSyntacticDefault)) { return false; } if (resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), dontResolveAlias)) { @@ -22035,29 +22122,36 @@ var ts; resolveEntityName(node.propertyName || node.name, meaning, false, dontResolveAlias); } function getTargetOfExportAssignment(node, dontResolveAlias) { - return resolveEntityName(node.expression, 67216319 | 67901928 | 1920, false, dontResolveAlias); + var aliasLike = resolveEntityName(node.expression, 67216319 | 67901928 | 1920, true, dontResolveAlias); + if (aliasLike) { + return aliasLike; + } + checkExpression(node.expression); + return getNodeLinks(node.expression).resolvedSymbol; } function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { - case 241: + case 242: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 243: - return getTargetOfImportClause(node, dontRecursivelyResolve); case 244: + return getTargetOfImportClause(node, dontRecursivelyResolve); + case 245: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 246: - return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 250: - return getTargetOfExportSpecifier(node, 67216319 | 67901928 | 1920, dontRecursivelyResolve); case 247: + return getTargetOfImportSpecifier(node, dontRecursivelyResolve); + case 251: + return getTargetOfExportSpecifier(node, 67216319 | 67901928 | 1920, dontRecursivelyResolve); + case 248: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 240: + case 241: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); } } function isNonLocalAlias(symbol, excludes) { if (excludes === void 0) { excludes = 67216319 | 67901928 | 1920; } - return symbol && (symbol.flags & (2097152 | excludes)) === 2097152; + if (!symbol) + return false; + return (symbol.flags & (2097152 | excludes)) === 2097152 || (symbol.flags & 2097152 && symbol.flags & 67108864); } function resolveSymbol(symbol, dontResolveAlias) { var shouldResolve = !dontResolveAlias && isNonLocalAlias(symbol); @@ -22100,10 +22194,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 247) { + if (node.kind === 248) { checkExpressionCached(node.expression); } - else if (node.kind === 250) { + else if (node.kind === 251) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -22119,7 +22213,7 @@ var ts; return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 241); + ts.Debug.assert(entityName.parent.kind === 242); return resolveEntityName(entityName, 67216319 | 67901928 | 1920, false, dontResolveAlias); } } @@ -22139,7 +22233,7 @@ var ts; return undefined; } } - else if (name.kind === 145 || name.kind === 183) { + else if (name.kind === 145 || name.kind === 184) { var left = name.kind === 145 ? name.left : name.expression; var right = name.kind === 145 ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, false, location); @@ -22205,7 +22299,8 @@ var ts; if (ambientModule) { return ambientModule; } - var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference); + var currentSourceFile = ts.getSourceFileOfNode(location); + var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference); var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule); var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { @@ -22261,15 +22356,15 @@ var ts; function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) { return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias)) || moduleSymbol; } - function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression, dontResolveAlias) { + function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) { var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { if (!(symbol.flags & (1536 | 3))) { - error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); + error(referencingLocation, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); return symbol; } if (compilerOptions.esModuleInterop) { - var referenceParent = moduleReferenceExpression.parent; + var referenceParent = referencingLocation.parent; if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) || ts.isImportCall(referenceParent)) { var type = getTypeOfSymbol(symbol); @@ -22497,11 +22592,11 @@ var ts; } } switch (location.kind) { - case 272: + case 273: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 237: + case 238: if (result = callback(getSymbolOfNode(location).exports)) { return result; } @@ -22519,11 +22614,8 @@ var ts; return undefined; } var id = "" + getSymbolId(symbol); - var visitedSymbolTables; - if (visitedSymbolTablesMap.has(id)) { - visitedSymbolTables = visitedSymbolTablesMap.get(id); - } - else { + var visitedSymbolTables = visitedSymbolTablesMap.get(id); + if (!visitedSymbolTables) { visitedSymbolTablesMap.set(id, visitedSymbolTables = []); } return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); @@ -22577,7 +22669,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 250)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 251)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -22655,7 +22747,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 272 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 273 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -22687,8 +22779,8 @@ var ts; entityName.parent.kind === 146) { meaning = 67216319 | 1048576; } - else if (entityName.kind === 145 || entityName.kind === 183 || - entityName.parent.kind === 241) { + else if (entityName.kind === 145 || entityName.kind === 184 || + entityName.parent.kind === 242) { meaning = 1920; } else { @@ -22870,7 +22962,7 @@ var ts; if (type.flags & 1024) { if (!(context.flags & 1048576)) { if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) { - return ts.createTypeQueryNode(symbolToName(type.symbol, context, 67216319, false)); + return symbolToTypeNode(type.symbol, context, 67216319); } if (context.tracker.reportInaccessibleUniqueSymbolError) { context.tracker.reportInaccessibleUniqueSymbolError(); @@ -22978,16 +23070,15 @@ var ts; function createAnonymousTypeNode(type) { var symbol = type.symbol; if (symbol) { - if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 203 && context.flags & 2048) || + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 204 && context.flags & 2048) || symbol.flags & (384 | 512) || shouldWriteTypeOfFunctionSymbol()) { - return createTypeQueryNodeFromSymbol(symbol, 67216319); + return symbolToTypeNode(symbol, context, 67216319); } else if (ts.contains(context.symbolStack, symbol)) { var typeAlias = getTypeAliasForTypeLiteral(type); if (typeAlias) { - var entityName = symbolToName(typeAlias, context, 67901928, false); - return ts.createTypeReferenceNode(entityName, undefined); + return symbolToTypeNode(typeAlias, context, 67901928); } else { return ts.createKeywordTypeNode(119); @@ -23018,7 +23109,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 272 || declaration.parent.kind === 238; + return declaration.parent.kind === 273 || declaration.parent.kind === 239; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return (!!(context.flags & 4096) || ts.contains(context.symbolStack, symbol)) && @@ -23053,10 +23144,6 @@ var ts; var typeLiteralNode = ts.createTypeLiteralNode(members); return ts.setEmitFlags(typeLiteralNode, (context.flags & 1024) ? 0 : 1); } - function createTypeQueryNodeFromSymbol(symbol, symbolFlags) { - var entityName = symbolToName(symbol, context, symbolFlags, false); - return ts.createTypeQueryNode(entityName); - } function symbolToTypeReferenceName(symbol) { var entityName = symbol.flags & 32 || !isReservedMemberName(symbol.escapedName) ? symbolToName(symbol, context, 67901928, false) : ts.createIdentifier(""); return entityName; @@ -23208,6 +23295,9 @@ var ts; var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 152, context); methodDeclaration.name = propertyName; methodDeclaration.questionToken = optionalToken; + if (propertySymbol.valueDeclaration) { + ts.setCommentRange(methodDeclaration, propertySymbol.valueDeclaration); + } typeElements.push(methodDeclaration); } } @@ -23218,6 +23308,9 @@ var ts; context.flags = savedFlags; var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(132)] : undefined; var propertySignature = ts.createPropertySignature(modifiers, propertyName, optionalToken, propertyTypeNode, undefined); + if (propertySymbol.valueDeclaration) { + ts.setCommentRange(propertySignature, propertySymbol.valueDeclaration); + } typeElements.push(propertySignature); } } @@ -23256,7 +23349,7 @@ var ts; else { typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); }); } - var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context); }); + var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 154); }); if (signature.thisParameter) { var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context); parameters.unshift(thisParameter); @@ -23295,7 +23388,7 @@ var ts; context.flags = savedContextFlags; return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); } - function symbolToParameterDeclaration(parameterSymbol, context) { + function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) { var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 148); ts.Debug.assert(!!parameterDeclaration || isTransientSymbol(parameterSymbol) && !!parameterSymbol.isRestParameter); var parameterType = getTypeOfSymbol(parameterSymbol); @@ -23303,7 +23396,7 @@ var ts; parameterType = getOptionalType(parameterType); } var parameterTypeNode = typeToTypeNodeHelper(parameterType, context); - var modifiers = !(context.flags & 8192) && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone); + var modifiers = !(context.flags & 8192) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone); var dotDotDotToken = !parameterDeclaration || ts.isRestParameter(parameterDeclaration) ? ts.createToken(24) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? @@ -23320,7 +23413,7 @@ var ts; function elideInitializerAndSetEmitFlags(node) { var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, undefined, elideInitializerAndSetEmitFlags); var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited); - if (clone.kind === 180) { + if (clone.kind === 181) { clone.initializer = undefined; } return ts.setEmitFlags(clone, 1 | 16777216); @@ -23388,6 +23481,34 @@ var ts; } return typeParameterNodes; } + function symbolToTypeNode(symbol, context, meaning) { + var chain = lookupSymbolChain(symbol, context, meaning); + context.flags |= 16777216; + var rootName = getNameOfSymbolAsWritten(chain[0], context); + context.flags ^= 16777216; + var isTypeOf = meaning === 67216319; + if (ambientModuleSymbolRegex.test(rootName)) { + var nonRootParts = chain.length > 1 ? createEntityNameFromSymbolChain(chain, chain.length - 1, 1) : undefined; + var typeParameterNodes = lookupTypeParameterNodes(chain, 0, context); + return ts.createImportTypeNode(ts.createLiteralTypeNode(ts.createLiteral(rootName.substring(1, rootName.length - 1))), nonRootParts, typeParameterNodes, isTypeOf); + } + var entityName = createEntityNameFromSymbolChain(chain, chain.length - 1, 0); + return isTypeOf ? ts.createTypeQueryNode(entityName) : ts.createTypeReferenceNode(entityName, undefined); + function createEntityNameFromSymbolChain(chain, index, stopper) { + var typeParameterNodes = lookupTypeParameterNodes(chain, index, context); + var symbol = chain[index]; + if (index === 0) { + context.flags |= 16777216; + } + var symbolName = getNameOfSymbolAsWritten(symbol, context); + if (index === 0) { + context.flags ^= 16777216; + } + var identifier = ts.setEmitFlags(ts.createIdentifier(symbolName, typeParameterNodes), 16777216); + identifier.symbol = symbol; + return index > stopper ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1, stopper), identifier) : identifier; + } + } function symbolToName(symbol, context, meaning, expectsIdentifier) { var chain = lookupSymbolChain(symbol, context, meaning); if (expectsIdentifier && chain.length !== 1 @@ -23502,7 +23623,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 172; }); - if (node.kind === 235) { + if (node.kind === 236) { return getSymbolOfNode(node); } } @@ -23510,11 +23631,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 238 && + node.parent.kind === 239 && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 272 || ts.isAmbientModule(location); + return location.kind === 273 || ts.isAmbientModule(location); } function getNameOfSymbolAsWritten(symbol, context) { if (context && symbol.escapedName === "default" && !(context.flags & 16384) && @@ -23529,17 +23650,17 @@ var ts; if (name) { return ts.declarationNameToString(name); } - if (declaration.parent && declaration.parent.kind === 230) { + if (declaration.parent && declaration.parent.kind === 231) { return ts.declarationNameToString(declaration.parent.name); } if (context && !context.encounteredError && !(context.flags & 131072)) { context.encounteredError = true; } switch (declaration.kind) { - case 203: + case 204: return "(Anonymous class)"; - case 190: case 191: + case 192: return "(Anonymous function)"; } } @@ -23562,26 +23683,26 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 180: + case 181: return isDeclarationVisible(node.parent.parent); - case 230: + case 231: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 237: - case 233: + case 238: case 234: case 235: - case 232: case 236: - case 241: + case 233: + case 237: + case 242: if (ts.isExternalModuleAugmentation(node)) { return true; } var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 241 && parent.kind !== 272 && parent.flags & 2097152)) { + !(node.kind !== 242 && parent.kind !== 273 && parent.flags & 2097152)) { return isGlobalSourceFile(parent); } return isDeclarationVisible(parent); @@ -23599,7 +23720,7 @@ var ts; case 157: case 159: case 148: - case 238: + case 239: case 162: case 163: case 165: @@ -23610,15 +23731,15 @@ var ts; case 169: case 172: return isDeclarationVisible(node.parent); - case 243: case 244: - case 246: + case 245: + case 247: return false; case 147: - case 272: - case 240: + case 273: + case 241: return true; - case 247: + case 248: return false; default: return false; @@ -23627,10 +23748,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 247) { + if (node.parent && node.parent.kind === 248) { exportSymbol = resolveName(node, node.escapedText, 67216319 | 67901928 | 1920 | 2097152, undefined, node, false); } - else if (node.parent.kind === 250) { + else if (node.parent.kind === 251) { exportSymbol = getTargetOfExportSpecifier(node.parent, 67216319 | 67901928 | 1920 | 2097152); } var result; @@ -23711,12 +23832,12 @@ var ts; function getDeclarationContainer(node) { node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 230: case 231: + case 232: + case 247: case 246: case 245: case 244: - case 243: return false; default: return true; @@ -23782,7 +23903,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 178) { + if (pattern.kind === 179) { if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -23857,18 +23978,18 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 181 && expr.elements.length === 0; + return expr.kind === 182 && expr.elements.length === 0; } function addOptionality(type, optional) { if (optional === void 0) { optional = true; } return strictNullChecks && optional ? getOptionalType(type) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 219) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 220) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (32768 | 524288) ? indexType : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 220) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 221) { var forOfStatement = declaration.parent.parent; return checkRightHandSideOfForOf(forOfStatement.expression, forOfStatement.awaitModifier) || anyType; } @@ -23882,7 +24003,7 @@ var ts; return addOptionality(declaredType, isOptional); } if ((noImplicitAny || ts.isInJavaScriptFile(declaration)) && - declaration.kind === 230 && !ts.isBindingPattern(declaration.name) && + declaration.kind === 231 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 2097152)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -23941,8 +24062,8 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var declarationInConstructor = false; - var expression = declaration.kind === 198 ? declaration : - declaration.kind === 183 ? ts.getAncestor(declaration, 198) : + var expression = declaration.kind === 199 ? declaration : + declaration.kind === 184 ? ts.getAncestor(declaration, 199) : undefined; if (!expression) { return unknownType; @@ -23950,8 +24071,8 @@ var ts; if (ts.isPropertyAccessExpression(expression.left) && expression.left.expression.kind === 99) { var thisContainer = ts.getThisContainer(expression, false); declarationInConstructor = thisContainer.kind === 154 || - thisContainer.kind === 232 || - (thisContainer.kind === 190 && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + thisContainer.kind === 233 || + (thisContainer.kind === 191 && !ts.isPrototypePropertyAssignment(thisContainer.parent)); if (declarationInConstructor) { definedInConstructor = true; } @@ -24056,7 +24177,7 @@ var ts; return result; } function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 178 + return pattern.kind === 179 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -24100,7 +24221,7 @@ var ts; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 247) { + if (declaration.kind === 248) { return links.type = checkExpression(declaration.expression); } if (ts.isInJavaScriptFile(declaration) && ts.isJSDocPropertyLikeTag(declaration) && declaration.typeExpression) { @@ -24110,8 +24231,8 @@ var ts; return unknownType; } var type = void 0; - if (declaration.kind === 198 || - declaration.kind === 183 && declaration.parent.kind === 198) { + if (declaration.kind === 199 || + declaration.kind === 184 && declaration.parent.kind === 199) { type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } else if (ts.isJSDocPropertyTag(declaration) @@ -24236,6 +24357,10 @@ var ts; if (symbol.flags & 1536 && ts.isShorthandAmbientModuleSymbol(symbol)) { links.type = anyType; } + else if (symbol.valueDeclaration.kind === 199 || + symbol.valueDeclaration.kind === 184 && symbol.valueDeclaration.parent.kind === 199) { + links.type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); + } else { var type = createObjectType(16, symbol); if (symbol.flags & 32) { @@ -24358,21 +24483,21 @@ var ts; return undefined; } switch (node.kind) { - case 233: - case 203: case 234: + case 204: + case 235: case 157: case 158: case 152: case 162: case 163: - case 280: - case 232: + case 281: + case 233: case 153: - case 190: case 191: - case 235: - case 290: + case 192: + case 236: + case 291: case 176: case 170: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); @@ -24384,22 +24509,22 @@ var ts; } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node) || ts.emptyArray); var thisType = includeThisTypes && - (node.kind === 233 || node.kind === 203 || node.kind === 234) && + (node.kind === 234 || node.kind === 204 || node.kind === 235) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 234); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 235); return getOuterTypeParameters(declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 234 || node.kind === 233 || - node.kind === 203 || node.kind === 235) { + if (node.kind === 235 || node.kind === 234 || + node.kind === 204 || node.kind === 236) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -24557,7 +24682,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 234 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 235 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -24586,7 +24711,7 @@ var ts; function isThislessInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 234) { + if (declaration.kind === 235) { if (declaration.flags & 64) { return false; } @@ -24637,9 +24762,9 @@ var ts; return unknownType; } var declaration = ts.find(symbol.declarations, function (d) { - return d.kind === 291 || d.kind === 235; + return d.kind === 292 || d.kind === 236; }); - var typeNode = declaration.kind === 291 ? declaration.typeExpression : declaration.type; + var typeNode = declaration.kind === 292 ? declaration.typeExpression : declaration.type; var type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -24666,7 +24791,7 @@ var ts; case 9: case 8: return true; - case 196: + case 197: return expr.operator === 38 && expr.operand.kind === 8; case 71: @@ -24683,7 +24808,7 @@ var ts; var hasNonLiteralMember = false; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 236) { + if (declaration.kind === 237) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && member.initializer.kind === 9) { @@ -24710,7 +24835,7 @@ var ts; var memberTypeList = []; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 236) { + if (declaration.kind === 237) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var memberType = getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member)); @@ -25512,14 +25637,22 @@ var ts; return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; } function getDefaultConstraintOfConditionalType(type) { - return getUnionType([getInferredTrueTypeFromConditionalType(type), getFalseTypeFromConditionalType(type)]); + if (!type.resolvedDefaultConstraint) { + var rootTrueType = type.root.trueType; + var rootTrueConstraint = rootTrueType.flags & 4194304 ? rootTrueType.substitute : rootTrueType; + type.resolvedDefaultConstraint = getUnionType([instantiateType(rootTrueConstraint, type.combinedMapper || type.mapper), getFalseTypeFromConditionalType(type)]); + } + return type.resolvedDefaultConstraint; } function getConstraintOfDistributiveConditionalType(type) { if (type.root.isDistributive) { var constraint = getConstraintOfType(type.checkType); if (constraint) { var mapper = createTypeMapper([type.root.checkType], [constraint]); - return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + var instantiated = getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + if (!(instantiated.flags & 16384)) { + return instantiated; + } } } return undefined; @@ -25678,7 +25811,7 @@ var ts; (modifiers & 16 ? 128 : 0) | (modifiers & 8 ? 256 : 0) | (modifiers & 32 ? 512 : 0); - if (!isMethodLike(prop)) { + if (!isPrototypeProperty(prop)) { syntheticFlag = 2; } } @@ -25811,10 +25944,10 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - return ts.isInJavaScriptFile(node) && (node.type && node.type.kind === 279 + return ts.isInJavaScriptFile(node) && (node.type && node.type.kind === 280 || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 279; + return isBracketed || !!typeExpression && typeExpression.type.kind === 280; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -26022,7 +26155,8 @@ var ts; return ts.emptyArray; var result = []; for (var i = 0; i < symbol.declarations.length; i++) { - var node = symbol.declarations[i]; + var decl = symbol.declarations[i]; + var node = ts.isPropertyAccessExpression(decl) ? ts.getAssignedJavascriptInitializer(decl) : decl; if (!ts.isFunctionLike(node)) continue; if (i > 0 && node.body) { @@ -26310,7 +26444,7 @@ var ts; var isJs = ts.isInJavaScriptFile(node); var isJsImplicitAny = !noImplicitAny && isJs; if (!isJsImplicitAny && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { - var missingAugmentsTag = isJs && node.parent.kind !== 285; + var missingAugmentsTag = isJs && node.parent.kind !== 286; var diag = minTypeArgumentCount === typeParameters.length ? missingAugmentsTag ? ts.Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag @@ -26360,7 +26494,7 @@ var ts; switch (node.kind) { case 161: return node.typeName; - case 205: + case 206: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { return expr; @@ -26430,7 +26564,7 @@ var ts; } function getConstrainedTypeVariable(typeVariable, node) { var constraints; - while (ts.isPartOfTypeNode(node)) { + while (node && !ts.isStatement(node)) { var parent = node.parent; if (parent.kind === 170 && node === parent.trueType) { var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType); @@ -26447,7 +26581,7 @@ var ts; } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : ts.declarationNameToString(node.typeName)); + error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? ts.declarationNameToString(node.typeName) : "(anonymous)"); return false; } return true; @@ -26538,9 +26672,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 233: case 234: - case 236: + case 235: + case 237: return declaration; } } @@ -27039,7 +27173,7 @@ var ts; return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 184 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 185 ? accessNode : undefined; var propName = isTypeUsableAsLateBoundName(indexType) ? getLateBoundNameFromType(indexType) : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ? ts.getPropertyNameForKnownSymbolName(ts.idText(accessExpression.argumentExpression.name)) : @@ -27089,7 +27223,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 184 ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 185 ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 | 64)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)); } @@ -27166,7 +27300,7 @@ var ts; if (objectType === wildcardType || indexType === wildcardType) { return wildcardType; } - if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind === 184) && isGenericObjectType(objectType)) { + if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind === 185) && isGenericObjectType(objectType)) { if (objectType.flags & 1) { return objectType; } @@ -27264,11 +27398,6 @@ var ts; function getFalseTypeFromConditionalType(type) { return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper)); } - function getInferredTrueTypeFromConditionalType(type) { - return type.combinedMapper ? - type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper)) : - getTrueTypeFromConditionalType(type); - } function getInferTypeParameters(node) { var result; if (node.locals) { @@ -27280,13 +27409,27 @@ var ts; } return result; } + function isPossiblyReferencedInConditionalType(tp, node) { + if (isTypeParameterPossiblyReferenced(tp, node)) { + return true; + } + while (node) { + if (node.kind === 170) { + if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) { + return true; + } + } + node = node.parent; + } + return false; + } function getTypeFromConditionalTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var checkType = getTypeFromTypeNode(node.checkType); var aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); var allOuterTypeParameters = getOuterTypeParameters(node, true); - var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); }); + var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); }); var root = { node: node, checkType: checkType, @@ -27315,6 +27458,75 @@ var ts; } return links.resolvedType; } + function getIdentifierChain(node) { + if (ts.isIdentifier(node)) { + return [node]; + } + else { + return ts.append(getIdentifierChain(node.left), node.right); + } + } + function getTypeFromImportTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + if (node.isTypeOf && node.typeArguments) { + error(node, ts.Diagnostics.Type_arguments_cannot_be_used_here); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + if (!ts.isLiteralImportTypeNode(node)) { + error(node.argument, ts.Diagnostics.String_literal_expected); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + var argumentType = getTypeFromTypeNode(node.argument); + var targetMeaning = node.isTypeOf ? 67216319 : 67901928; + var moduleName = argumentType.value; + var innerModuleSymbol = resolveExternalModule(node, moduleName, ts.Diagnostics.Cannot_find_module_0, node, false); + if (!innerModuleSymbol) { + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + var moduleSymbol = resolveExternalModuleSymbol(innerModuleSymbol, false); + if (!ts.nodeIsMissing(node.qualifier)) { + var nameStack = getIdentifierChain(node.qualifier); + var currentNamespace = moduleSymbol; + var current = void 0; + while (current = nameStack.shift()) { + var meaning = nameStack.length ? 1920 : targetMeaning; + var next = getSymbol(getExportsOfSymbol(getMergedSymbol(resolveSymbol(currentNamespace))), current.escapedText, meaning); + if (!next) { + error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current)); + return links.resolvedType = unknownType; + } + getNodeLinks(current).resolvedSymbol = next; + getNodeLinks(current.parent).resolvedSymbol = next; + currentNamespace = next; + } + resolveImportSymbolType(node, links, currentNamespace, targetMeaning); + } + else { + if (moduleSymbol.flags & targetMeaning) { + resolveImportSymbolType(node, links, moduleSymbol, targetMeaning); + } + else { + error(node, targetMeaning === 67216319 ? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here, moduleName); + links.resolvedSymbol = unknownSymbol; + links.resolvedType = unknownType; + } + } + } + return links.resolvedType; + } + function resolveImportSymbolType(node, links, symbol, meaning) { + links.resolvedSymbol = symbol; + if (meaning === 67216319) { + return links.resolvedType = getTypeOfSymbol(symbol); + } + else { + return links.resolvedType = getTypeReferenceType(node, symbol); + } + } function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -27335,7 +27547,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 235 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 236 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -27485,7 +27697,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 234)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 235)) { if (!ts.hasModifier(container, 32) && (container.kind !== 154 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -27504,8 +27716,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 119: - case 275: case 276: + case 277: return anyType; case 137: return stringType; @@ -27534,7 +27746,7 @@ var ts; return getTypeFromTypeReference(node); case 160: return booleanType; - case 205: + case 206: return getTypeFromTypeReference(node); case 164: return getTypeFromTypeQueryNode(node); @@ -27546,21 +27758,21 @@ var ts; return getTypeFromUnionTypeNode(node); case 169: return getTypeFromIntersectionTypeNode(node); - case 277: + case 278: return getTypeFromJSDocNullableTypeNode(node); - case 279: + case 280: return addOptionality(getTypeFromTypeNode(node.type)); case 172: - case 278: - case 274: + case 279: + case 275: return getTypeFromTypeNode(node.type); - case 281: + case 282: return getTypeFromJSDocVariadicType(node); case 162: case 163: case 165: - case 283: - case 280: + case 284: + case 281: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 174: return getTypeFromTypeOperatorNode(node); @@ -27572,6 +27784,8 @@ var ts; return getTypeFromConditionalTypeNode(node); case 171: return getTypeFromInferTypeNode(node); + case 178: + return getTypeFromImportTypeNode(node); case 71: case 145: var symbol = getSymbolAtLocation(node); @@ -27698,7 +27912,7 @@ var ts; symbol = links.target; mapper = combineTypeMappers(links.mapper, mapper); } - var result = createSymbol(symbol.flags, symbol.escapedName, 1); + var result = createSymbol(symbol.flags, symbol.escapedName, 1 | (ts.getCheckFlags(symbol) & 1024)); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -27742,10 +27956,14 @@ var ts; } return type; } + function maybeTypeParameterReference(node) { + return !(node.kind === 145 || + node.parent.kind === 161 && node.parent.typeArguments && node === node.parent.typeName); + } function isTypeParameterPossiblyReferenced(tp, node) { if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container_2 = tp.symbol.declarations[0].parent; - if (ts.findAncestor(node, function (n) { return n.kind === 211 ? "quit" : n === container_2; })) { + if (ts.findAncestor(node, function (n) { return n.kind === 212 ? "quit" : n === container_2; })) { return ts.forEachChild(node, containsReference); } } @@ -27755,7 +27973,8 @@ var ts; case 173: return tp.isThisType; case 71: - return !tp.isThisType && ts.isPartOfTypeNode(node) && getTypeFromTypeNode(node) === tp; + return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && + getTypeFromTypeNode(node) === tp; case 164: return true; } @@ -27873,29 +28092,29 @@ var ts; function isContextSensitive(node) { ts.Debug.assert(node.kind !== 153 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 190: case 191: + case 192: case 153: return isContextSensitiveFunctionLikeDeclaration(node); - case 182: + case 183: return ts.forEach(node.properties, isContextSensitive); - case 181: + case 182: return ts.forEach(node.elements, isContextSensitive); - case 199: + case 200: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 198: + case 199: return node.operatorToken.kind === 54 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 268: + case 269: return isContextSensitive(node.initializer); - case 189: + case 190: return isContextSensitive(node.expression); - case 261: + case 262: return ts.forEach(node.properties, isContextSensitive); - case 260: + case 261: return node.initializer && isContextSensitive(node.initializer); - case 263: + case 264: return node.expression && isContextSensitive(node.expression); } return false; @@ -27907,13 +28126,13 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 191) { + if (node.kind !== 192) { var parameter = ts.firstOrUndefined(node.parameters); if (!(parameter && ts.parameterIsThisKeyword(parameter))) { return true; } } - return node.body.kind === 211 ? false : isContextSensitive(node.body); + return node.body.kind === 212 ? false : isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (ts.isInJavaScriptFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && @@ -29726,7 +29945,7 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 198: + case 199: case 151: case 150: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; @@ -29736,16 +29955,16 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 180: + case 181: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 232: + case 233: case 153: case 152: case 155: case 156: - case 190: case 191: + case 192: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -30326,13 +30545,13 @@ var ts; if (node.kind === 99) { return "0"; } - if (node.kind === 183) { + if (node.kind === 184) { var key = getFlowCacheKey(node.expression); return key && key + "." + ts.idText(node.name); } - if (node.kind === 180) { + if (node.kind === 181) { var container = node.parent.parent; - var key = container.kind === 180 ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); + var key = container.kind === 181 ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); var text = getBindingElementNameText(node); var result = key && text && (key + "." + text); return result; @@ -30340,7 +30559,7 @@ var ts; return undefined; } function getBindingElementNameText(element) { - if (element.parent.kind === 178) { + if (element.parent.kind === 179) { var name = element.propertyName || element.name; switch (name.kind) { case 71: @@ -30362,26 +30581,26 @@ var ts; switch (source.kind) { case 71: return target.kind === 71 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 230 || target.kind === 180) && + (target.kind === 231 || target.kind === 181) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 99: return target.kind === 99; case 97: return target.kind === 97; - case 183: - return target.kind === 183 && + case 184: + return target.kind === 184 && source.name.escapedText === target.name.escapedText && isMatchingReference(source.expression, target.expression); - case 180: - if (target.kind !== 183) + case 181: + if (target.kind !== 184) return false; var t = target; if (t.name.escapedText !== getBindingElementNameText(source)) return false; - if (source.parent.parent.kind === 180 && isMatchingReference(source.parent.parent, t.expression)) { + if (source.parent.parent.kind === 181 && isMatchingReference(source.parent.parent, t.expression)) { return true; } - if (source.parent.parent.kind === 230) { + if (source.parent.parent.kind === 231) { var maybeId = source.parent.parent.initializer; return maybeId && isMatchingReference(maybeId, t.expression); } @@ -30389,7 +30608,7 @@ var ts; return false; } function containsMatchingReference(source, target) { - while (source.kind === 183) { + while (source.kind === 184) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -30398,7 +30617,7 @@ var ts; return false; } function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 183 && + return target.kind === 184 && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.escapedText); } @@ -30406,7 +30625,7 @@ var ts; if (expr.kind === 71) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 183) { + if (expr.kind === 184) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.escapedText); } @@ -30450,7 +30669,7 @@ var ts; } } } - if (callExpression.expression.kind === 183 && + if (callExpression.expression.kind === 184 && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -30579,15 +30798,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, undefined, false, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 181 && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 268 && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 182 && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 269 && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 198 && parent.parent.left === parent || - parent.parent.kind === 220 && parent.parent.initializer === parent; + return parent.parent.kind === 199 && parent.parent.left === parent || + parent.parent.kind === 221 && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -30604,21 +30823,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 219: - return stringType; case 220: + return stringType; + case 221: return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; - case 198: + case 199: return getAssignedTypeOfBinaryExpression(parent); - case 192: + case 193: return undefinedType; - case 181: + case 182: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 202: + case 203: return getAssignedTypeOfSpreadExpression(parent); - case 268: - return getAssignedTypeOfPropertyAssignment(parent); case 269: + return getAssignedTypeOfPropertyAssignment(parent); + case 270: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -30626,7 +30845,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 178 ? + var type = pattern.kind === 179 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -30641,35 +30860,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 219) { + if (node.parent.parent.kind === 220) { return stringType; } - if (node.parent.parent.kind === 220) { + if (node.parent.parent.kind === 221) { return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 230 ? + return node.kind === 231 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 230 || node.kind === 180 ? + return node.kind === 231 || node.kind === 181 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 230 && node.initializer && + return node.kind === 231 && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 180 && node.parent.kind === 198 && + node.kind !== 181 && node.parent.kind === 199 && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 189: + case 190: return getReferenceCandidate(node.expression); - case 198: + case 199: switch (node.operatorToken.kind) { case 58: return getReferenceCandidate(node.left); @@ -30681,13 +30900,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 189 || - parent.kind === 198 && parent.operatorToken.kind === 58 && parent.left === node || - parent.kind === 198 && parent.operatorToken.kind === 26 && parent.right === node ? + return parent.kind === 190 || + parent.kind === 199 && parent.operatorToken.kind === 58 && parent.left === node || + parent.kind === 199 && parent.operatorToken.kind === 26 && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 264) { + if (clause.kind === 265) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -30839,11 +31058,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 183 && (parent.name.escapedText === "length" || - parent.parent.kind === 185 && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 184 && + var isLengthPushOrUnshift = parent.kind === 184 && (parent.name.escapedText === "length" || + parent.parent.kind === 186 && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 185 && parent.expression === root && - parent.parent.kind === 198 && + parent.parent.kind === 199 && parent.parent.operatorToken.kind === 58 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -30887,7 +31106,7 @@ var ts; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); sharedFlowCount = sharedFlowStart; var resultType = ts.getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent && reference.parent.kind === 207 && getTypeWithFacts(resultType, 524288).flags & 16384) { + if (reference.parent && reference.parent.kind === 208 && getTypeWithFacts(resultType, 524288).flags & 16384) { return declaredType; } return resultType; @@ -30949,7 +31168,7 @@ var ts; } else if (flags & 2) { var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 183 && reference.kind !== 99) { + if (container && container !== flowContainer && reference.kind !== 184 && reference.kind !== 99) { flow = container.flowNode; continue; } @@ -30994,7 +31213,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 185 ? + var expr = node.kind === 186 ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -31002,7 +31221,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256) { var evolvedType_1 = type; - if (node.kind === 185) { + if (node.kind === 186) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -31126,7 +31345,7 @@ var ts; return result; } function isMatchingReferenceDiscriminant(expr, computedType) { - return expr.kind === 183 && + return expr.kind === 184 && computedType.flags & 131072 && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(computedType, expr.name.escapedText); @@ -31177,10 +31396,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 193 && ts.isStringLiteralLike(right_1)) { + if (left_1.kind === 194 && ts.isStringLiteralLike(right_1)) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 193 && ts.isStringLiteralLike(left_1)) { + if (right_1.kind === 194 && ts.isStringLiteralLike(left_1)) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -31371,7 +31590,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 184 || invokedExpression.kind === 183) { + if (invokedExpression.kind === 185 || invokedExpression.kind === 184) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -31389,15 +31608,15 @@ var ts; case 71: case 99: case 97: - case 183: + case 184: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 185: + case 186: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 189: + case 190: return narrowType(type, expr.expression, assumeTrue); - case 198: + case 199: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 196: + case 197: if (expr.operator === 51) { return narrowType(type, expr.operand, !assumeTrue); } @@ -31424,8 +31643,8 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 238 || - node.kind === 272 || + node.kind === 239 || + node.kind === 273 || node.kind === 151; }); } @@ -31469,10 +31688,10 @@ var ts; } function isConstraintPosition(node) { var parent = node.parent; - return parent.kind === 183 || + return parent.kind === 184 || + parent.kind === 186 && parent.expression === node || parent.kind === 185 && parent.expression === node || - parent.kind === 184 && parent.expression === node || - parent.kind === 180 && parent.name === node && !!parent.initializer; + parent.kind === 181 && parent.name === node && !!parent.initializer; } function typeHasNullableConstraint(type) { return type.flags & 7372800 && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 12288); @@ -31496,7 +31715,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2) { - if (container.kind === 191) { + if (container.kind === 192) { 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.hasModifier(container, 256)) { @@ -31512,7 +31731,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); var declaration = localOrExportSymbol.valueDeclaration; if (localOrExportSymbol.flags & 32) { - if (declaration.kind === 233 + if (declaration.kind === 234 && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -31524,7 +31743,7 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 203) { + else if (declaration.kind === 204) { var container = ts.getThisContainer(node, false); while (container !== undefined) { if (container.parent === declaration) { @@ -31538,9 +31757,6 @@ var ts; } } } - checkCollisionWithCapturedSuperVariable(node, node); - checkCollisionWithCapturedThisVariable(node, node); - checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getConstraintForLocation(getTypeOfSymbol(localOrExportSymbol), node); var assignmentKind = ts.getAssignmentTargetKind(node); @@ -31574,16 +31790,16 @@ var ts; var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; var isSpreadDestructuringAsignmentTarget = node.parent && node.parent.parent && ts.isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent); - while (flowContainer !== declarationContainer && (flowContainer.kind === 190 || - flowContainer.kind === 191 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 191 || + flowContainer.kind === 192 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAsignmentTarget || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0 || - isInTypeQuery(node) || node.parent.kind === 250) || - node.parent.kind === 207 || - declaration.kind === 230 && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 251) || + node.parent.kind === 208 || + declaration.kind === 231 && declaration.exclamationToken || declaration.flags & 2097152; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -31610,7 +31826,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 267) { + symbol.valueDeclaration.parent.kind === 268) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -31628,8 +31844,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 218 && - ts.getAncestor(symbol.valueDeclaration, 231).parent === container && + if (container.kind === 219 && + ts.getAncestor(symbol.valueDeclaration, 232).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -31641,14 +31857,14 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 189) { + while (current.parent.kind === 190) { current = current.parent; } var isAssigned = false; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 196 || current.parent.kind === 197)) { + else if ((current.parent.kind === 197 || current.parent.kind === 198)) { var expr = current.parent; isAssigned = expr.operator === 43 || expr.operator === 44; } @@ -31706,15 +31922,15 @@ var ts; if (container.kind === 154) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } - if (container.kind === 191) { + if (container.kind === 192) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 237: + case 238: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 236: + case 237: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 154: @@ -31745,8 +31961,8 @@ var ts; if (container === void 0) { container = ts.getThisContainer(node, false); } if (ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { - if (container.kind === 190 && - container.parent.kind === 198 && + if (container.kind === 191 && + container.parent.kind === 199 && ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { var className = container.parent .left @@ -31776,7 +31992,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 280) { + if (jsdocType && jsdocType.kind === 281) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -31789,11 +32005,11 @@ var ts; return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 148; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 185 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 186 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 191) { + while (container && container.kind === 192) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -31808,7 +32024,7 @@ var ts; 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 === 182)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 183)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -31837,7 +32053,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 182) { + if (container.parent.kind === 183) { 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 unknownType; @@ -31871,7 +32087,7 @@ var ts; return container.kind === 154; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 182) { + if (ts.isClassLike(container.parent) || container.parent.kind === 183) { if (ts.hasModifier(container, 32)) { return container.kind === 153 || container.kind === 152 || @@ -31895,8 +32111,8 @@ var ts; function getContainingObjectLiteral(func) { return (func.kind === 153 || func.kind === 155 || - func.kind === 156) && func.parent.kind === 182 ? func.parent : - func.kind === 190 && func.parent.kind === 268 ? func.parent.parent : + func.kind === 156) && func.parent.kind === 183 ? func.parent : + func.kind === 191 && func.parent.kind === 269 ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -31908,7 +32124,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 191) { + if (func.kind === 192) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -31932,7 +32148,7 @@ var ts; if (thisType) { return instantiateType(thisType, getContextualMapper(containingLiteral)); } - if (literal.parent.kind !== 268) { + if (literal.parent.kind !== 269) { break; } literal = literal.parent.parent; @@ -31941,9 +32157,9 @@ var ts; return contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral); } var parent = func.parent; - if (parent.kind === 198 && parent.operatorToken.kind === 58) { + if (parent.kind === 199 && parent.operatorToken.kind === 58) { var target = parent.left; - if (target.kind === 183 || target.kind === 184) { + if (target.kind === 184 || target.kind === 185) { var expression = target.expression; if (inJs && ts.isIdentifier(expression)) { var sourceFile = ts.getSourceFileOfNode(parent); @@ -32019,7 +32235,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; var name = declaration.propertyName || declaration.name; - if (parentDeclaration.kind !== 180) { + if (parentDeclaration.kind !== 181) { var parentTypeNode = ts.getEffectiveTypeAnnotationNode(parentDeclaration); if (parentTypeNode && !ts.isBindingPattern(name)) { var text = ts.getTextOfPropertyName(name); @@ -32094,7 +32310,7 @@ var ts; return getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 187) { + if (template.parent.kind === 188) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -32213,7 +32429,7 @@ var ts; var prop = _a[_i]; if (!prop.symbol) continue; - if (prop.kind !== 268) + if (prop.kind !== 269) continue; if (isDiscriminantProperty(contextualType, prop.symbol.escapedName)) { var discriminatingType = getTypeOfNode(prop.initializer); @@ -32243,51 +32459,51 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 230: + case 231: case 148: case 151: case 150: - case 180: + case 181: return getContextualTypeForInitializerExpression(node); - case 191: - case 223: + case 192: + case 224: return getContextualTypeForReturnExpression(node); - case 201: + case 202: return getContextualTypeForYieldOperand(parent); - case 185: case 186: + case 187: return getContextualTypeForArgument(parent, node); - case 188: - case 206: + case 189: + case 207: return getTypeFromTypeNode(parent.type); - case 198: + case 199: return getContextualTypeForBinaryOperand(node); - case 268: case 269: - return getContextualTypeForObjectLiteralElement(parent); case 270: + return getContextualTypeForObjectLiteralElement(parent); + case 271: return getApparentTypeOfContextualType(parent.parent); - case 181: { + case 182: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 199: + case 200: return getContextualTypeForConditionalOperand(node); - case 209: - ts.Debug.assert(parent.parent.kind === 200); + case 210: + ts.Debug.assert(parent.parent.kind === 201); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 189: { + case 190: { var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); } - case 263: + case 264: return getContextualTypeForJsxExpression(parent); - case 260: - case 262: + case 261: + case 263: return getContextualTypeForJsxAttribute(parent); + case 256: case 255: - case 254: return getContextualJsxElementAttributesType(parent); } return undefined; @@ -32338,59 +32554,53 @@ var ts; if (context.typeArguments) { signatures = ts.mapDefined(signatures, function (s) { return getJsxSignatureTypeArgumentInstantiation(s, context, isJs); }); } - return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromConstructSignature(t, isJs, context); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0); + return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, false); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0); } function getJsxPropsTypeFromCallSignature(sig, context) { - var propsType = getTypeOfFirstParameterOfSignature(sig); + var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType); var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (intrinsicAttribs !== unknownType) { propsType = intersectTypes(intrinsicAttribs, propsType); } return propsType; } - function getJsxPropsTypeFromClassType(hostClassType, isJs, context) { - if (isTypeAny(hostClassType)) { - return hostClassType; + function getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation) { + var instanceType = getReturnTypeOfSignature(sig); + return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation); + } + function getJsxPropsTypeFromClassType(sig, isJs, context, reportErrors) { + var forcedLookupLocation = getJsxElementPropertiesName(getJsxNamespaceAt(context)); + var attributesType = forcedLookupLocation === undefined + ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType) + : forcedLookupLocation === "" + ? getReturnTypeOfSignature(sig) + : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation); + if (!attributesType) { + if (reportErrors && !!forcedLookupLocation && !!ts.length(context.attributes.properties)) { + error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation)); + } + return emptyObjectType; } - var propsName = getJsxElementPropertiesName(getJsxNamespaceAt(context)); - if (propsName === undefined) { - return anyType; - } - else if (propsName === "") { - return hostClassType; + else if (isTypeAny(attributesType)) { + return attributesType; } else { - var attributesType = getTypeOfPropertyOfType(hostClassType, propsName); - if (!attributesType) { - return emptyObjectType; + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); + if (intrinsicClassAttribs !== unknownType) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + var hostClassType = getReturnTypeOfSignature(sig); + apparentAttributesType = intersectTypes(typeParams + ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) + : intrinsicClassAttribs, apparentAttributesType); } - else if (isTypeAny(attributesType)) { - return attributesType; - } - else { - var apparentAttributesType = attributesType; - var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); - if (intrinsicClassAttribs !== unknownType) { - var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) - : intrinsicClassAttribs, apparentAttributesType); - } - var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); - if (intrinsicAttribs !== unknownType) { - apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); - } - return apparentAttributesType; + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); } + return apparentAttributesType; } } - function getJsxPropsTypeFromConstructSignature(sig, isJs, context) { - var hostClassType = getReturnTypeOfSignature(sig); - if (hostClassType) { - return getJsxPropsTypeFromClassType(hostClassType, isJs, context); - } - return getJsxPropsTypeFromCallSignature(sig, context); - } function getContextualCallSignature(type, node) { var signatures = getSignaturesOfType(type, 0); if (signatures.length === 1) { @@ -32415,7 +32625,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 190 || node.kind === 191; + return node.kind === 191 || node.kind === 192; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -32477,8 +32687,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false, false); } function hasDefaultValue(node) { - return (node.kind === 180 && !!node.initializer) || - (node.kind === 198 && node.operatorToken.kind === 58); + return (node.kind === 181 && !!node.initializer) || + (node.kind === 199 && node.operatorToken.kind === 58); } function checkArrayLiteral(node, checkMode) { var elements = node.elements; @@ -32488,7 +32698,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); for (var index = 0; index < elements.length; index++) { var e = elements[index]; - if (inDestructuringPattern && e.kind === 202) { + if (inDestructuringPattern && e.kind === 203) { var restArrayType = checkExpression(e.expression, checkMode); var restElementType = getIndexTypeOfType(restArrayType, 1) || getIteratedTypeOrElementType(restArrayType, undefined, false, false, false); @@ -32501,7 +32711,7 @@ var ts; var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 202; + hasSpreadElement = hasSpreadElement || e.kind === 203; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -32511,7 +32721,7 @@ var ts; } if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 179 || pattern.kind === 181)) { + if (pattern && (pattern.kind === 180 || pattern.kind === 182)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -32519,7 +32729,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 204) { + if (patternElement.kind !== 205) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType); @@ -32591,7 +32801,7 @@ var ts; var propagatedFlags = 8388608; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 178 || contextualType.pattern.kind === 182); + (contextualType.pattern.kind === 179 || contextualType.pattern.kind === 183); var isInJSFile = ts.isInJavaScriptFile(node); var isJSObjectLiteral = !contextualType && isInJSFile; var typeFlags = 0; @@ -32612,15 +32822,15 @@ var ts; var memberDecl = node.properties[i]; var member = getSymbolOfNode(memberDecl); var literalName = void 0; - if (memberDecl.kind === 268 || - memberDecl.kind === 269 || + if (memberDecl.kind === 269 || + memberDecl.kind === 270 || ts.isObjectLiteralMethod(memberDecl)) { var jsdocType = void 0; if (isInJSFile) { jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); } var type = void 0; - if (memberDecl.kind === 268) { + if (memberDecl.kind === 269) { if (memberDecl.name.kind === 146) { var t = checkComputedPropertyName(memberDecl.name); if (t.flags & 224) { @@ -32633,7 +32843,7 @@ var ts; type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 269); + ts.Debug.assert(memberDecl.kind === 270); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } if (jsdocType) { @@ -32650,8 +32860,8 @@ var ts; prop.nameType = nameType; } if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 268 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 269 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 269 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 270 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216; } @@ -32677,7 +32887,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 270) { + else if (memberDecl.kind === 271) { if (languageVersion < 2) { checkExternalEmitHelpers(memberDecl, 2); } @@ -32787,7 +32997,7 @@ var ts; } function isJsxIntrinsicIdentifier(tagName) { switch (tagName.kind) { - case 183: + case 184: case 99: return false; case 71: @@ -32828,7 +33038,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 262); + ts.Debug.assert(attributeDecl.kind === 263); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, 0, 4096); attributesTable = ts.createSymbolTable(); @@ -32850,7 +33060,7 @@ var ts; spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, 0, 4096); } } - var parent = openingLikeElement.parent.kind === 253 ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 254 ? openingLikeElement.parent : undefined; if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { @@ -32933,19 +33143,7 @@ var ts; } return links.resolvedSymbol; } - function getJsxElementInstanceType(node, valueType) { - ts.Debug.assert(!(valueType.flags & 131072)); - if (isTypeAny(valueType)) { - return anyType; - } - var signatures = getSignaturesOfType(valueType, 1); - if (signatures.length === 0) { - signatures = getSignaturesOfType(valueType, 0); - if (signatures.length === 0) { - error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName)); - return unknownType; - } - } + function instantiateJsxSignatures(node, signatures) { var instantiatedSignatures = []; var candidateForTypeArgumentError; var hasTypeArgumentError = !!node.typeArguments; @@ -32979,7 +33177,7 @@ var ts; diagnostics.add(getTypeArgumentArityError(node, signatures, node.typeArguments)); } } - return getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2); + return instantiatedSignatures; } function getJsxSignatureTypeArgumentInstantiation(signature, node, isJavascript, reportErrors) { if (!node.typeArguments) { @@ -33114,7 +33312,10 @@ var ts; return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType); }), 2); } - if (elementType.flags & 2) { + if (isTypeAny(elementType)) { + return elementType; + } + else if (elementType.flags & 2) { return anyType; } else if (elementType.flags & 32) { @@ -33133,7 +33334,16 @@ var ts; } return anyType; } - var elemInstanceType = getJsxElementInstanceType(openingLikeElement, elementType); + var signatures = getSignaturesOfType(elementType, 1); + if (signatures.length === 0) { + signatures = getSignaturesOfType(elementType, 0); + if (signatures.length === 0) { + error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName)); + return unknownType; + } + } + var instantiatedSignatures = instantiateJsxSignatures(openingLikeElement, signatures); + var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2); var statelessAttributesType = shouldIncludeAllStatelessAttributesType ? tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) : defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType); @@ -33143,7 +33353,8 @@ var ts; if (elementClassType) { checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); } - return getJsxPropsTypeFromClassType(elemInstanceType, ts.isInJavaScriptFile(openingLikeElement), openingLikeElement); + var isJs = ts.isInJavaScriptFile(openingLikeElement); + return getUnionType(ts.map(instantiatedSignatures, function (sig) { return getJsxPropsTypeFromClassType(sig, isJs, openingLikeElement, true); })); } function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) { ts.Debug.assert(isJsxIntrinsicIdentifier(node.tagName)); @@ -33263,23 +33474,18 @@ var ts; getIntrinsicAttributesTypeFromJsxOpeningLikeElement(openingLikeElement) : getCustomJsxElementAttributesType(openingLikeElement, false); var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode); - if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || getPropertiesOfType(sourceAttributesType).length > 0)) { - error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(getJsxElementPropertiesName(getJsxNamespaceAt(openingLikeElement)))); - } - else { - var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); - if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { - for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { - var attribute = _a[_i]; - if (!ts.isJsxAttribute(attribute)) { - continue; - } - var attrName = attribute.name; - var isNotIgnoredJsxProperty = (isUnhyphenatedJsxName(ts.idText(attrName)) || !!(getPropertyOfType(targetAttributesType, attrName.escapedText))); - if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, true)) { - error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); - break; - } + var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); + if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { + for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { + var attribute = _a[_i]; + if (!ts.isJsxAttribute(attribute)) { + continue; + } + var attrName = attribute.name; + var isNotIgnoredJsxProperty = (isUnhyphenatedJsxName(ts.idText(attrName)) || !!(getPropertyOfType(targetAttributesType, attrName.escapedText))); + if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, true)) { + error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); + break; } } } @@ -33302,16 +33508,23 @@ var ts; function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } - function isMethodLike(symbol) { - return !!(symbol.flags & 8192 || - ts.getCheckFlags(symbol) & 4 || - ts.isInJavaScriptFile(symbol.valueDeclaration) && ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(symbol.valueDeclaration))); + function isPrototypeProperty(symbol) { + if (symbol.flags & 8192 || ts.getCheckFlags(symbol) & 4) { + return true; + } + if (ts.isInJavaScriptFile(symbol.valueDeclaration)) { + var parent = symbol.valueDeclaration.parent; + return parent && ts.isBinaryExpression(parent) && + ts.getSpecialPropertyAssignmentKind(parent) === 3; + } } function checkPropertyAccessibility(node, left, type, prop) { var flags = ts.getDeclarationModifierFlagsFromSymbol(prop); - var errorNode = node.kind === 183 || node.kind === 230 ? + var errorNode = node.kind === 184 || node.kind === 231 ? node.name : - node.right; + node.kind === 178 ? + node : + node.right; if (ts.getCheckFlags(prop) & 256) { error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); return false; @@ -33438,7 +33651,7 @@ var ts; } propType = getConstraintForLocation(getTypeOfSymbol(prop), node); } - if (node.kind !== 183 || + if (node.kind !== 184 || assignmentKind === 1 || prop && !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 131072)) { return propType; @@ -33470,7 +33683,7 @@ var ts; && !isPropertyDeclaredInAncestorClass(prop)) { error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.idText(right)); } - else if (valueDeclaration.kind === 233 && + else if (valueDeclaration.kind === 234 && node.parent.kind !== 161 && !(valueDeclaration.flags & 2097152) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { @@ -33482,7 +33695,7 @@ var ts; switch (node.kind) { case 151: return true; - case 268: + case 269: return false; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -33495,11 +33708,11 @@ var ts; } var classType = getTypeOfSymbol(prop.parent); while (true) { - classType = getSuperClass(classType); + classType = classType.symbol && getSuperClass(classType); if (!classType) { return false; } - var superProperty = getPropertyOfObjectType(classType, prop.escapedName); + var superProperty = getPropertyOfType(classType, prop.escapedName); if (superProperty && superProperty.valueDeclaration) { return true; } @@ -33510,8 +33723,7 @@ var ts; if (x.length === 0) { return undefined; } - ts.Debug.assert(x.length === 1); - return x[0]; + return getIntersectionType(x); } function reportNonexistentProperty(propNode, containingType) { var errorInfo; @@ -33641,11 +33853,17 @@ var ts; (ts.getCheckFlags(prop) & 1 ? getSymbolLinks(prop).target : prop).isReferenced = 67108863; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 183 ? node.expression : node.left; - return isValidPropertyAccessWithType(node, left, propertyName, getWidenedType(checkExpression(left))); + switch (node.kind) { + case 184: + return isValidPropertyAccessWithType(node, node.expression, propertyName, getWidenedType(checkExpression(node.expression))); + case 145: + return isValidPropertyAccessWithType(node, node.left, propertyName, getWidenedType(checkExpression(node.left))); + case 178: + return isValidPropertyAccessWithType(node, node, propertyName, getTypeFromTypeNode(node)); + } } function isValidPropertyAccessForCompletions(node, type, property) { - return isValidPropertyAccessWithType(node, node.expression, property.escapedName, type) + return isValidPropertyAccessWithType(node, node.kind === 178 ? node : node.expression, property.escapedName, type) && (!(property.flags & 8192) || isValidMethodAccess(property, type)); } function isValidMethodAccess(method, actualThisType) { @@ -33675,7 +33893,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 231) { + if (initializer.kind === 232) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -33697,7 +33915,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 219 && + if (node.kind === 220 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -33715,7 +33933,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 186 && node.parent.expression === node) { + if (node.parent.kind === 187 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -33774,7 +33992,7 @@ var ts; if (callLikeExpressionMayHaveTypeArguments(node)) { ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 187) { + if (node.kind === 188) { checkExpression(node.template); } else if (node.kind !== 149) { @@ -33828,7 +34046,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 202) { + if (arg && arg.kind === 203) { return i; } } @@ -33843,10 +34061,10 @@ var ts; if (ts.isJsxOpeningLikeElement(node)) { return true; } - if (node.kind === 187) { + if (node.kind === 188) { argCount = args.length; typeArguments = undefined; - if (node.template.kind === 200) { + if (node.template.kind === 201) { var lastSpan = ts.lastOrUndefined(node.template.templateSpans); ts.Debug.assert(lastSpan !== undefined); callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; @@ -33863,7 +34081,7 @@ var ts; } else { if (!node.arguments) { - ts.Debug.assert(node.kind === 186); + ts.Debug.assert(node.kind === 187); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -33947,7 +34165,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 204) { + if (arg === undefined || arg.kind !== 205) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -34012,7 +34230,7 @@ var ts; return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 186) { + if (thisType && thisType !== voidType && node.kind !== 187) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; @@ -34025,7 +34243,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 204) { + if (arg === undefined || arg.kind !== 205) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i) || checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); @@ -34039,21 +34257,18 @@ var ts; return true; } function getThisArgumentOfCall(node) { - if (node.kind === 185) { - var callee = node.expression; - if (callee.kind === 183) { - return callee.expression; - } - else if (callee.kind === 184) { + if (node.kind === 186) { + var callee = ts.skipOuterExpressions(node.expression); + if (callee.kind === 184 || callee.kind === 185) { return callee.expression; } } } function getEffectiveCallArguments(node) { - if (node.kind === 187) { + if (node.kind === 188) { var template = node.template; var args_4 = [undefined]; - if (template.kind === 200) { + if (template.kind === 201) { ts.forEach(template.templateSpans, function (span) { args_4.push(span.expression); }); @@ -34073,8 +34288,8 @@ var ts; function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 149) { switch (node.parent.kind) { - case 233: - case 203: + case 234: + case 204: return 1; case 151: return 2; @@ -34094,7 +34309,7 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 233) { + if (node.kind === 234) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } @@ -34115,7 +34330,7 @@ var ts; return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 233) { + if (node.kind === 234) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } @@ -34153,7 +34368,7 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 233) { + if (node.kind === 234) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } @@ -34190,14 +34405,14 @@ var ts; if (node.kind === 149) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 187) { + else if (argIndex === 0 && node.kind === 188) { return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { if (node.kind === 149 || - (argIndex === 0 && node.kind === 187)) { + (argIndex === 0 && node.kind === 188)) { return undefined; } return args[argIndex]; @@ -34206,7 +34421,7 @@ var ts; if (node.kind === 149) { return node.expression; } - else if (argIndex === 0 && node.kind === 187) { + else if (argIndex === 0 && node.kind === 188) { return node.template; } else { @@ -34225,7 +34440,7 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, paramCount, typeArguments.length); } function resolveCall(node, signatures, candidatesOutArray, fallbackError) { - var isTaggedTemplate = node.kind === 187; + var isTaggedTemplate = node.kind === 188; var isDecorator = node.kind === 149; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var typeArguments; @@ -34259,7 +34474,7 @@ var ts; var candidateForArgumentError; var candidateForTypeArgumentError; var result; - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 185 && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 186 && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma); } @@ -34568,8 +34783,8 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 233: - case 203: + case 234: + case 204: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 148: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; @@ -34637,16 +34852,16 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 185: - return resolveCallExpression(node, candidatesOutArray); case 186: - return resolveNewExpression(node, candidatesOutArray); + return resolveCallExpression(node, candidatesOutArray); case 187: + return resolveNewExpression(node, candidatesOutArray); + case 188: return resolveTaggedTemplateExpression(node, candidatesOutArray); case 149: return resolveDecorator(node, candidatesOutArray); + case 256: case 255: - case 254: return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray) || unknownSignature; } ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -34708,14 +34923,13 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 183) { + while (parent && parent.kind === 184) { parent = parent.parent; } - return parent && ts.isBinaryExpression(parent) && - ts.isPrototypeAccess(parent.left) && - parent.operatorToken.kind === 58 && - ts.isObjectLiteralExpression(parent.right) && - parent.right; + if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 58) { + var right = ts.getInitializerOfBinaryExpression(parent); + return ts.isObjectLiteralExpression(right) && right; + } } function getInferredClassType(symbol) { var links = getSymbolLinks(symbol); @@ -34736,7 +34950,7 @@ var ts; if (node.expression.kind === 97) { return voidType; } - if (node.kind === 186) { + if (node.kind === 187) { var declaration = signature.declaration; if (declaration && declaration.kind !== 154 && @@ -34843,9 +35057,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 232 + ? 233 : resolvedRequire.flags & 3 - ? 230 + ? 231 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -34909,7 +35123,10 @@ var ts; pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function getTypeOfFirstParameterOfSignature(signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType); + } + function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType; } function inferFromAnnotatedParameters(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -35005,7 +35222,7 @@ var ts; } var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 211) { + if (func.body.kind !== 212) { type = checkExpressionCached(func.body, checkMode); if (functionFlags & 2) { type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); @@ -35108,7 +35325,7 @@ var ts; if (!(func.flags & 128)) { return false; } - if (ts.some(func.body.statements, function (statement) { return statement.kind === 225 && isExhaustiveSwitchStatement(statement); })) { + if (ts.some(func.body.statements, function (statement) { return statement.kind === 226 && isExhaustiveSwitchStatement(statement); })) { return false; } return true; @@ -35145,11 +35362,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 190: case 191: + case 192: return true; case 153: - return func.parent.kind === 182; + return func.parent.kind === 183; default: return false; } @@ -35161,7 +35378,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 2048)) { return; } - if (func.kind === 152 || ts.nodeIsMissing(func.body) || func.body.kind !== 211 || !functionHasImplicitReturn(func)) { + if (func.kind === 152 || ts.nodeIsMissing(func.body) || func.body.kind !== 212 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -35193,7 +35410,7 @@ var ts; return anyFunctionType; } var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 190) { + if (!hasGrammarError && node.kind === 191) { checkGrammarForGenerator(node); } var links = getNodeLinks(node); @@ -35224,11 +35441,6 @@ var ts; checkNodeDeferred(node); } } - if (produceDiagnostics && node.kind !== 153) { - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); - } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { @@ -35246,7 +35458,7 @@ var ts; if (!returnTypeNode) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 211) { + if (node.body.kind === 212) { checkSourceElement(node.body); } else { @@ -35281,7 +35493,7 @@ var ts; function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 && - (expr.kind === 183 || expr.kind === 184) && + (expr.kind === 184 || expr.kind === 185) && expr.expression.kind === 99) { var func = ts.getContainingFunction(expr); if (!(func && func.kind === 154)) { @@ -35294,13 +35506,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 183 || expr.kind === 184) { + if (expr.kind === 184 || expr.kind === 185) { var node = ts.skipParentheses(expr.expression); if (node.kind === 71) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 2097152) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 244; + return declaration && declaration.kind === 245; } } } @@ -35308,7 +35520,7 @@ var ts; } function checkReferenceExpression(expr, invalidReferenceMessage) { var node = ts.skipOuterExpressions(expr, 2 | 1); - if (node.kind !== 71 && node.kind !== 183 && node.kind !== 184) { + if (node.kind !== 71 && node.kind !== 184 && node.kind !== 185) { error(expr, invalidReferenceMessage); return false; } @@ -35317,7 +35529,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 183 && expr.kind !== 184) { + if (expr.kind !== 184 && expr.kind !== 185) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -35468,6 +35680,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; + checkGrammarForDisallowedTrailingComma(properties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); if (strictNullChecks && properties.length === 0) { return checkNonNullType(sourceType, node); } @@ -35478,7 +35691,7 @@ var ts; return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 268 || property.kind === 269) { + if (property.kind === 269 || property.kind === 270) { var name = property.name; if (name.kind === 146) { checkComputedPropertyName(name); @@ -35493,7 +35706,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 269) { + if (property.kind === 270) { return checkDestructuringAssignment(property, type); } else { @@ -35504,7 +35717,7 @@ var ts; error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 270) { + else if (property.kind === 271) { if (languageVersion < 6) { checkExternalEmitHelpers(property, 4); } @@ -35522,11 +35735,12 @@ var ts; } } function checkArrayLiteralAssignment(node, sourceType, checkMode) { + var elements = node.elements; + checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); if (languageVersion < 2 && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512); } var elementType = checkIteratedTypeOrElementType(sourceType, node, false, false) || unknownType; - var elements = node.elements; for (var i = 0; i < elements.length; i++) { checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); } @@ -35535,8 +35749,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 204) { - if (element.kind !== 202) { + if (element.kind !== 205) { + if (element.kind !== 203) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -35562,7 +35776,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 198 && restExpression.operatorToken.kind === 58) { + if (restExpression.kind === 199 && restExpression.operatorToken.kind === 58) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -35575,7 +35789,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 269) { + if (exprOrAssignment.kind === 270) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -35589,21 +35803,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 198 && target.operatorToken.kind === 58) { + if (target.kind === 199 && target.operatorToken.kind === 58) { checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 182) { + if (target.kind === 183) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 181) { + if (target.kind === 182) { 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 === 270 ? + var error = target.parent.kind === 271 ? 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; if (checkReferenceExpression(target, error)) { @@ -35617,35 +35831,35 @@ var ts; case 71: case 9: case 12: - case 187: - case 200: + case 188: + case 201: case 13: case 8: case 101: case 86: case 95: case 140: - case 190: - case 203: case 191: - case 181: + case 204: + case 192: case 182: - case 193: - case 207: + case 183: + case 194: + case 208: + case 255: case 254: - case 253: return true; - case 199: + case 200: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 198: + case 199: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 196: case 197: + case 198: switch (node.operator) { case 51: case 37: @@ -35654,9 +35868,9 @@ var ts; return true; } return false; - case 194: - case 188: - case 206: + case 195: + case 189: + case 207: default: return false; } @@ -35672,7 +35886,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 58 && (left.kind === 182 || left.kind === 181)) { + if (operator === 58 && (left.kind === 183 || left.kind === 182)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); } var leftType = checkExpression(left, checkMode); @@ -35891,12 +36105,14 @@ var ts; } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { - checkExpression(templateSpan.expression); + if (maybeTypeOfKind(checkExpression(templateSpan.expression), 1536)) { + error(templateSpan.expression, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1, typeToString(esSymbolType), typeToString(stringType)); + } }); return stringType; } function getContextNode(node) { - if (node.kind === 261) { + if (node.kind === 262) { return node.parent.parent; } return node; @@ -35929,7 +36145,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 188 || node.kind === 206; + return node.kind === 189 || node.kind === 207; } function checkDeclarationInitializer(declaration) { var inJs = ts.isInJavaScriptFile(declaration); @@ -36013,7 +36229,7 @@ var ts; return type; } function getTypeOfExpression(node, cache) { - if (node.kind === 185 && node.expression.kind !== 97 && !ts.isRequireCall(node, true) && !isSymbolOrSymbolForCall(node)) { + if (node.kind === 186 && node.expression.kind !== 97 && !ts.isRequireCall(node, true) && !isSymbolOrSymbolForCall(node)) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -36039,8 +36255,8 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 183 && node.parent.expression === node) || - (node.parent.kind === 184 && node.parent.expression === node) || + var ok = (node.parent.kind === 184 && node.parent.expression === node) || + (node.parent.kind === 185 && node.parent.expression === node) || ((node.kind === 71 || node.kind === 145) && isInRightSideOfImportOrExportAssignment(node) || (node.parent.kind === 164 && node.parent.exprName === node)); if (!ok) { @@ -36076,73 +36292,73 @@ var ts; return trueType; case 86: return falseType; - case 200: + case 201: return checkTemplateExpression(node); case 12: return globalRegExpType; - case 181: - return checkArrayLiteral(node, checkMode); case 182: - return checkObjectLiteral(node, checkMode); + return checkArrayLiteral(node, checkMode); case 183: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, checkMode); case 184: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 185: + return checkIndexedAccess(node); + case 186: if (node.expression.kind === 91) { return checkImportCallExpression(node); } - case 186: - return checkCallExpression(node); case 187: - return checkTaggedTemplateExpression(node); - case 189: - return checkParenthesizedExpression(node, checkMode); - case 203: - return checkClassExpression(node); - case 190: - case 191: - return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 193: - return checkTypeOfExpression(node); + return checkCallExpression(node); case 188: - case 206: - return checkAssertion(node); - case 207: - return checkNonNullAssertion(node); - case 208: - return checkMetaProperty(node); - case 192: - return checkDeleteExpression(node); - case 194: - return checkVoidExpression(node); - case 195: - return checkAwaitExpression(node); - case 196: - return checkPrefixUnaryExpression(node); - case 197: - return checkPostfixUnaryExpression(node); - case 198: - return checkBinaryExpression(node, checkMode); - case 199: - return checkConditionalExpression(node, checkMode); - case 202: - return checkSpreadExpression(node, checkMode); + return checkTaggedTemplateExpression(node); + case 190: + return checkParenthesizedExpression(node, checkMode); case 204: + return checkClassExpression(node); + case 191: + case 192: + return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + case 194: + return checkTypeOfExpression(node); + case 189: + case 207: + return checkAssertion(node); + case 208: + return checkNonNullAssertion(node); + case 209: + return checkMetaProperty(node); + case 193: + return checkDeleteExpression(node); + case 195: + return checkVoidExpression(node); + case 196: + return checkAwaitExpression(node); + case 197: + return checkPrefixUnaryExpression(node); + case 198: + return checkPostfixUnaryExpression(node); + case 199: + return checkBinaryExpression(node, checkMode); + case 200: + return checkConditionalExpression(node, checkMode); + case 203: + return checkSpreadExpression(node, checkMode); + case 205: return undefinedWideningType; - case 201: + case 202: return checkYieldExpression(node); - case 263: + case 264: return checkJsxExpression(node, checkMode); - case 253: - return checkJsxElement(node, checkMode); case 254: - return checkJsxSelfClosingElement(node, checkMode); - case 257: - return checkJsxFragment(node, checkMode); - case 261: - return checkJsxAttributes(node, checkMode); + return checkJsxElement(node, checkMode); case 255: + return checkJsxSelfClosingElement(node, checkMode); + case 258: + return checkJsxFragment(node, checkMode); + case 262: + return checkJsxAttributes(node, checkMode); + case 256: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -36247,10 +36463,10 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 191: + case 192: case 157: - case 232: - case 190: + case 233: + case 191: case 162: case 153: case 152: @@ -36271,7 +36487,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 === 179 || name.kind === 178) { + else if (name.kind === 180 || name.kind === 179) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -36282,7 +36498,7 @@ var ts; if (node.kind === 159) { checkGrammarIndexSignature(node); } - else if (node.kind === 162 || node.kind === 232 || node.kind === 163 || + else if (node.kind === 162 || node.kind === 233 || node.kind === 163 || node.kind === 157 || node.kind === 154 || node.kind === 158) { checkGrammarFunctionLikeDeclaration(node); @@ -36445,7 +36661,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 234) { + if (node.kind === 235) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -36532,7 +36748,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 214 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 215 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -36691,7 +36907,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType))) { - if (accessNode.kind === 184 && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 185 && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 && getMappedTypeModifiers(objectType) & 1) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -36731,14 +36947,18 @@ var ts; } checkSourceElement(node.typeParameter); } + function checkImportType(node) { + checkSourceElement(node.argument); + getTypeFromTypeNode(node); + } function isPrivateWithinAmbient(node) { return ts.hasModifier(node, 8) && !!(node.flags & 2097152); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 234 && - n.parent.kind !== 233 && - n.parent.kind !== 203 && + if (n.parent.kind !== 235 && + n.parent.kind !== 234 && + n.parent.kind !== 204 && n.flags & 2097152) { if (!(flags & 2)) { flags |= 1; @@ -36851,11 +37071,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = node.flags & 2097152; - var inAmbientContextOrInterface = node.parent.kind === 234 || node.parent.kind === 165 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 235 || node.parent.kind === 165 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 232 || node.kind === 153 || node.kind === 152 || node.kind === 154) { + if (node.kind === 233 || node.kind === 153 || node.kind === 152 || node.kind === 154) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -36967,30 +37187,30 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 234: case 235: - case 291: + case 236: + case 292: return 2; - case 237: + case 238: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4 | 1 : 4; - case 233: - case 236: + case 234: + case 237: return 2 | 1; - case 272: + case 273: return 2 | 1 | 4; - case 241: + case 242: + case 245: case 244: - case 243: var result_2 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); }); return result_2; - case 230: - case 180: - case 232: - case 246: + case 231: + case 181: + case 233: + case 247: return 1; default: ts.Debug.fail(ts.Debug.showSyntaxKind(d)); @@ -37145,7 +37365,7 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 233: + case 234: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); @@ -37252,7 +37472,7 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 233: + case 234: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -37289,9 +37509,6 @@ var ts; if (produceDiagnostics) { checkFunctionOrMethodDeclaration(node); checkGrammarForGenerator(node); - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -37341,7 +37558,7 @@ var ts; switch (node.kind) { case 71: return node; - case 183: + case 184: return node.name; default: return undefined; @@ -37396,29 +37613,29 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 272: - case 237: + case 273: + case 238: checkUnusedModuleMembers(node); break; - case 233: - case 203: + case 234: + case 204: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 234: + case 235: checkUnusedTypeParameters(node); break; - case 211: - case 239: - case 218: + case 212: + case 240: case 219: case 220: + case 221: checkUnusedLocalsAndParameters(node); break; case 154: - case 190: - case 232: case 191: + case 233: + case 192: case 153: case 155: case 156: @@ -37432,7 +37649,7 @@ var ts; case 158: case 162: case 163: - case 235: + case 236: checkUnusedTypeParameters(node); break; default: @@ -37473,7 +37690,7 @@ var ts; var node = ts.getNameOfDeclaration(declaration) || declaration; if (isIdentifierThatStartsWithUnderScore(node)) { var declaration_2 = ts.getRootDeclaration(node.parent); - if ((declaration_2.kind === 230 && ts.isForInOrOfStatement(declaration_2.parent.parent)) || + if ((declaration_2.kind === 231 && ts.isForInOrOfStatement(declaration_2.parent.parent)) || declaration_2.kind === 147) { return; } @@ -37514,7 +37731,7 @@ var ts; } break; case 159: - case 210: + case 211: break; default: ts.Debug.fail(); @@ -37584,18 +37801,18 @@ var ts; } } function isImportedDeclaration(node) { - return node.kind === 243 || node.kind === 246 || node.kind === 244; + return node.kind === 244 || node.kind === 247 || node.kind === 245; } function importClauseFromImported(decl) { - return decl.kind === 243 ? decl : decl.kind === 244 ? decl.parent : decl.parent.parent; + return decl.kind === 244 ? decl : decl.kind === 245 ? decl.parent : decl.parent.parent; } function forEachImportedDeclaration(importClause, cb) { var defaultName = importClause.name, namedBindings = importClause.namedBindings; return (defaultName && cb(importClause)) || - namedBindings && (namedBindings.kind === 244 ? cb(namedBindings) : ts.forEach(namedBindings.elements, cb)); + namedBindings && (namedBindings.kind === 245 ? cb(namedBindings) : ts.forEach(namedBindings.elements, cb)); } function checkBlock(node) { - if (node.kind === 211) { + if (node.kind === 212) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -37641,16 +37858,6 @@ var ts; } return true; } - function checkCollisionWithCapturedThisVariable(node, name) { - if (languageVersion <= 1 && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_this")) { - potentialThisCollisions.push(node); - } - } - function checkCollisionWithCapturedNewTargetVariable(node, name) { - if (languageVersion <= 1 && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_newTarget")) { - potentialNewTargetCollisions.push(node); - } - } function checkIfThisIsCapturedInEnclosingScope(node) { ts.findAncestor(node, function (current) { if (getNodeCheckFlags(current) & 4) { @@ -37679,27 +37886,6 @@ var ts; } }); } - function checkCollisionWithCapturedSuperVariable(node, name) { - if (languageVersion >= 2 || compilerOptions.noEmit) { - return; - } - if (!needCollisionCheckForIdentifier(node, name, "_super")) { - return; - } - var enclosingClass = ts.getContainingClass(node); - if (!enclosingClass || enclosingClass.flags & 2097152) { - return; - } - if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_3 = node.kind !== 71; - if (isDeclaration_3) { - error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); - } - else { - error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference); - } - } - } function checkCollisionWithRequireExportsInGeneratedCode(node, name) { if (modulekind >= ts.ModuleKind.ES2015 || compilerOptions.noEmit) { return; @@ -37711,7 +37897,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 272 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 273 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -37723,7 +37909,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 272 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { + if (parent.kind === 273 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(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)); } } @@ -37731,7 +37917,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 230 && !node.initializer) { + if (node.kind === 231 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -37743,15 +37929,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 231); - var container = varDeclList.parent.kind === 212 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 232); + var container = varDeclList.parent.kind === 213 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 211 && ts.isFunctionLike(container.parent) || + (container.kind === 212 && ts.isFunctionLike(container.parent) || + container.kind === 239 || container.kind === 238 || - container.kind === 237 || - container.kind === 272); + container.kind === 273); 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); @@ -37770,7 +37956,7 @@ var ts; if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { return; } - if (n.kind === 183) { + if (n.kind === 184) { return visit(n.expression); } else if (n.kind === 71) { @@ -37785,7 +37971,7 @@ var ts; var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { if (symbol.valueDeclaration.kind === 148 || - symbol.valueDeclaration.kind === 180) { + symbol.valueDeclaration.kind === 181) { if (symbol.valueDeclaration.pos < node.pos) { return; } @@ -37826,8 +38012,8 @@ var ts; checkExpressionCached(node.initializer); } } - if (node.kind === 180) { - if (node.parent.kind === 178 && languageVersion < 6) { + if (node.kind === 181) { + if (node.parent.kind === 179 && languageVersion < 6) { checkExternalEmitHelpers(node, 4); } if (node.propertyName && node.propertyName.kind === 146) { @@ -37845,7 +38031,7 @@ var ts; } } if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 179 && languageVersion < 2 && compilerOptions.downlevelIteration) { + if (node.name.kind === 180 && languageVersion < 2 && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512); } ts.forEach(node.name.elements, checkSourceElement); @@ -37855,7 +38041,7 @@ var ts; return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 219) { + if (node.initializer && node.parent.parent.kind !== 220) { var initializerType = checkExpressionCached(node.initializer); if (strictNullChecks && node.name.elements.length === 0) { checkNonNullType(initializerType, node); @@ -37870,7 +38056,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfSymbol(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 219) { + if (node.initializer && node.parent.parent.kind !== 220) { var initializer = ts.isInJavaScriptFile(node) && ts.getDeclaredJavascriptInitializer(node) || node.initializer; checkTypeAssignableTo(checkExpressionCached(initializer), type, node, undefined); checkParameterInitializer(node); @@ -37893,12 +38079,9 @@ var ts; } if (node.kind !== 151 && node.kind !== 150) { checkExportsOnMergedDeclarations(node); - if (node.kind === 230 || node.kind === 180) { + if (node.kind === 231 || node.kind === 181) { checkVarDeclaredNamesNotShadowed(node); } - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -37911,8 +38094,8 @@ var ts; error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType)); } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 148 && right.kind === 230) || - (left.kind === 230 && right.kind === 148)) { + if ((left.kind === 148 && right.kind === 231) || + (left.kind === 231 && right.kind === 148)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -37947,7 +38130,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 213) { + if (node.thenStatement.kind === 214) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -37964,12 +38147,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 231) { + if (node.initializer && node.initializer.kind === 232) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 231) { + if (node.initializer.kind === 232) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -37987,24 +38170,22 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.kind === 220) { - if (node.awaitModifier) { - var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); - if ((functionFlags & (4 | 2)) === 2 && languageVersion < 6) { - checkExternalEmitHelpers(node, 16384); - } - } - else if (compilerOptions.downlevelIteration && languageVersion < 2) { - checkExternalEmitHelpers(node, 256); + if (node.awaitModifier) { + var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); + if ((functionFlags & (4 | 2)) === 2 && languageVersion < 6) { + checkExternalEmitHelpers(node, 16384); } } - if (node.initializer.kind === 231) { + else if (compilerOptions.downlevelIteration && languageVersion < 2) { + checkExternalEmitHelpers(node, 256); + } + if (node.initializer.kind === 232) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); - if (varExpr.kind === 181 || varExpr.kind === 182) { + if (varExpr.kind === 182 || varExpr.kind === 183) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -38023,7 +38204,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 231) { + if (node.initializer.kind === 232) { 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); @@ -38033,7 +38214,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 181 || varExpr.kind === 182) { + if (varExpr.kind === 182 || varExpr.kind === 183) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -38043,8 +38224,8 @@ var ts; checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - if (!isTypeAssignableToKind(rightType, 134217728 | 7372800)) { - error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); + if (rightType === neverType || !isTypeAssignableToKind(rightType, 134217728 | 7372800)) { + error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)); } checkSourceElement(node.statement); if (node.locals) { @@ -38069,6 +38250,10 @@ var ts; return getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables, true) || anyType; } function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables, checkAssignability) { + if (inputType === neverType) { + reportTypeNotIterableError(errorNode, inputType, allowAsyncIterables); + return undefined; + } var uplevelIteration = languageVersion >= 2; var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; if (uplevelIteration || downlevelIteration || allowAsyncIterables) { @@ -38106,13 +38291,18 @@ var ts; } if (!isArrayLikeType(arrayType)) { if (errorNode && !reportedError) { + var isIterable = !!getIteratedTypeOfIterable(inputType, undefined, allowAsyncIterables, true, checkAssignability); var diagnostic = !allowStringInput || hasStringConstituent ? downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator - : ts.Diagnostics.Type_0_is_not_an_array_type + : isIterable + ? ts.Diagnostics.Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators + : ts.Diagnostics.Type_0_is_not_an_array_type : downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + : isIterable + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(errorNode, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : undefined; @@ -38159,9 +38349,7 @@ var ts; var signatures = methodType && getSignaturesOfType(methodType, 0); if (!ts.some(signatures)) { if (errorNode) { - error(errorNode, allowAsyncIterables - ? ts.Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator - : ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); + reportTypeNotIterableError(errorNode, type, allowAsyncIterables); errorNode = undefined; } return undefined; @@ -38178,6 +38366,11 @@ var ts; : typeAsIterable.iteratedTypeOfIterable = iteratedType; } } + function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) { + error(errorNode, allowAsyncIterables + ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator, typeToString(type)); + } function getIteratedTypeOfIterator(type, errorNode, isAsyncIterator) { if (isTypeAny(type)) { return undefined; @@ -38315,7 +38508,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 265 && !hasDuplicateDefaultClause) { + if (clause.kind === 266 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -38327,7 +38520,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 264) { + if (produceDiagnostics && clause.kind === 265) { var caseType = checkExpression(clause.expression); var caseIsLiteral = isLiteralType(caseType); var comparedExpressionType = expressionType; @@ -38351,7 +38544,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 226 && current.label.escapedText === node.label.escapedText) { + if (current.kind === 227 && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -38444,7 +38637,7 @@ var ts; } var errorNode; if (propDeclaration && - (propDeclaration.kind === 198 || + (propDeclaration.kind === 199 || ts.getNameOfDeclaration(propDeclaration).kind === 146 || prop.parent === containingType.symbol)) { errorNode = propDeclaration; @@ -38572,8 +38765,6 @@ var ts; checkDecorators(node); if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -38702,7 +38893,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 233 || d.kind === 234; + return d.kind === 234 || d.kind === 235; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -38720,7 +38911,7 @@ var ts; if (derived === base) { var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128))) { - if (derivedClassDecl.kind === 203) { + if (derivedClassDecl.kind === 204) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -38733,11 +38924,11 @@ var ts; if (baseDeclarationFlags & 8 || derivedDeclarationFlags & 8) { continue; } - if (isMethodLike(base) && isMethodLike(derived) || base.flags & 98308 && derived.flags & 98308) { + if (isPrototypeProperty(base) && isPrototypeProperty(derived) || base.flags & 98308 && derived.flags & 98308) { continue; } var errorMessage = void 0; - if (isMethodLike(base)) { + if (isPrototypeProperty(base)) { if (derived.flags & 98304) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } @@ -38745,11 +38936,11 @@ var ts; errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } - else if (base.flags & 4) { - errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + else if (base.flags & 98304) { + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } @@ -38829,7 +39020,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 234); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 235); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -38925,7 +39116,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 196: + case 197: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -38935,7 +39126,7 @@ var ts; } } break; - case 198: + case 199: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -38960,18 +39151,18 @@ var ts; case 8: checkGrammarNumericLiteral(expr); return +expr.text; - case 189: + case 190: return evaluate(expr.expression); case 71: return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), expr.escapedText); + case 185: case 184: - case 183: var ex = expr; if (isConstantMemberAccess(ex)) { var type = getTypeOfExpression(ex.expression); if (type.symbol && type.symbol.flags & 384) { var name = void 0; - if (ex.kind === 183) { + if (ex.kind === 184) { name = ex.name.escapedText; } else { @@ -39003,8 +39194,8 @@ var ts; } function isConstantMemberAccess(node) { return node.kind === 71 || - node.kind === 183 && isConstantMemberAccess(node.expression) || - node.kind === 184 && isConstantMemberAccess(node.expression) && + node.kind === 184 && isConstantMemberAccess(node.expression) || + node.kind === 185 && isConstantMemberAccess(node.expression) && node.argumentExpression.kind === 9; } function checkEnumDeclaration(node) { @@ -39013,8 +39204,6 @@ var ts; } checkGrammarDecoratorsAndModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -39035,7 +39224,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 236) { + if (declaration.kind !== 237) { return false; } var enumDeclaration = declaration; @@ -39058,8 +39247,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { var declaration = declarations_7[_i]; - if ((declaration.kind === 233 || - (declaration.kind === 232 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 234 || + (declaration.kind === 233 && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 2097152)) { return declaration; } @@ -39099,7 +39288,6 @@ var ts; } } if (ts.isIdentifier(node.name)) { - checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -39118,7 +39306,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, 233); + var mergedClass = ts.getDeclarationOfKind(symbol, 234); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -39161,22 +39349,22 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 212: + case 213: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 247: case 248: + case 249: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 241: case 242: + case 243: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 180: - case 230: + case 181: + case 231: var name = node.name; if (ts.isBindingPattern(name)) { for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { @@ -39185,12 +39373,12 @@ var ts; } break; } - case 233: - case 236: - case 232: case 234: case 237: + case 233: case 235: + case 238: + case 236: if (isGlobalAugmentation) { return; } @@ -39213,7 +39401,7 @@ var ts; node = node.left; } while (node.kind !== 71); return node; - case 183: + case 184: do { node = node.expression; } while (node.kind !== 71); @@ -39229,9 +39417,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 238 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 272 && !inAmbientExternalModule) { - error(moduleName, node.kind === 248 ? + var inAmbientExternalModule = node.parent.kind === 239 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 273 && !inAmbientExternalModule) { + error(moduleName, node.kind === 249 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -39252,13 +39440,13 @@ var ts; (symbol.flags & 67901928 ? 67901928 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 250 ? + var message = node.kind === 251 ? 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)); } if (compilerOptions.isolatedModules - && node.kind === 250 + && node.kind === 251 && !(target.flags & 67216319) && !(node.flags & 2097152)) { error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided); @@ -39266,7 +39454,6 @@ var ts; } } function checkImportBinding(node) { - checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkAliasSymbol(node); @@ -39285,7 +39472,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 244) { + if (importClause.namedBindings.kind === 245) { checkImportBinding(importClause.namedBindings); } else { @@ -39305,7 +39492,7 @@ var ts; if (ts.hasModifier(node, 1)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 252) { + if (node.moduleReference.kind !== 253) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 67216319) { @@ -39336,10 +39523,10 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 238 && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 238 && + var inAmbientExternalModule = node.parent.kind === 239 && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 239 && !node.moduleSpecifier && node.flags & 2097152; - if (node.parent.kind !== 272 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 273 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -39355,7 +39542,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 272 || node.parent.kind === 238 || node.parent.kind === 237; + var isInAppropriateContext = node.parent.kind === 273 || node.parent.kind === 239 || node.parent.kind === 238; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -39381,8 +39568,8 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 272 ? node.parent : node.parent.parent; - if (container.kind === 237 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 273 ? node.parent : node.parent.parent; + if (container.kind === 238 && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -39461,7 +39648,7 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 232 && declaration.kind !== 153) || + return (declaration.kind !== 233 && declaration.kind !== 153) || !!declaration.body; } function checkSourceElement(node) { @@ -39477,10 +39664,10 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 237: - case 233: + case 238: case 234: - case 232: + case 235: + case 233: cancellationToken.throwIfCancellationRequested(); } } @@ -39530,95 +39717,97 @@ var ts; return checkConditionalType(node); case 171: return checkInferType(node); - case 285: + case 178: + return checkImportType(node); + case 286: return checkJSDocAugmentsTag(node); - case 291: + case 292: return checkJSDocTypedefTag(node); - case 287: + case 288: return checkJSDocParameterTag(node); - case 280: + case 281: checkSignatureDeclaration(node); + case 279: case 278: - case 277: - case 275: case 276: + case 277: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 281: + case 282: checkJSDocVariadicType(node); return; - case 274: + case 275: return checkSourceElement(node.type); case 175: return checkIndexedAccessType(node); case 176: return checkMappedType(node); - case 232: - return checkFunctionDeclaration(node); - case 211: - case 238: - return checkBlock(node); - case 212: - return checkVariableStatement(node); - case 214: - return checkExpressionStatement(node); - case 215: - return checkIfStatement(node); - case 216: - return checkDoStatement(node); - case 217: - return checkWhileStatement(node); - case 218: - return checkForStatement(node); - case 219: - return checkForInStatement(node); - case 220: - return checkForOfStatement(node); - case 221: - case 222: - return checkBreakOrContinueStatement(node); - case 223: - return checkReturnStatement(node); - case 224: - return checkWithStatement(node); - case 225: - return checkSwitchStatement(node); - case 226: - return checkLabeledStatement(node); - case 227: - return checkThrowStatement(node); - case 228: - return checkTryStatement(node); - case 230: - return checkVariableDeclaration(node); - case 180: - return checkBindingElement(node); case 233: - return checkClassDeclaration(node); - case 234: - return checkInterfaceDeclaration(node); - case 235: - return checkTypeAliasDeclaration(node); - case 236: - return checkEnumDeclaration(node); - case 237: - return checkModuleDeclaration(node); - case 242: - return checkImportDeclaration(node); - case 241: - return checkImportEqualsDeclaration(node); - case 248: - return checkExportDeclaration(node); - case 247: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); + case 212: + case 239: + return checkBlock(node); case 213: - checkGrammarStatementInAmbientContext(node); - return; + return checkVariableStatement(node); + case 215: + return checkExpressionStatement(node); + case 216: + return checkIfStatement(node); + case 217: + return checkDoStatement(node); + case 218: + return checkWhileStatement(node); + case 219: + return checkForStatement(node); + case 220: + return checkForInStatement(node); + case 221: + return checkForOfStatement(node); + case 222: + case 223: + return checkBreakOrContinueStatement(node); + case 224: + return checkReturnStatement(node); + case 225: + return checkWithStatement(node); + case 226: + return checkSwitchStatement(node); + case 227: + return checkLabeledStatement(node); + case 228: + return checkThrowStatement(node); case 229: + return checkTryStatement(node); + case 231: + return checkVariableDeclaration(node); + case 181: + return checkBindingElement(node); + case 234: + return checkClassDeclaration(node); + case 235: + return checkInterfaceDeclaration(node); + case 236: + return checkTypeAliasDeclaration(node); + case 237: + return checkEnumDeclaration(node); + case 238: + return checkModuleDeclaration(node); + case 243: + return checkImportDeclaration(node); + case 242: + return checkImportEqualsDeclaration(node); + case 249: + return checkExportDeclaration(node); + case 248: + return checkExportAssignment(node); + case 214: checkGrammarStatementInAmbientContext(node); return; - case 251: + case 230: + checkGrammarStatementInAmbientContext(node); + return; + case 252: return checkMissingDeclaration(node); } } @@ -39683,8 +39872,8 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 190: case 191: + case 192: case 153: case 152: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); @@ -39693,7 +39882,7 @@ var ts; case 156: checkAccessorDeclaration(node); break; - case 203: + case 204: checkClassExpressionDeferred(node); break; } @@ -39794,24 +39983,24 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 237: + case 238: copySymbols(getSymbolOfNode(location).exports, meaning & 2623475); break; - case 236: + case 237: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 203: + case 204: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 233: case 234: + case 235: if (!isStatic) { copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67901928); } break; - case 190: + case 191: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -39850,10 +40039,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 147: - case 233: case 234: case 235: case 236: + case 237: return true; } } @@ -39866,10 +40055,10 @@ var ts; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 183) { + while (node.parent && node.parent.kind === 184) { node = node.parent; } - return node.parent && node.parent.kind === 205; + return node.parent && node.parent.kind === 206; } function forEachEnclosingClass(node, callback) { var result; @@ -39900,10 +40089,10 @@ var ts; while (nodeOnRightSide.parent.kind === 145) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 241) { + if (nodeOnRightSide.parent.kind === 242) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 247) { + if (nodeOnRightSide.parent.kind === 248) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -39923,32 +40112,54 @@ var ts; return getSymbolOfNode(entityName.parent.parent); } } + function isImportTypeQualifierPart(node) { + var parent = node.parent; + while (ts.isQualifiedName(parent)) { + node = parent; + parent = parent.parent; + } + if (parent && parent.kind === 178 && parent.qualifier === node) { + return parent; + } + return undefined; + } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } if (ts.isInJavaScriptFile(entityName) && - entityName.parent.kind === 183 && + entityName.parent.kind === 184 && entityName.parent === entityName.parent.parent.left) { var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); if (specialPropertyAssignmentSymbol) { return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 247 && ts.isEntityNameExpression(entityName)) { - return resolveEntityName(entityName, 67216319 | 67901928 | 1920 | 2097152); + if (entityName.parent.kind === 248 && ts.isEntityNameExpression(entityName)) { + var success = resolveEntityName(entityName, 67216319 | 67901928 | 1920 | 2097152, true); + if (success && success !== unknownSymbol) { + return success; + } } - if (entityName.kind !== 183 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 241); + else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) { + var importEqualsDeclaration = ts.getAncestor(entityName, 242); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } - if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (!ts.isPropertyAccessExpression(entityName)) { + var possibleImportNode = isImportTypeQualifierPart(entityName); + if (possibleImportNode) { + getTypeFromTypeNode(possibleImportNode); + var sym = getNodeLinks(entityName).resolvedSymbol; + return sym === unknownSymbol ? undefined : sym; + } + } + while (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 205) { + if (entityName.parent.kind === 206) { meaning = 67901928; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 67216319; @@ -39963,10 +40174,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 287) { + if (entityName.parent.kind === 288) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 147 && entityName.parent.parent.kind === 290) { + if (entityName.parent.kind === 147 && entityName.parent.parent.kind === 291) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -39982,12 +40193,12 @@ var ts; } return resolveEntityName(entityName, 67216319, false, true); } - else if (entityName.kind === 183 || entityName.kind === 145) { + else if (entityName.kind === 184 || entityName.kind === 145) { var links = getNodeLinks(entityName); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (entityName.kind === 183) { + if (entityName.kind === 184) { checkPropertyAccessExpression(entityName); } else { @@ -40000,7 +40211,7 @@ var ts; var meaning = entityName.parent.kind === 161 ? 67901928 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 260) { + else if (entityName.parent.kind === 261) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 160) { @@ -40009,7 +40220,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 272) { + if (node.kind === 273) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (node.flags & 4194304) { @@ -40025,8 +40236,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 180 && - node.parent.parent.kind === 178 && + else if (node.parent.kind === 181 && + node.parent.parent.kind === 179 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.escapedText); @@ -40037,7 +40248,7 @@ var ts; } switch (node.kind) { case 71: - case 183: + case 184: case 145: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 99: @@ -40064,8 +40275,9 @@ var ts; case 9: case 13: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 242 || node.parent.kind === 248) && node.parent.moduleSpecifier === node) || - ((ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, false)) || ts.isImportCall(node.parent))) { + ((node.parent.kind === 243 || node.parent.kind === 249) && node.parent.moduleSpecifier === node) || + ((ts.isInJavaScriptFile(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); } case 8: @@ -40079,12 +40291,14 @@ var ts; case 89: case 36: return getSymbolOfNode(node.parent); + case 178: + return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined; default: return undefined; } } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 269) { + if (location && location.kind === 270) { return resolveEntityName(location.name, 67216319 | 2097152); } return undefined; @@ -40145,20 +40359,20 @@ var ts; return unknownType; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 182 || expr.kind === 181); - if (expr.parent.kind === 220) { + ts.Debug.assert(expr.kind === 183 || expr.kind === 182); + if (expr.parent.kind === 221) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 198) { + if (expr.parent.kind === 199) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 268) { + if (expr.parent.kind === 269) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } - ts.Debug.assert(expr.parent.kind === 181); + ts.Debug.assert(expr.parent.kind === 182); var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false, false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, expr.parent.elements.indexOf(expr), elementType || unknownType); @@ -40222,7 +40436,7 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - var isPropertyName_1 = node.parent.kind === 183 && node.parent.name === node; + var isPropertyName_1 = node.parent.kind === 184 && node.parent.name === node; return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } @@ -40265,7 +40479,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 272) { + if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 273) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -40299,7 +40513,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 211 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 212 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -40335,16 +40549,16 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 241: - case 243: + case 242: case 244: - case 246: - case 250: + case 245: + case 247: + case 251: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 248: + case 249: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 247: + case 248: return node.expression && node.expression.kind === 71 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -40354,7 +40568,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 272 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 273 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -40419,15 +40633,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 271: - case 183: + case 272: case 184: + case 185: return true; } return false; } function getConstantValue(node) { - if (node.kind === 271) { + if (node.kind === 272) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -40583,7 +40797,7 @@ var ts; if (resolvedTypeReferenceDirectives) { fileToDirective = ts.createMap(); resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { - if (!resolvedDirective) { + if (!resolvedDirective || !resolvedDirective.resolvedFileName) { return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); @@ -40640,13 +40854,17 @@ var ts; }, getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; } }; + function isInHeritageClause(node) { + return node.parent && node.parent.kind === 206 && node.parent.parent && node.parent.parent.kind === 267; + } function getTypeReferenceDirectivesForEntityName(node) { if (!fileToDirective) { return undefined; } - var meaning = (node.kind === 183) || (node.kind === 71 && isInTypeQuery(node)) - ? 67216319 | 1048576 - : 67901928 | 1920; + var meaning = 67901928 | 1920; + if ((node.kind === 71 && isInTypeQuery(node)) || (node.kind === 184 && !isInHeritageClause(node))) { + meaning = 67216319 | 1048576; + } var symbol = resolveEntityName(node, meaning, true); return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; } @@ -40687,7 +40905,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 272 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 273 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -40701,12 +40919,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 237 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 238 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 272); + return ts.getDeclarationOfKind(moduleSymbol, 273); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -40867,7 +41085,7 @@ var ts; } switch (modifier.kind) { case 76: - if (node.kind !== 236 && node.parent.kind === 233) { + if (node.kind !== 237 && node.parent.kind === 234) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(76)); } break; @@ -40887,7 +41105,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 238 || node.parent.kind === 272) { + else if (node.parent.kind === 239 || node.parent.kind === 273) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -40910,7 +41128,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 238 || node.parent.kind === 272) { + else if (node.parent.kind === 239 || node.parent.kind === 273) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 148) { @@ -40945,7 +41163,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 233) { + else if (node.parent.kind === 234) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 148) { @@ -40954,8 +41172,8 @@ var ts; flags |= 1; break; case 79: - var container = node.parent.kind === 272 ? node.parent : node.parent.parent; - if (container.kind === 237 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 273 ? node.parent : node.parent.parent; + if (container.kind === 238 && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } flags |= 512; @@ -40967,13 +41185,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 233) { + else if (node.parent.kind === 234) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 148) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 2097152) && node.parent.kind === 238) { + else if ((node.parent.flags & 2097152) && node.parent.kind === 239) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -40983,14 +41201,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 233) { + if (node.kind !== 234) { if (node.kind !== 153 && node.kind !== 151 && node.kind !== 155 && node.kind !== 156) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 233 && ts.hasModifier(node.parent, 128))) { + if (!(node.parent.kind === 234 && ts.hasModifier(node.parent, 128))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -41032,7 +41250,7 @@ var ts; } return; } - else if ((node.kind === 242 || node.kind === 241) && flags & 2) { + else if ((node.kind === 243 || node.kind === 242) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 148 && (flags & 92) && ts.isBindingPattern(node.name)) { @@ -41062,29 +41280,29 @@ var ts; case 153: case 152: case 159: - case 237: + case 238: + case 243: case 242: - case 241: + case 249: case 248: - case 247: - case 190: case 191: + case 192: case 148: return false; default: - if (node.parent.kind === 238 || node.parent.kind === 272) { + if (node.parent.kind === 239 || node.parent.kind === 273) { return false; } switch (node.kind) { - case 232: - return nodeHasAnyModifiersExcept(node, 120); case 233: - return nodeHasAnyModifiersExcept(node, 117); + return nodeHasAnyModifiersExcept(node, 120); case 234: - case 212: + return nodeHasAnyModifiersExcept(node, 117); case 235: - return true; + case 213: case 236: + return true; + case 237: return nodeHasAnyModifiersExcept(node, 76); default: ts.Debug.fail(); @@ -41098,18 +41316,17 @@ var ts; function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 153: - case 232: - case 190: + case 233: case 191: + case 192: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } - function checkGrammarForDisallowedTrailingComma(list) { + function checkGrammarForDisallowedTrailingComma(list, diag) { + if (diag === void 0) { diag = ts.Diagnostics.Trailing_comma_not_allowed; } if (list && list.hasTrailingComma) { - var start = list.end - ",".length; - var end = list.end; - return grammarErrorAtPos(list[0], start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); + return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag); } } function checkGrammarTypeParameterList(typeParameters, file) { @@ -41128,6 +41345,9 @@ var ts; if (i !== (parameterCount - 1)) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); } + if (!(parameter.flags & 2097152)) { + checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + } if (ts.isBindingPattern(parameter.name)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } @@ -41197,7 +41417,7 @@ var ts; if (type.flags & 2 || type.flags & 4) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type))); } - if (allTypesAssignableToKind(type, 32, true)) { + if (type.flags & 131072 && allTypesAssignableToKind(type, 32, true)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead); } return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); @@ -41225,7 +41445,7 @@ var ts; if (args) { for (var _i = 0, args_5 = args; _i < args_5.length; _i++) { var arg = args_5[_i]; - if (arg.kind === 204) { + if (arg.kind === 205) { return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -41302,14 +41522,14 @@ var ts; return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 198 && computedPropertyName.expression.operatorToken.kind === 26) { + if (computedPropertyName.expression.kind === 199 && computedPropertyName.expression.operatorToken.kind === 26) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 232 || - node.kind === 190 || + ts.Debug.assert(node.kind === 233 || + node.kind === 191 || node.kind === 153); if (node.flags & 2097152) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); @@ -41328,14 +41548,14 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 270) { + if (prop.kind === 271) { continue; } var name = prop.name; if (name.kind === 146) { checkGrammarComputedPropertyName(name); } - if (prop.kind === 269 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 270 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { @@ -41348,8 +41568,8 @@ var ts; } var currentKind = void 0; switch (prop.kind) { - case 268: case 269: + case 270: checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8) { checkGrammarNumericLiteral(name); @@ -41397,7 +41617,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 262) { + if (attr.kind === 263) { continue; } var name = attr.name, initializer = attr.initializer; @@ -41407,7 +41627,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 263 && !initializer.expression) { + if (initializer && initializer.kind === 264 && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -41416,12 +41636,12 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 220 && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 221 && forInOrOfStatement.awaitModifier) { if ((forInOrOfStatement.flags & 16384) === 0) { return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); } } - if (forInOrOfStatement.initializer.kind === 231) { + if (forInOrOfStatement.initializer.kind === 232) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -41429,20 +41649,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 219 + var diagnostic = forInOrOfStatement.kind === 220 ? 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 === 219 + var diagnostic = forInOrOfStatement.kind === 220 ? 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 === 219 + var diagnostic = forInOrOfStatement.kind === 220 ? 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); @@ -41506,7 +41726,7 @@ var ts; } var parent = ts.walkUpParenthesizedTypes(node.parent); switch (parent.kind) { - case 230: + case 231: var decl = parent; if (decl.name.kind !== 71) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -41544,7 +41764,7 @@ var ts; return true; } if (node.kind === 153) { - if (node.parent.kind === 182) { + if (node.parent.kind === 183) { if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 120)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } @@ -41567,7 +41787,7 @@ var ts; 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 === 234) { + else if (node.parent.kind === 235) { 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 === 165) { @@ -41581,9 +41801,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 226: + case 227: if (node.label && current.label.escapedText === node.label.escapedText) { - var isMisplacedContinueLabel = node.kind === 221 + var isMisplacedContinueLabel = node.kind === 222 && !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); @@ -41591,8 +41811,8 @@ var ts; return false; } break; - case 225: - if (node.kind === 222 && !node.label) { + case 226: + if (node.kind === 223 && !node.label) { return false; } break; @@ -41605,13 +41825,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 222 + var message = node.kind === 223 ? 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 === 222 + var message = node.kind === 223 ? 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); @@ -41623,7 +41843,8 @@ var ts; if (node !== ts.last(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 179 || node.name.kind === 178) { + checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + if (node.name.kind === 180 || node.name.kind === 179) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.propertyName) { @@ -41636,11 +41857,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 || expr.kind === 8 || - expr.kind === 196 && expr.operator === 38 && + expr.kind === 197 && expr.operator === 38 && expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 219 && node.parent.parent.kind !== 220) { + if (node.parent.parent.kind !== 220 && node.parent.parent.kind !== 221) { if (node.flags & 2097152) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -41667,7 +41888,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 212 || !node.type || node.initializer || node.flags & 2097152)) { + if (node.exclamationToken && (node.parent.parent.kind !== 213 || !node.type || node.initializer || node.flags & 2097152)) { return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); } if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && @@ -41720,15 +41941,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 215: case 216: case 217: - case 224: case 218: + case 225: case 219: case 220: + case 221: return false; - case 226: + case 227: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -41794,7 +42015,7 @@ var ts; return true; } } - else if (node.parent.kind === 234) { + else if (node.parent.kind === 235) { 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; } @@ -41819,13 +42040,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 234 || - node.kind === 235 || + if (node.kind === 235 || + node.kind === 236 || + node.kind === 243 || node.kind === 242 || - node.kind === 241 || + node.kind === 249 || node.kind === 248 || - node.kind === 247 || - node.kind === 240 || + node.kind === 241 || ts.hasModifier(node, 2 | 1 | 512)) { return false; } @@ -41834,7 +42055,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 === 212) { + if (ts.isDeclaration(decl) || decl.kind === 213) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -41853,7 +42074,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 211 || node.parent.kind === 238 || node.parent.kind === 272) { + if (node.parent.kind === 212 || node.parent.kind === 239 || node.parent.kind === 273) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -41872,7 +42093,7 @@ var ts; else if (ts.isChildOfNodeWithKind(node, 177)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 271)) { + else if (ts.isChildOfNodeWithKind(node, 272)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -41920,8 +42141,8 @@ var ts; ts.createTypeChecker = createTypeChecker; function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 246: - case 250: + case 247: + case 251: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -41929,13 +42150,13 @@ var ts; } function isSomeImportDeclaration(decl) { switch (decl.kind) { - case 243: - case 241: case 244: - case 246: + case 242: + case 245: + case 247: return true; case 71: - return decl.parent.kind === 246; + return decl.parent.kind === 247; default: return false; } @@ -42084,12 +42305,18 @@ var ts; ts.createUniqueName = createUniqueName; function createOptimisticUniqueName(text) { var name = createIdentifier(text); - name.autoGenerateFlags = 5; + name.autoGenerateFlags = 3 | 32; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createOptimisticUniqueName = createOptimisticUniqueName; + function createFileLevelUniqueName(text) { + var name = createOptimisticUniqueName(text); + name.autoGenerateFlags |= 64; + return name; + } + ts.createFileLevelUniqueName = createFileLevelUniqueName; function getGeneratedNameForNode(node, shouldSkipNameGenerationScope) { var name = createIdentifier(""); name.autoGenerateFlags = 4; @@ -42184,7 +42411,7 @@ var ts; ts.updateQualifiedName = updateQualifiedName; function parenthesizeForComputedName(expression) { return (ts.isBinaryExpression(expression) && expression.operatorToken.kind === 26) || - expression.kind === 296 ? + expression.kind === 297 ? createParen(expression) : expression; } @@ -42608,6 +42835,24 @@ var ts; : node; } ts.updateInferTypeNode = updateInferTypeNode; + function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) { + var node = createSynthesizedNode(178); + node.argument = argument; + node.qualifier = qualifier; + node.typeArguments = asNodeArray(typeArguments); + node.isTypeOf = isTypeOf; + return node; + } + ts.createImportTypeNode = createImportTypeNode; + function updateImportTypeNode(node, argument, qualifier, typeArguments, isTypeOf) { + return node.argument !== argument + || node.qualifier !== qualifier + || node.typeArguments !== typeArguments + || node.isTypeOf !== isTypeOf + ? updateNode(createImportTypeNode(argument, qualifier, typeArguments, isTypeOf), node) + : node; + } + ts.updateImportTypeNode = updateImportTypeNode; function createParenthesizedType(type) { var node = createSynthesizedNode(172); node.type = type; @@ -42680,7 +42925,7 @@ var ts; } ts.updateLiteralTypeNode = updateLiteralTypeNode; function createObjectBindingPattern(elements) { - var node = createSynthesizedNode(178); + var node = createSynthesizedNode(179); node.elements = createNodeArray(elements); return node; } @@ -42692,7 +42937,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements) { - var node = createSynthesizedNode(179); + var node = createSynthesizedNode(180); node.elements = createNodeArray(elements); return node; } @@ -42704,7 +42949,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createSynthesizedNode(180); + var node = createSynthesizedNode(181); node.dotDotDotToken = dotDotDotToken; node.propertyName = asName(propertyName); node.name = asName(name); @@ -42722,7 +42967,7 @@ var ts; } ts.updateBindingElement = updateBindingElement; function createArrayLiteral(elements, multiLine) { - var node = createSynthesizedNode(181); + var node = createSynthesizedNode(182); node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) node.multiLine = true; @@ -42736,7 +42981,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, multiLine) { - var node = createSynthesizedNode(182); + var node = createSynthesizedNode(183); node.properties = createNodeArray(properties); if (multiLine) node.multiLine = true; @@ -42750,7 +42995,7 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name) { - var node = createSynthesizedNode(183); + var node = createSynthesizedNode(184); node.expression = ts.parenthesizeForAccess(expression); node.name = asName(name); setEmitFlags(node, 131072); @@ -42765,7 +43010,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index) { - var node = createSynthesizedNode(184); + var node = createSynthesizedNode(185); node.expression = ts.parenthesizeForAccess(expression); node.argumentExpression = asExpression(index); return node; @@ -42779,7 +43024,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(185); + var node = createSynthesizedNode(186); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); @@ -42795,7 +43040,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(186); + var node = createSynthesizedNode(187); node.expression = ts.parenthesizeForNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -42811,7 +43056,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, template) { - var node = createSynthesizedNode(187); + var node = createSynthesizedNode(188); node.tag = ts.parenthesizeForAccess(tag); node.template = template; return node; @@ -42825,7 +43070,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createTypeAssertion(type, expression) { - var node = createSynthesizedNode(188); + var node = createSynthesizedNode(189); node.type = type; node.expression = ts.parenthesizePrefixOperand(expression); return node; @@ -42839,7 +43084,7 @@ var ts; } ts.updateTypeAssertion = updateTypeAssertion; function createParen(expression) { - var node = createSynthesizedNode(189); + var node = createSynthesizedNode(190); node.expression = expression; return node; } @@ -42851,7 +43096,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(190); + var node = createSynthesizedNode(191); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -42875,7 +43120,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createSynthesizedNode(191); + var node = createSynthesizedNode(192); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); @@ -42909,7 +43154,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression) { - var node = createSynthesizedNode(192); + var node = createSynthesizedNode(193); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -42921,7 +43166,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression) { - var node = createSynthesizedNode(193); + var node = createSynthesizedNode(194); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -42933,7 +43178,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression) { - var node = createSynthesizedNode(194); + var node = createSynthesizedNode(195); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -42945,7 +43190,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression) { - var node = createSynthesizedNode(195); + var node = createSynthesizedNode(196); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -42957,7 +43202,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand) { - var node = createSynthesizedNode(196); + var node = createSynthesizedNode(197); node.operator = operator; node.operand = ts.parenthesizePrefixOperand(operand); return node; @@ -42970,7 +43215,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator) { - var node = createSynthesizedNode(197); + var node = createSynthesizedNode(198); node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -42983,7 +43228,7 @@ var ts; } ts.updatePostfix = updatePostfix; function createBinary(left, operator, right) { - var node = createSynthesizedNode(198); + var node = createSynthesizedNode(199); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = ts.parenthesizeBinaryOperand(operatorKind, left, true, undefined); @@ -43000,7 +43245,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { - var node = createSynthesizedNode(199); + var node = createSynthesizedNode(200); node.condition = ts.parenthesizeForConditionalHead(condition); node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(55); node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); @@ -43030,7 +43275,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans) { - var node = createSynthesizedNode(200); + var node = createSynthesizedNode(201); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -43068,7 +43313,7 @@ var ts; } ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral; function createYield(asteriskTokenOrExpression, expression) { - var node = createSynthesizedNode(201); + var node = createSynthesizedNode(202); node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 39 ? asteriskTokenOrExpression : undefined; node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 39 ? asteriskTokenOrExpression : expression; return node; @@ -43082,7 +43327,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression) { - var node = createSynthesizedNode(202); + var node = createSynthesizedNode(203); node.expression = ts.parenthesizeExpressionForList(expression); return node; } @@ -43094,7 +43339,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(203); + var node = createSynthesizedNode(204); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -43115,11 +43360,11 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression() { - return createSynthesizedNode(204); + return createSynthesizedNode(205); } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression) { - var node = createSynthesizedNode(205); + var node = createSynthesizedNode(206); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); return node; @@ -43133,7 +43378,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createAsExpression(expression, type) { - var node = createSynthesizedNode(206); + var node = createSynthesizedNode(207); node.expression = expression; node.type = type; return node; @@ -43147,7 +43392,7 @@ var ts; } ts.updateAsExpression = updateAsExpression; function createNonNullExpression(expression) { - var node = createSynthesizedNode(207); + var node = createSynthesizedNode(208); node.expression = ts.parenthesizeForAccess(expression); return node; } @@ -43159,7 +43404,7 @@ var ts; } ts.updateNonNullExpression = updateNonNullExpression; function createMetaProperty(keywordToken, name) { - var node = createSynthesizedNode(208); + var node = createSynthesizedNode(209); node.keywordToken = keywordToken; node.name = name; return node; @@ -43172,7 +43417,7 @@ var ts; } ts.updateMetaProperty = updateMetaProperty; function createTemplateSpan(expression, literal) { - var node = createSynthesizedNode(209); + var node = createSynthesizedNode(210); node.expression = expression; node.literal = literal; return node; @@ -43186,11 +43431,11 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createSemicolonClassElement() { - return createSynthesizedNode(210); + return createSynthesizedNode(211); } ts.createSemicolonClassElement = createSemicolonClassElement; function createBlock(statements, multiLine) { - var block = createSynthesizedNode(211); + var block = createSynthesizedNode(212); block.statements = createNodeArray(statements); if (multiLine) block.multiLine = multiLine; @@ -43204,7 +43449,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList) { - var node = createSynthesizedNode(212); + var node = createSynthesizedNode(213); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -43219,11 +43464,11 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createEmptyStatement() { - return createSynthesizedNode(213); + return createSynthesizedNode(214); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression) { - var node = createSynthesizedNode(214); + var node = createSynthesizedNode(215); node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -43235,7 +43480,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement) { - var node = createSynthesizedNode(215); + var node = createSynthesizedNode(216); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -43251,7 +43496,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression) { - var node = createSynthesizedNode(216); + var node = createSynthesizedNode(217); node.statement = statement; node.expression = expression; return node; @@ -43265,7 +43510,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement) { - var node = createSynthesizedNode(217); + var node = createSynthesizedNode(218); node.expression = expression; node.statement = statement; return node; @@ -43279,7 +43524,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement) { - var node = createSynthesizedNode(218); + var node = createSynthesizedNode(219); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -43297,7 +43542,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement) { - var node = createSynthesizedNode(219); + var node = createSynthesizedNode(220); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -43313,7 +43558,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(awaitModifier, initializer, expression, statement) { - var node = createSynthesizedNode(220); + var node = createSynthesizedNode(221); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; @@ -43331,7 +43576,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label) { - var node = createSynthesizedNode(221); + var node = createSynthesizedNode(222); node.label = asName(label); return node; } @@ -43343,7 +43588,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label) { - var node = createSynthesizedNode(222); + var node = createSynthesizedNode(223); node.label = asName(label); return node; } @@ -43355,7 +43600,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression) { - var node = createSynthesizedNode(223); + var node = createSynthesizedNode(224); node.expression = expression; return node; } @@ -43367,7 +43612,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement) { - var node = createSynthesizedNode(224); + var node = createSynthesizedNode(225); node.expression = expression; node.statement = statement; return node; @@ -43381,7 +43626,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock) { - var node = createSynthesizedNode(225); + var node = createSynthesizedNode(226); node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -43395,7 +43640,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement) { - var node = createSynthesizedNode(226); + var node = createSynthesizedNode(227); node.label = asName(label); node.statement = statement; return node; @@ -43409,7 +43654,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression) { - var node = createSynthesizedNode(227); + var node = createSynthesizedNode(228); node.expression = expression; return node; } @@ -43421,7 +43666,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock) { - var node = createSynthesizedNode(228); + var node = createSynthesizedNode(229); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -43437,11 +43682,11 @@ var ts; } ts.updateTry = updateTry; function createDebuggerStatement() { - return createSynthesizedNode(229); + return createSynthesizedNode(230); } ts.createDebuggerStatement = createDebuggerStatement; function createVariableDeclaration(name, type, initializer) { - var node = createSynthesizedNode(230); + var node = createSynthesizedNode(231); node.name = asName(name); node.type = type; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -43457,7 +43702,7 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createVariableDeclarationList(declarations, flags) { - var node = createSynthesizedNode(231); + var node = createSynthesizedNode(232); node.flags |= flags & 3; node.declarations = createNodeArray(declarations); return node; @@ -43470,7 +43715,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(232); + var node = createSynthesizedNode(233); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; @@ -43496,7 +43741,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(233); + var node = createSynthesizedNode(234); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -43518,7 +43763,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(234); + var node = createSynthesizedNode(235); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -43540,7 +43785,7 @@ var ts; } ts.updateInterfaceDeclaration = updateInterfaceDeclaration; function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) { - var node = createSynthesizedNode(235); + var node = createSynthesizedNode(236); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -43560,7 +43805,7 @@ var ts; } ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration; function createEnumDeclaration(decorators, modifiers, name, members) { - var node = createSynthesizedNode(236); + var node = createSynthesizedNode(237); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -43578,7 +43823,7 @@ var ts; } ts.updateEnumDeclaration = updateEnumDeclaration; function createModuleDeclaration(decorators, modifiers, name, body, flags) { - var node = createSynthesizedNode(237); + var node = createSynthesizedNode(238); node.flags |= flags & (16 | 4 | 512); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -43597,7 +43842,7 @@ var ts; } ts.updateModuleDeclaration = updateModuleDeclaration; function createModuleBlock(statements) { - var node = createSynthesizedNode(238); + var node = createSynthesizedNode(239); node.statements = createNodeArray(statements); return node; } @@ -43609,7 +43854,7 @@ var ts; } ts.updateModuleBlock = updateModuleBlock; function createCaseBlock(clauses) { - var node = createSynthesizedNode(239); + var node = createSynthesizedNode(240); node.clauses = createNodeArray(clauses); return node; } @@ -43621,7 +43866,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createNamespaceExportDeclaration(name) { - var node = createSynthesizedNode(240); + var node = createSynthesizedNode(241); node.name = asName(name); return node; } @@ -43633,7 +43878,7 @@ var ts; } ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration; function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { - var node = createSynthesizedNode(241); + var node = createSynthesizedNode(242); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -43651,7 +43896,7 @@ var ts; } ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { - var node = createSynthesizedNode(242); + var node = createSynthesizedNode(243); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; @@ -43669,7 +43914,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings) { - var node = createSynthesizedNode(243); + var node = createSynthesizedNode(244); node.name = name; node.namedBindings = namedBindings; return node; @@ -43683,7 +43928,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name) { - var node = createSynthesizedNode(244); + var node = createSynthesizedNode(245); node.name = name; return node; } @@ -43695,7 +43940,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements) { - var node = createSynthesizedNode(245); + var node = createSynthesizedNode(246); node.elements = createNodeArray(elements); return node; } @@ -43707,7 +43952,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name) { - var node = createSynthesizedNode(246); + var node = createSynthesizedNode(247); node.propertyName = propertyName; node.name = name; return node; @@ -43721,7 +43966,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression) { - var node = createSynthesizedNode(247); + var node = createSynthesizedNode(248); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; @@ -43738,7 +43983,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { - var node = createSynthesizedNode(248); + var node = createSynthesizedNode(249); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; @@ -43756,7 +44001,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements) { - var node = createSynthesizedNode(249); + var node = createSynthesizedNode(250); node.elements = createNodeArray(elements); return node; } @@ -43768,7 +44013,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(propertyName, name) { - var node = createSynthesizedNode(250); + var node = createSynthesizedNode(251); node.propertyName = asName(propertyName); node.name = asName(name); return node; @@ -43782,7 +44027,7 @@ var ts; } ts.updateExportSpecifier = updateExportSpecifier; function createExternalModuleReference(expression) { - var node = createSynthesizedNode(252); + var node = createSynthesizedNode(253); node.expression = expression; return node; } @@ -43794,7 +44039,7 @@ var ts; } ts.updateExternalModuleReference = updateExternalModuleReference; function createJsxElement(openingElement, children, closingElement) { - var node = createSynthesizedNode(253); + var node = createSynthesizedNode(254); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -43810,7 +44055,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(254); + var node = createSynthesizedNode(255); node.tagName = tagName; node.typeArguments = typeArguments && createNodeArray(typeArguments); node.attributes = attributes; @@ -43826,7 +44071,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(255); + var node = createSynthesizedNode(256); node.tagName = tagName; node.typeArguments = typeArguments && createNodeArray(typeArguments); node.attributes = attributes; @@ -43842,7 +44087,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName) { - var node = createSynthesizedNode(256); + var node = createSynthesizedNode(257); node.tagName = tagName; return node; } @@ -43854,7 +44099,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxFragment(openingFragment, children, closingFragment) { - var node = createSynthesizedNode(257); + var node = createSynthesizedNode(258); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -43870,7 +44115,7 @@ var ts; } ts.updateJsxFragment = updateJsxFragment; function createJsxAttribute(name, initializer) { - var node = createSynthesizedNode(260); + var node = createSynthesizedNode(261); node.name = name; node.initializer = initializer; return node; @@ -43884,7 +44129,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(261); + var node = createSynthesizedNode(262); node.properties = createNodeArray(properties); return node; } @@ -43896,7 +44141,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(262); + var node = createSynthesizedNode(263); node.expression = expression; return node; } @@ -43908,7 +44153,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(263); + var node = createSynthesizedNode(264); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -43921,7 +44166,7 @@ var ts; } ts.updateJsxExpression = updateJsxExpression; function createCaseClause(expression, statements) { - var node = createSynthesizedNode(264); + var node = createSynthesizedNode(265); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -43935,7 +44180,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(265); + var node = createSynthesizedNode(266); node.statements = createNodeArray(statements); return node; } @@ -43947,7 +44192,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(266); + var node = createSynthesizedNode(267); node.token = token; node.types = createNodeArray(types); return node; @@ -43960,7 +44205,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(267); + var node = createSynthesizedNode(268); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -43974,7 +44219,7 @@ var ts; } ts.updateCatchClause = updateCatchClause; function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(268); + var node = createSynthesizedNode(269); node.name = asName(name); node.questionToken = undefined; node.initializer = ts.parenthesizeExpressionForList(initializer); @@ -43989,7 +44234,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(269); + var node = createSynthesizedNode(270); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -44003,7 +44248,7 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(270); + var node = createSynthesizedNode(271); node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; return node; } @@ -44015,7 +44260,7 @@ var ts; } ts.updateSpreadAssignment = updateSpreadAssignment; function createEnumMember(name, initializer) { - var node = createSynthesizedNode(271); + var node = createSynthesizedNode(272); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -44028,12 +44273,13 @@ var ts; : node; } ts.updateEnumMember = updateEnumMember; - function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences) { + function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib) { if (node.statements !== statements || (isDeclarationFile !== undefined && node.isDeclarationFile !== isDeclarationFile) || (referencedFiles !== undefined && node.referencedFiles !== referencedFiles) || - (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences)) { - var updated = createSynthesizedNode(272); + (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) || + (hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) { + var updated = createSynthesizedNode(273); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -44043,6 +44289,7 @@ var ts; updated.isDeclarationFile = isDeclarationFile === undefined ? node.isDeclarationFile : isDeclarationFile; updated.referencedFiles = referencedFiles === undefined ? node.referencedFiles : referencedFiles; updated.typeReferenceDirectives = typeReferences === undefined ? node.typeReferenceDirectives : typeReferences; + updated.hasNoDefaultLib = hasNoDefaultLib === undefined ? node.hasNoDefaultLib : hasNoDefaultLib; if (node.amdDependencies !== undefined) updated.amdDependencies = node.amdDependencies; if (node.moduleName !== undefined) @@ -44051,8 +44298,6 @@ var ts; updated.languageVariant = node.languageVariant; if (node.renamedDependencies !== undefined) updated.renamedDependencies = node.renamedDependencies; - if (node.hasNoDefaultLib !== undefined) - updated.hasNoDefaultLib = node.hasNoDefaultLib; if (node.languageVersion !== undefined) updated.languageVersion = node.languageVersion; if (node.scriptKind !== undefined) @@ -44105,28 +44350,28 @@ var ts; } ts.getMutableClone = getMutableClone; function createNotEmittedStatement(original) { - var node = createSynthesizedNode(294); + var node = createSynthesizedNode(295); node.original = original; setTextRange(node, original); return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(298); + var node = createSynthesizedNode(299); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(297); + var node = createSynthesizedNode(298); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(295); + var node = createSynthesizedNode(296); node.expression = expression; node.original = original; setTextRange(node, original); @@ -44142,7 +44387,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 296) { + if (node.kind === 297) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26) { @@ -44152,7 +44397,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(296); + var node = createSynthesizedNode(297); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -44164,7 +44409,7 @@ var ts; } ts.updateCommaList = updateCommaList; function createBundle(sourceFiles) { - var node = ts.createNode(273); + var node = ts.createNode(274); node.sourceFiles = sourceFiles; return node; } @@ -44267,7 +44512,7 @@ var ts; function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 272) { + if (node.kind === 273) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -44689,7 +44934,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 226 + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 227 ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -44707,13 +44952,13 @@ var ts; case 8: case 9: return false; - case 181: + case 182: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 182: + case 183: return target.properties.length > 0; default: return true; @@ -44739,7 +44984,7 @@ var ts; } else { switch (callee.kind) { - case 183: { + case 184: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = ts.createTempVariable(recordTempVariable); target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name); @@ -44751,7 +44996,7 @@ var ts; } break; } - case 184: { + case 185: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = ts.createTempVariable(recordTempVariable); target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression); @@ -44807,9 +45052,9 @@ var ts; case 155: case 156: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 268: - return createExpressionForPropertyAssignment(property, receiver); case 269: + return createExpressionForPropertyAssignment(property, receiver); + case 270: return createExpressionForShorthandPropertyAssignment(property, receiver); case 153: return createExpressionForMethodDeclaration(property, receiver); @@ -45011,7 +45256,7 @@ var ts; ts.ensureUseStrict = ensureUseStrict; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 189) { + if (skipped.kind === 190) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -45020,15 +45265,15 @@ var ts; } ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(198, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(198, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(199, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(199, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1: if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 - && operand.kind === 201) { + && operand.kind === 202) { return false; } return true; @@ -45067,7 +45312,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 198 && node.operatorToken.kind === 37) { + if (node.kind === 199 && node.operatorToken.kind === 37) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -45082,7 +45327,7 @@ var ts; return 0; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(199, 55); + var conditionalPrecedence = ts.getOperatorPrecedence(200, 55); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { @@ -45093,17 +45338,17 @@ var ts; ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; function parenthesizeSubexpressionOfConditionalExpression(e) { var emittedExpression = ts.skipPartiallyEmittedExpressions(e); - return emittedExpression.kind === 198 && emittedExpression.operatorToken.kind === 26 || - emittedExpression.kind === 296 + return emittedExpression.kind === 199 && emittedExpression.operatorToken.kind === 26 || + emittedExpression.kind === 297 ? ts.createParen(e) : e; } ts.parenthesizeSubexpressionOfConditionalExpression = parenthesizeSubexpressionOfConditionalExpression; function parenthesizeDefaultExpression(e) { var check = ts.skipPartiallyEmittedExpressions(e); - return (check.kind === 203 || - check.kind === 190 || - check.kind === 296 || + return (check.kind === 204 || + check.kind === 191 || + check.kind === 297 || ts.isBinaryExpression(check) && check.operatorToken.kind === 26) ? ts.createParen(e) : e; @@ -45112,9 +45357,9 @@ var ts; function parenthesizeForNew(expression) { var leftmostExpr = getLeftmostExpression(expression, true); switch (leftmostExpr.kind) { - case 185: - return ts.createParen(expression); case 186: + return ts.createParen(expression); + case 187: return !leftmostExpr.arguments ? ts.createParen(expression) : expression; @@ -45125,7 +45370,7 @@ var ts; function parenthesizeForAccess(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 186 || emittedExpression.arguments)) { + && (emittedExpression.kind !== 187 || emittedExpression.arguments)) { return expression; } return ts.setTextRange(ts.createParen(expression), expression); @@ -45163,7 +45408,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(198, 26); + var commaPrecedence = ts.getOperatorPrecedence(199, 26); return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(ts.createParen(expression), expression); @@ -45174,14 +45419,14 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 190 || kind === 191) { + if (kind === 191 || kind === 192) { var mutableCall = ts.getMutableClone(emittedExpression); mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreateOuterExpressions(expression, mutableCall, 4); } } var leftmostExpressionKind = getLeftmostExpression(emittedExpression, false).kind; - if (leftmostExpressionKind === 182 || leftmostExpressionKind === 190) { + if (leftmostExpressionKind === 183 || leftmostExpressionKind === 191) { return ts.setTextRange(ts.createParen(expression), expression); } return expression; @@ -45231,24 +45476,24 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 197: + case 198: node = node.operand; continue; - case 198: + case 199: node = node.left; continue; - case 199: + case 200: node = node.condition; continue; - case 185: + case 186: if (stopAtCallExpressions) { return node; } + case 185: case 184: - case 183: node = node.expression; continue; - case 295: + case 296: node = node.expression; continue; } @@ -45256,7 +45501,7 @@ var ts; } } function parenthesizeConciseBody(body) { - if (!ts.isBlock(body) && getLeftmostExpression(body, false).kind === 182) { + if (!ts.isBlock(body) && getLeftmostExpression(body, false).kind === 183) { return ts.setTextRange(ts.createParen(body), body); } return body; @@ -45265,13 +45510,13 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 7; } switch (node.kind) { - case 189: + case 190: return (kinds & 1) !== 0; - case 188: - case 206: + case 189: case 207: + case 208: return (kinds & 2) !== 0; - case 295: + case 296: return (kinds & 4) !== 0; } return false; @@ -45296,7 +45541,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipAssertions(node) { - while (ts.isAssertionExpression(node) || node.kind === 207) { + while (ts.isAssertionExpression(node) || node.kind === 208) { node = node.expression; } return node; @@ -45304,15 +45549,15 @@ var ts; ts.skipAssertions = skipAssertions; function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 189: return ts.updateParen(outerExpression, expression); - case 188: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 206: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); - case 207: return ts.updateNonNullExpression(outerExpression, expression); - case 295: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 190: return ts.updateParen(outerExpression, expression); + case 189: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 207: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); + case 208: return ts.updateNonNullExpression(outerExpression, expression); + case 296: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } function isIgnorableParen(node) { - return node.kind === 189 + return node.kind === 190 && ts.nodeIsSynthesized(node) && ts.nodeIsSynthesized(ts.getSourceMapRange(node)) && ts.nodeIsSynthesized(ts.getCommentRange(node)) @@ -45374,10 +45619,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 242 && node.importClause) { + if (node.kind === 243 && node.importClause) { return ts.getGeneratedNameForNode(node); } - if (node.kind === 248 && node.moduleSpecifier) { + if (node.kind === 249 && node.moduleSpecifier) { return ts.getGeneratedNameForNode(node); } return undefined; @@ -45439,11 +45684,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 268: - return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 269: - return bindingElement.name; + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 270: + return bindingElement.name; + case 271: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -45460,10 +45705,10 @@ var ts; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { case 148: - case 180: + case 181: return bindingElement.dotDotDotToken; - case 202: - case 270: + case 203: + case 271: return bindingElement; } return undefined; @@ -45471,7 +45716,7 @@ var ts; ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 180: + case 181: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -45479,7 +45724,7 @@ var ts; : propertyName; } break; - case 268: + case 269: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -45487,7 +45732,7 @@ var ts; : propertyName; } break; - case 270: + case 271: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -45501,11 +45746,11 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 178: case 179: - case 181: - return name.elements; + case 180: case 182: + return name.elements; + case 183: return name.properties; } } @@ -45544,11 +45789,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 179: - case 181: - return convertToArrayAssignmentPattern(node); - case 178: + case 180: case 182: + return convertToArrayAssignmentPattern(node); + case 179: + case 183: return convertToObjectAssignmentPattern(node); } } @@ -45745,6 +45990,8 @@ var ts; return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode)); case 171: return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + case 178: + return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); case 172: return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode)); case 174: @@ -45755,185 +46002,185 @@ var ts; return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode)); case 177: return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); - case 178: - return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); case 179: - return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); case 180: - return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); case 181: - return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); case 182: - return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); case 183: - return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); case 184: - return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); + return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); case 185: - return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); case 186: - return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); case 187: - return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); case 188: - return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); case 189: - return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); case 190: - return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 191: - return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context)); + return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 192: - return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context)); case 193: - return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 194: - return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); case 195: - return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); case 196: - return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); + return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); case 197: - return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); + return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); case 198: - return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken)); + return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); case 199: - return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression)); + return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken)); case 200: - return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression)); case 201: - return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); case 202: - return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); case 203: + return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + case 204: return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 205: - return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); case 206: - return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); + return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); case 207: - return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); case 208: - return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 209: + return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier)); + case 210: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 211: - return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 212: + return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 213: return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 214: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 215: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 216: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); case 217: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); case 218: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 219: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 220: - return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 221: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); + return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 222: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); case 223: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); case 224: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); case 225: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 226: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); case 227: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 228: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 229: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); - case 230: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 231: - return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 232: - return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); case 233: - return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 234: - return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); case 235: - return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); + return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); case 236: - return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); case 237: - return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); + return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); case 238: - return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); case 239: - return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 240: - return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); case 241: - return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); + return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier)); case 242: - return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); case 243: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); + return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 244: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); case 245: - return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); case 246: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); case 247: - return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); case 248: - return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); case 249: - return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 250: + return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + case 251: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); - case 252: - return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); case 253: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); + return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); case 254: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 255: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 256: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 257: + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + case 258: return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 260: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 261: - return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 262: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); case 263: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 264: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 265: - return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); case 266: - return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 267: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); case 268: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 269: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 270: - return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); case 271: - return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); case 272: + return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + case 273: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 295: - return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 296: + return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + case 297: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: return node; @@ -45967,11 +46214,11 @@ var ts; } var result = initial; switch (node.kind) { - case 210: - case 213: - case 204: - case 229: - case 294: + case 211: + case 214: + case 205: + case 230: + case 295: break; case 145: result = reduceNode(node.left, cbNode, result); @@ -46033,33 +46280,28 @@ var ts; result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 178: case 179: + case 180: result = reduceNodes(node.elements, cbNodes, result); break; - case 180: + case 181: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 181: + case 182: result = reduceNodes(node.elements, cbNodes, result); break; - case 182: - result = reduceNodes(node.properties, cbNodes, result); - break; case 183: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.properties, cbNodes, result); break; case 184: result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.argumentExpression, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 185: result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - result = reduceNodes(node.arguments, cbNodes, result); + result = reduceNode(node.argumentExpression, cbNode, result); break; case 186: result = reduceNode(node.expression, cbNode, result); @@ -46067,14 +46309,19 @@ var ts; result = reduceNodes(node.arguments, cbNodes, result); break; case 187: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); + break; + case 188: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 188: + case 189: result = reduceNode(node.type, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 190: + case 191: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -46082,262 +46329,262 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 191: + case 192: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 189: - case 192: + case 190: case 193: case 194: case 195: - case 201: + case 196: case 202: - case 207: + case 203: + case 208: result = reduceNode(node.expression, cbNode, result); break; - case 196: case 197: + case 198: result = reduceNode(node.operand, cbNode, result); break; - case 198: + case 199: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 199: + case 200: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 200: + case 201: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 203: + case 204: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 205: + case 206: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 206: + case 207: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.type, cbNode, result); break; - case 209: + case 210: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; - case 211: + case 212: result = reduceNodes(node.statements, cbNodes, result); break; - case 212: + case 213: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 214: + case 215: result = reduceNode(node.expression, cbNode, result); break; - case 215: + case 216: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 216: - result = reduceNode(node.statement, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; case 217: - case 224: - result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 218: + case 225: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 219: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 219: case 220: + case 221: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 223: - case 227: + case 224: + case 228: result = reduceNode(node.expression, cbNode, result); break; - case 225: + case 226: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 226: + case 227: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 228: + case 229: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 230: + case 231: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 231: - result = reduceNodes(node.declarations, cbNodes, result); - break; case 232: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); + result = reduceNodes(node.declarations, cbNodes, result); break; case 233: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.heritageClauses, cbNodes, result); - result = reduceNodes(node.members, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; - case 236: + case 234: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; case 237: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.body, cbNode, result); + result = reduceNodes(node.members, cbNodes, result); break; case 238: - result = reduceNodes(node.statements, cbNodes, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 239: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 240: result = reduceNodes(node.clauses, cbNodes, result); break; - case 241: + case 242: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.moduleReference, cbNode, result); break; - case 242: + case 243: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 243: + case 244: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 244: - result = reduceNode(node.name, cbNode, result); - break; case 245: - case 249: - result = reduceNodes(node.elements, cbNodes, result); + result = reduceNode(node.name, cbNode, result); break; case 246: case 250: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 247: + case 251: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 247: + case 248: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 248: + case 249: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 252: + case 253: result = reduceNode(node.expression, cbNode, result); break; - case 253: + case 254: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 257: + case 258: result = reduceNode(node.openingFragment, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingFragment, cbNode, result); break; - case 254: case 255: + case 256: result = reduceNode(node.tagName, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 261: + case 262: result = reduceNodes(node.properties, cbNodes, result); break; - case 256: + case 257: result = reduceNode(node.tagName, cbNode, result); break; - case 260: + case 261: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 262: - result = reduceNode(node.expression, cbNode, result); - break; case 263: result = reduceNode(node.expression, cbNode, result); break; case 264: result = reduceNode(node.expression, cbNode, result); + break; case 265: + result = reduceNode(node.expression, cbNode, result); + case 266: result = reduceNodes(node.statements, cbNodes, result); break; - case 266: + case 267: result = reduceNodes(node.types, cbNodes, result); break; - case 267: + case 268: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; - case 268: + case 269: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 269: + case 270: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 270: + case 271: result = reduceNode(node.expression, cbNode, result); break; - case 271: + case 272: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 272: + case 273: result = reduceNodes(node.statements, cbNodes, result); break; - case 295: + case 296: result = reduceNode(node.expression, cbNode, result); break; - case 296: + case 297: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -46390,7 +46637,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 205)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 206)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -46513,16 +46760,16 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 242: + case 243: externalImports.push(node); - hasImportStarOrImportDefault = getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); + hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); break; - case 241: - if (node.moduleReference.kind === 252) { + case 242: + if (node.moduleReference.kind === 253) { externalImports.push(node); } break; - case 248: + case 249: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -46549,12 +46796,12 @@ var ts; } } break; - case 247: + case 248: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 212: + case 213: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -46562,7 +46809,7 @@ var ts; } } break; - case 232: + case 233: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { @@ -46580,7 +46827,7 @@ var ts; } } break; - case 233: + case 234: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { @@ -46644,6 +46891,22 @@ var ts; ts.isIdentifier(expression); } ts.isSimpleCopiableExpression = isSimpleCopiableExpression; + function helperString(input) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return function (uniqueName) { + var result = ""; + for (var i = 0; i < args.length; i++) { + result += input[i]; + result += uniqueName(args[i]); + } + result += input[input.length - 1]; + return result; + }; + } + ts.helperString = helperString; })(ts || (ts = {})); var ts; (function (ts) { @@ -47008,8 +47271,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(183); context.enableSubstitution(184); + context.enableSubstitution(185); var currentSourceFile; var currentNamespace; var currentNamespaceContainerName; @@ -47043,15 +47306,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 272: + case 273: + case 240: case 239: - case 238: - case 211: + case 212: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; + case 234: case 233: - case 232: if (ts.hasModifier(node, 2)) { break; } @@ -47059,7 +47322,7 @@ var ts; recordEmittedDeclarationInScope(node); } else { - ts.Debug.assert(node.kind === 233 || ts.hasModifier(node, 512)); + ts.Debug.assert(node.kind === 234 || ts.hasModifier(node, 512)); } break; } @@ -47081,10 +47344,10 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { + case 243: case 242: - case 241: - case 247: case 248: + case 249: return visitEllidableStatement(node); default: return visitorWorker(node); @@ -47099,13 +47362,13 @@ var ts; return node; } switch (node.kind) { - case 242: + case 243: return visitImportDeclaration(node); - case 241: + case 242: return visitImportEqualsDeclaration(node); - case 247: - return visitExportAssignment(node); case 248: + return visitExportAssignment(node); + case 249: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -47115,11 +47378,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 248 || - node.kind === 242 || + if (node.kind === 249 || node.kind === 243 || - (node.kind === 241 && - node.moduleReference.kind === 252)) { + node.kind === 244 || + (node.kind === 242 && + node.moduleReference.kind === 253)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -47143,7 +47406,7 @@ var ts; case 156: case 153: return visitorWorker(node); - case 210: + case 211: return node; default: return ts.Debug.failBadSyntaxKind(node); @@ -47200,23 +47463,23 @@ var ts; case 177: case 159: case 149: - case 235: + case 236: return undefined; case 151: return visitPropertyDeclaration(node); - case 240: + case 241: return undefined; case 154: return visitConstructor(node); - case 234: + case 235: return ts.createNotEmittedStatement(node); - case 233: + case 234: return visitClassDeclaration(node); - case 203: + case 204: return visitClassExpression(node); - case 266: + case 267: return visitHeritageClause(node); - case 205: + case 206: return visitExpressionWithTypeArguments(node); case 153: return visitMethodDeclaration(node); @@ -47224,34 +47487,34 @@ var ts; return visitGetAccessor(node); case 156: return visitSetAccessor(node); - case 232: + case 233: return visitFunctionDeclaration(node); - case 190: - return visitFunctionExpression(node); case 191: + return visitFunctionExpression(node); + case 192: return visitArrowFunction(node); case 148: return visitParameter(node); - case 189: + case 190: return visitParenthesizedExpression(node); - case 188: - case 206: - return visitAssertionExpression(node); - case 185: - return visitCallExpression(node); - case 186: - return visitNewExpression(node); + case 189: case 207: + return visitAssertionExpression(node); + case 186: + return visitCallExpression(node); + case 187: + return visitNewExpression(node); + case 208: return visitNonNullExpression(node); - case 236: - return visitEnumDeclaration(node); - case 212: - return visitVariableStatement(node); - case 230: - return visitVariableDeclaration(node); case 237: + return visitEnumDeclaration(node); + case 213: + return visitVariableStatement(node); + case 231: + return visitVariableDeclaration(node); + case 238: return visitModuleDeclaration(node); - case 241: + case 242: return visitImportEqualsDeclaration(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -47471,7 +47734,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 214 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 215 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -47758,8 +48021,8 @@ var ts; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 233: - case 203: + case 234: + case 204: return ts.getFirstConstructorWithBody(node) !== undefined; case 153: case 155: @@ -47776,8 +48039,8 @@ var ts; return serializeTypeNode(node.type); case 156: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 233: - case 203: + case 234: + case 204: case 153: return ts.createIdentifier("Function"); default: @@ -48270,11 +48533,11 @@ var ts; function addVarForEnumOrModuleDeclaration(statements, node) { var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, false, true)) - ], currentScope.kind === 272 ? 0 : 1)); + ], currentScope.kind === 273 ? 0 : 1)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 236) { + if (node.kind === 237) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -48335,7 +48598,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 238) { + if (body.kind === 239) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -48359,13 +48622,13 @@ var ts; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true); ts.setTextRange(block, blockLocation); - if (body.kind !== 238) { + if (body.kind !== 239) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 237) { + if (moduleDeclaration.body.kind === 238) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -48385,7 +48648,7 @@ var ts; return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 244) { + if (node.kind === 245) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -48520,15 +48783,15 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(71); - context.enableSubstitution(269); - context.enableEmitNotification(237); + context.enableSubstitution(270); + context.enableEmitNotification(238); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 237; + return ts.getOriginalNode(node).kind === 238; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 236; + return ts.getOriginalNode(node).kind === 237; } function onEmitNode(hint, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; @@ -48574,9 +48837,9 @@ var ts; switch (node.kind) { case 71: return substituteExpressionIdentifier(node); - case 183: - return substitutePropertyAccessExpression(node); case 184: + return substitutePropertyAccessExpression(node); + case 185: return substituteElementAccessExpression(node); } return node; @@ -48606,9 +48869,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 !== 272) { - var substitute = (applicableSubstitutions & 2 && container.kind === 237) || - (applicableSubstitutions & 8 && container.kind === 236); + if (container && container.kind !== 273) { + var substitute = (applicableSubstitutions & 2 && container.kind === 238) || + (applicableSubstitutions & 8 && container.kind === 237); if (substitute) { return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), node); } @@ -48721,15 +48984,15 @@ var ts; switch (node.kind) { case 120: return undefined; - case 195: + case 196: return visitAwaitExpression(node); case 153: return visitMethodDeclaration(node); - case 232: + case 233: return visitFunctionDeclaration(node); - case 190: - return visitFunctionExpression(node); case 191: + return visitFunctionExpression(node); + case 192: return visitArrowFunction(node); default: return ts.visitEachChild(node, visitor, context); @@ -48738,27 +49001,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 212: + case 213: return visitVariableStatementInAsyncBody(node); - case 218: - return visitForStatementInAsyncBody(node); case 219: - return visitForInStatementInAsyncBody(node); + return visitForStatementInAsyncBody(node); case 220: + return visitForInStatementInAsyncBody(node); + case 221: return visitForOfStatementInAsyncBody(node); - case 267: + case 268: return visitCatchClauseInAsyncBody(node); - case 211: - case 225: - case 239: - case 264: - case 265: - case 228: - case 216: - case 217: - case 215: - case 224: + case 212: case 226: + case 240: + case 265: + case 266: + case 229: + case 217: + case 218: + case 216: + case 225: + case 227: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -48906,7 +49169,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 === 191; + var isArrowFunction = node.kind === 192; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; var savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; enclosingFunctionParameterNames = ts.createUnderscoreEscapedMap(); @@ -48970,10 +49233,10 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution(185); - context.enableSubstitution(183); + context.enableSubstitution(186); context.enableSubstitution(184); - context.enableEmitNotification(233); + context.enableSubstitution(185); + context.enableEmitNotification(234); context.enableEmitNotification(153); context.enableEmitNotification(155); context.enableEmitNotification(156); @@ -49002,11 +49265,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 183: - return substitutePropertyAccessExpression(node); case 184: - return substituteElementAccessExpression(node); + return substitutePropertyAccessExpression(node); case 185: + return substituteElementAccessExpression(node); + case 186: return substituteCallExpression(node); } return node; @@ -49037,7 +49300,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 233 + return kind === 234 || kind === 154 || kind === 153 || kind === 155 @@ -49045,10 +49308,10 @@ var ts; } function createSuperAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096) { - return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value"), location); + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createFileLevelUniqueName("_super"), undefined, [argumentExpression]), "value"), location); } else { - return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), location); + return ts.setTextRange(ts.createCall(ts.createFileLevelUniqueName("_super"), undefined, [argumentExpression]), location); } } } @@ -49073,12 +49336,12 @@ var ts; ts.asyncSuperHelper = { name: "typescript:async-super", scoped: true, - text: "\n const _super = name => super[name];" + text: ts.helperString(__makeTemplateObject(["\n const ", " = name => super[name];"], ["\n const ", " = name => super[name];"]), "_super") }; ts.advancedAsyncSuperHelper = { name: "typescript:advanced-async-super", scoped: true, - text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" + text: ts.helperString(__makeTemplateObject(["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"], ["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"]), "_super") }; })(ts || (ts = {})); var ts; @@ -49121,23 +49384,23 @@ var ts; return node; } switch (node.kind) { - case 195: + case 196: return visitAwaitExpression(node); - case 201: + case 202: return visitYieldExpression(node); - case 226: + case 227: return visitLabeledStatement(node); - case 182: + case 183: return visitObjectLiteralExpression(node); - case 198: + case 199: return visitBinaryExpression(node, noDestructuringValue); - case 230: + case 231: return visitVariableDeclaration(node); - case 220: + case 221: return visitForOfStatement(node, undefined); - case 218: + case 219: return visitForStatement(node); - case 194: + case 195: return visitVoidExpression(node); case 154: return visitConstructorDeclaration(node); @@ -49147,19 +49410,19 @@ var ts; return visitGetAccessorDeclaration(node); case 156: return visitSetAccessorDeclaration(node); - case 232: + case 233: return visitFunctionDeclaration(node); - case 190: - return visitFunctionExpression(node); case 191: + return visitFunctionExpression(node); + case 192: return visitArrowFunction(node); case 148: return visitParameter(node); - case 214: + case 215: return visitExpressionStatement(node); - case 189: + case 190: return visitParenthesizedExpression(node, noDestructuringValue); - case 267: + case 268: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -49181,7 +49444,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 220 && statement.awaitModifier) { + if (statement.kind === 221 && statement.awaitModifier) { return visitForOfStatement(statement, node); } return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node); @@ -49193,7 +49456,7 @@ var ts; var objects = []; for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { var e = elements_4[_i]; - if (e.kind === 270) { + if (e.kind === 271) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -49202,7 +49465,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 268 + chunkObject = ts.append(chunkObject, e.kind === 269 ? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -49215,7 +49478,7 @@ var ts; function visitObjectLiteralExpression(node) { if (node.transformFlags & 1048576) { var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 182) { + if (objects.length && objects[0].kind !== 183) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -49278,6 +49541,11 @@ var ts; bodyLocation = node.statement; statementsLocation = node.statement.statements; } + else if (node.statement) { + ts.append(statements, node.statement); + bodyLocation = node.statement; + statementsLocation = node.statement; + } return ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer) ], 1), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation)); @@ -49466,10 +49734,10 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution(185); - context.enableSubstitution(183); + context.enableSubstitution(186); context.enableSubstitution(184); - context.enableEmitNotification(233); + context.enableSubstitution(185); + context.enableEmitNotification(234); context.enableEmitNotification(153); context.enableEmitNotification(155); context.enableEmitNotification(156); @@ -49498,11 +49766,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 183: - return substitutePropertyAccessExpression(node); case 184: - return substituteElementAccessExpression(node); + return substitutePropertyAccessExpression(node); case 185: + return substituteElementAccessExpression(node); + case 186: return substituteCallExpression(node); } return node; @@ -49533,7 +49801,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 233 + return kind === 234 || kind === 154 || kind === 153 || kind === 155 @@ -49632,13 +49900,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 253: - return visitJsxElement(node, false); case 254: + return visitJsxElement(node, false); + case 255: return visitJsxSelfClosingElement(node, false); - case 257: + case 258: return visitJsxFragment(node, false); - case 263: + case 264: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -49648,13 +49916,13 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 263: + case 264: return visitJsxExpression(node); - case 253: - return visitJsxElement(node, true); case 254: + return visitJsxElement(node, true); + case 255: return visitJsxSelfClosingElement(node, true); - case 257: + case 258: return visitJsxFragment(node, true); default: return ts.Debug.failBadSyntaxKind(node); @@ -49718,7 +49986,7 @@ var ts; literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile); return ts.setTextRange(literal, node); } - else if (node.kind === 263) { + else if (node.kind === 264) { if (node.expression === undefined) { return ts.createTrue(); } @@ -49778,7 +50046,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 253) { + if (node.kind === 254) { return getTagName(node.openingElement); } else { @@ -50078,7 +50346,7 @@ var ts; return node; } switch (node.kind) { - case 198: + case 199: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -50168,13 +50436,13 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return hierarchyFacts & 4096 - && node.kind === 223 + && node.kind === 224 && !node.expression; } function shouldVisitNode(node) { return (node.transformFlags & 128) !== 0 || convertedLoopState !== undefined - || (hierarchyFacts & 4096 && (ts.isStatement(node) || (node.kind === 211))) + || (hierarchyFacts & 4096 && (ts.isStatement(node) || (node.kind === 212))) || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)) || (ts.getEmitFlags(node) & 33554432) !== 0; } @@ -50202,63 +50470,63 @@ var ts; switch (node.kind) { case 115: return undefined; - case 233: + case 234: return visitClassDeclaration(node); - case 203: + case 204: return visitClassExpression(node); case 148: return visitParameter(node); - case 232: + case 233: return visitFunctionDeclaration(node); - case 191: + case 192: return visitArrowFunction(node); - case 190: + case 191: return visitFunctionExpression(node); - case 230: + case 231: return visitVariableDeclaration(node); case 71: return visitIdentifier(node); - case 231: + case 232: return visitVariableDeclarationList(node); - case 225: - return visitSwitchStatement(node); - case 239: - return visitCaseBlock(node); - case 211: - return visitBlock(node, false); - case 222: - case 221: - return visitBreakOrContinueStatement(node); case 226: + return visitSwitchStatement(node); + case 240: + return visitCaseBlock(node); + case 212: + return visitBlock(node, false); + case 223: + case 222: + return visitBreakOrContinueStatement(node); + case 227: return visitLabeledStatement(node); - case 216: case 217: - return visitDoOrWhileStatement(node, undefined); case 218: - return visitForStatement(node, undefined); + return visitDoOrWhileStatement(node, undefined); case 219: - return visitForInStatement(node, undefined); + return visitForStatement(node, undefined); case 220: + return visitForInStatement(node, undefined); + case 221: return visitForOfStatement(node, undefined); - case 214: + case 215: return visitExpressionStatement(node); - case 182: + case 183: return visitObjectLiteralExpression(node); - case 267: + case 268: return visitCatchClause(node); - case 269: + case 270: return visitShorthandPropertyAssignment(node); case 146: return visitComputedPropertyName(node); - case 181: + case 182: return visitArrayLiteralExpression(node); - case 185: - return visitCallExpression(node); case 186: + return visitCallExpression(node); + case 187: return visitNewExpression(node); - case 189: + case 190: return visitParenthesizedExpression(node, true); - case 198: + case 199: return visitBinaryExpression(node, true); case 13: case 14: @@ -50269,28 +50537,28 @@ var ts; return visitStringLiteral(node); case 8: return visitNumericLiteral(node); - case 187: + case 188: return visitTaggedTemplateExpression(node); - case 200: - return visitTemplateExpression(node); case 201: - return visitYieldExpression(node); + return visitTemplateExpression(node); case 202: + return visitYieldExpression(node); + case 203: return visitSpreadElement(node); case 97: return visitSuperKeyword(false); case 99: return visitThisKeyword(node); - case 208: + case 209: return visitMetaProperty(node); case 153: return visitMethodDeclaration(node); case 155: case 156: return visitAccessorDeclaration(node); - case 212: + case 213: return visitVariableStatement(node); - case 223: + case 224: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); @@ -50328,7 +50596,7 @@ var ts; return updated; } function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + return ts.setOriginalNode(ts.createReturn(ts.createFileLevelUniqueName("_this")), node); } function visitReturnStatement(node) { if (convertedLoopState) { @@ -50371,13 +50639,13 @@ var ts; } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 222 ? 2 : 4; + var jump = node.kind === 223 ? 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; if (!node.label) { - if (node.kind === 222) { + if (node.kind === 223) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -50387,7 +50655,7 @@ var ts; } } else { - if (node.kind === 222) { + if (node.kind === 223) { labelMarker = "break-" + node.label.escapedText; setLabeledJump(convertedLoopState, true, ts.idText(node.label), labelMarker); } @@ -50447,7 +50715,7 @@ var ts; enableSubstitutionsForBlockScopedBindings(); } var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node); - var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, "_super")] : [], undefined, transformClassBody(node, extendsClauseElement)); + var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, ts.createFileLevelUniqueName("_super"))] : [], undefined, transformClassBody(node, extendsClauseElement)); ts.setEmitFlags(classFunction, (ts.getEmitFlags(node) & 65536) | 524288); var inner = ts.createPartiallyEmittedExpression(classFunction); inner.end = node.end; @@ -50537,7 +50805,7 @@ var ts; if (isDerivedClass && superCaptureStatus !== 2 && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { - statements.push(ts.createReturn(ts.createIdentifier("_this"))); + statements.push(ts.createReturn(ts.createFileLevelUniqueName("_this"))); } ts.addRange(statements, endLexicalEnvironment()); if (constructor) { @@ -50551,17 +50819,17 @@ var ts; return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 223) { + if (statement.kind === 224) { return true; } - else if (statement.kind === 215) { + else if (statement.kind === 216) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 211) { + else if (statement.kind === 212) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -50590,7 +50858,7 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 214 && ts.isSuperCall(firstStatement.expression)) { + if (firstStatement.kind === 215 && ts.isSuperCall(firstStatement.expression)) { superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } @@ -50598,8 +50866,8 @@ var ts; && statementOffset === ctorStatements.length - 1 && !(ctor.transformFlags & (16384 | 32768))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 198 - || superCallExpression.left.kind !== 185) { + if (superCallExpression.kind !== 199 + || superCallExpression.left.kind !== 186) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); @@ -50616,7 +50884,7 @@ var ts; return ts.setEmitFlags(ts.createThis(), 4); } function createDefaultSuperCallOrThis() { - return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createFileLevelUniqueName("_super"), ts.createNull()), ts.createFunctionApply(ts.createFileLevelUniqueName("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } function visitParameter(node) { if (node.dotDotDotToken) { @@ -50700,14 +50968,14 @@ var ts; statements.push(forStatement); } function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 && node.kind !== 191) { + if (node.transformFlags & 32768 && node.kind !== 192) { captureThisForNode(statements, node, ts.createThis()); } } function captureThisForNode(statements, node, initializer, originalStatement) { enableSubstitutionsForCapturedThis(); var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("_this", undefined, initializer) + ts.createVariableDeclaration(ts.createFileLevelUniqueName("_this"), undefined, initializer) ])); ts.setEmitFlags(captureThisStatement, 1536 | 1048576); ts.setTextRange(captureThisStatement, originalStatement); @@ -50718,7 +50986,7 @@ var ts; if (hierarchyFacts & 16384) { var newTarget = void 0; switch (node.kind) { - case 191: + case 192: return statements; case 153: case 155: @@ -50728,15 +50996,15 @@ var ts; case 154: newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); break; - case 232: - case 190: + case 233: + case 191: newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 93, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); break; default: return ts.Debug.failBadSyntaxKind(node); } var captureNewTargetStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("_newTarget", undefined, newTarget) + ts.createVariableDeclaration(ts.createFileLevelUniqueName("_newTarget"), undefined, newTarget) ])); if (copyOnWrite) { return [captureNewTargetStatement].concat(statements); @@ -50749,7 +51017,7 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 210: + case 211: statements.push(transformSemicolonClassElementToStatement(member)); break; case 153: @@ -50887,7 +51155,7 @@ var ts; : enterSubtree(16286, 65); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 16384 && !name && (node.kind === 232 || node.kind === 190)) { + if (hierarchyFacts & 16384 && !name && (node.kind === 233 || node.kind === 191)) { name = ts.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 49152, 0); @@ -50921,7 +51189,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 191); + ts.Debug.assert(node.kind === 192); statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { @@ -50973,9 +51241,9 @@ var ts; } function visitExpressionStatement(node) { switch (node.expression.kind) { - case 189: + case 190: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false)); - case 198: + case 199: return ts.updateStatement(node, visitBinaryExpression(node.expression, false)); } return ts.visitEachChild(node, visitor, context); @@ -50983,9 +51251,9 @@ var ts; function visitParenthesizedExpression(node, needsDestructuringValue) { if (!needsDestructuringValue) { switch (node.expression.kind) { - case 189: + case 190: return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); - case 198: + case 199: return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } @@ -51111,14 +51379,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 216: case 217: - return visitDoOrWhileStatement(node, outermostLabeledStatement); case 218: - return visitForStatement(node, outermostLabeledStatement); + return visitDoOrWhileStatement(node, outermostLabeledStatement); case 219: - return visitForInStatement(node, outermostLabeledStatement); + return visitForStatement(node, outermostLabeledStatement); case 220: + return visitForInStatement(node, outermostLabeledStatement); + case 221: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -51305,11 +51573,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 218: case 219: case 220: + case 221: var initializer = node.initializer; - if (initializer && initializer.kind === 231) { + if (initializer && initializer.kind === 232) { loopInitializer = initializer; } break; @@ -51545,10 +51813,10 @@ var ts; case 153: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 268: + case 269: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 269: + case 270: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -51718,7 +51986,7 @@ var ts; ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); resultingCall = assignToCapturedThis - ? ts.createAssignment(ts.createIdentifier("_this"), initializer) + ? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer) : initializer; } return ts.setOriginalNode(resultingCall, node); @@ -51752,7 +52020,7 @@ var ts; else { if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 181 + return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 182 ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -51862,8 +52130,8 @@ var ts; function visitSuperKeyword(isExpressionOfCall) { return hierarchyFacts & 8 && !isExpressionOfCall - ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") - : ts.createIdentifier("_super"); + ? ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), "prototype") + : ts.createFileLevelUniqueName("_super"); } function visitMetaProperty(node) { if (node.keywordToken === 94 && node.name.escapedText === "target") { @@ -51873,7 +52141,7 @@ var ts; else { hierarchyFacts |= 16384; } - return ts.createIdentifier("_newTarget"); + return ts.createFileLevelUniqueName("_newTarget"); } return node; } @@ -51902,9 +52170,9 @@ var ts; context.enableEmitNotification(153); context.enableEmitNotification(155); context.enableEmitNotification(156); + context.enableEmitNotification(192); context.enableEmitNotification(191); - context.enableEmitNotification(190); - context.enableEmitNotification(232); + context.enableEmitNotification(233); } } function onSubstituteNode(hint, node) { @@ -51929,10 +52197,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 180: - case 233: - case 236: - case 230: + case 181: + case 234: + case 237: + case 231: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -51976,7 +52244,7 @@ var ts; function substituteThisKeyword(node) { if (enabledSubstitutions & 1 && hierarchyFacts & 16) { - return ts.setTextRange(ts.createIdentifier("_this"), node); + return ts.setTextRange(ts.createFileLevelUniqueName("_this"), node); } return node; } @@ -51993,11 +52261,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 214) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 215) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 185) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 186) { return false; } var callTarget = statementExpression.expression; @@ -52005,7 +52273,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 202) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 203) { return false; } var expression = callArgument.expression; @@ -52017,7 +52285,7 @@ var ts; context.requestEmitHelper(extendsHelper); return ts.createCall(ts.getHelperName("__extends"), undefined, [ name, - ts.createIdentifier("_super") + ts.createFileLevelUniqueName("_super") ]); } function createTemplateObjectHelper(context, cooked, raw) { @@ -52049,24 +52317,24 @@ var ts; if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(255); context.enableEmitNotification(256); - context.enableEmitNotification(254); + context.enableEmitNotification(257); + context.enableEmitNotification(255); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(183); - context.enableSubstitution(268); + context.enableSubstitution(184); + context.enableSubstitution(269); return transformSourceFile; function transformSourceFile(node) { return node; } function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 255: case 256: - case 254: + case 257: + case 255: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -52182,13 +52450,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 216: - return visitDoStatement(node); case 217: + return visitDoStatement(node); + case 218: return visitWhileStatement(node); - case 225: - return visitSwitchStatement(node); case 226: + return visitSwitchStatement(node); + case 227: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -52196,24 +52464,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 232: + case 233: return visitFunctionDeclaration(node); - case 190: + case 191: return visitFunctionExpression(node); case 155: case 156: return visitAccessorDeclaration(node); - case 212: + case 213: return visitVariableStatement(node); - case 218: - return visitForStatement(node); case 219: + return visitForStatement(node); + case 220: return visitForInStatement(node); - case 222: - return visitBreakStatement(node); - case 221: - return visitContinueStatement(node); case 223: + return visitBreakStatement(node); + case 222: + return visitContinueStatement(node); + case 224: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -52229,21 +52497,21 @@ var ts; } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 198: - return visitBinaryExpression(node); case 199: + return visitBinaryExpression(node); + case 200: return visitConditionalExpression(node); - case 201: + case 202: return visitYieldExpression(node); - case 181: - return visitArrayLiteralExpression(node); case 182: + return visitArrayLiteralExpression(node); + case 183: return visitObjectLiteralExpression(node); - case 184: - return visitElementAccessExpression(node); case 185: - return visitCallExpression(node); + return visitElementAccessExpression(node); case 186: + return visitCallExpression(node); + case 187: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -52251,9 +52519,9 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 232: + case 233: return visitFunctionDeclaration(node); - case 190: + case 191: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -52409,10 +52677,10 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 183: + case 184: target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 184: + case 185: target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: @@ -52613,35 +52881,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 211: + case 212: return transformAndEmitBlock(node); - case 214: - return transformAndEmitExpressionStatement(node); case 215: - return transformAndEmitIfStatement(node); + return transformAndEmitExpressionStatement(node); case 216: - return transformAndEmitDoStatement(node); + return transformAndEmitIfStatement(node); case 217: - return transformAndEmitWhileStatement(node); + return transformAndEmitDoStatement(node); case 218: - return transformAndEmitForStatement(node); + return transformAndEmitWhileStatement(node); case 219: + return transformAndEmitForStatement(node); + case 220: return transformAndEmitForInStatement(node); - case 221: - return transformAndEmitContinueStatement(node); case 222: - return transformAndEmitBreakStatement(node); + return transformAndEmitContinueStatement(node); case 223: - return transformAndEmitReturnStatement(node); + return transformAndEmitBreakStatement(node); case 224: - return transformAndEmitWithStatement(node); + return transformAndEmitReturnStatement(node); case 225: - return transformAndEmitSwitchStatement(node); + return transformAndEmitWithStatement(node); case 226: - return transformAndEmitLabeledStatement(node); + return transformAndEmitSwitchStatement(node); case 227: - return transformAndEmitThrowStatement(node); + return transformAndEmitLabeledStatement(node); case 228: + return transformAndEmitThrowStatement(node); + case 229: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -52935,7 +53203,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 265 && defaultClauseIndex === -1) { + if (clause.kind === 266 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -52945,7 +53213,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 264) { + if (clause.kind === 265) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -53760,11 +54028,11 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(71); - context.enableSubstitution(198); - context.enableSubstitution(196); + context.enableSubstitution(199); context.enableSubstitution(197); - context.enableSubstitution(269); - context.enableEmitNotification(272); + context.enableSubstitution(198); + context.enableSubstitution(270); + context.enableEmitNotification(273); var moduleInfoMap = []; var deferredExports = []; var currentSourceFile; @@ -53949,23 +54217,23 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 242: + case 243: return visitImportDeclaration(node); - case 241: + case 242: return visitImportEqualsDeclaration(node); - case 248: + case 249: return visitExportDeclaration(node); - case 247: + case 248: return visitExportAssignment(node); - case 212: + case 213: return visitVariableStatement(node); - case 232: - return visitFunctionDeclaration(node); case 233: + return visitFunctionDeclaration(node); + case 234: return visitClassDeclaration(node); - case 297: - return visitMergeDeclarationMarker(node); case 298: + return visitMergeDeclarationMarker(node); + case 299: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -54254,7 +54522,7 @@ var ts; } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 212) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 213) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -54286,10 +54554,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 244: + case 245: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 245: + case 246: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -54397,7 +54665,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 272) { + if (node.kind === 273) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -54439,10 +54707,10 @@ var ts; switch (node.kind) { case 71: return substituteExpressionIdentifier(node); - case 198: + case 199: return substituteBinaryExpression(node); + case 198: case 197: - case 196: return substituteUnaryExpression(node); } return node; @@ -54457,7 +54725,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 272) { + if (exportContainer && exportContainer.kind === 273) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -54500,7 +54768,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 197 + var expression = node.kind === 198 ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 43 ? 59 : 60), ts.createLiteral(1)), node) : node; for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { @@ -54564,11 +54832,11 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(71); - context.enableSubstitution(269); - context.enableSubstitution(198); - context.enableSubstitution(196); + context.enableSubstitution(270); + context.enableSubstitution(199); context.enableSubstitution(197); - context.enableEmitNotification(272); + context.enableSubstitution(198); + context.enableEmitNotification(273); var moduleInfoMap = []; var deferredExports = []; var exportFunctionsMap = []; @@ -54672,7 +54940,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 248 && externalImport.exportClause) { + if (externalImport.kind === 249 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -54695,7 +54963,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 248) { + if (externalImport.kind !== 249) { continue; } if (!externalImport.exportClause) { @@ -54746,15 +55014,15 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 242: + case 243: if (!entry.importClause) { break; } - case 241: + case 242: ts.Debug.assert(importVariableName !== undefined); statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 248: + case 249: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { var properties = []; @@ -54776,13 +55044,13 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 242: + case 243: return visitImportDeclaration(node); - case 241: + case 242: return visitImportEqualsDeclaration(node); - case 248: + case 249: return undefined; - case 247: + case 248: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -54903,7 +55171,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 2097152) === 0 - && (enclosingBlockScopedContainer.kind === 272 + && (enclosingBlockScopedContainer.kind === 273 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -54925,7 +55193,7 @@ var ts; : preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 212) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 213) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -54942,6 +55210,12 @@ var ts; delete deferredExports[id]; return ts.append(statements, node); } + else { + var original = ts.getOriginalNode(node); + if (ts.isModuleOrEnumDeclaration(original)) { + return ts.append(appendExportsOfDeclaration(statements, original), node); + } + } return node; } function appendExportsOfImportDeclaration(statements, decl) { @@ -54958,10 +55232,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 244: + case 245: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 245: + case 246: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -55061,43 +55335,43 @@ var ts; } function nestedElementVisitor(node) { switch (node.kind) { - case 212: + case 213: return visitVariableStatement(node); - case 232: - return visitFunctionDeclaration(node); case 233: + return visitFunctionDeclaration(node); + case 234: return visitClassDeclaration(node); - case 218: - return visitForStatement(node); case 219: - return visitForInStatement(node); + return visitForStatement(node); case 220: + return visitForInStatement(node); + case 221: return visitForOfStatement(node); - case 216: - return visitDoStatement(node); case 217: + return visitDoStatement(node); + case 218: return visitWhileStatement(node); - case 226: + case 227: return visitLabeledStatement(node); - case 224: - return visitWithStatement(node); case 225: + return visitWithStatement(node); + case 226: return visitSwitchStatement(node); - case 239: + case 240: return visitCaseBlock(node); - case 264: - return visitCaseClause(node); case 265: + return visitCaseClause(node); + case 266: return visitDefaultClause(node); - case 228: + case 229: return visitTryStatement(node); - case 267: + case 268: return visitCatchClause(node); - case 211: + case 212: return visitBlock(node); - case 297: - return visitMergeDeclarationMarker(node); case 298: + return visitMergeDeclarationMarker(node); + case 299: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -55194,7 +55468,7 @@ var ts; } function destructuringAndImportCallVisitor(node) { if (node.transformFlags & 1024 - && node.kind === 198) { + && node.kind === 199) { return visitDestructuringAssignment(node); } else if (ts.isImportCall(node)) { @@ -55237,7 +55511,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 272; + return container !== undefined && container.kind === 273; } else { return false; @@ -55252,7 +55526,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 272) { + if (node.kind === 273) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -55286,7 +55560,7 @@ var ts; } function substituteUnspecified(node) { switch (node.kind) { - case 269: + case 270: return substituteShorthandPropertyAssignment(node); } return node; @@ -55310,10 +55584,10 @@ var ts; switch (node.kind) { case 71: return substituteExpressionIdentifier(node); - case 198: + case 199: return substituteBinaryExpression(node); - case 196: case 197: + case 198: return substituteUnaryExpression(node); } return node; @@ -55365,14 +55639,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 197 + var expression = node.kind === 198 ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 197) { + if (node.kind === 198) { expression = node.operator === 43 ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -55389,7 +55663,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 272) { + if (exportContainer && exportContainer.kind === 273) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -55417,7 +55691,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(272); + context.enableEmitNotification(273); context.enableSubstitution(71); var currentSourceFile; return transformSourceFile; @@ -55444,9 +55718,9 @@ var ts; } function visitor(node) { switch (node.kind) { - case 241: + case 242: return undefined; - case 247: + case 248: return visitExportAssignment(node); } return node; @@ -55532,7 +55806,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 === 233) { + else if (node.parent.kind === 234) { 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 : @@ -55561,7 +55835,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 === 233) { + else if (node.parent.kind === 234) { 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 : @@ -55608,7 +55882,7 @@ var ts; ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 230 || node.kind === 180) { + if (node.kind === 231 || node.kind === 181) { 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 : @@ -55624,7 +55898,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 === 233 || node.kind === 148) { + else if (node.parent.kind === 234 || node.kind === 148) { 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 : @@ -55709,7 +55983,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 === 233) { + else if (node.parent.kind === 234) { 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 : @@ -55722,7 +55996,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 232: + case 233: 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 : @@ -55775,7 +56049,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 === 233) { + else if (node.parent.parent.kind === 234) { 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 : @@ -55787,7 +56061,7 @@ 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 232: + case 233: case 162: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -55801,10 +56075,10 @@ var ts; function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 233: + case 234: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 234: + case 235: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 158: @@ -55818,17 +56092,17 @@ var ts; if (ts.hasModifier(node.parent, 32)) { 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 === 233) { + else if (node.parent.parent.kind === 234) { 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 232: + case 233: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 235: + case 236: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -55842,7 +56116,7 @@ var ts; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 233) { + if (node.parent.parent.kind === 234) { diagnosticMessage = node.parent.token === 108 ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1; @@ -55966,15 +56240,17 @@ var ts; } } function transformRoot(node) { - if (node.kind === 272 && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) { + if (node.kind === 273 && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) { return node; } - if (node.kind === 273) { + if (node.kind === 274) { isBundledEmit = true; var refs_1 = ts.createMap(); + var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) return; + hasNoDefaultLib_1 = hasNoDefaultLib_1 || sourceFile.hasNoDefaultLib; currentSourceFile = sourceFile; enclosingDeclaration = sourceFile; possibleImports = undefined; @@ -55986,15 +56262,16 @@ var ts; resultHasExternalModuleIndicator = false; needsDeclare = false; var statements_5 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements_5)), sourceFile.statements)))], true, [], []); + var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements_5)), sourceFile.statements)))], true, [], [], false); return newFile; } needsDeclare = true; var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - return ts.updateSourceFileNode(sourceFile, updated, true, [], []); + return ts.updateSourceFileNode(sourceFile, updated, true, [], [], false); })); bundle.syntheticFileReferences = []; bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences(); + bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); refs_1.forEach(referenceVisitor_1); @@ -56017,15 +56294,28 @@ var ts; refs.forEach(referenceVisitor); var statements = ts.visitNodes(node.statements, visitDeclarationStatements); var combinedStatements = ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements)), node.statements); + var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax); if (ts.isExternalModule(node) && !resultHasExternalModuleIndicator) { combinedStatements = ts.setTextRange(ts.createNodeArray(combinedStatements.concat([ts.createExportDeclaration(undefined, undefined, ts.createNamedExports([]), undefined)])), combinedStatements); } - var updated = ts.updateSourceFileNode(node, combinedStatements, true, references, getFileReferencesForUsedTypeReferences()); + var updated = ts.updateSourceFileNode(node, combinedStatements, true, references, getFileReferencesForUsedTypeReferences(), node.hasNoDefaultLib); return updated; function getFileReferencesForUsedTypeReferences() { - return necessaryTypeRefernces ? ts.map(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : []; + return necessaryTypeRefernces ? ts.mapDefined(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : []; } function getFileReferenceForTypeName(typeName) { + for (var _i = 0, emittedImports_1 = emittedImports; _i < emittedImports_1.length; _i++) { + var importStatement = emittedImports_1[_i]; + if (ts.isImportEqualsDeclaration(importStatement) && ts.isExternalModuleReference(importStatement.moduleReference)) { + var expr = importStatement.moduleReference.expression; + if (ts.isStringLiteralLike(expr) && expr.text === typeName) { + return undefined; + } + } + else if (ts.isImportDeclaration(importStatement) && ts.isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) { + return undefined; + } + } return { fileName: typeName, pos: -1, end: -1 }; } function mapReferencesIntoArray(references, outputFilePath) { @@ -56066,7 +56356,7 @@ var ts; return name; } else { - if (name.kind === 179) { + if (name.kind === 180) { return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -56074,7 +56364,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 204) { + if (elem.kind === 205) { return elem; } return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined); @@ -56126,7 +56416,7 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 230 || node.kind === 180) { + if (node.kind === 231 || node.kind === 181) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } if (node.kind === 148 @@ -56148,19 +56438,19 @@ var ts; function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 232: - case 237: - case 234: case 233: + case 238: case 235: + case 234: case 236: + case 237: return !resolver.isDeclarationVisible(node); - case 230: + case 231: return !getBindingNameVisible(node); - case 241: case 242: + case 243: + case 249: case 248: - case 247: return false; } return false; @@ -56213,7 +56503,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return; - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 237; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 238 && parent.kind !== 178); if (input.kind === 9 && isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); if (newName) { @@ -56225,7 +56515,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 252) { + if (decl.moduleReference.kind === 253) { var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return ts.updateImportEqualsDeclaration(decl, undefined, decl.modifiers, decl.name, ts.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); } @@ -56245,7 +56535,7 @@ var ts; if (!decl.importClause.namedBindings) { return visibleDefaultBinding && ts.updateImportDeclaration(decl, undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier)); } - if (decl.importClause.namedBindings.kind === 244) { + if (decl.importClause.namedBindings.kind === 245) { var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : undefined; return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined; } @@ -56262,7 +56552,7 @@ var ts; unconsideredImports.push(i); continue; } - if (i.kind === 241) { + if (i.kind === 242) { var result_3 = transformImportEqualsDeclaration(i); importDeclarationMap.set("" + ts.getNodeId(i), result_3); continue; @@ -56312,7 +56602,7 @@ var ts; if (ts.hasModifier(input, 8)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) return; - return cleanup(ts.createProperty(undefined, input.modifiers, input.name, undefined, undefined, undefined)); + return cleanup(ts.createProperty(undefined, ensureModifiers(input), input.name, undefined, undefined, undefined)); } } var canProdiceDiagnostic = ts.canProduceDiagnostics(input); @@ -56323,13 +56613,13 @@ var ts; checkEntityNameVisibility(input.exprName, enclosingDeclaration); } var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 165 || input.kind === 176) && input.parent.kind !== 235); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 165 || input.kind === 176) && input.parent.kind !== 236); if (shouldEnterSuppressNewDiagnosticsContextContext) { suppressNewDiagnosticContexts = true; } if (isProcessedComponent(input)) { switch (input.kind) { - case 205: { + case 206: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } @@ -56377,7 +56667,7 @@ var ts; case 159: { return cleanup(ts.updateIndexSignature(input, undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(119))); } - case 230: { + case 231: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -56407,6 +56697,11 @@ var ts; case 163: { return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } + case 178: { + if (!ts.isLiteralImportTypeNode(input)) + return cleanup(input); + return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); + } default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]); } } @@ -56440,13 +56735,13 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 248: { + case 249: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } return ts.updateExportDeclaration(input, undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier)); } - case 247: { + case 248: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -56464,8 +56759,8 @@ var ts; return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)]; } } - case 241: - case 242: { + case 242: + case 243: { possibleImports = possibleImports || []; ts.pushIfUnique(possibleImports, input); return input; @@ -56488,21 +56783,21 @@ var ts; } var oldPossibleImports; switch (input.kind) { - case 235: + case 236: return cleanup(ts.updateTypeAliasDeclaration(input, undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 234: { + case 235: { return cleanup(ts.updateInterfaceDeclaration(input, undefined, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 232: { + case 233: { return cleanup(ts.updateFunctionDeclaration(input, undefined, ensureModifiers(input), undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), undefined)); } - case 237: { + case 238: { previousNeedsDeclare = needsDeclare; needsDeclare = false; oldPossibleImports = possibleImports; possibleImports = undefined; var inner = input.body; - if (inner && inner.kind === 238) { + if (inner && inner.kind === 239) { var statements = ts.visitNodes(inner.statements, visitDeclarationStatements); var body = ts.updateModuleBlock(inner, filterCandidateImports(statements)); needsDeclare = previousNeedsDeclare; @@ -56516,7 +56811,7 @@ var ts; return cleanup(ts.updateModuleDeclaration(input, undefined, mods, input.name, ts.visitNode(inner, visitDeclarationStatements))); } } - case 233: { + case 234: { var modifiers = ts.createNodeArray(ensureModifiers(input)); var typeParameters = ensureTypeParams(input, input.typeParameters); var ctor = ts.getFirstConstructorWithBody(input); @@ -56578,7 +56873,7 @@ var ts; return cleanup(ts.updateClassDeclaration(input, undefined, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 212: { + case 213: { if (!ts.forEach(input.declarationList.declarations, getBindingNameVisible)) return; var nodes = ts.visitNodes(input.declarationList.declarations, visitDeclarationSubtree); @@ -56586,7 +56881,7 @@ var ts; return; return cleanup(ts.updateVariableStatement(input, ts.createNodeArray(ensureModifiers(input)), ts.updateVariableDeclarationList(input.declarationList, nodes))); } - case 236: { + case 237: { return cleanup(ts.updateEnumDeclaration(input, undefined, ts.createNodeArray(ensureModifiers(input)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -56600,7 +56895,7 @@ var ts; if (isEnclosingDeclaration(input)) { enclosingDeclaration = previousEnclosingDeclaration; } - if (input.kind === 237) { + if (input.kind === 238) { needsDeclare = previousNeedsDeclare; possibleImports = ts.concatenate(oldPossibleImports, possibleImports); } @@ -56622,7 +56917,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 204) { + if (e.kind === 205) { return; } if (e.name) { @@ -56676,7 +56971,7 @@ var ts; function ensureModifierFlags(node) { var mask = 3071 ^ (4 | 256); var additions = (needsDeclare && !isAlwaysType(node)) ? 2 : 0; - var parentIsFile = node.parent.kind === 272; + var parentIsFile = node.parent.kind === 273; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= ((isBundledEmit && parentIsFile ? 0 : 1) | 512 | 2); additions = 0; @@ -56723,7 +57018,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 234) { + if (node.kind === 235) { return true; } return false; @@ -56751,7 +57046,7 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 230: + case 231: case 151: case 150: case 148: @@ -56761,17 +57056,17 @@ var ts; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 232: - case 237: - case 241: - case 234: case 233: - case 235: - case 236: - case 212: + case 238: case 242: + case 235: + case 234: + case 236: + case 237: + case 213: + case 243: + case 249: case 248: - case 247: return true; } return false; @@ -56788,13 +57083,14 @@ var ts; case 152: case 157: case 159: - case 230: + case 231: case 147: - case 205: + case 206: case 161: case 170: case 162: case 163: + case 178: return true; } return false; @@ -56845,7 +57141,7 @@ var ts; } ts.getTransformers = getTransformers; function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(299); + var enabledSyntaxKindFeatures = new Array(300); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -57111,7 +57407,7 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (sourceFileOrBundle.kind === 272) { + if (sourceFileOrBundle.kind === 273) { sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); } if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { @@ -57222,7 +57518,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 294 + if (node.kind !== 295 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -57239,7 +57535,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 294 + if (node.kind !== 295 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -57381,7 +57677,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 294; + var isEmittedNode = node.kind !== 295; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0 || node.kind === 10; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 10; if (!skipLeadingComments) { @@ -57395,7 +57691,7 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 231) { + if (node.kind === 232) { declarationListContainerEnd = end; } } @@ -57702,7 +57998,7 @@ var ts; ts.forEachEmittedFile = forEachEmittedFile; function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 273) { + if (sourceFile.kind === 274) { var jsFilePath = options.outFile || options.out; var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); var declarationFilePath = (forceDtsPaths || options.declaration) ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; @@ -57737,7 +58033,6 @@ var ts; } function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); - var moduleKind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); @@ -57750,9 +58045,6 @@ var ts; mapRoot: compilerOptions.mapRoot, extendedDiagnostics: compilerOptions.extendedDiagnostics, }); - var currentSourceFile; - var bundledHelpers; - var isOwnFileEmit; var emitSkipped = false; ts.performance.mark("beforePrint"); forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile), emitOnlyDtsFiles); @@ -57789,14 +58081,13 @@ var ts; return; } var transform = ts.transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, false); - var printer = createPrinter(compilerOptions, { + var printer = createPrinter(__assign({}, compilerOptions, { noEmitHelpers: compilerOptions.noEmitHelpers }), { hasGlobalName: resolver.hasGlobalName, onEmitNode: transform.emitNodeWithNotification, substituteNode: transform.substituteNode, onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap, onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, onEmitSourceMapOfPosition: sourceMap.emitPos, - onEmitHelpers: emitHelpers, onSetSourceFile: setSourceFile, }); printSourceFileOrBundle(jsFilePath, sourceMapFilePath, ts.isSourceFile(sourceFileOrBundle) ? transform.transformed[0] : ts.createBundle(transform.transformed), printer, sourceMap); @@ -57816,7 +58107,7 @@ var ts; emitterDiagnostics.add(diagnostic); } } - var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: true }), { + var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: true, noEmitHelpers: true }), { hasGlobalName: resolver.hasGlobalName, onEmitSourceMapOfNode: declarationSourceMap.emitNodeWithSourceMap, onEmitSourceMapOfToken: declarationSourceMap.emitTokenWithSourceMap, @@ -57833,17 +58124,14 @@ var ts; declarationTransform.dispose(); } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapRecorder) { - var bundle = sourceFileOrBundle.kind === 273 ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 272 ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 274 ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 273 ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; mapRecorder.initialize(jsFilePath, sourceMapFilePath || "", sourceFileOrBundle, sourceMapDataList); if (bundle) { - bundledHelpers = ts.createMap(); - isOwnFileEmit = false; printer.writeBundle(bundle, writer); } else { - isOwnFileEmit = true; printer.writeFile(sourceFile, writer); } writer.writeLine(); @@ -57857,60 +58145,19 @@ var ts; ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); mapRecorder.reset(); writer.clear(); - currentSourceFile = undefined; - bundledHelpers = undefined; - isOwnFileEmit = false; } function setSourceFile(node) { - currentSourceFile = node; sourceMap.setSourceFile(node); } function setSourceFileForDeclarationSourceMaps(node) { - currentSourceFile = node; declarationSourceMap.setSourceFile(node); } - function emitHelpers(node, writeLines) { - var helpersEmitted = false; - var bundle = node.kind === 273 ? node : undefined; - if (bundle && moduleKind === ts.ModuleKind.None) { - return; - } - var numNodes = bundle ? bundle.sourceFiles.length : 1; - for (var i = 0; i < numNodes; i++) { - var currentNode = bundle ? bundle.sourceFiles[i] : node; - var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; - var shouldSkip = compilerOptions.noEmitHelpers || ts.getExternalHelpersModuleName(sourceFile) !== undefined; - var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; - var helpers = ts.getEmitHelpers(currentNode); - if (helpers) { - for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { - var helper = _b[_a]; - if (!helper.scoped) { - if (shouldSkip) - continue; - if (shouldBundle) { - if (bundledHelpers.get(helper.name)) { - continue; - } - bundledHelpers.set(helper.name, true); - } - } - else if (bundle) { - continue; - } - writeLines(helper.text); - helpersEmitted = true; - } - } - } - return helpersEmitted; - } } ts.emitFiles = emitFiles; function createPrinter(printerOptions, handlers) { if (printerOptions === void 0) { printerOptions = {}; } if (handlers === void 0) { handlers = {}; } - var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onEmitHelpers = handlers.onEmitHelpers, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; + var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; var newLine = ts.getNewLineCharacter(printerOptions); var comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition); var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition; @@ -57933,6 +58180,9 @@ var ts; writeSemicolon = deferWriteSemicolon; } var syntheticParent = { pos: -1, end: -1 }; + var moduleKind = ts.getEmitModuleKind(printerOptions); + var bundledHelpers = ts.createMap(); + var isOwnFileEmit; reset(); return { printNode: printNode, @@ -57957,8 +58207,8 @@ var ts; break; } switch (node.kind) { - case 272: return printFile(node); - case 273: return printBundle(node); + case 273: return printFile(node); + case 274: return printBundle(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -57993,11 +58243,12 @@ var ts; writer = previousWriter; } function writeBundle(bundle, output) { + isOwnFileEmit = false; var previousWriter = writer; setWriter(output); emitShebangIfNeeded(bundle); emitPrologueDirectivesIfNeeded(bundle); - emitHelpersIndirect(bundle); + emitHelpers(bundle); emitSyntheticTripleSlashReferencesIfNeeded(bundle); for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) { var sourceFile = _b[_a]; @@ -58007,6 +58258,7 @@ var ts; writer = previousWriter; } function writeFile(sourceFile, output) { + isOwnFileEmit = true; var previousWriter = writer; setWriter(output); emitShebangIfNeeded(sourceFile); @@ -58111,7 +58363,7 @@ var ts; writeSpace(); writeKeyword("in"); writeSpace(); - emit(node.constraint); + emitIfPresent(node.constraint); } function pipelineEmitUnspecified(node) { var kind = node.kind; @@ -58161,7 +58413,7 @@ var ts; return emitTypeReference(node); case 162: return emitFunctionType(node); - case 280: + case 281: return emitJSDocFunctionType(node); case 163: return emitConstructorType(node); @@ -58183,7 +58435,7 @@ var ts; return emitInferType(node); case 172: return emitParenthesizedType(node); - case 205: + case 206: return emitExpressionWithTypeArguments(node); case 173: return emitThisType(); @@ -58195,145 +58447,147 @@ var ts; return emitMappedType(node); case 177: return emitLiteralType(node); - case 275: + case 178: + return emitImportTypeNode(node); + case 276: write("*"); return; - case 276: + case 277: write("?"); return; - case 277: - return emitJSDocNullableType(node); case 278: - return emitJSDocNonNullableType(node); + return emitJSDocNullableType(node); case 279: + return emitJSDocNonNullableType(node); + case 280: return emitJSDocOptionalType(node); - case 281: + case 282: return emitJSDocVariadicType(node); - case 178: - return emitObjectBindingPattern(node); case 179: - return emitArrayBindingPattern(node); + return emitObjectBindingPattern(node); case 180: + return emitArrayBindingPattern(node); + case 181: return emitBindingElement(node); - case 209: - return emitTemplateSpan(node); case 210: - return emitSemicolonClassElement(); + return emitTemplateSpan(node); case 211: - return emitBlock(node); + return emitSemicolonClassElement(); case 212: - return emitVariableStatement(node); + return emitBlock(node); case 213: - return emitEmptyStatement(); + return emitVariableStatement(node); case 214: - return emitExpressionStatement(node); + return emitEmptyStatement(); case 215: - return emitIfStatement(node); + return emitExpressionStatement(node); case 216: - return emitDoStatement(node); + return emitIfStatement(node); case 217: - return emitWhileStatement(node); + return emitDoStatement(node); case 218: - return emitForStatement(node); + return emitWhileStatement(node); case 219: - return emitForInStatement(node); + return emitForStatement(node); case 220: - return emitForOfStatement(node); + return emitForInStatement(node); case 221: - return emitContinueStatement(node); + return emitForOfStatement(node); case 222: - return emitBreakStatement(node); + return emitContinueStatement(node); case 223: - return emitReturnStatement(node); + return emitBreakStatement(node); case 224: - return emitWithStatement(node); + return emitReturnStatement(node); case 225: - return emitSwitchStatement(node); + return emitWithStatement(node); case 226: - return emitLabeledStatement(node); + return emitSwitchStatement(node); case 227: - return emitThrowStatement(node); + return emitLabeledStatement(node); case 228: - return emitTryStatement(node); + return emitThrowStatement(node); case 229: - return emitDebuggerStatement(node); + return emitTryStatement(node); case 230: - return emitVariableDeclaration(node); + return emitDebuggerStatement(node); case 231: - return emitVariableDeclarationList(node); + return emitVariableDeclaration(node); case 232: - return emitFunctionDeclaration(node); + return emitVariableDeclarationList(node); case 233: - return emitClassDeclaration(node); + return emitFunctionDeclaration(node); case 234: - return emitInterfaceDeclaration(node); + return emitClassDeclaration(node); case 235: - return emitTypeAliasDeclaration(node); + return emitInterfaceDeclaration(node); case 236: - return emitEnumDeclaration(node); + return emitTypeAliasDeclaration(node); case 237: - return emitModuleDeclaration(node); + return emitEnumDeclaration(node); case 238: - return emitModuleBlock(node); + return emitModuleDeclaration(node); case 239: - return emitCaseBlock(node); + return emitModuleBlock(node); case 240: - return emitNamespaceExportDeclaration(node); + return emitCaseBlock(node); case 241: - return emitImportEqualsDeclaration(node); + return emitNamespaceExportDeclaration(node); case 242: - return emitImportDeclaration(node); + return emitImportEqualsDeclaration(node); case 243: - return emitImportClause(node); + return emitImportDeclaration(node); case 244: - return emitNamespaceImport(node); + return emitImportClause(node); case 245: - return emitNamedImports(node); + return emitNamespaceImport(node); case 246: - return emitImportSpecifier(node); + return emitNamedImports(node); case 247: - return emitExportAssignment(node); + return emitImportSpecifier(node); case 248: - return emitExportDeclaration(node); + return emitExportAssignment(node); case 249: - return emitNamedExports(node); + return emitExportDeclaration(node); case 250: - return emitExportSpecifier(node); + return emitNamedExports(node); case 251: - return; + return emitExportSpecifier(node); case 252: + return; + case 253: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 255: - case 258: - return emitJsxOpeningElementOrFragment(node); case 256: case 259: - return emitJsxClosingElementOrFragment(node); + return emitJsxOpeningElementOrFragment(node); + case 257: case 260: - return emitJsxAttribute(node); + return emitJsxClosingElementOrFragment(node); case 261: - return emitJsxAttributes(node); + return emitJsxAttribute(node); case 262: - return emitJsxSpreadAttribute(node); + return emitJsxAttributes(node); case 263: - return emitJsxExpression(node); + return emitJsxSpreadAttribute(node); case 264: - return emitCaseClause(node); + return emitJsxExpression(node); case 265: - return emitDefaultClause(node); + return emitCaseClause(node); case 266: - return emitHeritageClause(node); + return emitDefaultClause(node); case 267: - return emitCatchClause(node); + return emitHeritageClause(node); case 268: - return emitPropertyAssignment(node); + return emitCatchClause(node); case 269: - return emitShorthandPropertyAssignment(node); + return emitPropertyAssignment(node); case 270: - return emitSpreadAssignment(node); + return emitShorthandPropertyAssignment(node); case 271: + return emitSpreadAssignment(node); + case 272: return emitEnumMember(node); } if (ts.isExpression(node)) { @@ -58363,79 +58617,115 @@ var ts; case 91: writeTokenNode(node, writeKeyword); return; - case 181: - return emitArrayLiteralExpression(node); case 182: - return emitObjectLiteralExpression(node); + return emitArrayLiteralExpression(node); case 183: - return emitPropertyAccessExpression(node); + return emitObjectLiteralExpression(node); case 184: - return emitElementAccessExpression(node); + return emitPropertyAccessExpression(node); case 185: - return emitCallExpression(node); + return emitElementAccessExpression(node); case 186: - return emitNewExpression(node); + return emitCallExpression(node); case 187: - return emitTaggedTemplateExpression(node); + return emitNewExpression(node); case 188: - return emitTypeAssertionExpression(node); + return emitTaggedTemplateExpression(node); case 189: - return emitParenthesizedExpression(node); + return emitTypeAssertionExpression(node); case 190: - return emitFunctionExpression(node); + return emitParenthesizedExpression(node); case 191: - return emitArrowFunction(node); + return emitFunctionExpression(node); case 192: - return emitDeleteExpression(node); + return emitArrowFunction(node); case 193: - return emitTypeOfExpression(node); + return emitDeleteExpression(node); case 194: - return emitVoidExpression(node); + return emitTypeOfExpression(node); case 195: - return emitAwaitExpression(node); + return emitVoidExpression(node); case 196: - return emitPrefixUnaryExpression(node); + return emitAwaitExpression(node); case 197: - return emitPostfixUnaryExpression(node); + return emitPrefixUnaryExpression(node); case 198: - return emitBinaryExpression(node); + return emitPostfixUnaryExpression(node); case 199: - return emitConditionalExpression(node); + return emitBinaryExpression(node); case 200: - return emitTemplateExpression(node); + return emitConditionalExpression(node); case 201: - return emitYieldExpression(node); + return emitTemplateExpression(node); case 202: - return emitSpreadExpression(node); + return emitYieldExpression(node); case 203: - return emitClassExpression(node); + return emitSpreadExpression(node); case 204: + return emitClassExpression(node); + case 205: return; - case 206: - return emitAsExpression(node); case 207: - return emitNonNullExpression(node); + return emitAsExpression(node); case 208: + return emitNonNullExpression(node); + case 209: return emitMetaProperty(node); - case 253: - return emitJsxElement(node); case 254: + return emitJsxElement(node); + case 255: return emitJsxSelfClosingElement(node); - case 257: + case 258: return emitJsxFragment(node); - case 295: - return emitPartiallyEmittedExpression(node); case 296: + return emitPartiallyEmittedExpression(node); + case 297: return emitCommaList(node); } } function trySubstituteNode(hint, node) { return node && substituteNode && substituteNode(hint, node) || node; } - function emitHelpersIndirect(node) { - if (onEmitHelpers) { - onEmitHelpers(node, writeLines); + function emitHelpers(node) { + var helpersEmitted = false; + var bundle = node.kind === 274 ? node : undefined; + if (bundle && moduleKind === ts.ModuleKind.None) { + return; } + var numNodes = bundle ? bundle.sourceFiles.length : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? bundle.sourceFiles[i] : node; + var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; + var shouldSkip = printerOptions.noEmitHelpers || ts.getExternalHelpersModuleName(sourceFile) !== undefined; + var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; + var helpers = ts.getEmitHelpers(currentNode); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + if (shouldSkip) + continue; + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } + else if (bundle) { + continue; + } + if (typeof helper.text === "string") { + writeLines(helper.text); + } + else { + writeLines(helper.text(makeFileLevelOptmiisticUniqueName)); + } + helpersEmitted = true; + } + } + } + return helpersEmitted; } function emitNumericLiteral(node) { emitLiteral(node); @@ -58496,8 +58786,8 @@ var ts; emitNodeWithWriter(node.name, writeParameter); } emitIfPresent(node.questionToken); - if (node.parent && node.parent.kind === 280 && !node.name) { - emit(node.type); + if (node.parent && node.parent.kind === 281 && !node.name) { + emitIfPresent(node.type); } else { emitTypeAnnotation(node.type); @@ -58602,13 +58892,13 @@ var ts; writeSpace(); writePunctuation("=>"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); } function emitJSDocFunctionType(node) { write("function"); emitParameters(node, node.parameters); write(":"); - emit(node.type); + emitIfPresent(node.type); } function emitJSDocNullableType(node) { write("?"); @@ -58630,7 +58920,7 @@ var ts; writeSpace(); writePunctuation("=>"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); } function emitTypeQuery(node) { writeKeyword("typeof"); @@ -58730,7 +59020,7 @@ var ts; } writePunctuation(":"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); writeSemicolon(); if (emitFlags & 1) { writeSpace(); @@ -58744,6 +59034,21 @@ var ts; function emitLiteralType(node) { emitExpression(node.literal); } + function emitImportTypeNode(node) { + if (node.isTypeOf) { + writeKeyword("typeof"); + writeSpace(); + } + writeKeyword("import"); + writePunctuation("("); + emit(node.argument); + writePunctuation(")"); + if (node.qualifier) { + writePunctuation("."); + emit(node.qualifier); + } + emitTypeArguments(node, node.typeArguments); + } function emitObjectBindingPattern(node) { writePunctuation("{"); emitList(node, node.elements, 262576); @@ -58896,7 +59201,7 @@ var ts; } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; - return operand.kind === 196 + return operand.kind === 197 && ((node.operator === 37 && (operand.operator === 37 || operand.operator === 43)) || (node.operator === 38 && (operand.operator === 38 || operand.operator === 44))); } @@ -58940,7 +59245,7 @@ var ts; } function emitYieldExpression(node) { emitTokenWithComment(116, node.pos, writeKeyword, node); - emit(node.asteriskToken); + emitIfPresent(node.asteriskToken); emitExpressionWithLeadingSpace(node.expression); } function emitSpreadExpression(node) { @@ -59007,7 +59312,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node); emitTokenWithComment(82, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 215) { + if (node.elseStatement.kind === 216) { writeSpace(); emit(node.elseStatement); } @@ -59078,7 +59383,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 231) { + if (node.kind === 232) { emit(node); } else { @@ -59279,7 +59584,7 @@ var ts; function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) { var statementOffset = emitPrologueDirectives(body.statements, true); var pos = writer.getTextPos(); - emitHelpersIndirect(body); + emitHelpers(body); if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) { decreaseIndent(); emitList(body, body.statements, 384); @@ -59360,7 +59665,7 @@ var ts; var body = node.body; if (!body) return writeSemicolon(); - while (body.kind === 237) { + while (body.kind === 238) { writePunctuation("."); emit(body.name); body = body.body; @@ -59411,12 +59716,12 @@ var ts; writeSemicolon(); } function emitImportClause(node) { - emit(node.name); + emitIfPresent(node.name); if (node.name && node.namedBindings) { emitTokenWithComment(26, node.name.end, writePunctuation, node); writeSpace(); } - emit(node.namedBindings); + emitIfPresent(node.namedBindings); } function emitNamespaceImport(node) { var asPos = emitTokenWithComment(39, node.pos, writePunctuation, node); @@ -59653,20 +59958,40 @@ var ts; emitSourceFileWorker(node); } function emitSyntheticTripleSlashReferencesIfNeeded(node) { - emitTripleSlashDirectives(node.syntheticFileReferences || [], node.syntheticTypeReferences || []); + emitTripleSlashDirectives(node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || []); } function emitTripleSlashDirectivesIfNeeded(node) { if (node.isDeclarationFile) - emitTripleSlashDirectives(node.referencedFiles, node.typeReferenceDirectives); + emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives); } - function emitTripleSlashDirectives(files, types) { - for (var _a = 0, files_1 = files; _a < files_1.length; _a++) { - var directive = files_1[_a]; + function emitTripleSlashDirectives(hasNoDefaultLib, files, types) { + if (hasNoDefaultLib) { + write("/// "); + writeLine(); + } + if (currentSourceFile && currentSourceFile.moduleName) { + write("/// "); + writeLine(); + } + if (currentSourceFile && currentSourceFile.amdDependencies) { + for (var _a = 0, _b = currentSourceFile.amdDependencies; _a < _b.length; _a++) { + var dep = _b[_a]; + if (dep.name) { + write("/// "); + } + else { + write("/// "); + } + writeLine(); + } + } + for (var _c = 0, files_1 = files; _c < files_1.length; _c++) { + var directive = files_1[_c]; write("/// "); writeLine(); } - for (var _b = 0, types_18 = types; _b < types_18.length; _b++) { - var directive = types_18[_b]; + for (var _d = 0, types_18 = types; _d < types_18.length; _d++) { + var directive = types_18[_d]; write("/// "); writeLine(); } @@ -59674,7 +59999,7 @@ var ts; function emitSourceFileWorker(node) { var statements = node.statements; pushNameGenerationScope(node); - emitHelpersIndirect(node); + emitHelpers(node); var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); }); emitTripleSlashDirectivesIfNeeded(node); emitList(node, statements, 1, index === -1 ? statements.length : index); @@ -60191,7 +60516,7 @@ var ts; && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 189 && ts.nodeIsSynthesized(node)) { + while (node.kind === 190 && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -60270,11 +60595,13 @@ var ts; return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node)); } function isUniqueName(name) { - return !(hasGlobalName && hasGlobalName(name)) - && !currentSourceFile.identifiers.has(name) + return isFileLevelUniqueName(name) && !generatedNames.has(name) && !(reservedNames && reservedNames.has(name)); } + function isFileLevelUniqueName(name) { + return ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName); + } function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { if (node.locals) { @@ -60313,9 +60640,10 @@ var ts; } } } - function makeUniqueName(baseName, optimistic) { + function makeUniqueName(baseName, checkFn, optimistic) { + if (checkFn === void 0) { checkFn = isUniqueName; } if (optimistic) { - if (isUniqueName(baseName)) { + if (checkFn(baseName)) { generatedNames.set(baseName, true); return baseName; } @@ -60326,13 +60654,16 @@ var ts; var i = 1; while (true) { var generatedName = baseName + i; - if (isUniqueName(generatedName)) { + if (checkFn(generatedName)) { generatedNames.set(generatedName, true); return generatedName; } i++; } } + function makeFileLevelOptmiisticUniqueName(name) { + return makeUniqueName(name, isFileLevelUniqueName, true); + } function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); return isUniqueLocalName(name, node) ? name : makeUniqueName(name); @@ -60359,17 +60690,17 @@ var ts; switch (node.kind) { case 71: return makeUniqueName(getTextOfNode(node)); + case 238: case 237: - case 236: return generateNameForModuleOrEnum(node); - case 242: - case 248: + case 243: + case 249: return generateNameForImportOrExportDeclaration(node); - case 232: case 233: - case 247: + case 234: + case 248: return generateNameForExportDefault(); - case 203: + case 204: return generateNameForClassExpression(); case 153: case 155: @@ -60386,9 +60717,7 @@ var ts; case 2: return makeTempVariableName(268435456, !!(name.autoGenerateFlags & 16)); case 3: - return makeUniqueName(ts.idText(name)); - case 5: - return makeUniqueName(ts.idText(name), true); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 64) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 32)); } ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } @@ -60859,7 +61188,7 @@ var ts; } ts.createCompilerHost = createCompilerHost; function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { - var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + var diagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(cancellationToken), program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (program.getCompilerOptions().declaration) { ts.addRange(diagnostics, program.getDeclarationDiagnostics(sourceFile, cancellationToken)); } @@ -61048,6 +61377,12 @@ var ts; } } ts.isProgramUptoDate = isProgramUptoDate; + function getConfigFileParsingDiagnostics(configFileParseResult) { + return configFileParseResult.options.configFile ? + configFileParseResult.options.configFile.parseDiagnostics.concat(configFileParseResult.errors) : + configFileParseResult.errors; + } + ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics; function shouldProgramCreateNewSourceFiles(program, newOptions) { var oldOptions = program && program.getCompilerOptions(); return oldOptions && (oldOptions.target !== newOptions.target || @@ -61060,7 +61395,7 @@ var ts; oldOptions.baseUrl !== newOptions.baseUrl || !ts.equalOwnProperties(oldOptions.paths, newOptions.paths)); } - function createProgram(rootNames, options, host, oldProgram) { + function createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics) { var program; var files = []; var commonSourceDirectory; @@ -61090,7 +61425,7 @@ var ts; var resolveModuleNamesWorker; var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; if (host.resolveModuleNames) { - resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(checkAllDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { + resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { if (!resolved || resolved.extension !== undefined) { return resolved; } @@ -61102,15 +61437,15 @@ var ts; else { moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; - resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(checkAllDefined(moduleNames), containingFile, loader_1); }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; if (host.resolveTypeReferenceDirectives) { - resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(checkAllDefined(typeDirectiveNames), containingFile); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile); }; } else { var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; - resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(checkAllDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; } var packageIdToSourceFile = ts.createMap(); var sourceFileToPackageName = ts.createMap(); @@ -61132,8 +61467,9 @@ var ts; } } if (!skipDefaultLib) { - if (!options.lib) { - processRootFile(getDefaultLibraryFileName(), true); + var defaultLibraryFileName = getDefaultLibraryFileName(); + if (!options.lib && defaultLibraryFileName) { + processRootFile(defaultLibraryFileName, true); } else { ts.forEach(options.lib, function (libFileName) { @@ -61185,7 +61521,8 @@ var ts; getSourceFileFromReference: getSourceFileFromReference, sourceFileToPackageName: sourceFileToPackageName, redirectTargetsSet: redirectTargetsSet, - isEmittedFile: isEmittedFile + isEmittedFile: isEmittedFile, + getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics }; verifyCompilerOptions(); ts.performance.mark("afterProgram"); @@ -61651,51 +61988,51 @@ var ts; case 154: case 155: case 156: - case 190: - case 232: case 191: - case 230: + case 233: + case 192: + case 231: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); return; } } switch (node.kind) { - case 241: + case 242: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 247: + case 248: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 266: + case 267: var heritageClause = node; if (heritageClause.token === 108) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 234: + case 235: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 237: + case 238: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 235: + case 236: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 236: + case 237: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 207: + case 208: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file)); return; - case 206: + case 207: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; - case 188: + case 189: ts.Debug.fail(); } var prevParent = parent; @@ -61708,22 +62045,22 @@ 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_to_remove_this_warning)); } switch (parent.kind) { - case 233: + case 234: case 153: case 152: case 154: case 155: case 156: - case 190: - case 232: case 191: + case 233: + case 192: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - case 212: + case 213: if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 212); + return checkModifiers(nodes, parent.kind === 213); } break; case 151: @@ -61743,11 +62080,11 @@ var ts; return; } break; - case 185: case 186: - case 205: - case 254: + case 187: + case 206: case 255: + case 256: if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); return; @@ -61827,6 +62164,9 @@ var ts; function getGlobalDiagnostics() { return ts.sortAndDeduplicateDiagnostics(getDiagnosticsProducingTypeChecker().getGlobalDiagnostics().slice()); } + function getConfigFileParsingDiagnostics() { + return configFileParsingDiagnostics || ts.emptyArray; + } function processRootFile(fileName, isDefaultLib) { processSourceFile(ts.normalizePath(fileName), isDefaultLib, undefined); } @@ -61903,9 +62243,18 @@ var ts; else if (ts.isImportCall(node) && node.arguments.length === 1 && ts.isStringLiteralLike(node.arguments[0])) { imports = ts.append(imports, node.arguments[0]); } - else { - ts.forEachChild(node, collectDynamicImportOrRequireCalls); + else if (ts.isLiteralImportTypeNode(node)) { + imports = ts.append(imports, node.argument.literal); } + else { + collectDynamicImportOrRequireCallsForEachChild(node); + if (ts.hasJSDocNodes(node)) { + ts.forEach(node.jsDoc, collectDynamicImportOrRequireCallsForEachChild); + } + } + } + function collectDynamicImportOrRequireCallsForEachChild(node) { + ts.forEachChild(node, collectDynamicImportOrRequireCalls); } } function getSourceFileFromReference(referencingFile, ref) { @@ -62501,10 +62850,6 @@ var ts; } } ts.getResolutionDiagnostic = getResolutionDiagnostic; - function checkAllDefined(names) { - ts.Debug.assert(names.every(function (name) { return name !== undefined; }), "A name is undefined.", function () { return JSON.stringify(names); }); - return names; - } function getModuleNames(_a) { var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations; var res = imports.map(function (i) { return i.text; }); @@ -62869,25 +63214,35 @@ var ts; BuilderProgramKind[BuilderProgramKind["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram"; BuilderProgramKind[BuilderProgramKind["EmitAndSemanticDiagnosticsBuilderProgram"] = 1] = "EmitAndSemanticDiagnosticsBuilderProgram"; })(BuilderProgramKind = ts.BuilderProgramKind || (ts.BuilderProgramKind = {})); - function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { + function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { var host; var newProgram; - if (ts.isArray(newProgramOrRootNames)) { - newProgram = ts.createProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram && oldProgram.getProgram()); + var oldProgram; + if (newProgramOrRootNames === undefined) { + ts.Debug.assert(hostOrOptions === undefined); + host = oldProgramOrHost; + oldProgram = configFileParsingDiagnosticsOrOldProgram; + ts.Debug.assert(!!oldProgram); + newProgram = oldProgram.getProgram(); + } + else if (ts.isArray(newProgramOrRootNames)) { + oldProgram = configFileParsingDiagnosticsOrOldProgram; + newProgram = ts.createProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram && oldProgram.getProgram(), configFileParsingDiagnostics); host = oldProgramOrHost; } else { newProgram = newProgramOrRootNames; host = hostOrOptions; oldProgram = oldProgramOrHost; + configFileParsingDiagnostics = configFileParsingDiagnosticsOrOldProgram; } - return { host: host, newProgram: newProgram, oldProgram: oldProgram }; + return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray }; } ts.getBuilderCreationParameters = getBuilderCreationParameters; function createBuilderProgram(kind, _a) { - var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram; + var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics; var oldState = oldProgram && oldProgram.getState(); - if (oldState && newProgram === oldState.program) { + if (oldState && newProgram === oldState.program && configFileParsingDiagnostics !== newProgram.getConfigFileParsingDiagnostics()) { newProgram = undefined; oldState = undefined; return oldProgram; @@ -62906,6 +63261,7 @@ var ts; getSourceFiles: function () { return state.program.getSourceFiles(); }, getOptionsDiagnostics: function (cancellationToken) { return state.program.getOptionsDiagnostics(cancellationToken); }, getGlobalDiagnostics: function (cancellationToken) { return state.program.getGlobalDiagnostics(cancellationToken); }, + getConfigFileParsingDiagnostics: function () { return configFileParsingDiagnostics || state.program.getConfigFileParsingDiagnostics(); }, getSyntacticDiagnostics: function (sourceFile, cancellationToken) { return state.program.getSyntacticDiagnostics(sourceFile, cancellationToken); }, getSemanticDiagnostics: getSemanticDiagnostics, emit: emit, @@ -62997,16 +63353,16 @@ var ts; ts.createBuilderProgram = createBuilderProgram; })(ts || (ts = {})); (function (ts) { - function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { - return ts.createBuilderProgram(ts.BuilderProgramKind.SemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram)); + function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { + return ts.createBuilderProgram(ts.BuilderProgramKind.SemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics)); } ts.createSemanticDiagnosticsBuilderProgram = createSemanticDiagnosticsBuilderProgram; - function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { - return ts.createBuilderProgram(ts.BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram)); + function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { + return ts.createBuilderProgram(ts.BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics)); } ts.createEmitAndSemanticDiagnosticsBuilderProgram = createEmitAndSemanticDiagnosticsBuilderProgram; - function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { - var program = ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram).newProgram; + function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { + var program = ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics).newProgram; return { getProgram: function () { return program; }, getState: ts.notImplemented, @@ -63015,6 +63371,7 @@ var ts; getSourceFiles: ts.notImplemented, getOptionsDiagnostics: ts.notImplemented, getGlobalDiagnostics: ts.notImplemented, + getConfigFileParsingDiagnostics: ts.notImplemented, getSyntacticDiagnostics: ts.notImplemented, getSemanticDiagnostics: ts.notImplemented, emit: ts.notImplemented, @@ -63528,10 +63885,8 @@ var ts; ts.createWatchStatusReporter = createWatchStatusReporter; function parseConfigFileWithSystem(configFileName, optionsToExtend, system, reportDiagnostic) { var host = system; - host.onConfigFileDiagnostic = reportDiagnostic; host.onUnRecoverableConfigFileDiagnostic = function (diagnostic) { return reportUnrecoverableDiagnostic(ts.sys, reportDiagnostic, diagnostic); }; var result = getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host); - host.onConfigFileDiagnostic = undefined; host.onUnRecoverableConfigFileDiagnostic = undefined; return result; } @@ -63552,20 +63907,19 @@ var ts; return undefined; } var result = ts.parseJsonText(configFileName, configFileText); - result.parseDiagnostics.forEach(function (diagnostic) { return host.onConfigFileDiagnostic(diagnostic); }); var cwd = host.getCurrentDirectory(); - var configParseResult = ts.parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd)); - configParseResult.errors.forEach(function (diagnostic) { return host.onConfigFileDiagnostic(diagnostic); }); - return configParseResult; + return ts.parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd)); } ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile; function emitFilesAndReportErrors(program, reportDiagnostic, writeFileName) { - var diagnostics = program.getSyntacticDiagnostics().slice(); + var diagnostics = program.getConfigFileParsingDiagnostics().slice(); + var configFileParsingDiagnosticsLength = diagnostics.length; + ts.addRange(diagnostics, program.getSyntacticDiagnostics()); var reportSemanticDiagnostics = false; - if (diagnostics.length === 0) { + if (diagnostics.length === configFileParsingDiagnosticsLength) { ts.addRange(diagnostics, program.getOptionsDiagnostics()); ts.addRange(diagnostics, program.getGlobalDiagnostics()); - if (diagnostics.length === 0) { + if (diagnostics.length === configFileParsingDiagnosticsLength) { reportSemanticDiagnostics = true; } } @@ -63652,7 +64006,6 @@ var ts; function createWatchCompilerHostOfConfigFile(configFileName, optionsToExtend, system, createProgram, reportDiagnostic, reportWatchStatus) { reportDiagnostic = reportDiagnostic || createDiagnosticReporter(system); var host = createWatchCompilerHost(system, createProgram, reportDiagnostic, reportWatchStatus); - host.onConfigFileDiagnostic = reportDiagnostic; host.onUnRecoverableConfigFileDiagnostic = function (diagnostic) { return reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic); }; host.configFileName = configFileName; host.optionsToExtend = optionsToExtend; @@ -63693,7 +64046,10 @@ var ts; var getCurrentDirectory = function () { return currentDirectory; }; var readFile = function (path, encoding) { return host.readFile(path, encoding); }; var configFileName = host.configFileName, _a = host.optionsToExtend, optionsToExtendForConfigFile = _a === void 0 ? {} : _a, createProgram = host.createProgram; - var rootFileNames = host.rootFiles, compilerOptions = host.options, configFileSpecs = host.configFileSpecs, configFileWildCardDirectories = host.configFileWildCardDirectories; + var rootFileNames = host.rootFiles, compilerOptions = host.options; + var configFileSpecs; + var configFileParsingDiagnostics; + var hasChangedConfigFileParsingErrors = false; var cachedDirectoryStructureHost = configFileName && ts.createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames); if (cachedDirectoryStructureHost && host.onCachedDirectoryStructureHostCreate) { host.onCachedDirectoryStructureHostCreate(cachedDirectoryStructureHost); @@ -63705,11 +64061,20 @@ var ts; fileExists: function (path) { return host.fileExists(path); }, readFile: readFile, getCurrentDirectory: getCurrentDirectory, - onConfigFileDiagnostic: host.onConfigFileDiagnostic, onUnRecoverableConfigFileDiagnostic: host.onUnRecoverableConfigFileDiagnostic }; - if (configFileName && !rootFileNames) { - parseConfigFile(); + var newLine = updateNewLine(); + reportWatchDiagnostic(ts.Diagnostics.Starting_compilation_in_watch_mode); + if (configFileName) { + newLine = ts.getNewLineCharacter(optionsToExtendForConfigFile, function () { return host.getNewLine(); }); + if (host.configFileParsingResult) { + setConfigFileParsingResult(host.configFileParsingResult); + } + else { + ts.Debug.assert(!rootFileNames); + parseConfigFile(); + } + newLine = updateNewLine(); } var trace = host.trace && (function (s) { host.trace(s + newLine); }); var watchLogLevel = trace ? compilerOptions.extendedDiagnostics ? ts.WatchLogLevel.Verbose : @@ -63717,7 +64082,6 @@ var ts; var writeLog = watchLogLevel !== ts.WatchLogLevel.None ? trace : ts.noop; var _b = ts.getWatchFactory(watchLogLevel, writeLog), watchFile = _b.watchFile, watchFilePath = _b.watchFilePath, watchDirectoryWorker = _b.watchDirectory; var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - var newLine = updateNewLine(); writeLog("Current directory: " + currentDirectory + " CaseSensitiveFileNames: " + useCaseSensitiveFileNames); if (configFileName) { watchFile(host, configFileName, scheduleProgramReload, ts.PollingInterval.High); @@ -63765,7 +64129,6 @@ var ts; (function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }) : (function (typeDirectiveNames, containingFile) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; - reportWatchDiagnostic(ts.Diagnostics.Starting_compilation_in_watch_mode); synchronizeProgram(); watchConfigFileWildCardDirectories(); return configFileName ? @@ -63788,6 +64151,10 @@ var ts; } var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames)) { + if (hasChangedConfigFileParsingErrors) { + builderProgram = createProgram(undefined, undefined, compilerHost, builderProgram, configFileParsingDiagnostics); + hasChangedConfigFileParsingErrors = false; + } return builderProgram; } if (watchLogLevel !== ts.WatchLogLevel.None) { @@ -63797,10 +64164,11 @@ var ts; } var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !program; hasChangedCompilerOptions = false; + hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; - builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram); + builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics); resolutionCache.finishCachingPerDirectoryResolution(); ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = ts.createMap()), watchMissingFilePath); if (needsUpdateInTypeRootWatch) { @@ -63827,7 +64195,7 @@ var ts; scheduleProgramUpdate(); } function updateNewLine() { - return ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); }); + return ts.getNewLineCharacter(compilerOptions || optionsToExtendForConfigFile, function () { return host.getNewLine(); }); } function toPath(fileName) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); @@ -63931,7 +64299,7 @@ var ts; } function reportWatchDiagnostic(message) { if (host.onWatchStatusChange) { - host.onWatchStatusChange(ts.createCompilerDiagnostic(message), newLine, compilerOptions); + host.onWatchStatusChange(ts.createCompilerDiagnostic(message), newLine, compilerOptions || optionsToExtendForConfigFile); } } function scheduleProgramUpdate() { @@ -63963,8 +64331,13 @@ var ts; } function reloadFileNamesFromConfigFile() { var result = ts.getFileNamesFromConfigSpecs(configFileSpecs, ts.getDirectoryPath(configFileName), compilerOptions, parseConfigFileHost); - if (!configFileSpecs.filesSpecs && result.fileNames.length === 0) { - host.onConfigFileDiagnostic(ts.getErrorForNoInputFiles(configFileSpecs, configFileName)); + if (result.fileNames.length) { + configFileParsingDiagnostics = ts.filter(configFileParsingDiagnostics, function (error) { return !ts.isErrorNoInputFiles(error); }); + hasChangedConfigFileParsingErrors = true; + } + else if (!configFileSpecs.filesSpecs && !ts.some(configFileParsingDiagnostics, ts.isErrorNoInputFiles)) { + configFileParsingDiagnostics = configFileParsingDiagnostics.concat(ts.getErrorForNoInputFiles(configFileSpecs, configFileName)); + hasChangedConfigFileParsingErrors = true; } rootFileNames = result.fileNames; synchronizeProgram(); @@ -63981,11 +64354,14 @@ var ts; watchConfigFileWildCardDirectories(); } function parseConfigFile() { - var configParseResult = ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost); - rootFileNames = configParseResult.fileNames; - compilerOptions = configParseResult.options; - configFileSpecs = configParseResult.configFileSpecs; - configFileWildCardDirectories = configParseResult.wildcardDirectories; + setConfigFileParsingResult(ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost)); + } + function setConfigFileParsingResult(configFileParseResult) { + rootFileNames = configFileParseResult.fileNames; + compilerOptions = configFileParseResult.options; + configFileSpecs = configFileParseResult.configFileSpecs; + configFileParsingDiagnostics = ts.getConfigFileParsingDiagnostics(configFileParseResult); + hasChangedConfigFileParsingErrors = true; } function onSourceFileChange(fileName, eventKind, path) { updateCachedSystemWithFile(fileName, path, eventKind); @@ -64016,8 +64392,8 @@ var ts; } } function watchConfigFileWildCardDirectories() { - if (configFileWildCardDirectories) { - ts.updateWatchingWildcardDirectories(watchedWildcardDirectories || (watchedWildcardDirectories = ts.createMap()), ts.createMapFromTemplate(configFileWildCardDirectories), watchWildcardDirectory); + if (configFileSpecs) { + ts.updateWatchingWildcardDirectories(watchedWildcardDirectories || (watchedWildcardDirectories = ts.createMap()), ts.createMapFromTemplate(configFileSpecs.wildcardDirectories), watchWildcardDirectory); } else if (watchedWildcardDirectories) { ts.clearMap(watchedWildcardDirectories, ts.closeFileWatcherOf); @@ -65030,7 +65406,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 268) { + if (element.kind !== 269) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -65099,13 +65475,13 @@ var ts; case 8: reportInvalidOptionValue(option && option.type !== "number"); return Number(valueExpression.text); - case 196: + case 197: if (valueExpression.operator !== 38 || valueExpression.operand.kind !== 8) { break; } reportInvalidOptionValue(option && option.type !== "number"); return -Number(valueExpression.operand.text); - case 182: + case 183: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; if (option) { @@ -65115,7 +65491,7 @@ var ts; else { return convertObjectLiteralExpressionToJson(objectLiteralExpression, undefined, undefined, undefined); } - case 181: + case 182: reportInvalidOptionValue(option && option.type !== "list"); return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element); } @@ -65224,12 +65600,18 @@ var ts; function makePadding(paddingLength) { return Array(paddingLength + 1).join(" "); } + function isAllowedOption(_a) { + var category = _a.category, name = _a.name; + return category !== undefined + && category !== ts.Diagnostics.Command_line_Options + && (category !== ts.Diagnostics.Advanced_Options || compilerOptionsMap.has(name)); + } function writeConfigurations() { var categorizedOptions = ts.createMultiMap(); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; var category = option.category; - if (category !== undefined && category !== ts.Diagnostics.Command_line_Options && category !== ts.Diagnostics.Advanced_Options) { + if (isAllowedOption(option)) { categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); } } @@ -65943,7 +66325,7 @@ var ts; createWatchOfConfigFile(configParseResult, commandLineOptions); } else { - performCompilation(configParseResult.fileNames, configParseResult.options); + performCompilation(configParseResult.fileNames, configParseResult.options, ts.getConfigFileParsingDiagnostics(configParseResult)); } } else { @@ -65964,10 +66346,10 @@ var ts; ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } } - function performCompilation(rootFileNames, compilerOptions) { + function performCompilation(rootFileNames, compilerOptions, configFileParsingDiagnostics) { var compilerHost = ts.createCompilerHost(compilerOptions); enableStatistics(compilerOptions); - var program = ts.createProgram(rootFileNames, compilerOptions, compilerHost); + var program = ts.createProgram(rootFileNames, compilerOptions, compilerHost, undefined, configFileParsingDiagnostics); var exitStatus = ts.emitFilesAndReportErrors(program, reportDiagnostic, function (s) { return ts.sys.write(s + ts.sys.newLine); }); reportStatistics(program); return ts.sys.exit(exitStatus); @@ -65990,10 +66372,7 @@ var ts; function createWatchOfConfigFile(configParseResult, optionsToExtend) { var watchCompilerHost = ts.createWatchCompilerHostOfConfigFile(configParseResult.options.configFilePath, optionsToExtend, ts.sys, undefined, reportDiagnostic, createWatchStatusReporter(configParseResult.options)); updateWatchCompilationHost(watchCompilerHost); - watchCompilerHost.rootFiles = configParseResult.fileNames; - watchCompilerHost.options = configParseResult.options; - watchCompilerHost.configFileSpecs = configParseResult.configFileSpecs; - watchCompilerHost.configFileWildCardDirectories = configParseResult.wildcardDirectories; + watchCompilerHost.configFileParsingResult = configParseResult; ts.createWatchProgram(watchCompilerHost); } function createWatchOfFilesAndCompilerOptions(rootFiles, options) { diff --git a/lib/tsserver.js b/lib/tsserver.js index 315a4e74829..d41e4ac5b2f 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -22,6 +22,10 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { } return t; }; +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || @@ -220,128 +224,129 @@ var ts; SyntaxKind[SyntaxKind["IndexedAccessType"] = 175] = "IndexedAccessType"; SyntaxKind[SyntaxKind["MappedType"] = 176] = "MappedType"; SyntaxKind[SyntaxKind["LiteralType"] = 177] = "LiteralType"; - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 178] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 179] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 180] = "BindingElement"; - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 181] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 182] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 183] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 184] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 185] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 186] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 187] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 188] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 189] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 190] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 191] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 192] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 193] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 194] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 195] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 196] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 197] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 198] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 199] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 200] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 201] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 202] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 203] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 204] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 205] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 206] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 207] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 208] = "MetaProperty"; - SyntaxKind[SyntaxKind["TemplateSpan"] = 209] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 210] = "SemicolonClassElement"; - SyntaxKind[SyntaxKind["Block"] = 211] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 212] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 213] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 214] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 215] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 216] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 217] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 218] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 219] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 220] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 221] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 222] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 223] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 224] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 225] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 226] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 227] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 228] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 229] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 230] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 231] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 232] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 233] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 234] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 235] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 236] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 237] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 238] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 239] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 240] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 241] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 242] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 243] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 244] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 245] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 246] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 247] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 248] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 249] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 250] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 251] = "MissingDeclaration"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 252] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["JsxElement"] = 253] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 254] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 255] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 256] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 257] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 258] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 259] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 260] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 261] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 262] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 263] = "JsxExpression"; - SyntaxKind[SyntaxKind["CaseClause"] = 264] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 265] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 266] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 267] = "CatchClause"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 268] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 269] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 270] = "SpreadAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 271] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 272] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 273] = "Bundle"; - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 274] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 275] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 276] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 277] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 278] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 279] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 280] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 281] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 282] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 283] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocTag"] = 284] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 285] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 286] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 287] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 288] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 289] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 290] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 291] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 292] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 296] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 297] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 298] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["Count"] = 299] = "Count"; + SyntaxKind[SyntaxKind["ImportType"] = 178] = "ImportType"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 179] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 180] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 181] = "BindingElement"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 182] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 183] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 184] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 185] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 186] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 187] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 188] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 189] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 190] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 191] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 192] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 193] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 194] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 195] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 196] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 197] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 198] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 199] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 200] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 201] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 202] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 203] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 204] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 205] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 206] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 207] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 208] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 209] = "MetaProperty"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 210] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 211] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["Block"] = 212] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 213] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 214] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 215] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 216] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 217] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 218] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 219] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 220] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 221] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 222] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 223] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 224] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 225] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 226] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 227] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 228] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 229] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 230] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 231] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 232] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 233] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 234] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 235] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 236] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 237] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 238] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 239] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 240] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 241] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 242] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 243] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 244] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 245] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 246] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 247] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 248] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 249] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 250] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 251] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 252] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 253] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["JsxElement"] = 254] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 255] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 256] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 257] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 258] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 259] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 260] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 261] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 262] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 263] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 264] = "JsxExpression"; + SyntaxKind[SyntaxKind["CaseClause"] = 265] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 266] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 267] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 268] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 269] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 270] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 271] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 272] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 273] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 274] = "Bundle"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 275] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 276] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 277] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 278] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 279] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 280] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 281] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 282] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 283] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 284] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocTag"] = 285] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 286] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 287] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 288] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 289] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 290] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 291] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 292] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 293] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["SyntaxList"] = 294] = "SyntaxList"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 295] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 296] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 297] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 298] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 299] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["Count"] = 300] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 59] = "FirstCompoundAssignment"; @@ -353,7 +358,7 @@ var ts; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 108] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 116] = "LastFutureReservedWord"; SyntaxKind[SyntaxKind["FirstTypeNode"] = 160] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 177] = "LastTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 178] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 17] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 70] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; @@ -367,10 +372,10 @@ var ts; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 27] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 145] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 274] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 292] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 284] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 275] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 293] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 285] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 293] = "LastJSDocTagNode"; SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword"; SyntaxKind[SyntaxKind["LastContextualKeyword"] = 144] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); @@ -448,10 +453,11 @@ var ts; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Loop"] = 2] = "Loop"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Unique"] = 3] = "Unique"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Node"] = 4] = "Node"; - GeneratedIdentifierFlags[GeneratedIdentifierFlags["OptimisticUnique"] = 5] = "OptimisticUnique"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["KindMask"] = 7] = "KindMask"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["SkipNameGenerationScope"] = 8] = "SkipNameGenerationScope"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["ReservedInNestedScopes"] = 16] = "ReservedInNestedScopes"; + GeneratedIdentifierFlags[GeneratedIdentifierFlags["Optimistic"] = 32] = "Optimistic"; + GeneratedIdentifierFlags[GeneratedIdentifierFlags["FileLevel"] = 64] = "FileLevel"; })(GeneratedIdentifierFlags = ts.GeneratedIdentifierFlags || (ts.GeneratedIdentifierFlags = {})); var TokenFlags; (function (TokenFlags) { @@ -2616,7 +2622,7 @@ var ts; ts.compose = compose; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (_match, index) { return Debug.assertDefined(args[+index + baseIndex]); }); } ts.formatStringFromArgs = formatStringFromArgs; function getLocaleSpecificMessage(message) { @@ -4124,10 +4130,13 @@ var ts; } function watchChildDirectories(parentDir, existingChildWatches, callback) { var newChildWatches; - ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? host.getAccessileSortedChildDirectories(parentDir) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(ts.getNormalizedAbsolutePath(child, parentDir), childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); + ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? ts.mapDefined(host.getAccessibleSortedChildDirectories(parentDir), function (child) { + var childFullName = ts.getNormalizedAbsolutePath(child, parentDir); + return host.filePathComparer(childFullName, host.realpath(childFullName)) === 0 ? childFullName : undefined; + }) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); return newChildWatches || ts.emptyArray; function createAndAddChildDirectoryWatcher(childName) { - var result = createDirectoryWatcher(ts.getNormalizedAbsolutePath(childName, parentDir), callback); + var result = createDirectoryWatcher(childName, callback); addChildDirectoryWatcher(result); } function addChildDirectoryWatcher(childWatcher) { @@ -4229,14 +4238,7 @@ var ts; exit: function (exitCode) { process.exit(exitCode); }, - realpath: function (path) { - try { - return _fs.realpathSync(path); - } - catch (_a) { - return path; - } - }, + realpath: realpath, debugMode: ts.some(process.execArgv, function (arg) { return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg); }), tryEnableSourceMapsForHost: function () { try { @@ -4310,8 +4312,9 @@ var ts; var watchDirectoryRecursively = createRecursiveDirectoryWatcher({ filePathComparer: useCaseSensitiveFileNames ? ts.compareStringsCaseSensitive : ts.compareStringsCaseInsensitive, directoryExists: directoryExists, - getAccessileSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, - watchDirectory: watchDirectory + getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, + watchDirectory: watchDirectory, + realpath: realpath }); return function (directoryName, callback, recursive) { if (recursive) { @@ -4563,6 +4566,14 @@ var ts; function getDirectories(path) { return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1); }); } + function realpath(path) { + try { + return _fs.realpathSync(path); + } + catch (_a) { + return path; + } + } function getModifiedTime(path) { try { return _fs.statSync(path).mtime; @@ -4665,6 +4676,7 @@ var ts; Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), Unexpected_token: diag(1012, ts.DiagnosticCategory.Error, "Unexpected_token_1012", "Unexpected token."), + A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma: diag(1013, ts.DiagnosticCategory.Error, "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013", "A rest parameter or binding pattern may not have a trailing comma."), A_rest_parameter_must_be_last_in_a_parameter_list: diag(1014, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."), Parameter_cannot_have_question_mark_and_initializer: diag(1015, ts.DiagnosticCategory.Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."), A_required_parameter_cannot_follow_an_optional_parameter: diag(1016, ts.DiagnosticCategory.Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."), @@ -4896,6 +4908,9 @@ var ts; An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead: diag(1336, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead_1336", "An index signature parameter type cannot be a type alias. Consider writing '[{0}: {1}]: {2}' instead."), An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead: diag(1337, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead_1337", "An index signature parameter type cannot be a union type. Consider using a mapped object type instead."), infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."), + Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."), + Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340", "Module '{0}' does not refer to a type, but is used as a type here."), + Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."), Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."), Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."), @@ -5001,7 +5016,7 @@ var ts; The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."), The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: diag(2405, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."), The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: diag(2406, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."), - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter."), + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."), Setters_cannot_return_a_value: diag(2408, ts.DiagnosticCategory.Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."), Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: diag(2409, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."), The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: diag(2410, ts.DiagnosticCategory.Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."), @@ -5075,7 +5090,7 @@ var ts; The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: diag(2483, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."), Export_declaration_conflicts_with_exported_declaration_of_0: diag(2484, ts.DiagnosticCategory.Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."), The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: diag(2487, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."), - Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type must have a '[Symbol.iterator]()' method that returns an iterator."), + Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."), An_iterator_must_have_a_next_method: diag(2489, ts.DiagnosticCategory.Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."), The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: diag(2490, ts.DiagnosticCategory.Error, "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the 'next()' method of an iterator must have a 'value' property."), The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: diag(2491, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."), @@ -5091,7 +5106,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: diag(2501, ts.DiagnosticCategory.Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."), _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: diag(2502, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."), Cannot_find_namespace_0: diag(2503, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."), - Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), + Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), A_generator_cannot_have_a_void_type_annotation: diag(2505, ts.DiagnosticCategory.Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."), _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: diag(2506, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."), Type_0_is_not_a_constructor_function_type: diag(2507, ts.DiagnosticCategory.Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."), @@ -5155,6 +5170,8 @@ var ts; Property_0_is_used_before_being_assigned: diag(2565, ts.DiagnosticCategory.Error, "Property_0_is_used_before_being_assigned_2565", "Property '{0}' is used before being assigned."), A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."), Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."), + Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2568, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568", "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), + Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."), The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."), JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."), @@ -6199,6 +6216,7 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); } + ts.Debug.assert(host.fileExists(real), path + " linked to nonexistent file " + real); return real; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { @@ -6726,7 +6744,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 272) { + while (node && node.kind !== 273) { node = node.parent; } return node; @@ -6734,11 +6752,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 211: - case 239: - case 218: + case 212: + case 240: case 219: case 220: + case 221: return true; } return false; @@ -6774,6 +6792,11 @@ var ts; } } ts.getEndLinePosition = getEndLinePosition; + function isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) { + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name); + } + ts.isFileLevelUniqueName = isFileLevelUniqueName; function nodeIsMissing(node) { if (node === undefined) { return true; @@ -6814,7 +6837,7 @@ var ts; if (includeJsDoc && ts.hasJSDocNodes(node)) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 293 && node._children.length > 0) { + if (node.kind === 294 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -6908,7 +6931,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 230 && node.parent.kind === 267; + return node.kind === 231 && node.parent.kind === 268; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -6928,11 +6951,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node && node.kind === 237 && (!node.body); + return node && node.kind === 238 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 272 || - node.kind === 237 || + return node.kind === 273 || + node.kind === 238 || ts.isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -6946,9 +6969,9 @@ var ts; ts.isExternalModuleAugmentation = isExternalModuleAugmentation; function isModuleAugmentationExternal(node) { switch (node.parent.kind) { - case 272: + case 273: return ts.isExternalModule(node.parent); - case 238: + case 239: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -6960,22 +6983,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 272: - case 239: - case 267: - case 237: - case 218: + case 273: + case 240: + case 268: + case 238: case 219: case 220: + case 221: case 154: case 153: case 155: case 156: - case 232: - case 190: + case 233: case 191: + case 192: return true; - case 211: + case 212: return parentNode && !ts.isFunctionLike(parentNode); } return false; @@ -6989,19 +7012,19 @@ var ts; case 159: case 162: case 163: - case 280: - case 233: - case 203: + case 281: case 234: + case 204: case 235: - case 290: - case 232: + case 236: + case 291: + case 233: case 153: case 154: case 155: case 156: - case 190: case 191: + case 192: return true; default: ts.assertTypeIsNever(node); @@ -7011,8 +7034,8 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isAnyImportSyntax(node) { switch (node.kind) { + case 243: case 242: - case 241: return true; default: return false; @@ -7061,7 +7084,7 @@ var ts; return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); case 145: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 183: + case 184: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -7108,7 +7131,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 211) { + if (node.body && node.body.kind === 212) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -7120,29 +7143,29 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 272: + case 273: 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 230: - case 180: - case 233: - case 203: + case 231: + case 181: case 234: + case 204: + case 235: + case 238: case 237: - case 236: - case 271: - case 232: - case 190: + case 272: + case 233: + case 191: case 153: case 155: case 156: - case 235: + case 236: errorNode = node.name; break; - case 191: + case 192: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -7168,7 +7191,7 @@ var ts; } ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isConstEnumDeclaration(node) { - return node.kind === 236 && isConst(node); + return node.kind === 237 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -7181,15 +7204,21 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 185 && n.expression.kind === 97; + return n.kind === 186 && n.expression.kind === 97; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 185 && n.expression.kind === 91; + return n.kind === 186 && n.expression.kind === 91; } ts.isImportCall = isImportCall; + function isLiteralImportTypeNode(n) { + return n.kind === 178 && + n.argument.kind === 177 && + ts.isStringLiteral(n.argument.literal); + } + ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 214 + return node.kind === 215 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -7200,9 +7229,9 @@ var ts; function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 148 || node.kind === 147 || - node.kind === 190 || node.kind === 191 || - node.kind === 189) ? + node.kind === 192 || + node.kind === 190) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); return ts.filter(commentRanges, function (comment) { @@ -7217,7 +7246,7 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (160 <= node.kind && node.kind <= 177) { + if (160 <= node.kind && node.kind <= 178) { return true; } switch (node.kind) { @@ -7230,8 +7259,8 @@ var ts; case 131: return true; case 105: - return node.parent.kind !== 194; - case 205: + return node.parent.kind !== 195; + case 206: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 147: return node.parent.kind === 176 || node.parent.kind === 171; @@ -7239,33 +7268,36 @@ var ts; if (node.parent.kind === 145 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 183 && node.parent.name === node) { + else if (node.parent.kind === 184 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 71 || node.kind === 145 || node.kind === 183, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 71 || node.kind === 145 || node.kind === 184, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); case 145: - case 183: + case 184: case 99: var parent = node.parent; if (parent.kind === 164) { return false; } - if (160 <= parent.kind && parent.kind <= 177) { + if (parent.kind === 178) { + return !parent.isTypeOf; + } + if (160 <= parent.kind && parent.kind <= 178) { return true; } switch (parent.kind) { - case 205: + case 206: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 147: return node === parent.constraint; case 151: case 150: case 148: - case 230: + case 231: return node === parent.type; - case 232: - case 190: + case 233: case 191: + case 192: case 154: case 153: case 152: @@ -7276,12 +7308,12 @@ var ts; case 158: case 159: return node === parent.type; - case 188: + case 189: return node === parent.type; - case 185: case 186: - return ts.contains(parent.typeArguments, node); case 187: + return ts.contains(parent.typeArguments, node); + case 188: return false; } } @@ -7302,23 +7334,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 223: + case 224: return visitor(node); - case 239: - case 211: - case 215: + case 240: + case 212: case 216: case 217: case 218: case 219: case 220: - case 224: + case 221: case 225: - case 264: - case 265: case 226: - case 228: - case 267: + case 265: + case 266: + case 227: + case 229: + case 268: return ts.forEachChild(node, traverse); } } @@ -7328,19 +7360,19 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 201: + case 202: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 236: - case 234: case 237: case 235: - case 233: - case 203: + case 238: + case 236: + case 234: + case 204: return; default: if (ts.isFunctionLike(node)) { @@ -7370,12 +7402,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { + case 235: case 234: - case 233: - case 203: + case 204: case 165: return node.members; - case 182: + case 183: return node.properties; } } @@ -7383,14 +7415,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 180: - case 271: + case 181: + case 272: case 148: - case 268: + case 269: case 151: case 150: - case 269: - case 230: + case 270: + case 231: return true; } } @@ -7402,8 +7434,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 231 - && node.parent.parent.kind === 212; + return node.parent.kind === 232 + && node.parent.parent.kind === 213; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isValidESSymbolDeclaration(node) { @@ -7419,8 +7451,8 @@ var ts; case 154: case 155: case 156: - case 232: - case 190: + case 233: + case 191: return true; } return false; @@ -7431,7 +7463,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 226) { + if (node.statement.kind !== 227) { return node.statement; } node = node.statement; @@ -7439,17 +7471,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 211 && ts.isFunctionLike(node.parent); + return node && node.kind === 212 && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 153 && node.parent.kind === 182; + return node && node.kind === 153 && node.parent.kind === 183; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { return node.kind === 153 && - (node.parent.kind === 182 || - node.parent.kind === 203); + (node.parent.kind === 183 || + node.parent.kind === 204); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -7462,7 +7494,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 268) { + if (property.kind === 269) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -7498,13 +7530,13 @@ var ts; node = node.parent; } break; - case 191: + case 192: if (!includeArrowFunctions) { continue; } - case 232: - case 190: - case 237: + case 233: + case 191: + case 238: case 151: case 150: case 153: @@ -7515,8 +7547,8 @@ var ts; case 157: case 158: case 159: - case 236: - case 272: + case 237: + case 273: return node; } } @@ -7527,8 +7559,8 @@ var ts; if (container) { switch (container.kind) { case 154: - case 232: - case 190: + case 233: + case 191: return container; } } @@ -7545,9 +7577,9 @@ var ts; case 146: node = node.parent; break; - case 232: - case 190: + case 233: case 191: + case 192: if (!stopOnFunctions) { continue; } @@ -7572,14 +7604,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 190 || func.kind === 191) { + if (func.kind === 191 || func.kind === 192) { var prev = func; var parent = func.parent; - while (parent.kind === 189) { + while (parent.kind === 190) { prev = parent; parent = parent.parent; } - if (parent.kind === 185 && parent.expression === prev) { + if (parent.kind === 186 && parent.expression === prev) { return parent; } } @@ -7587,13 +7619,13 @@ var ts; ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; function isSuperProperty(node) { var kind = node.kind; - return (kind === 183 || kind === 184) + return (kind === 184 || kind === 185) && node.expression.kind === 97; } ts.isSuperProperty = isSuperProperty; function isThisProperty(node) { var kind = node.kind; - return (kind === 183 || kind === 184) + return (kind === 184 || kind === 185) && node.expression.kind === 99; } ts.isThisProperty = isThisProperty; @@ -7601,7 +7633,7 @@ var ts; switch (node.kind) { case 161: return node.typeName; - case 205: + case 206: return isEntityNameExpression(node.expression) ? node.expression : undefined; @@ -7614,10 +7646,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 187: + case 188: return node.tag; + case 256: case 255: - case 254: return node.tagName; default: return node.expression; @@ -7626,21 +7658,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node, parent, grandparent) { switch (node.kind) { - case 233: + case 234: return true; case 151: - return parent.kind === 233; + return parent.kind === 234; case 155: case 156: case 153: return node.body !== undefined - && parent.kind === 233; + && parent.kind === 234; case 148: return parent.body !== undefined && (parent.kind === 154 || parent.kind === 153 || parent.kind === 156) - && grandparent.kind === 233; + && grandparent.kind === 234; } return false; } @@ -7656,7 +7688,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 233: + case 234: return ts.forEach(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); case 153: case 156: @@ -7666,9 +7698,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 255 || - parent.kind === 254 || - parent.kind === 256) { + if (parent.kind === 256 || + parent.kind === 255 || + parent.kind === 257) { return parent.tagName === node; } return false; @@ -7681,37 +7713,37 @@ var ts; case 101: case 86: case 12: - case 181: case 182: case 183: case 184: case 185: case 186: case 187: - case 206: case 188: case 207: case 189: + case 208: case 190: - case 203: case 191: - case 194: + case 204: case 192: + case 195: case 193: - case 196: + case 194: case 197: case 198: case 199: - case 202: case 200: - case 13: - case 204: - case 253: - case 254: - case 257: + case 203: case 201: - case 195: - case 208: + case 13: + case 205: + case 254: + case 255: + case 258: + case 202: + case 196: + case 209: return true; case 145: while (node.parent.kind === 145) { @@ -7734,47 +7766,47 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 230: + case 231: case 148: case 151: case 150: - case 271: - case 268: - case 180: + case 272: + case 269: + case 181: return parent.initializer === node; - case 214: case 215: case 216: case 217: - case 223: + case 218: case 224: case 225: - case 264: - case 227: + case 226: + case 265: + case 228: return parent.expression === node; - case 218: + case 219: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 231) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 232) || forStatement.condition === node || forStatement.incrementor === node; - case 219: case 220: + case 221: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 231) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 232) || forInStatement.expression === node; - case 188: - case 206: + case 189: + case 207: return node === parent.expression; - case 209: + case 210: return node === parent.expression; case 146: return node === parent.expression; case 149: + case 264: case 263: - case 262: - case 270: + case 271: return true; - case 205: + case 206: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: return isExpressionNode(parent); @@ -7782,7 +7814,7 @@ var ts; } ts.isInExpressionContext = isInExpressionContext; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 && node.moduleReference.kind === 252; + return node.kind === 242 && node.moduleReference.kind === 253; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7791,7 +7823,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 && node.moduleReference.kind !== 252; + return node.kind === 242 && node.moduleReference.kind !== 253; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7819,7 +7851,7 @@ var ts; } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) { - if (callExpression.kind !== 185) { + if (callExpression.kind !== 186) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -7868,9 +7900,11 @@ var ts; function getJavascriptInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 190 || e.kind === 191 ? initializer : undefined; + return e.kind === 191 || e.kind === 192 ? initializer : undefined; } - if (initializer.kind === 190 || initializer.kind === 203) { + if (initializer.kind === 191 || + initializer.kind === 204 || + initializer.kind === 192) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -7942,7 +7976,7 @@ var ts; return 2; } else if (isEntityNameExpression(lhs.expression)) { - if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(expr.right)) { + if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) { return 6; } else if (isPrototypeAccess(lhs.expression)) { @@ -7963,24 +7997,31 @@ var ts; return 0; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; + function getInitializerOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.right)) { + expr = expr.right; + } + return expr.right; + } + ts.getInitializerOfBinaryExpression = getInitializerOfBinaryExpression; function isPrototypePropertyAssignment(node) { return ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === 3; } ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJavaScriptFile(expr) && - expr.parent && expr.parent.kind === 214 && + expr.parent && expr.parent.kind === 215 && !!ts.getJSDocTypeTag(expr.parent); } ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration; function importFromModuleSpecifier(node) { switch (node.parent.kind) { - case 242: - case 248: + case 243: + case 249: return node.parent; - case 252: + case 253: return node.parent.parent; - case 185: + case 186: return node.parent; default: return ts.Debug.fail(ts.Debug.showSyntaxKind(node)); @@ -7989,11 +8030,13 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 242: - case 248: + case 243: + case 249: return node.moduleSpecifier; - case 241: - return node.moduleReference.kind === 252 ? node.moduleReference.expression : undefined; + case 242: + return node.moduleReference.kind === 253 ? node.moduleReference.expression : undefined; + case 178: + return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; default: return ts.Debug.assertNever(node); } @@ -8001,11 +8044,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 242: + case 243: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 241: + case 242: return node; - case 248: + case 249: return undefined; default: return ts.Debug.assertNever(node); @@ -8013,7 +8056,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 242 && node.importClause && !!node.importClause.name; + return node.kind === 243 && node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function hasQuestionToken(node) { @@ -8022,8 +8065,8 @@ var ts; case 148: case 153: case 152: + case 270: case 269: - case 268: case 151: case 150: return node.questionToken !== undefined; @@ -8033,7 +8076,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 280 && + return node.kind === 281 && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -8055,7 +8098,7 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 212: + case 213: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; case 151: @@ -8068,9 +8111,9 @@ var ts; node.declarationList.declarations[0]; } function getNestedModuleDeclaration(node) { - return node.kind === 237 && + return node.kind === 238 && node.body && - node.body.kind === 237 && + node.body.kind === 238 && node.body; } function getJSDocCommentsAndTags(node) { @@ -8079,7 +8122,10 @@ var ts; return result || ts.emptyArray; function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; - if (parent && (parent.kind === 268 || parent.kind === 151 || getNestedModuleDeclaration(parent))) { + if (parent && + (parent.kind === 269 || + parent.kind === 151 || + getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } if (parent && parent.parent && @@ -8091,7 +8137,8 @@ var ts; getJSDocCommentsAndTagsWorker(parent.parent.parent); } if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 || - node.kind === 183 && node.parent && node.parent.kind === 214) { + parent && ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 || + node.kind === 184 && node.parent && node.parent.kind === 215) { getJSDocCommentsAndTagsWorker(parent); } if (node.kind === 148) { @@ -8134,7 +8181,7 @@ var ts; } ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 282); + ts.Debug.assert(node.parent.kind === 283); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -8150,7 +8197,7 @@ var ts; } ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { - return node.dotDotDotToken !== undefined || node.type && node.type.kind === 281; + return node.dotDotDotToken !== undefined || node.type && node.type.kind === 282; } ts.isRestParameter = isRestParameter; var AssignmentKind; @@ -8163,31 +8210,31 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 198: + case 199: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 58 ? 1 : 2 : 0; - case 196: case 197: + case 198: var unaryOperator = parent.operator; return unaryOperator === 43 || unaryOperator === 44 ? 2 : 0; - case 219: case 220: + case 221: return parent.initializer === node ? 1 : 0; - case 189: - case 181: - case 202: - case 207: + case 190: + case 182: + case 203: + case 208: node = parent; break; - case 269: + case 270: if (parent.name !== node) { return 0; } node = parent.parent; break; - case 268: + case 269: if (parent.name === node) { return 0; } @@ -8206,22 +8253,22 @@ var ts; ts.isAssignmentTarget = isAssignmentTarget; function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 211: case 212: - case 224: - case 215: + case 213: case 225: - case 239: - case 264: - case 265: + case 216: case 226: - case 218: + case 240: + case 265: + case 266: + case 227: case 219: case 220: - case 216: + case 221: case 217: - case 228: - case 267: + case 218: + case 229: + case 268: return true; } return false; @@ -8242,22 +8289,22 @@ var ts; } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 189); + return walkUp(node, 190); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; function skipParentheses(node) { - while (node.kind === 189) { + while (node.kind === 190) { node = node.expression; } return node; } ts.skipParentheses = skipParentheses; function isDeleteTarget(node) { - if (node.kind !== 183 && node.kind !== 184) { + if (node.kind !== 184 && node.kind !== 185) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 192; + return node && node.kind === 193; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -8303,36 +8350,36 @@ var ts; case 152: case 155: case 156: - case 271: - case 268: - case 183: + case 272: + case 269: + case 184: return parent.name === node; case 145: if (parent.right === node) { while (parent.kind === 145) { parent = parent.parent; } - return parent.kind === 164; + return parent.kind === 164 || parent.kind === 161; } return false; - case 180: - case 246: + case 181: + case 247: return parent.propertyName === node; - case 250: - case 260: + case 251: + case 261: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 241 || - node.kind === 240 || - node.kind === 243 && !!node.name || - node.kind === 244 || - node.kind === 246 || - node.kind === 250 || - node.kind === 247 && exportAssignmentIsAlias(node); + return node.kind === 242 || + node.kind === 241 || + node.kind === 244 && !!node.name || + node.kind === 245 || + node.kind === 247 || + node.kind === 251 || + node.kind === 248 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8424,13 +8471,13 @@ var ts; } var flags = 0; switch (node.kind) { - case 232: - case 190: + case 233: + case 191: case 153: if (node.asteriskToken) { flags |= 1; } - case 191: + case 192: if (hasModifier(node, 256)) { flags |= 2; } @@ -8444,9 +8491,9 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 232: - case 190: + case 233: case 191: + case 192: case 153: return node.body !== undefined && node.asteriskToken === undefined @@ -8537,7 +8584,7 @@ var ts; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 180) { + while (node.kind === 181) { node = node.parent.parent; } return node; @@ -8546,14 +8593,14 @@ var ts; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; return kind === 154 - || kind === 190 - || kind === 232 || kind === 191 + || kind === 233 + || kind === 192 || kind === 153 || kind === 155 || kind === 156 - || kind === 237 - || kind === 272; + || kind === 238 + || kind === 273; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -8572,23 +8619,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 186: + case 187: return hasArguments ? 0 : 1; - case 196: - case 193: + case 197: case 194: - case 192: case 195: - case 199: - case 201: + case 193: + case 196: + case 200: + case 202: return 1; - case 198: + case 199: switch (operator) { case 40: case 58: @@ -8612,15 +8659,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 198) { + if (expression.kind === 199) { return expression.operatorToken.kind; } - else if (expression.kind === 196 || expression.kind === 197) { + else if (expression.kind === 197 || expression.kind === 198) { return expression.operator; } else { @@ -8630,15 +8677,15 @@ var ts; ts.getOperator = getOperator; function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 296: + case 297: return 0; - case 202: + case 203: return 1; - case 201: + case 202: return 2; - case 199: + case 200: return 4; - case 198: + case 199: switch (operatorKind) { case 26: return 0; @@ -8659,21 +8706,21 @@ var ts; default: return getBinaryOperatorPrecedence(operatorKind); } - case 196: - case 193: - case 194: - case 192: - case 195: - return 16; case 197: + case 194: + case 195: + case 193: + case 196: + return 16; + case 198: return 17; - case 185: - return 18; case 186: - return hasArguments ? 19 : 18; + return 18; case 187: - case 183: + return hasArguments ? 19 : 18; + case 188: case 184: + case 185: return 19; case 99: case 97: @@ -8683,19 +8730,19 @@ var ts; case 86: case 8: case 9: - case 181: case 182: - case 190: + case 183: case 191: - case 203: - case 253: + case 192: + case 204: case 254: - case 257: + case 255: + case 258: case 12: case 13: - case 200: - case 189: - case 204: + case 201: + case 190: + case 205: return 20; default: return -1; @@ -8749,17 +8796,12 @@ var ts; var filesWithDiagnostics = []; var fileDiagnostics = ts.createMap(); var hasReadNonFileDiagnostics = false; - var modificationCount = 0; return { add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount, reattachFileDiagnostics: reattachFileDiagnostics }; - function getModificationCount() { - return modificationCount; - } function reattachFileDiagnostics(newFile) { ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } @@ -8781,7 +8823,6 @@ var ts; diagnostics = nonFileDiagnostics; } ts.insertSorted(diagnostics, diagnostic, ts.compareDiagnostics); - modificationCount++; } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -9359,7 +9400,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 205 && + if (node.kind === 206 && node.parent.token === 85 && ts.isClassLike(node.parent.parent)) { return node.parent.parent; @@ -9377,8 +9418,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, true)) { var kind = node.left.kind; - return kind === 182 - || kind === 181; + return kind === 183 + || kind === 182; } return false; } @@ -9388,7 +9429,7 @@ var ts; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isExpressionWithTypeArgumentsInClassImplementsClause(node) { - return node.kind === 205 + return node.kind === 206 && isEntityNameExpression(node.expression) && node.parent && node.parent.token === 108 @@ -9410,16 +9451,16 @@ var ts; ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { return (node.parent.kind === 145 && node.parent.right === node) || - (node.parent.kind === 183 && node.parent.name === node); + (node.parent.kind === 184 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteral(expression) { - return expression.kind === 182 && + return expression.kind === 183 && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 181 && + return expression.kind === 182 && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -9699,8 +9740,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 236: case 237: + case 238: return parseNode === parseNode.parent.name; } } @@ -9768,20 +9809,20 @@ var ts; if (!parent) return 0; switch (parent.kind) { + case 198: case 197: - case 196: var operator = parent.operator; return operator === 43 || operator === 44 ? writeOrReadWrite() : 0; - case 198: + case 199: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? writeOrReadWrite() : 0; - case 183: + case 184: return parent.name !== node ? 0 : accessKind(parent); default: return 0; } function writeOrReadWrite() { - return parent.parent && parent.parent.kind === 214 ? 1 : 2; + return parent.parent && parent.parent.kind === 215 ? 1 : 2; } } function compareDataObjects(dst, src) { @@ -10038,7 +10079,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 147) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 234) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 235) { return current; } } @@ -10064,7 +10105,7 @@ var ts; } ts.isEmptyBindingElement = isEmptyBindingElement; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 180 || ts.isBindingPattern(node))) { + while (node && (node.kind === 181 || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -10072,14 +10113,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 230) { + if (node.kind === 231) { node = node.parent; } - if (node && node.kind === 231) { + if (node && node.kind === 232) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 212) { + if (node && node.kind === 213) { flags |= ts.getModifierFlags(node); } return flags; @@ -10088,14 +10129,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 230) { + if (node.kind === 231) { node = node.parent; } - if (node && node.kind === 231) { + if (node && node.kind === 232) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 212) { + if (node && node.kind === 213) { flags |= node.flags; } return flags; @@ -10199,17 +10240,17 @@ var ts; return getDeclarationIdentifier(hostNode); } switch (hostNode.kind) { - case 212: + case 213: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } return undefined; - case 214: + case 215: var expr = hostNode.expression; switch (expr.kind) { - case 183: - return expr.name; case 184: + return expr.name; + case 185: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; @@ -10218,10 +10259,10 @@ var ts; return undefined; case 1: return undefined; - case 189: { + case 190: { return getDeclarationIdentifier(hostNode.expression); } - case 226: { + case 227: { if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -10250,15 +10291,15 @@ var ts; switch (declaration.kind) { case 71: return declaration; - case 292: - case 287: { + case 293: + case 288: { var name = declaration.name; if (name.kind === 145) { return name.right; } break; } - case 198: { + case 199: { var expr = declaration; switch (ts.getSpecialPropertyAssignmentKind(expr)) { case 1: @@ -10270,9 +10311,9 @@ var ts; return undefined; } } - case 291: + case 292: return getNameOfJSDocTypedef(declaration); - case 247: { + case 248: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } @@ -10515,480 +10556,480 @@ var ts; } ts.isLiteralTypeNode = isLiteralTypeNode; function isObjectBindingPattern(node) { - return node.kind === 178; + return node.kind === 179; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 179; + return node.kind === 180; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 180; + return node.kind === 181; } ts.isBindingElement = isBindingElement; function isArrayLiteralExpression(node) { - return node.kind === 181; + return node.kind === 182; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 182; + return node.kind === 183; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 183; + return node.kind === 184; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 184; + return node.kind === 185; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 185; + return node.kind === 186; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 186; + return node.kind === 187; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 187; + return node.kind === 188; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertion(node) { - return node.kind === 188; + return node.kind === 189; } ts.isTypeAssertion = isTypeAssertion; function isParenthesizedExpression(node) { - return node.kind === 189; + return node.kind === 190; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295) { + while (node.kind === 296) { node = node.expression; } return node; } ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; function isFunctionExpression(node) { - return node.kind === 190; + return node.kind === 191; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 191; + return node.kind === 192; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 192; + return node.kind === 193; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 193; + return node.kind === 194; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 194; + return node.kind === 195; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 195; + return node.kind === 196; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 196; + return node.kind === 197; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 197; + return node.kind === 198; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 198; + return node.kind === 199; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 199; + return node.kind === 200; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 200; + return node.kind === 201; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 201; + return node.kind === 202; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 202; + return node.kind === 203; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 203; + return node.kind === 204; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 204; + return node.kind === 205; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 205; + return node.kind === 206; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 206; + return node.kind === 207; } ts.isAsExpression = isAsExpression; function isNonNullExpression(node) { - return node.kind === 207; + return node.kind === 208; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 208; + return node.kind === 209; } ts.isMetaProperty = isMetaProperty; function isTemplateSpan(node) { - return node.kind === 209; + return node.kind === 210; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 210; + return node.kind === 211; } ts.isSemicolonClassElement = isSemicolonClassElement; function isBlock(node) { - return node.kind === 211; + return node.kind === 212; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 212; + return node.kind === 213; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 213; + return node.kind === 214; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 214; + return node.kind === 215; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 215; + return node.kind === 216; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 216; + return node.kind === 217; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 217; + return node.kind === 218; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 218; + return node.kind === 219; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 219; + return node.kind === 220; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 220; + return node.kind === 221; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 221; + return node.kind === 222; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 222; + return node.kind === 223; } ts.isBreakStatement = isBreakStatement; function isBreakOrContinueStatement(node) { - return node.kind === 222 || node.kind === 221; + return node.kind === 223 || node.kind === 222; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isReturnStatement(node) { - return node.kind === 223; + return node.kind === 224; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 224; + return node.kind === 225; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 225; + return node.kind === 226; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 226; + return node.kind === 227; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 227; + return node.kind === 228; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 228; + return node.kind === 229; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 229; + return node.kind === 230; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 230; + return node.kind === 231; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 231; + return node.kind === 232; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 232; + return node.kind === 233; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 233; + return node.kind === 234; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 234; + return node.kind === 235; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 235; + return node.kind === 236; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 236; + return node.kind === 237; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 237; + return node.kind === 238; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 238; + return node.kind === 239; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 239; + return node.kind === 240; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 240; + return node.kind === 241; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 241; + return node.kind === 242; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 242; + return node.kind === 243; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 243; + return node.kind === 244; } ts.isImportClause = isImportClause; function isNamespaceImport(node) { - return node.kind === 244; + return node.kind === 245; } ts.isNamespaceImport = isNamespaceImport; function isNamedImports(node) { - return node.kind === 245; + return node.kind === 246; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 246; + return node.kind === 247; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 247; + return node.kind === 248; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 248; + return node.kind === 249; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 249; + return node.kind === 250; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 250; + return node.kind === 251; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 251; + return node.kind === 252; } ts.isMissingDeclaration = isMissingDeclaration; function isExternalModuleReference(node) { - return node.kind === 252; + return node.kind === 253; } ts.isExternalModuleReference = isExternalModuleReference; function isJsxElement(node) { - return node.kind === 253; + return node.kind === 254; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 254; + return node.kind === 255; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 255; + return node.kind === 256; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 256; + return node.kind === 257; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 257; + return node.kind === 258; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 258; + return node.kind === 259; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 259; + return node.kind === 260; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 260; + return node.kind === 261; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 261; + return node.kind === 262; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 262; + return node.kind === 263; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 263; + return node.kind === 264; } ts.isJsxExpression = isJsxExpression; function isCaseClause(node) { - return node.kind === 264; + return node.kind === 265; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 265; + return node.kind === 266; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 266; + return node.kind === 267; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 267; + return node.kind === 268; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 268; + return node.kind === 269; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 269; + return node.kind === 270; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 270; + return node.kind === 271; } ts.isSpreadAssignment = isSpreadAssignment; function isEnumMember(node) { - return node.kind === 271; + return node.kind === 272; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 272; + return node.kind === 273; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 273; + return node.kind === 274; } ts.isBundle = isBundle; function isJSDocTypeExpression(node) { - return node.kind === 274; + return node.kind === 275; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 275; + return node.kind === 276; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 276; + return node.kind === 277; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 277; + return node.kind === 278; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 278; + return node.kind === 279; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 279; + return node.kind === 280; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 280; + return node.kind === 281; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 281; + return node.kind === 282; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 282; + return node.kind === 283; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 285; + return node.kind === 286; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocClassTag(node) { - return node.kind === 286; + return node.kind === 287; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocParameterTag(node) { - return node.kind === 287; + return node.kind === 288; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 288; + return node.kind === 289; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 289; + return node.kind === 290; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 290; + return node.kind === 291; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 291; + return node.kind === 292; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 292; + return node.kind === 293; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 292 || node.kind === 287; + return node.kind === 293 || node.kind === 288; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 283; + return node.kind === 284; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); (function (ts) { function isSyntaxList(n) { - return n.kind === 293; + return n.kind === 294; } ts.isSyntaxList = isSyntaxList; function isNode(node) { @@ -11080,8 +11121,8 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 71 - || kind === 178 - || kind === 179; + || kind === 179 + || kind === 180; } ts.isBindingName = isBindingName; function isFunctionLike(node) { @@ -11094,13 +11135,13 @@ var ts; ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 232: + case 233: case 153: case 154: case 155: case 156: - case 190: case 191: + case 192: return true; default: return false; @@ -11113,7 +11154,7 @@ var ts; case 158: case 159: case 162: - case 280: + case 281: case 163: return true; default: @@ -11133,12 +11174,12 @@ var ts; || kind === 155 || kind === 156 || kind === 159 - || kind === 210 - || kind === 251; + || kind === 211 + || kind === 252; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 233 || node.kind === 203); + return node && (node.kind === 234 || node.kind === 204); } ts.isClassLike = isClassLike; function isAccessor(node) { @@ -11163,22 +11204,22 @@ var ts; || kind === 150 || kind === 152 || kind === 159 - || kind === 251; + || kind === 252; } ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 268 - || kind === 269 + return kind === 269 || kind === 270 + || kind === 271 || kind === 153 || kind === 155 || kind === 156 - || kind === 251; + || kind === 252; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { - return (kind >= 160 && kind <= 177) + return (kind >= 160 && kind <= 178) || kind === 119 || kind === 134 || kind === 135 @@ -11190,14 +11231,14 @@ var ts; || kind === 140 || kind === 95 || kind === 131 - || kind === 205 - || kind === 275 + || kind === 206 || kind === 276 || kind === 277 || kind === 278 || kind === 279 || kind === 280 - || kind === 281; + || kind === 281 + || kind === 282; } function isTypeNode(node) { return isTypeNodeKind(node.kind); @@ -11215,29 +11256,29 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 179 - || kind === 178; + return kind === 180 + || kind === 179; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 181 - || kind === 182; + return kind === 182 + || kind === 183; } ts.isAssignmentPattern = isAssignmentPattern; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 180 - || kind === 204; + return kind === 181 + || kind === 205; } ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 230: + case 231: case 148: - case 180: + case 181: return true; } return false; @@ -11250,8 +11291,8 @@ var ts; ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 178: - case 182: + case 179: + case 183: return true; } return false; @@ -11259,26 +11300,33 @@ var ts; ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 179: - case 181: + case 180: + case 182: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; + function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { + var kind = node.kind; + return kind === 184 + || kind === 145 + || kind === 178; + } + ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 183 + return kind === 184 || kind === 145; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { + case 256: case 255: - case 254: - case 185: case 186: case 187: + case 188: case 149: return true; default: @@ -11287,12 +11335,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 185 || node.kind === 186; + return node.kind === 186 || node.kind === 187; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 200 + return kind === 201 || kind === 13; } ts.isTemplateLiteral = isTemplateLiteral; @@ -11302,32 +11350,32 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 183: case 184: - case 186: case 185: - case 253: - case 254: - case 257: case 187: - case 181: - case 189: + case 186: + case 254: + case 255: + case 258: + case 188: case 182: - case 203: case 190: + case 183: + case 204: + case 191: case 71: case 12: case 8: case 9: case 13: - case 200: + case 201: case 86: case 95: case 99: case 101: case 97: - case 207: case 208: + case 209: case 91: return true; default: @@ -11340,13 +11388,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 196: case 197: - case 192: + case 198: case 193: case 194: case 195: - case 188: + case 196: + case 189: return true; default: return isLeftHandSideExpressionKind(kind); @@ -11354,9 +11402,9 @@ var ts; } function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 197: + case 198: return true; - case 196: + case 197: return expr.operator === 43 || expr.operator === 44; default: @@ -11370,15 +11418,15 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 199: - case 201: - case 191: - case 198: + case 200: case 202: - case 206: - case 204: + case 192: + case 199: + case 203: + case 207: + case 205: + case 297: case 296: - case 295: return true; default: return isUnaryExpressionKind(kind); @@ -11386,16 +11434,16 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 188 - || kind === 206; + return kind === 189 + || kind === 207; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 295; + return node.kind === 296; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 294; + return node.kind === 295; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -11405,20 +11453,20 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 218: case 219: case 220: - case 216: + case 221: case 217: + case 218: return true; - case 226: + case 227: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isForInOrOfStatement(node) { - return node.kind === 219 || node.kind === 220; + return node.kind === 220 || node.kind === 221; } ts.isForInOrOfStatement = isForInOrOfStatement; function isConciseBody(node) { @@ -11437,106 +11485,106 @@ var ts; ts.isForInitializer = isForInitializer; function isModuleBody(node) { var kind = node.kind; - return kind === 238 - || kind === 237 + return kind === 239 + || kind === 238 || kind === 71; } ts.isModuleBody = isModuleBody; function isNamespaceBody(node) { var kind = node.kind; - return kind === 238 - || kind === 237; + return kind === 239 + || kind === 238; } ts.isNamespaceBody = isNamespaceBody; function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 71 - || kind === 237; + || kind === 238; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 245 - || kind === 244; + return kind === 246 + || kind === 245; } ts.isNamedImportBindings = isNamedImportBindings; function isModuleOrEnumDeclaration(node) { - return node.kind === 237 || node.kind === 236; + return node.kind === 238 || node.kind === 237; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 191 - || kind === 180 - || kind === 233 - || kind === 203 - || kind === 154 - || kind === 236 - || kind === 271 - || kind === 250 - || kind === 232 - || kind === 190 - || kind === 155 - || kind === 243 - || kind === 241 - || kind === 246 + return kind === 192 + || kind === 181 || kind === 234 - || kind === 260 + || kind === 204 + || kind === 154 + || kind === 237 + || kind === 272 + || kind === 251 + || kind === 233 + || kind === 191 + || kind === 155 + || kind === 244 + || kind === 242 + || kind === 247 + || kind === 235 + || kind === 261 || kind === 153 || kind === 152 - || kind === 237 - || kind === 240 - || kind === 244 + || kind === 238 + || kind === 241 + || kind === 245 || kind === 148 - || kind === 268 + || kind === 269 || kind === 151 || kind === 150 || kind === 156 - || kind === 269 - || kind === 235 + || kind === 270 + || kind === 236 || kind === 147 - || kind === 230 - || kind === 291; + || kind === 231 + || kind === 292; } function isDeclarationStatementKind(kind) { - return kind === 232 - || kind === 251 - || kind === 233 + return kind === 233 + || kind === 252 || kind === 234 || kind === 235 || kind === 236 || kind === 237 + || kind === 238 + || kind === 243 || kind === 242 - || kind === 241 + || kind === 249 || kind === 248 - || kind === 247 - || kind === 240; + || kind === 241; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 222 - || kind === 221 - || kind === 229 - || kind === 216 - || kind === 214 - || kind === 213 - || kind === 219 - || kind === 220 - || kind === 218 - || kind === 215 - || kind === 226 - || kind === 223 - || kind === 225 - || kind === 227 - || kind === 228 - || kind === 212 + return kind === 223 + || kind === 222 + || kind === 230 || kind === 217 + || kind === 215 + || kind === 214 + || kind === 220 + || kind === 221 + || kind === 219 + || kind === 216 + || kind === 227 || kind === 224 - || kind === 294 - || kind === 298 - || kind === 297; + || kind === 226 + || kind === 228 + || kind === 229 + || kind === 213 + || kind === 218 + || kind === 225 + || kind === 295 + || kind === 299 + || kind === 298; } function isDeclaration(node) { if (node.kind === 147) { - return node.parent.kind !== 290 || ts.isInJavaScriptFile(node); + return node.parent.kind !== 291 || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -11557,10 +11605,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 211) + if (node.kind !== 212) return false; if (node.parent !== undefined) { - if (node.parent.kind === 228 || node.parent.kind === 267) { + if (node.parent.kind === 229 || node.parent.kind === 268) { return false; } } @@ -11568,7 +11616,7 @@ var ts; } function isModuleReference(node) { var kind = node.kind; - return kind === 252 + return kind === 253 || kind === 145 || kind === 71; } @@ -11577,52 +11625,52 @@ var ts; var kind = node.kind; return kind === 99 || kind === 71 - || kind === 183; + || kind === 184; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 253 - || kind === 263 - || kind === 254 + return kind === 254 + || kind === 264 + || kind === 255 || kind === 10 - || kind === 257; + || kind === 258; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 260 - || kind === 262; + return kind === 261 + || kind === 263; } ts.isJsxAttributeLike = isJsxAttributeLike; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 263; + || kind === 264; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 255 - || kind === 254; + return kind === 256 + || kind === 255; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 264 - || kind === 265; + return kind === 265 + || kind === 266; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isJSDocNode(node) { - return node.kind >= 274 && node.kind <= 292; + return node.kind >= 275 && node.kind <= 293; } ts.isJSDocNode = isJSDocNode; function isJSDocCommentContainingNode(node) { - return node.kind === 282 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); + return node.kind === 283 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; function isJSDocTag(node) { - return node.kind >= 284 && node.kind <= 292; + return node.kind >= 285 && node.kind <= 293; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -11660,19 +11708,19 @@ var ts; case 172: case 174: case 176: - case 188: - case 190: + case 189: case 191: - case 206: - case 230: - case 232: - case 235: - case 274: - case 277: + case 192: + case 207: + case 231: + case 233: + case 236: + case 275: case 278: case 279: case 280: case 281: + case 282: return true; } return false; @@ -11688,10 +11736,10 @@ var ts; ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { switch (node.kind) { - case 260: - case 262: - case 268: + case 261: + case 263: case 269: + case 270: case 153: case 155: case 156: @@ -11702,7 +11750,7 @@ var ts; } ts.isObjectLiteralElement = isObjectLiteralElement; function isTypeReferenceType(node) { - return node.kind === 161 || node.kind === 205; + return node.kind === 161 || node.kind === 206; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -13446,7 +13494,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 272) { + if (kind === 273) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71) { @@ -13496,14 +13544,14 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 269: + case 270: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 270: + case 271: return visitNode(cbNode, node.expression); case 148: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -13528,20 +13576,20 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 268: + case 269: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.initializer); - case 230: + case 231: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 180: + case 181: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || @@ -13563,9 +13611,9 @@ var ts; case 154: case 155: case 156: - case 190: - case 232: case 191: + case 233: + case 192: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -13600,6 +13648,10 @@ var ts; visitNode(cbNode, node.falseType); case 171: return visitNode(cbNode, node.typeParameter); + case 178: + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); case 172: case 174: return visitNode(cbNode, node.type); @@ -13613,145 +13665,138 @@ var ts; visitNode(cbNode, node.type); case 177: return visitNode(cbNode, node.literal); - case 178: case 179: - return visitNodes(cbNode, cbNodes, node.elements); - case 181: + case 180: return visitNodes(cbNode, cbNodes, node.elements); case 182: - return visitNodes(cbNode, cbNodes, node.properties); + return visitNodes(cbNode, cbNodes, node.elements); case 183: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.name); + return visitNodes(cbNode, cbNodes, node.properties); case 184: return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.argumentExpression); + visitNode(cbNode, node.name); case 185: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); case 186: + case 187: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNodes(cbNode, cbNodes, node.arguments); - case 187: + case 188: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 188: + case 189: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 189: - return visitNode(cbNode, node.expression); - case 192: + case 190: return visitNode(cbNode, node.expression); case 193: return visitNode(cbNode, node.expression); case 194: return visitNode(cbNode, node.expression); - case 196: - return visitNode(cbNode, node.operand); - case 201: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 195: return visitNode(cbNode, node.expression); case 197: return visitNode(cbNode, node.operand); + case 202: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 196: + return visitNode(cbNode, node.expression); case 198: + return visitNode(cbNode, node.operand); + case 199: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 206: + case 207: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 207: - return visitNode(cbNode, node.expression); case 208: + return visitNode(cbNode, node.expression); + case 209: return visitNode(cbNode, node.name); - case 199: + case 200: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 202: + case 203: return visitNode(cbNode, node.expression); - case 211: - case 238: + case 212: + case 239: return visitNodes(cbNode, cbNodes, node.statements); - case 272: + case 273: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 212: + case 213: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 231: + case 232: return visitNodes(cbNode, cbNodes, node.declarations); - case 214: - return visitNode(cbNode, node.expression); case 215: + return visitNode(cbNode, node.expression); + case 216: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 216: + case 217: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 217: + case 218: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218: + case 219: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 219: + case 220: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 220: + case 221: return visitNode(cbNode, node.awaitModifier) || visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 221: case 222: - return visitNode(cbNode, node.label); case 223: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.label); case 224: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression); case 225: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 226: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 239: + case 240: return visitNodes(cbNode, cbNodes, node.clauses); - case 264: + case 265: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 265: + case 266: return visitNodes(cbNode, cbNodes, node.statements); - case 226: + case 227: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 227: - return visitNode(cbNode, node.expression); case 228: + return visitNode(cbNode, node.expression); + case 229: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 267: + case 268: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 149: return visitNode(cbNode, node.expression); - case 233: - case 203: - return visitNodes(cbNode, cbNodes, node.decorators) || - 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 234: + case 204: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || @@ -13763,112 +13808,119 @@ var ts; visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); case 236: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 271: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); case 237: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + case 272: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 238: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 241: + case 242: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 242: + case 243: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 243: + case 244: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 240: - return visitNode(cbNode, node.name); - case 244: + case 241: return visitNode(cbNode, node.name); case 245: - case 249: + return visitNode(cbNode, node.name); + case 246: + case 250: return visitNodes(cbNode, cbNodes, node.elements); - case 248: + case 249: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 246: - case 250: + case 247: + case 251: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 247: + case 248: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 200: + case 201: return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); - case 209: + case 210: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 146: return visitNode(cbNode, node.expression); - case 266: + case 267: return visitNodes(cbNode, cbNodes, node.types); - case 205: + case 206: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); - case 252: - return visitNode(cbNode, node.expression); - case 251: - return visitNodes(cbNode, cbNodes, node.decorators); - case 296: - return visitNodes(cbNode, cbNodes, node.elements); case 253: + return visitNode(cbNode, node.expression); + case 252: + return visitNodes(cbNode, cbNodes, node.decorators); + case 297: + return visitNodes(cbNode, cbNodes, node.elements); + case 254: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 257: + case 258: return visitNode(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingFragment); - case 254: case 255: + case 256: return visitNode(cbNode, node.tagName) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.attributes); - case 261: + case 262: return visitNodes(cbNode, cbNodes, node.properties); - case 260: + case 261: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 262: - return visitNode(cbNode, node.expression); case 263: + return visitNode(cbNode, node.expression); + case 264: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 256: + case 257: return visitNode(cbNode, node.tagName); - case 274: - return visitNode(cbNode, node.type); - case 278: - return visitNode(cbNode, node.type); - case 277: + case 275: return visitNode(cbNode, node.type); case 279: return visitNode(cbNode, node.type); + case 278: + return visitNode(cbNode, node.type); case 280: + return visitNode(cbNode, node.type); + case 281: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 281: - return visitNode(cbNode, node.type); case 282: + return visitNode(cbNode, node.type); + case 283: return visitNodes(cbNode, cbNodes, node.tags); - case 287: - case 292: + case 288: + case 293: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -13877,17 +13929,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 288: - return visitNode(cbNode, node.typeExpression); case 289: return visitNode(cbNode, node.typeExpression); - case 285: - return visitNode(cbNode, node.class); case 290: - return visitNodes(cbNode, cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 286: + return visitNode(cbNode, node.class); case 291: + return visitNodes(cbNode, cbNodes, node.typeParameters); + case 292: if (node.typeExpression && - node.typeExpression.kind === 274) { + node.typeExpression.kind === 275) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -13895,7 +13947,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 283: + case 284: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -13903,7 +13955,7 @@ var ts; } } return; - case 295: + case 296: return visitNode(cbNode, node.expression); } } @@ -14104,7 +14156,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) { - var sourceFile = new SourceFileConstructor(272, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(273, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -14734,7 +14786,7 @@ var ts; case 155: case 156: case 151: - case 210: + case 211: return true; case 153: var methodDeclaration = node; @@ -14748,8 +14800,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 264: case 265: + case 266: return true; } } @@ -14758,42 +14810,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 232: + case 233: + case 213: case 212: - case 211: + case 216: case 215: - case 214: - case 227: + case 228: + case 224: + case 226: case 223: - case 225: case 222: + case 220: case 221: case 219: - case 220: case 218: - case 217: - case 224: - case 213: - case 228: - case 226: - case 216: + case 225: + case 214: case 229: + case 227: + case 217: + case 230: + case 243: case 242: - case 241: + case 249: case 248: - case 247: - case 237: - case 233: + case 238: case 234: - case 236: case 235: + case 237: + case 236: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 271; + return node.kind === 272; } function isReusableTypeMember(node) { if (node) { @@ -14809,7 +14861,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 230) { + if (node.kind !== 231) { return false; } var variableDeclarator = node; @@ -14938,7 +14990,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(200); + var template = createNode(201); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 14, "Template head has wrong token kind"); var list = []; @@ -14950,7 +15002,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(209); + var span = createNode(210); span.expression = allowInAnd(parseExpression); var literal; if (token() === 18) { @@ -15014,9 +15066,9 @@ var ts; return finishNode(node); } function parseJSDocAllType(postFixEquals) { - var result = createNode(275); + var result = createNode(276); if (postFixEquals) { - return createJSDocPostfixType(279, result); + return createJSDocPostfixType(280, result); } else { nextToken(); @@ -15024,7 +15076,7 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(278); + var result = createNode(279); nextToken(); result.type = parseNonArrayType(); return finishNode(result); @@ -15038,18 +15090,18 @@ var ts; token() === 29 || token() === 58 || token() === 49) { - var result = createNode(276, pos); + var result = createNode(277, pos); return finishNode(result); } else { - var result = createNode(277, pos); + var result = createNode(278, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNodeWithJSDoc(280); + var result = createNodeWithJSDoc(281); nextToken(); fillSignature(56, 4 | 32, result); return finishNode(result); @@ -15071,12 +15123,12 @@ var ts; var dotdotdot = parseOptionalToken(24); var type = parseType(); if (dotdotdot) { - var variadic = createNode(281, dotdotdot.pos); + var variadic = createNode(282, dotdotdot.pos); variadic.type = type; type = finishNode(variadic); } if (token() === 58) { - return createJSDocPostfixType(279, type); + return createJSDocPostfixType(280, type); } return type; } @@ -15376,7 +15428,7 @@ var ts; var node = createNode(177); var unaryMinusExpression; if (negative) { - unaryMinusExpression = createNode(196); + unaryMinusExpression = createNode(197); unaryMinusExpression.operator = 38; nextToken(); } @@ -15391,6 +15443,26 @@ var ts; node.literal = expression; return finishNode(node); } + function isStartOfTypeOfImportType() { + nextToken(); + return token() === 91; + } + function parseImportType() { + sourceFile.flags |= 524288; + var node = createNode(178); + if (parseOptional(103)) { + node.isTypeOf = true; + } + parseExpected(91); + parseExpected(19); + node.argument = parseType(); + parseExpected(20); + if (parseOptional(23)) { + node.qualifier = parseEntityName(true, ts.Diagnostics.Type_expected); + } + node.typeArguments = tryParseTypeArguments(); + return finishNode(node); + } function nextTokenIsNumericLiteral() { return nextToken() === 8; } @@ -15436,13 +15508,15 @@ var ts; } } case 103: - return parseTypeQuery(); + return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); case 17: return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); case 21: return parseTupleType(); case 19: return parseParenthesizedType(); + case 91: + return parseImportType(); default: return parseTypeReference(); } @@ -15477,6 +15551,7 @@ var ts; case 51: case 24: case 126: + case 91: return true; case 38: return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral); @@ -15495,13 +15570,13 @@ var ts; while (!scanner.hasPrecedingLineBreak()) { switch (token()) { case 51: - type = createJSDocPostfixType(278, type); + type = createJSDocPostfixType(279, type); break; case 55: if (!(contextFlags & 1048576) && lookAhead(nextTokenIsStartOfType)) { return type; } - type = createJSDocPostfixType(277, type); + type = createJSDocPostfixType(278, type); break; case 21: parseExpected(21); @@ -15771,7 +15846,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(201); + var node = createNode(202); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token() === 39 || isStartOfExpression())) { @@ -15787,11 +15862,11 @@ var ts; ts.Debug.assert(token() === 36, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(191, asyncModifier.pos); + node = createNode(192, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(191, identifier.pos); + node = createNode(192, identifier.pos); } var parameter = createNode(148, identifier.pos); parameter.name = identifier; @@ -15939,7 +16014,7 @@ var ts; return 0; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNodeWithJSDoc(191); + var node = createNodeWithJSDoc(192); node.modifiers = parseModifiersForArrowFunction(); var isAsync = ts.hasModifier(node, 256) ? 2 : 0; fillSignature(56, isAsync | (allowAmbiguity ? 0 : 8), node); @@ -15971,7 +16046,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(199, leftOperand.pos); + var node = createNode(200, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -16023,43 +16098,43 @@ var ts; return ts.getBinaryOperatorPrecedence(token()) > 0; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(198, left.pos); + var node = createNode(199, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(206, left.pos); + var node = createNode(207, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(196); + var node = createNode(197); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(192); - nextToken(); - node.expression = parseSimpleUnaryExpression(); - return finishNode(node); - } - function parseTypeOfExpression() { var node = createNode(193); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } - function parseVoidExpression() { + function parseTypeOfExpression() { var node = createNode(194); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } + function parseVoidExpression() { + var node = createNode(195); + nextToken(); + node.expression = parseSimpleUnaryExpression(); + return finishNode(node); + } function isAwaitExpression() { if (token() === 121) { if (inAwaitContext()) { @@ -16070,7 +16145,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(195); + var node = createNode(196); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -16087,7 +16162,7 @@ var ts; if (token() === 40) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 188) { + if (simpleUnaryExpression.kind === 189) { 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 { @@ -16140,7 +16215,7 @@ var ts; } function parseUpdateExpression() { if (token() === 43 || token() === 44) { - var node = createNode(196); + var node = createNode(197); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -16152,7 +16227,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 43 || token() === 44) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(197, expression.pos); + var node = createNode(198, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -16180,7 +16255,7 @@ var ts; if (token() === 19 || token() === 23 || token() === 21) { return expression; } - var node = createNode(183, expression.pos); + var node = createNode(184, expression.pos); node.expression = expression; parseExpectedToken(23, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -16202,8 +16277,8 @@ var ts; function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 255) { - var node = createNode(253, opening.pos); + if (opening.kind === 256) { + var node = createNode(254, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -16212,22 +16287,22 @@ var ts; } result = finishNode(node); } - else if (opening.kind === 258) { - var node = createNode(257, opening.pos); + else if (opening.kind === 259) { + var node = createNode(258, opening.pos); node.openingFragment = opening; node.children = parseJsxChildren(node.openingFragment); node.closingFragment = parseJsxClosingFragment(inExpressionContext); result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 254); + ts.Debug.assert(opening.kind === 255); result = opening; } if (inExpressionContext && token() === 27) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(198, result.pos); + var badNode = createNode(199, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -16283,7 +16358,7 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(261); + var jsxAttributes = createNode(262); jsxAttributes.properties = parseList(13, parseJsxAttribute); return finishNode(jsxAttributes); } @@ -16291,7 +16366,7 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(27); if (token() === 29) { - var node_1 = createNode(258, fullStart); + var node_1 = createNode(259, fullStart); scanJsxText(); return finishNode(node_1); } @@ -16300,7 +16375,7 @@ var ts; var attributes = parseJsxAttributes(); var node; if (token() === 29) { - node = createNode(255, fullStart); + node = createNode(256, fullStart); scanJsxText(); } else { @@ -16312,7 +16387,7 @@ var ts; parseExpected(29, undefined, false); scanJsxText(); } - node = createNode(254, fullStart); + node = createNode(255, fullStart); } node.tagName = tagName; node.typeArguments = typeArguments; @@ -16324,7 +16399,7 @@ var ts; var expression = token() === 99 ? parseTokenNode() : parseIdentifierName(); while (parseOptional(23)) { - var propertyAccess = createNode(183, expression.pos); + var propertyAccess = createNode(184, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -16332,7 +16407,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(263); + var node = createNode(264); if (!parseExpected(17)) { return undefined; } @@ -16354,7 +16429,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(260); + var node = createNode(261); node.name = parseIdentifierName(); if (token() === 58) { switch (scanJsxAttributeValue()) { @@ -16369,7 +16444,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(262); + var node = createNode(263); parseExpected(17); parseExpected(24); node.expression = parseExpression(); @@ -16377,7 +16452,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(256); + var node = createNode(257); parseExpected(28); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -16390,7 +16465,7 @@ var ts; return finishNode(node); } function parseJsxClosingFragment(inExpressionContext) { - var node = createNode(259); + var node = createNode(260); parseExpected(28); if (ts.tokenIsIdentifierOrKeyword(token())) { parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); @@ -16405,7 +16480,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(188); + var node = createNode(189); parseExpected(27); node.type = parseType(); parseExpected(29); @@ -16416,7 +16491,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(23); if (dotToken) { - var propertyAccess = createNode(183, expression.pos); + var propertyAccess = createNode(184, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -16424,13 +16499,13 @@ var ts; } if (token() === 51 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(207, expression.pos); + var nonNullExpression = createNode(208, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } if (!inDecoratorContext() && parseOptional(21)) { - var indexedAccess = createNode(184, expression.pos); + var indexedAccess = createNode(185, expression.pos); indexedAccess.expression = expression; if (token() !== 22) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -16444,7 +16519,7 @@ var ts; continue; } if (token() === 13 || token() === 14) { - var tagExpression = createNode(187, expression.pos); + var tagExpression = createNode(188, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 13 ? parseLiteralNode() @@ -16463,7 +16538,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(185, expression.pos); + var callExpr = createNode(186, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -16471,7 +16546,7 @@ var ts; continue; } else if (token() === 19) { - var callExpr = createNode(185, expression.pos); + var callExpr = createNode(186, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -16566,28 +16641,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNodeWithJSDoc(189); + var node = createNodeWithJSDoc(190); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); return finishNode(node); } function parseSpreadElement() { - var node = createNode(202); + var node = createNode(203); parseExpected(24); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 24 ? parseSpreadElement() : - token() === 26 ? createNode(204) : + token() === 26 ? createNode(205) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(181); + var node = createNode(182); parseExpected(21); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16599,7 +16674,7 @@ var ts; function parseObjectLiteralElement() { var node = createNodeWithJSDoc(0); if (parseOptionalToken(24)) { - node.kind = 270; + node.kind = 271; node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -16620,7 +16695,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 || token() === 18 || token() === 58); if (isShorthandPropertyAssignment) { - node.kind = 269; + node.kind = 270; var equalsToken = parseOptionalToken(58); if (equalsToken) { node.equalsToken = equalsToken; @@ -16628,14 +16703,14 @@ var ts; } } else { - node.kind = 268; + node.kind = 269; parseExpected(56); node.initializer = allowInAnd(parseAssignmentExpressionOrHigher); } return finishNode(node); } function parseObjectLiteralExpression() { - var node = createNode(182); + var node = createNode(183); parseExpected(17); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16649,7 +16724,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNodeWithJSDoc(190); + var node = createNodeWithJSDoc(191); node.modifiers = parseModifiers(); parseExpected(89); node.asteriskToken = parseOptionalToken(39); @@ -16674,12 +16749,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94); if (parseOptional(23)) { - var node_2 = createNode(208, fullStart); + var node_2 = createNode(209, fullStart); node_2.keywordToken = 94; node_2.name = parseIdentifierName(); return finishNode(node_2); } - var node = createNode(186, fullStart); + var node = createNode(187, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 19) { @@ -16688,7 +16763,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(211); + var node = createNode(212); if (parseExpected(17, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16719,12 +16794,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(213); + var node = createNode(214); parseExpected(25); return finishNode(node); } function parseIfStatement() { - var node = createNode(215); + var node = createNode(216); parseExpected(90); parseExpected(19); node.expression = allowInAnd(parseExpression); @@ -16734,7 +16809,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(216); + var node = createNode(217); parseExpected(81); node.statement = parseStatement(); parseExpected(106); @@ -16745,7 +16820,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(217); + var node = createNode(218); parseExpected(106); parseExpected(19); node.expression = allowInAnd(parseExpression); @@ -16769,7 +16844,7 @@ var ts; } var forOrForInOrForOfStatement; if (awaitToken ? parseExpected(144) : parseOptional(144)) { - var forOfStatement = createNode(220, pos); + var forOfStatement = createNode(221, pos); forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); @@ -16777,14 +16852,14 @@ var ts; forOrForInOrForOfStatement = forOfStatement; } else if (parseOptional(92)) { - var forInStatement = createNode(219, pos); + var forInStatement = createNode(220, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(20); forOrForInOrForOfStatement = forInStatement; } else { - var forStatement = createNode(218, pos); + var forStatement = createNode(219, pos); forStatement.initializer = initializer; parseExpected(25); if (token() !== 25 && token() !== 20) { @@ -16802,7 +16877,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 222 ? 72 : 77); + parseExpected(kind === 223 ? 72 : 77); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -16810,7 +16885,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(223); + var node = createNode(224); parseExpected(96); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -16819,7 +16894,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(224); + var node = createNode(225); parseExpected(107); parseExpected(19); node.expression = allowInAnd(parseExpression); @@ -16828,7 +16903,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(264); + var node = createNode(265); parseExpected(73); node.expression = allowInAnd(parseExpression); parseExpected(56); @@ -16836,7 +16911,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(265); + var node = createNode(266); parseExpected(79); parseExpected(56); node.statements = parseList(3, parseStatement); @@ -16846,12 +16921,12 @@ var ts; return token() === 73 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(225); + var node = createNode(226); parseExpected(98); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); - var caseBlock = createNode(239); + var caseBlock = createNode(240); parseExpected(17); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(18); @@ -16859,14 +16934,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(227); + var node = createNode(228); parseExpected(100); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(228); + var node = createNode(229); parseExpected(102); node.tryBlock = parseBlock(false); node.catchClause = token() === 74 ? parseCatchClause() : undefined; @@ -16877,7 +16952,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(267); + var result = createNode(268); parseExpected(74); if (parseOptional(19)) { result.variableDeclaration = parseVariableDeclaration(); @@ -16890,7 +16965,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(229); + var node = createNode(230); parseExpected(78); parseSemicolon(); return finishNode(node); @@ -16899,12 +16974,12 @@ var ts; var node = createNodeWithJSDoc(0); var expression = allowInAnd(parseExpression); if (expression.kind === 71 && parseOptional(56)) { - node.kind = 226; + node.kind = 227; node.label = expression; node.statement = parseStatement(); } else { - node.kind = 214; + node.kind = 215; node.expression = expression; parseSemicolon(); } @@ -17042,16 +17117,16 @@ var ts; case 17: return parseBlock(false); case 104: - return parseVariableStatement(createNodeWithJSDoc(230)); + return parseVariableStatement(createNodeWithJSDoc(231)); case 110: if (isLetDeclaration()) { - return parseVariableStatement(createNodeWithJSDoc(230)); + return parseVariableStatement(createNodeWithJSDoc(231)); } break; case 89: - return parseFunctionDeclaration(createNodeWithJSDoc(232)); + return parseFunctionDeclaration(createNodeWithJSDoc(233)); case 75: - return parseClassDeclaration(createNodeWithJSDoc(233)); + return parseClassDeclaration(createNodeWithJSDoc(234)); case 90: return parseIfStatement(); case 81: @@ -17061,9 +17136,9 @@ var ts; case 88: return parseForOrForInOrForOfStatement(); case 77: - return parseBreakOrContinueStatement(221); - case 72: return parseBreakOrContinueStatement(222); + case 72: + return parseBreakOrContinueStatement(223); case 96: return parseReturnStatement(); case 107: @@ -17157,7 +17232,7 @@ var ts; } default: if (node.decorators || node.modifiers) { - var missing = createMissingNode(251, true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(252, true, ts.Diagnostics.Declaration_expected); missing.pos = node.pos; missing.decorators = node.decorators; missing.modifiers = node.modifiers; @@ -17178,16 +17253,16 @@ var ts; } function parseArrayBindingElement() { if (token() === 26) { - return createNode(204); + return createNode(205); } - var node = createNode(180); + var node = createNode(181); node.dotDotDotToken = parseOptionalToken(24); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(180); + var node = createNode(181); node.dotDotDotToken = parseOptionalToken(24); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -17203,14 +17278,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(178); + var node = createNode(179); parseExpected(17); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(18); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(179); + var node = createNode(180); parseExpected(21); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(22); @@ -17232,7 +17307,7 @@ var ts; return parseVariableDeclaration(true); } function parseVariableDeclaration(allowExclamation) { - var node = createNode(230); + var node = createNode(231); node.name = parseIdentifierOrPattern(); if (allowExclamation && node.name.kind === 71 && token() === 51 && !scanner.hasPrecedingLineBreak()) { @@ -17245,7 +17320,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(231); + var node = createNode(232); switch (token()) { case 104: break; @@ -17274,13 +17349,13 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 20; } function parseVariableStatement(node) { - node.kind = 212; + node.kind = 213; node.declarationList = parseVariableDeclarationList(false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(node) { - node.kind = 232; + node.kind = 233; parseExpected(89); node.asteriskToken = parseOptionalToken(39); node.name = ts.hasModifier(node, 512) ? parseOptionalIdentifier() : parseIdentifier(); @@ -17423,7 +17498,7 @@ var ts; } function parseClassElement() { if (token() === 25) { - var result = createNode(210); + var result = createNode(211); nextToken(); return finishNode(result); } @@ -17456,10 +17531,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(createNodeWithJSDoc(0), 203); + return parseClassDeclarationOrExpression(createNodeWithJSDoc(0), 204); } function parseClassDeclaration(node) { - return parseClassDeclarationOrExpression(node, 233); + return parseClassDeclarationOrExpression(node, 234); } function parseClassDeclarationOrExpression(node, kind) { node.kind = kind; @@ -17493,7 +17568,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 || tok === 108) { - var node = createNode(266); + var node = createNode(267); node.token = tok; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -17502,7 +17577,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(205); + var node = createNode(206); node.expression = parseLeftHandSideExpressionOrHigher(); node.typeArguments = tryParseTypeArguments(); return finishNode(node); @@ -17519,7 +17594,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(node) { - node.kind = 234; + node.kind = 235; parseExpected(109); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -17528,7 +17603,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(node) { - node.kind = 235; + node.kind = 236; parseExpected(139); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -17538,13 +17613,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNodeWithJSDoc(271); + var node = createNodeWithJSDoc(272); node.name = parsePropertyName(); node.initializer = allowInAnd(parseInitializer); return finishNode(node); } function parseEnumDeclaration(node) { - node.kind = 236; + node.kind = 237; parseExpected(83); node.name = parseIdentifier(); if (parseExpected(17)) { @@ -17557,7 +17632,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(238); + var node = createNode(239); if (parseExpected(17)) { node.statements = parseList(1, parseStatement); parseExpected(18); @@ -17568,7 +17643,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(node, flags) { - node.kind = 237; + node.kind = 238; var namespaceFlag = flags & 16; node.flags |= flags; node.name = parseIdentifier(); @@ -17578,7 +17653,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(node) { - node.kind = 237; + node.kind = 238; if (token() === 143) { node.name = parseIdentifier(); node.flags |= 512; @@ -17622,7 +17697,7 @@ var ts; return nextToken() === 41; } function parseNamespaceExportDeclaration(node) { - node.kind = 240; + node.kind = 241; parseExpected(118); parseExpected(130); node.name = parseIdentifier(); @@ -17639,7 +17714,7 @@ var ts; return parseImportEqualsDeclaration(node, identifier); } } - node.kind = 242; + node.kind = 243; if (identifier || token() === 39 || token() === 17) { @@ -17651,7 +17726,7 @@ var ts; return finishNode(node); } function parseImportEqualsDeclaration(node, identifier) { - node.kind = 241; + node.kind = 242; node.name = identifier; parseExpected(58); node.moduleReference = parseModuleReference(); @@ -17659,13 +17734,13 @@ var ts; return finishNode(node); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(243, fullStart); + var importClause = createNode(244, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(26)) { - importClause.namedBindings = token() === 39 ? parseNamespaceImport() : parseNamedImportsOrExports(245); + importClause.namedBindings = token() === 39 ? parseNamespaceImport() : parseNamedImportsOrExports(246); } return finishNode(importClause); } @@ -17675,7 +17750,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(252); + var node = createNode(253); parseExpected(133); parseExpected(19); node.expression = parseModuleSpecifier(); @@ -17693,7 +17768,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(244); + var namespaceImport = createNode(245); parseExpected(39); parseExpected(118); namespaceImport.name = parseIdentifier(); @@ -17701,14 +17776,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 245 ? parseImportSpecifier : parseExportSpecifier, 17, 18); + node.elements = parseBracketedList(22, kind === 246 ? parseImportSpecifier : parseExportSpecifier, 17, 18); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(250); + return parseImportOrExportSpecifier(251); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(246); + return parseImportOrExportSpecifier(247); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -17727,19 +17802,19 @@ var ts; else { node.name = identifierName; } - if (kind === 246 && checkIdentifierIsKeyword) { + if (kind === 247 && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(node) { - node.kind = 248; + node.kind = 249; if (parseOptional(39)) { parseExpected(142); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(249); + node.exportClause = parseNamedImportsOrExports(250); if (token() === 142 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { parseExpected(142); node.moduleSpecifier = parseModuleSpecifier(); @@ -17749,7 +17824,7 @@ var ts; return finishNode(node); } function parseExportAssignment(node) { - node.kind = 247; + node.kind = 248; if (parseOptional(58)) { node.isExportEquals = true; } @@ -17763,10 +17838,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 241 && node.moduleReference.kind === 252 - || node.kind === 242 - || node.kind === 247 + || node.kind === 242 && node.moduleReference.kind === 253 + || node.kind === 243 || node.kind === 248 + || node.kind === 249 ? node : undefined; }); @@ -17818,7 +17893,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression(mayOmitBraces) { - var result = createNode(274, scanner.getTokenPos()); + var result = createNode(275, scanner.getTokenPos()); var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(17); result.type = doInsideOfContext(1048576, parseJSDocType); if (!mayOmitBraces || hasBrace) { @@ -17974,7 +18049,7 @@ var ts; } } function createJSDocComment() { - var result = createNode(282, start); + var result = createNode(283, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -18092,7 +18167,7 @@ var ts; return comments.length === 0 ? undefined : comments.join(""); } function parseUnknownTag(atToken, tagName) { - var result = createNode(284, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -18146,9 +18221,9 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 ? - createNode(287, atToken.pos) : - createNode(292, atToken.pos); - var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); + createNode(288, atToken.pos) : + createNode(293, atToken.pos); + var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; isNameFirst = true; @@ -18161,18 +18236,20 @@ var ts; result.isBracketed = isBracketed; return finishNode(result); } - function parseNestedTypeLiteral(typeExpression, name) { + function parseNestedTypeLiteral(typeExpression, name, target) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(274, scanner.getTokenPos()); + var typeLiteralExpression = createNode(275, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); var children = void 0; - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(1, name); })) { - children = ts.append(children, child); + while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, name); })) { + if (child.kind === 288 || child.kind === 293) { + children = ts.append(children, child); + } } if (children) { - jsdocTypeLiteral = createNode(283, start_2); + jsdocTypeLiteral = createNode(284, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 166) { jsdocTypeLiteral.isArrayType = true; @@ -18183,27 +18260,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 288; })) { - parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); - } - var result = createNode(288, atToken.pos); - result.atToken = atToken; - result.tagName = tagName; - result.typeExpression = tryParseTypeExpression(); - return finishNode(result); - } - function parseTypeTag(atToken, tagName) { if (ts.forEach(tags, function (t) { return t.kind === 289; })) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } var result = createNode(289, atToken.pos); result.atToken = atToken; result.tagName = tagName; + result.typeExpression = tryParseTypeExpression(); + return finishNode(result); + } + function parseTypeTag(atToken, tagName) { + if (ts.forEach(tags, function (t) { return t.kind === 290; })) { + parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); + } + var result = createNode(290, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(285, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -18211,7 +18288,7 @@ var ts; } function parseExpressionWithTypeArgumentsForAugments() { var usedBrace = parseOptional(17); - var node = createNode(205); + var node = createNode(206); node.expression = parsePropertyAccessEntityNameExpression(); node.typeArguments = tryParseTypeArguments(); var res = finishNode(node); @@ -18223,7 +18300,7 @@ var ts; function parsePropertyAccessEntityNameExpression() { var node = parseJSDocIdentifierName(true); while (parseOptional(23)) { - var prop = createNode(183, node.pos); + var prop = createNode(184, node.pos); prop.expression = node; prop.name = parseJSDocIdentifierName(); node = finishNode(prop); @@ -18231,7 +18308,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(286, atToken.pos); + var tag = createNode(287, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -18239,7 +18316,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(291, atToken.pos); + var typedefTag = createNode(292, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -18260,11 +18337,11 @@ var ts; var jsdocTypeLiteral = void 0; var childTypeTag = void 0; var start_3 = scanner.getStartPos(); - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0); })) { + while (child = tryParse(function () { return parseChildPropertyTag(); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(283, start_3); + jsdocTypeLiteral = createNode(284, start_3); } - if (child.kind === 289) { + if (child.kind === 290) { if (childTypeTag) { break; } @@ -18290,7 +18367,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(23)) { - var jsDocNamespaceNode = createNode(237, pos); + var jsDocNamespaceNode = createNode(238, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -18314,6 +18391,9 @@ var ts; } return a.escapedText === b.escapedText; } + function parseChildPropertyTag() { + return parseChildParameterOrPropertyTag(0); + } function parseChildParameterOrPropertyTag(target, name) { var canParseTag = true; var seenAsterisk = false; @@ -18322,7 +18402,7 @@ var ts; case 57: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 287 && + if (child && child.kind === 288 && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -18406,7 +18486,7 @@ var ts; break; } } - var result = createNode(290, atToken.pos); + var result = createNode(291, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -18965,21 +19045,21 @@ var ts; ts.getModuleInstanceState = getModuleInstanceState; function getModuleInstanceStateWorker(node) { switch (node.kind) { - case 234: case 235: - return 0; case 236: + return 0; + case 237: if (ts.isConst(node)) { return 2; } break; + case 243: case 242: - case 241: if (!(ts.hasModifier(node, 1))) { return 0; } break; - case 238: { + case 239: { var state_1 = 0; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateWorker(n); @@ -18998,7 +19078,7 @@ var ts; }); return state_1; } - case 237: + case 238: return getModuleInstanceState(node); case 71: if (node.isInJSDocNamespace) { @@ -19118,13 +19198,13 @@ var ts; if (symbolFlags & 67216319) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 237)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 238)) { symbol.valueDeclaration = node; } } } function getDeclarationName(node) { - if (node.kind === 247) { + if (node.kind === 248) { return node.isExportEquals ? "export=" : "default"; } var name = ts.getNameOfDeclaration(node); @@ -19154,25 +19234,25 @@ var ts; return "__new"; case 159: return "__index"; - case 248: + case 249: return "__export"; - case 198: + case 199: if (ts.getSpecialPropertyAssignmentKind(node) === 2) { return "export="; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 232: case 233: + case 234: return (ts.hasModifier(node, 512) ? "default" : undefined); - case 280: + case 281: return (ts.isJSDocConstructSignature(node) ? "__new" : "__call"); case 148: - ts.Debug.assert(node.parent.kind === 280, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); + ts.Debug.assert(node.parent.kind === 281, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; - case 291: + case 292: var name_2 = ts.getNameOfJSDocTypedef(node); return typeof name_2 !== "undefined" ? name_2.escapedText : undefined; } @@ -19221,7 +19301,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 247 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 248 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -19246,7 +19326,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 2097152) { - if (node.kind === 250 || (node.kind === 241 && hasExportModifier)) { + if (node.kind === 251 || (node.kind === 242 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -19254,7 +19334,7 @@ var ts; } } else { - if (node.kind === 291) + if (node.kind === 292) ts.Debug.assert(ts.isInJavaScriptFile(node)); var isJSDocTypedefInJSDocNamespace = ts.isJSDocTypedefTag(node) && node.name && node.name.kind === 71 && node.name.isInJSDocNamespace; if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32)) || isJSDocTypedefInJSDocNamespace) { @@ -19274,7 +19354,7 @@ var ts; var saveThisParentContainer = thisParentContainer; var savedBlockScopeContainer = blockScopeContainer; if (containerFlags & 1) { - if (node.kind !== 191) { + if (node.kind !== 192) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -19313,7 +19393,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 272) { + if (node.kind === 273) { node.flags |= emitFlags; } if (currentReturnTarget) { @@ -19362,8 +19442,8 @@ var ts; } } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 232 ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 232 ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 233 ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 233 ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -19409,78 +19489,78 @@ var ts; return; } switch (node.kind) { - case 217: + case 218: bindWhileStatement(node); break; - case 216: + case 217: bindDoStatement(node); break; - case 218: + case 219: bindForStatement(node); break; - case 219: case 220: + case 221: bindForInOrForOfStatement(node); break; - case 215: + case 216: bindIfStatement(node); break; - case 223: - case 227: + case 224: + case 228: bindReturnOrThrow(node); break; + case 223: case 222: - case 221: bindBreakOrContinueStatement(node); break; - case 228: + case 229: bindTryStatement(node); break; - case 225: + case 226: bindSwitchStatement(node); break; - case 239: + case 240: bindCaseBlock(node); break; - case 264: + case 265: bindCaseClause(node); break; - case 226: + case 227: bindLabeledStatement(node); break; - case 196: + case 197: bindPrefixUnaryExpressionFlow(node); break; - case 197: + case 198: bindPostfixUnaryExpressionFlow(node); break; - case 198: + case 199: bindBinaryExpressionFlow(node); break; - case 192: + case 193: bindDeleteExpressionFlow(node); break; - case 199: + case 200: bindConditionalExpressionFlow(node); break; - case 230: + case 231: bindVariableDeclarationFlow(node); break; - case 185: + case 186: bindCallExpressionFlow(node); break; - case 282: + case 283: bindJSDocComment(node); break; - case 291: + case 292: bindJSDocTypedefTag(node); break; - case 272: + case 273: bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; - case 211: - case 238: + case 212: + case 239: bindEachFunctionsFirst(node.statements); break; default: @@ -19492,15 +19572,15 @@ var ts; switch (expr.kind) { case 71: case 99: - case 183: + case 184: return isNarrowableReference(expr); - case 185: + case 186: return hasNarrowableArgument(expr); - case 189: + case 190: return isNarrowingExpression(expr.expression); - case 198: + case 199: return isNarrowingBinaryExpression(expr); - case 196: + case 197: return expr.operator === 51 && isNarrowingExpression(expr.operand); } return false; @@ -19509,7 +19589,7 @@ var ts; return expr.kind === 71 || expr.kind === 99 || expr.kind === 97 || - expr.kind === 183 && isNarrowableReference(expr.expression); + expr.kind === 184 && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -19520,7 +19600,7 @@ var ts; } } } - if (expr.expression.kind === 183 && + if (expr.expression.kind === 184 && isNarrowableReference(expr.expression.expression)) { return true; } @@ -19553,9 +19633,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 189: + case 190: return isNarrowableOperand(expr.expression); - case 198: + case 199: switch (expr.operatorToken.kind) { case 58: return isNarrowableOperand(expr.left); @@ -19632,33 +19712,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 215: - case 217: case 216: - return parent.expression === node; case 218: - case 199: + case 217: + return parent.expression === node; + case 219: + case 200: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 189) { + if (node.kind === 190) { node = node.expression; } - else if (node.kind === 196 && node.operator === 51) { + else if (node.kind === 197 && node.operator === 51) { node = node.operand; } else { - return node.kind === 198 && (node.operatorToken.kind === 53 || + return node.kind === 199 && (node.operatorToken.kind === 53 || node.operatorToken.kind === 54); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 189 || - node.parent.kind === 196 && + while (node.parent.kind === 190 || + node.parent.kind === 197 && node.parent.operator === 51) { node = node.parent; } @@ -19700,7 +19780,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 226 + var enclosingLabeledStatement = node.parent.kind === 227 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -19732,13 +19812,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 220) { + if (node.kind === 221) { bind(node.awaitModifier); } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 231) { + if (node.initializer.kind !== 232) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -19760,7 +19840,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 223) { + if (node.kind === 224) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -19780,7 +19860,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 222 ? breakTarget : continueTarget; + var flowLabel = node.kind === 223 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -19843,7 +19923,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 265; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 266; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -19908,13 +19988,13 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 216) { + if (!node.statement || node.statement.kind !== 217) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 198 && node.operatorToken.kind === 58) { + if (node.kind === 199 && node.operatorToken.kind === 58) { bindAssignmentTargetFlow(node.left); } else { @@ -19925,10 +20005,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 181) { + else if (node.kind === 182) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 202) { + if (e.kind === 203) { bindAssignmentTargetFlow(e.expression); } else { @@ -19936,16 +20016,16 @@ var ts; } } } - else if (node.kind === 182) { + else if (node.kind === 183) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 268) { + if (p.kind === 269) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 269) { + else if (p.kind === 270) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 270) { + else if (p.kind === 271) { bindAssignmentTargetFlow(p.expression); } } @@ -20001,7 +20081,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 58 && node.left.kind === 184) { + if (operator === 58 && node.left.kind === 185) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -20012,7 +20092,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 183) { + if (node.expression.kind === 184) { bindAssignmentTargetFlow(node.expression); } } @@ -20051,7 +20131,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 291) { + if (n.kind !== 292) { bind(n); } }); @@ -20066,10 +20146,10 @@ var ts; } function bindCallExpressionFlow(node) { var expr = node.expression; - while (expr.kind === 189) { + while (expr.kind === 190) { expr = expr.expression; } - if (expr.kind === 190 || expr.kind === 191) { + if (expr.kind === 191 || expr.kind === 192) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -20077,7 +20157,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 183) { + if (node.expression.kind === 184) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -20086,52 +20166,52 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 203: - case 233: - case 236: - case 182: - case 165: - case 283: - case 261: - return 1; + case 204: case 234: - return 1 | 64; case 237: + case 183: + case 165: + case 284: + case 262: + return 1; case 235: + return 1 | 64; + case 238: + case 236: case 176: return 1 | 32; - case 272: + case 273: return 1 | 4 | 32; case 153: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } case 154: - case 232: + case 233: case 152: case 155: case 156: case 157: - case 280: + case 281: case 162: case 158: case 159: case 163: return 1 | 4 | 32 | 8; - case 190: case 191: + case 192: return 1 | 4 | 32 | 8 | 16; - case 238: + case 239: return 4; case 151: return node.initializer ? 4 : 0; - case 267: - case 218: + case 268: case 219: case 220: - case 239: + case 221: + case 240: return 2; - case 211: + case 212: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -20144,20 +20224,20 @@ var ts; } function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 237: + case 238: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 272: + case 273: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 203: - case 233: + case 204: + case 234: return declareClassMember(node, symbolFlags, symbolExcludes); - case 236: + case 237: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 165: - case 283: - case 182: - case 234: - case 261: + case 284: + case 183: + case 235: + case 262: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 162: case 163: @@ -20169,11 +20249,11 @@ var ts; case 154: case 155: case 156: - case 232: - case 190: + case 233: case 191: - case 280: - case 235: + case 192: + case 281: + case 236: case 176: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } @@ -20189,11 +20269,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 272 ? node : node.body; - if (body && (body.kind === 272 || body.kind === 238)) { + var body = node.kind === 273 ? node : node.body; + if (body && (body.kind === 273 || body.kind === 239)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 248 || stat.kind === 247) { + if (stat.kind === 249 || stat.kind === 248) { return true; } } @@ -20266,11 +20346,11 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 270 || prop.name.kind !== 71) { + if (prop.kind === 271 || prop.name.kind !== 71) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 268 || prop.kind === 269 || prop.kind === 153 + var currentKind = prop.kind === 269 || prop.kind === 270 || prop.kind === 153 ? 1 : 2; var existingKind = seen.get(identifier.escapedText); @@ -20301,10 +20381,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 237: + case 238: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 272: + case 273: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -20393,8 +20473,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 272 && - blockScopeContainer.kind !== 237 && + if (blockScopeContainer.kind !== 273 && + blockScopeContainer.kind !== 238 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -20464,7 +20544,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 291) { + if (tag.kind === 292) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -20496,18 +20576,18 @@ var ts; case 71: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 291) { + while (parentNode && parentNode.kind !== 292) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 67901928); break; } case 99: - if (currentFlow && (ts.isExpression(node) || parent.kind === 269)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 270)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 183: + case 184: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } @@ -20515,7 +20595,7 @@ var ts; bindSpecialPropertyDeclaration(node); } break; - case 198: + case 199: var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { case 1: @@ -20542,17 +20622,17 @@ var ts; ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 267: + case 268: return checkStrictModeCatchClause(node); - case 192: + case 193: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 197: + case 198: return checkStrictModePostfixUnaryExpression(node); - case 196: + case 197: return checkStrictModePrefixUnaryExpression(node); - case 224: + case 225: return checkStrictModeWithStatement(node); case 173: seenThisKeyword = true; @@ -20563,18 +20643,18 @@ var ts; return bindTypeParameter(node); case 148: return bindParameter(node); - case 230: + case 231: return bindVariableDeclarationOrBindingElement(node); - case 180: + case 181: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); case 151: case 150: return bindPropertyWorker(node); - case 268: case 269: + case 270: return bindPropertyOrMethodOrAccessor(node, 4, 0); - case 271: + case 272: return bindPropertyOrMethodOrAccessor(node, 8, 68008959); case 157: case 158: @@ -20583,7 +20663,7 @@ var ts; case 153: case 152: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 67208127); - case 232: + case 233: return bindFunctionDeclaration(node); case 154: return declareSymbolAndAddToSymbolTable(node, 16384, 0); @@ -20592,72 +20672,72 @@ var ts; case 156: return bindPropertyOrMethodOrAccessor(node, 65536, 67183551); case 162: - case 280: + case 281: case 163: return bindFunctionOrConstructorType(node); case 165: - case 283: + case 284: case 176: return bindAnonymousTypeWorker(node); - case 182: + case 183: return bindObjectLiteralExpression(node); - case 190: case 191: + case 192: return bindFunctionExpression(node); - case 185: + case 186: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 203: - case 233: + case 204: + case 234: inStrictMode = true; return bindClassLikeDeclaration(node); - case 234: - return bindBlockScopedDeclaration(node, 64, 67901832); case 235: - return bindBlockScopedDeclaration(node, 524288, 67901928); + return bindBlockScopedDeclaration(node, 64, 67901832); case 236: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 524288, 67901928); case 237: + return bindEnumDeclaration(node); + case 238: return bindModuleDeclaration(node); - case 261: + case 262: return bindJsxAttributes(node); - case 260: + case 261: return bindJsxAttribute(node, 4, 0); - case 241: - case 244: - case 246: - case 250: - return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152); - case 240: - return bindNamespaceExportDeclaration(node); - case 243: - return bindImportClause(node); - case 248: - return bindExportDeclaration(node); + case 242: + case 245: case 247: + case 251: + return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152); + case 241: + return bindNamespaceExportDeclaration(node); + case 244: + return bindImportClause(node); + case 249: + return bindExportDeclaration(node); + case 248: return bindExportAssignment(node); - case 272: + case 273: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 211: + case 212: if (!ts.isFunctionLike(node.parent)) { return; } - case 238: + case 239: return updateStrictModeStatementList(node.statements); - case 287: - if (node.parent.kind !== 283) { + case 288: + if (node.parent.kind !== 284) { break; } - case 292: + case 293: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 279 ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 280 ? 4 | 16777216 : 4; return declareSymbolAndAddToSymbolTable(propTag, flags, 0); - case 291: { + case 292: { var fullName = node.fullName; if (!fullName || fullName.kind === 71) { return bindBlockScopedDeclaration(node, 524288, 67901928); @@ -20686,7 +20766,7 @@ var ts; bindAnonymousDeclaration(node, 2097152, getDeclarationName(node)); } else { - var flags = node.kind === 247 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 248 && ts.exportAssignmentIsAlias(node) ? 2097152 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863); @@ -20696,7 +20776,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 272) { + if (node.parent.kind !== 273) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -20763,8 +20843,8 @@ var ts; ts.Debug.assert(ts.isInJavaScriptFile(node)); var thisContainer = ts.getThisContainer(node, false); switch (thisContainer.kind) { - case 232: - case 190: + case 233: + case 191: var constructorSymbol = thisContainer.symbol; if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 58) { var l = thisContainer.parent.left; @@ -20786,7 +20866,7 @@ var ts; var symbolTable = ts.hasModifier(thisContainer, 32) ? containingClass.symbol.exports : containingClass.symbol.members; declareSymbol(symbolTable, containingClass.symbol, node, 4, 0, true); break; - case 272: + case 273: break; default: ts.Debug.fail(ts.Debug.showSyntaxKind(thisContainer)); @@ -20796,7 +20876,7 @@ var ts; if (node.expression.kind === 99) { bindThisPropertyAssignment(node); } - else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 272) { + else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 273) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -20840,9 +20920,9 @@ var ts; function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) { var symbol = getJSInitializerSymbolFromName(name); var isToplevelNamespaceableInitializer = ts.isBinaryExpression(propertyAccess.parent) - ? propertyAccess.parent.parent.parent.kind === 272 && - !!ts.getJavascriptInitializer(propertyAccess.parent.right, ts.isPrototypeAccess(propertyAccess.parent.left)) - : propertyAccess.parent.parent.kind === 272; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 273 && + !!ts.getJavascriptInitializer(ts.getInitializerOfBinaryExpression(propertyAccess.parent), ts.isPrototypeAccess(propertyAccess.parent.left)) + : propertyAccess.parent.parent.kind === 273; if (!isPrototypeProperty && (!symbol || !(symbol.flags & 1920)) && isToplevelNamespaceableInitializer) { var flags_1 = 1536 | 67108864; var excludeFlags_1 = 67215503 & ~67108864; @@ -20862,10 +20942,18 @@ var ts; var symbolTable = isPrototypeProperty ? (symbol.members || (symbol.members = ts.createSymbolTable())) : (symbol.exports || (symbol.exports = ts.createSymbolTable())); - var symbolFlags = 4 | (isToplevelNamespaceableInitializer ? 67108864 : 0); - var symbolExcludes = 0 & ~(isToplevelNamespaceableInitializer ? 67108864 : 0); + var jsContainerFlag = isToplevelNamespaceableInitializer ? 67108864 : 0; + var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(propertyAccess)); + var symbolFlags = (isMethod ? 8192 : 4) | jsContainerFlag; + var symbolExcludes = (isMethod ? 67208127 : 0) & ~jsContainerFlag; declareSymbol(symbolTable, symbol, propertyAccess, symbolFlags, symbolExcludes); } + function getParentOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.parent)) { + expr = expr.parent; + } + return expr.parent; + } function lookupSymbolForPropertyAccess(node, lookupContainer) { if (lookupContainer === void 0) { lookupContainer = container; } if (ts.isIdentifier(node)) { @@ -20895,7 +20983,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 233) { + if (node.kind === 234) { bindBlockScopedDeclaration(node, 32, 68008383); } else { @@ -21028,15 +21116,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 213) || - node.kind === 233 || - (node.kind === 237 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 236 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 214) || + node.kind === 234 || + (node.kind === 238 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 237 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !(node.flags & 2097152) && - (node.kind !== 212 || + (node.kind !== 213 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -21072,43 +21160,43 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 185: - return computeCallExpression(node, subtreeFlags); case 186: + return computeCallExpression(node, subtreeFlags); + case 187: return computeNewExpression(node, subtreeFlags); - case 237: + case 238: return computeModuleDeclaration(node, subtreeFlags); - case 189: + case 190: return computeParenthesizedExpression(node, subtreeFlags); - case 198: + case 199: return computeBinaryExpression(node, subtreeFlags); - case 214: + case 215: return computeExpressionStatement(node, subtreeFlags); case 148: return computeParameter(node, subtreeFlags); - case 191: + case 192: return computeArrowFunction(node, subtreeFlags); - case 190: + case 191: return computeFunctionExpression(node, subtreeFlags); - case 232: - return computeFunctionDeclaration(node, subtreeFlags); - case 230: - return computeVariableDeclaration(node, subtreeFlags); - case 231: - return computeVariableDeclarationList(node, subtreeFlags); - case 212: - return computeVariableStatement(node, subtreeFlags); - case 226: - return computeLabeledStatement(node, subtreeFlags); case 233: + return computeFunctionDeclaration(node, subtreeFlags); + case 231: + return computeVariableDeclaration(node, subtreeFlags); + case 232: + return computeVariableDeclarationList(node, subtreeFlags); + case 213: + return computeVariableStatement(node, subtreeFlags); + case 227: + return computeLabeledStatement(node, subtreeFlags); + case 234: return computeClassDeclaration(node, subtreeFlags); - case 203: + case 204: return computeClassExpression(node, subtreeFlags); - case 266: - return computeHeritageClause(node, subtreeFlags); case 267: + return computeHeritageClause(node, subtreeFlags); + case 268: return computeCatchClause(node, subtreeFlags); - case 205: + case 206: return computeExpressionWithTypeArguments(node, subtreeFlags); case 154: return computeConstructor(node, subtreeFlags); @@ -21119,11 +21207,11 @@ var ts; case 155: case 156: return computeAccessor(node, subtreeFlags); - case 241: + case 242: return computeImportEquals(node, subtreeFlags); - case 183: - return computePropertyAccess(node, subtreeFlags); case 184: + return computePropertyAccess(node, subtreeFlags); + case 185: return computeElementAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -21167,10 +21255,10 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 58 && leftKind === 182) { + if (operatorTokenKind === 58 && leftKind === 183) { transformFlags |= 8 | 192 | 3072; } - else if (operatorTokenKind === 58 && leftKind === 181) { + else if (operatorTokenKind === 58 && leftKind === 182) { transformFlags |= 192 | 3072; } else if (operatorTokenKind === 40 @@ -21208,8 +21296,8 @@ var ts; var expression = node.expression; var expressionKind = expression.kind; var expressionTransformFlags = expression.transformFlags; - if (expressionKind === 206 - || expressionKind === 188) { + if (expressionKind === 207 + || expressionKind === 189) { transformFlags |= 3; } if (expressionTransformFlags & 1024) { @@ -21508,12 +21596,12 @@ var ts; var excludeFlags = 939525441; switch (kind) { case 120: - case 195: + case 196: transformFlags |= 8 | 16; break; - case 188: - case 206: - case 295: + case 189: + case 207: + case 296: transformFlags |= 3; excludeFlags = 536872257; break; @@ -21523,17 +21611,16 @@ var ts; case 117: case 124: case 76: - case 236: - case 271: - case 207: + case 237: + case 272: + case 208: case 132: transformFlags |= 3; break; - case 253: case 254: case 255: - case 10: case 256: + case 10: case 257: case 258: case 259: @@ -21541,17 +21628,18 @@ var ts; case 261: case 262: case 263: + case 264: transformFlags |= 4; break; case 13: case 14: case 15: case 16: - case 200: - case 187: - case 269: + case 201: + case 188: + case 270: case 115: - case 208: + case 209: transformFlags |= 192; break; case 9: @@ -21564,13 +21652,13 @@ var ts; transformFlags |= 192; } break; - case 220: + case 221: if (node.awaitModifier) { transformFlags |= 8; } transformFlags |= 192; break; - case 201: + case 202: transformFlags |= 8 | 192 | 16777216; break; case 119: @@ -21600,14 +21688,14 @@ var ts; case 170: case 171: case 172: - case 234: case 235: + case 236: case 173: case 174: case 175: case 176: case 177: - case 240: + case 241: transformFlags = 3; excludeFlags = -3; break; @@ -21617,10 +21705,10 @@ var ts; transformFlags |= 65536; } break; - case 202: + case 203: transformFlags |= 192 | 524288; break; - case 270: + case 271: transformFlags |= 8 | 1048576; break; case 97: @@ -21630,18 +21718,18 @@ var ts; case 99: transformFlags |= 16384; break; - case 178: + case 179: transformFlags |= 192 | 8388608; if (subtreeFlags & 524288) { transformFlags |= 8 | 1048576; } excludeFlags = 940049729; break; - case 179: + case 180: transformFlags |= 192 | 8388608; excludeFlags = 940049729; break; - case 180: + case 181: transformFlags |= 192; if (node.dotDotDotToken) { transformFlags |= 524288; @@ -21650,7 +21738,7 @@ var ts; case 149: transformFlags |= 3 | 4096; break; - case 182: + case 183: excludeFlags = 942740801; if (subtreeFlags & 2097152) { transformFlags |= 192; @@ -21662,29 +21750,29 @@ var ts; transformFlags |= 8; } break; - case 181: - case 186: + case 182: + case 187: excludeFlags = 940049729; if (subtreeFlags & 524288) { transformFlags |= 192; } break; - case 216: case 217: case 218: case 219: + case 220: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 272: + case 273: if (subtreeFlags & 32768) { transformFlags |= 192; } break; - case 223: - case 221: + case 224: case 222: + case 223: transformFlags |= 33554432; break; } @@ -21692,27 +21780,27 @@ var ts; return transformFlags & ~excludeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 160 && kind <= 177) { + if (kind >= 160 && kind <= 178) { return -3; } switch (kind) { - case 185: case 186: - case 181: + case 187: + case 182: return 940049729; - case 237: + case 238: return 977327425; case 148: return 939525441; - case 191: + case 192: return 1003902273; - case 190: - case 232: - return 1003935041; - case 231: - return 948962625; + case 191: case 233: - case 203: + return 1003935041; + case 232: + return 948962625; + case 234: + case 204: return 942011713; case 154: return 1003668801; @@ -21734,24 +21822,24 @@ var ts; case 157: case 158: case 159: - case 234: case 235: + case 236: return -3; - case 182: + case 183: return 942740801; - case 267: + case 268: return 940574017; - case 178: case 179: + case 180: return 940049729; - case 188: - case 206: - case 295: case 189: + case 207: + case 296: + case 190: case 97: return 536872257; - case 183: case 184: + case 185: return 671089985; default: return 939525441; @@ -22107,7 +22195,7 @@ var ts; return node ? getConstantValue(node) : undefined; }, isValidPropertyAccess: function (node, propertyName) { - node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); + node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedNameOrImportTypeNode); return !!node && isValidPropertyAccess(node, ts.escapeLeadingUnderscores(propertyName)); }, isValidPropertyAccessForCompletions: function (node, type, property) { @@ -22174,6 +22262,7 @@ var ts; getAllPossiblePropertiesOfTypes: getAllPossiblePropertiesOfTypes, getSuggestionForNonexistentProperty: function (node, type) { return getSuggestionForNonexistentProperty(node, type); }, getSuggestionForNonexistentSymbol: function (location, name, meaning) { return getSuggestionForNonexistentSymbol(location, ts.escapeLeadingUnderscores(name), meaning); }, + getSuggestionForNonexistentModule: function (node, target) { return getSuggestionForNonexistentModule(node, target); }, getBaseConstraintOfType: getBaseConstraintOfType, getDefaultFromTypeParameter: function (type) { return type && type.flags & 32768 ? getDefaultFromTypeParameter(type) : undefined; }, resolveName: function (name, location, meaning, excludeGlobals) { @@ -22716,7 +22805,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 237 && source.valueDeclaration.kind !== 237))) { + (target.valueDeclaration.kind === 238 && source.valueDeclaration.kind !== 238))) { target.valueDeclaration = source.valueDeclaration; } ts.addRange(target.declarations, source.declarations); @@ -22835,7 +22924,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 }); } function isGlobalSourceFile(node) { - return node.kind === 272 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 273 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -22881,23 +22970,23 @@ var ts; return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile); } if (declaration.pos <= usage.pos) { - if (declaration.kind === 180) { - var errorBindingElement = ts.getAncestor(usage, 180); + if (declaration.kind === 181) { + var errorBindingElement = ts.getAncestor(usage, 181); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 230), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 231), usage); } - else if (declaration.kind === 230) { + else if (declaration.kind === 231) { return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } return true; } - if (usage.parent.kind === 250 || (usage.parent.kind === 247 && usage.parent.isExportEquals)) { + if (usage.parent.kind === 251 || (usage.parent.kind === 248 && usage.parent.isExportEquals)) { return true; } - if (usage.kind === 247 && usage.isExportEquals) { + if (usage.kind === 248 && usage.isExportEquals) { return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -22905,9 +22994,9 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 212: - case 218: - case 220: + case 213: + case 219: + case 221: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } @@ -22960,7 +23049,7 @@ var ts; if (result = lookup(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 67901928 && lastLocation.kind !== 282) { + if (meaning & result.flags & 67901928 && lastLocation.kind !== 283) { useResult = result.flags & 262144 ? lastLocation === location.type || lastLocation.kind === 148 || @@ -22986,13 +23075,13 @@ var ts; } } switch (location.kind) { - case 272: + case 273: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 237: + case 238: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 272 || ts.isAmbientModule(location)) { + if (location.kind === 273 || ts.isAmbientModule(location)) { if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) { @@ -23003,7 +23092,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 && - ts.getDeclarationOfKind(moduleExport, 250)) { + ts.getDeclarationOfKind(moduleExport, 251)) { break; } } @@ -23011,7 +23100,7 @@ var ts; break loop; } break; - case 236: + case 237: if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } @@ -23027,9 +23116,9 @@ var ts; } } break; - case 233: - case 203: case 234: + case 204: + case 235: if (result = lookup(getMembersOfSymbol(getSymbolOfNode(location)), name, meaning & 67901928)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { result = undefined; @@ -23041,7 +23130,7 @@ var ts; } break loop; } - if (location.kind === 203 && meaning & 32) { + if (location.kind === 204 && meaning & 32) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -23049,7 +23138,7 @@ var ts; } } break; - case 205: + case 206: if (lastLocation === location.expression && location.parent.token === 85) { var container = location.parent.parent; if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67901928))) { @@ -23062,7 +23151,7 @@ var ts; break; case 146: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 234) { + if (ts.isClassLike(grandparent) || grandparent.kind === 235) { if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67901928)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -23074,14 +23163,14 @@ var ts; case 154: case 155: case 156: - case 232: - case 191: + case 233: + case 192: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 190: + case 191: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -23109,12 +23198,12 @@ var ts; lastLocation = location; location = location.parent; } - if (isUse && result && nameNotFoundMessage && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { + if (isUse && result && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { result.isReferenced |= meaning; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 272); + ts.Debug.assert(lastLocation.kind === 273); if (lastLocation.commonJsModuleIndicator && name === "exports") { return lastLocation.symbol; } @@ -23160,9 +23249,9 @@ var ts; checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); } } - if (result && isInExternalModule && (meaning & 67216319) === 67216319) { + if (result && isInExternalModule && (meaning & 67216319) === 67216319 && !(originalLocation.flags & 1048576)) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 240) { + if (decls && decls.length === 1 && decls[0].kind === 241) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); } } @@ -23171,12 +23260,12 @@ var ts; } function isSelfReferenceLocation(node) { switch (node.kind) { - case 232: case 233: case 234: - case 236: case 235: case 237: + case 236: + case 238: return true; default: return false; @@ -23234,9 +23323,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 71: - case 183: + case 184: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 205: + case 206: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -23298,7 +23387,7 @@ var ts; } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert(!!(result.flags & 2 || result.flags & 32 || result.flags & 384)); - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 236) ? d : undefined; }); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 237) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); if (!(declaration.flags & 2097152) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { if (result.flags & 2) { @@ -23317,13 +23406,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 241: + case 242: return node; - case 243: - return node.parent; case 244: + return node.parent; + case 245: return node.parent.parent; - case 246: + case 247: return node.parent.parent.parent; default: return undefined; @@ -23333,7 +23422,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { - if (node.moduleReference.kind === 252) { + if (node.moduleReference.kind === 253) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); @@ -23352,8 +23441,8 @@ var ts; return false; } if (!file || file.isDeclarationFile) { - var defaultExportSymbol = resolveExportByName(moduleSymbol, "default", dontResolveAlias); - if (defaultExportSymbol && defaultExportSymbol.valueDeclaration && isSyntacticDefault(defaultExportSymbol.valueDeclaration)) { + var defaultExportSymbol = resolveExportByName(moduleSymbol, "default", true); + if (defaultExportSymbol && ts.some(defaultExportSymbol.declarations, isSyntacticDefault)) { return false; } if (resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), dontResolveAlias)) { @@ -23473,29 +23562,36 @@ var ts; resolveEntityName(node.propertyName || node.name, meaning, false, dontResolveAlias); } function getTargetOfExportAssignment(node, dontResolveAlias) { - return resolveEntityName(node.expression, 67216319 | 67901928 | 1920, false, dontResolveAlias); + var aliasLike = resolveEntityName(node.expression, 67216319 | 67901928 | 1920, true, dontResolveAlias); + if (aliasLike) { + return aliasLike; + } + checkExpression(node.expression); + return getNodeLinks(node.expression).resolvedSymbol; } function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { - case 241: + case 242: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 243: - return getTargetOfImportClause(node, dontRecursivelyResolve); case 244: + return getTargetOfImportClause(node, dontRecursivelyResolve); + case 245: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 246: - return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 250: - return getTargetOfExportSpecifier(node, 67216319 | 67901928 | 1920, dontRecursivelyResolve); case 247: + return getTargetOfImportSpecifier(node, dontRecursivelyResolve); + case 251: + return getTargetOfExportSpecifier(node, 67216319 | 67901928 | 1920, dontRecursivelyResolve); + case 248: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 240: + case 241: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); } } function isNonLocalAlias(symbol, excludes) { if (excludes === void 0) { excludes = 67216319 | 67901928 | 1920; } - return symbol && (symbol.flags & (2097152 | excludes)) === 2097152; + if (!symbol) + return false; + return (symbol.flags & (2097152 | excludes)) === 2097152 || (symbol.flags & 2097152 && symbol.flags & 67108864); } function resolveSymbol(symbol, dontResolveAlias) { var shouldResolve = !dontResolveAlias && isNonLocalAlias(symbol); @@ -23538,10 +23634,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 247) { + if (node.kind === 248) { checkExpressionCached(node.expression); } - else if (node.kind === 250) { + else if (node.kind === 251) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -23557,7 +23653,7 @@ var ts; return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 241); + ts.Debug.assert(entityName.parent.kind === 242); return resolveEntityName(entityName, 67216319 | 67901928 | 1920, false, dontResolveAlias); } } @@ -23577,7 +23673,7 @@ var ts; return undefined; } } - else if (name.kind === 145 || name.kind === 183) { + else if (name.kind === 145 || name.kind === 184) { var left = name.kind === 145 ? name.left : name.expression; var right = name.kind === 145 ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, false, location); @@ -23643,7 +23739,8 @@ var ts; if (ambientModule) { return ambientModule; } - var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference); + var currentSourceFile = ts.getSourceFileOfNode(location); + var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference); var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule); var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { @@ -23699,15 +23796,15 @@ var ts; function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) { return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias)) || moduleSymbol; } - function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression, dontResolveAlias) { + function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) { var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { if (!(symbol.flags & (1536 | 3))) { - error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); + error(referencingLocation, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); return symbol; } if (compilerOptions.esModuleInterop) { - var referenceParent = moduleReferenceExpression.parent; + var referenceParent = referencingLocation.parent; if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) || ts.isImportCall(referenceParent)) { var type = getTypeOfSymbol(symbol); @@ -23935,11 +24032,11 @@ var ts; } } switch (location.kind) { - case 272: + case 273: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 237: + case 238: if (result = callback(getSymbolOfNode(location).exports)) { return result; } @@ -23957,11 +24054,8 @@ var ts; return undefined; } var id = "" + getSymbolId(symbol); - var visitedSymbolTables; - if (visitedSymbolTablesMap.has(id)) { - visitedSymbolTables = visitedSymbolTablesMap.get(id); - } - else { + var visitedSymbolTables = visitedSymbolTablesMap.get(id); + if (!visitedSymbolTables) { visitedSymbolTablesMap.set(id, visitedSymbolTables = []); } return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); @@ -24015,7 +24109,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 250)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 251)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -24093,7 +24187,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 272 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 273 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -24125,8 +24219,8 @@ var ts; entityName.parent.kind === 146) { meaning = 67216319 | 1048576; } - else if (entityName.kind === 145 || entityName.kind === 183 || - entityName.parent.kind === 241) { + else if (entityName.kind === 145 || entityName.kind === 184 || + entityName.parent.kind === 242) { meaning = 1920; } else { @@ -24308,7 +24402,7 @@ var ts; if (type.flags & 1024) { if (!(context.flags & 1048576)) { if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) { - return ts.createTypeQueryNode(symbolToName(type.symbol, context, 67216319, false)); + return symbolToTypeNode(type.symbol, context, 67216319); } if (context.tracker.reportInaccessibleUniqueSymbolError) { context.tracker.reportInaccessibleUniqueSymbolError(); @@ -24416,16 +24510,15 @@ var ts; function createAnonymousTypeNode(type) { var symbol = type.symbol; if (symbol) { - if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 203 && context.flags & 2048) || + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 204 && context.flags & 2048) || symbol.flags & (384 | 512) || shouldWriteTypeOfFunctionSymbol()) { - return createTypeQueryNodeFromSymbol(symbol, 67216319); + return symbolToTypeNode(symbol, context, 67216319); } else if (ts.contains(context.symbolStack, symbol)) { var typeAlias = getTypeAliasForTypeLiteral(type); if (typeAlias) { - var entityName = symbolToName(typeAlias, context, 67901928, false); - return ts.createTypeReferenceNode(entityName, undefined); + return symbolToTypeNode(typeAlias, context, 67901928); } else { return ts.createKeywordTypeNode(119); @@ -24456,7 +24549,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 272 || declaration.parent.kind === 238; + return declaration.parent.kind === 273 || declaration.parent.kind === 239; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return (!!(context.flags & 4096) || ts.contains(context.symbolStack, symbol)) && @@ -24491,10 +24584,6 @@ var ts; var typeLiteralNode = ts.createTypeLiteralNode(members); return ts.setEmitFlags(typeLiteralNode, (context.flags & 1024) ? 0 : 1); } - function createTypeQueryNodeFromSymbol(symbol, symbolFlags) { - var entityName = symbolToName(symbol, context, symbolFlags, false); - return ts.createTypeQueryNode(entityName); - } function symbolToTypeReferenceName(symbol) { var entityName = symbol.flags & 32 || !isReservedMemberName(symbol.escapedName) ? symbolToName(symbol, context, 67901928, false) : ts.createIdentifier(""); return entityName; @@ -24646,6 +24735,9 @@ var ts; var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 152, context); methodDeclaration.name = propertyName; methodDeclaration.questionToken = optionalToken; + if (propertySymbol.valueDeclaration) { + ts.setCommentRange(methodDeclaration, propertySymbol.valueDeclaration); + } typeElements.push(methodDeclaration); } } @@ -24656,6 +24748,9 @@ var ts; context.flags = savedFlags; var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(132)] : undefined; var propertySignature = ts.createPropertySignature(modifiers, propertyName, optionalToken, propertyTypeNode, undefined); + if (propertySymbol.valueDeclaration) { + ts.setCommentRange(propertySignature, propertySymbol.valueDeclaration); + } typeElements.push(propertySignature); } } @@ -24694,7 +24789,7 @@ var ts; else { typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); }); } - var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context); }); + var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 154); }); if (signature.thisParameter) { var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context); parameters.unshift(thisParameter); @@ -24733,7 +24828,7 @@ var ts; context.flags = savedContextFlags; return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); } - function symbolToParameterDeclaration(parameterSymbol, context) { + function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) { var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 148); ts.Debug.assert(!!parameterDeclaration || isTransientSymbol(parameterSymbol) && !!parameterSymbol.isRestParameter); var parameterType = getTypeOfSymbol(parameterSymbol); @@ -24741,7 +24836,7 @@ var ts; parameterType = getOptionalType(parameterType); } var parameterTypeNode = typeToTypeNodeHelper(parameterType, context); - var modifiers = !(context.flags & 8192) && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone); + var modifiers = !(context.flags & 8192) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone); var dotDotDotToken = !parameterDeclaration || ts.isRestParameter(parameterDeclaration) ? ts.createToken(24) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? @@ -24758,7 +24853,7 @@ var ts; function elideInitializerAndSetEmitFlags(node) { var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, undefined, elideInitializerAndSetEmitFlags); var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited); - if (clone.kind === 180) { + if (clone.kind === 181) { clone.initializer = undefined; } return ts.setEmitFlags(clone, 1 | 16777216); @@ -24826,6 +24921,34 @@ var ts; } return typeParameterNodes; } + function symbolToTypeNode(symbol, context, meaning) { + var chain = lookupSymbolChain(symbol, context, meaning); + context.flags |= 16777216; + var rootName = getNameOfSymbolAsWritten(chain[0], context); + context.flags ^= 16777216; + var isTypeOf = meaning === 67216319; + if (ambientModuleSymbolRegex.test(rootName)) { + var nonRootParts = chain.length > 1 ? createEntityNameFromSymbolChain(chain, chain.length - 1, 1) : undefined; + var typeParameterNodes = lookupTypeParameterNodes(chain, 0, context); + return ts.createImportTypeNode(ts.createLiteralTypeNode(ts.createLiteral(rootName.substring(1, rootName.length - 1))), nonRootParts, typeParameterNodes, isTypeOf); + } + var entityName = createEntityNameFromSymbolChain(chain, chain.length - 1, 0); + return isTypeOf ? ts.createTypeQueryNode(entityName) : ts.createTypeReferenceNode(entityName, undefined); + function createEntityNameFromSymbolChain(chain, index, stopper) { + var typeParameterNodes = lookupTypeParameterNodes(chain, index, context); + var symbol = chain[index]; + if (index === 0) { + context.flags |= 16777216; + } + var symbolName = getNameOfSymbolAsWritten(symbol, context); + if (index === 0) { + context.flags ^= 16777216; + } + var identifier = ts.setEmitFlags(ts.createIdentifier(symbolName, typeParameterNodes), 16777216); + identifier.symbol = symbol; + return index > stopper ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1, stopper), identifier) : identifier; + } + } function symbolToName(symbol, context, meaning, expectsIdentifier) { var chain = lookupSymbolChain(symbol, context, meaning); if (expectsIdentifier && chain.length !== 1 @@ -24940,7 +25063,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 172; }); - if (node.kind === 235) { + if (node.kind === 236) { return getSymbolOfNode(node); } } @@ -24948,11 +25071,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 238 && + node.parent.kind === 239 && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 272 || ts.isAmbientModule(location); + return location.kind === 273 || ts.isAmbientModule(location); } function getNameOfSymbolAsWritten(symbol, context) { if (context && symbol.escapedName === "default" && !(context.flags & 16384) && @@ -24967,17 +25090,17 @@ var ts; if (name) { return ts.declarationNameToString(name); } - if (declaration.parent && declaration.parent.kind === 230) { + if (declaration.parent && declaration.parent.kind === 231) { return ts.declarationNameToString(declaration.parent.name); } if (context && !context.encounteredError && !(context.flags & 131072)) { context.encounteredError = true; } switch (declaration.kind) { - case 203: + case 204: return "(Anonymous class)"; - case 190: case 191: + case 192: return "(Anonymous function)"; } } @@ -25000,26 +25123,26 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 180: + case 181: return isDeclarationVisible(node.parent.parent); - case 230: + case 231: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 237: - case 233: + case 238: case 234: case 235: - case 232: case 236: - case 241: + case 233: + case 237: + case 242: if (ts.isExternalModuleAugmentation(node)) { return true; } var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 241 && parent.kind !== 272 && parent.flags & 2097152)) { + !(node.kind !== 242 && parent.kind !== 273 && parent.flags & 2097152)) { return isGlobalSourceFile(parent); } return isDeclarationVisible(parent); @@ -25037,7 +25160,7 @@ var ts; case 157: case 159: case 148: - case 238: + case 239: case 162: case 163: case 165: @@ -25048,15 +25171,15 @@ var ts; case 169: case 172: return isDeclarationVisible(node.parent); - case 243: case 244: - case 246: + case 245: + case 247: return false; case 147: - case 272: - case 240: + case 273: + case 241: return true; - case 247: + case 248: return false; default: return false; @@ -25065,10 +25188,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 247) { + if (node.parent && node.parent.kind === 248) { exportSymbol = resolveName(node, node.escapedText, 67216319 | 67901928 | 1920 | 2097152, undefined, node, false); } - else if (node.parent.kind === 250) { + else if (node.parent.kind === 251) { exportSymbol = getTargetOfExportSpecifier(node.parent, 67216319 | 67901928 | 1920 | 2097152); } var result; @@ -25149,12 +25272,12 @@ var ts; function getDeclarationContainer(node) { node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 230: case 231: + case 232: + case 247: case 246: case 245: case 244: - case 243: return false; default: return true; @@ -25220,7 +25343,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 178) { + if (pattern.kind === 179) { if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -25295,18 +25418,18 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 181 && expr.elements.length === 0; + return expr.kind === 182 && expr.elements.length === 0; } function addOptionality(type, optional) { if (optional === void 0) { optional = true; } return strictNullChecks && optional ? getOptionalType(type) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 219) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 220) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (32768 | 524288) ? indexType : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 220) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 221) { var forOfStatement = declaration.parent.parent; return checkRightHandSideOfForOf(forOfStatement.expression, forOfStatement.awaitModifier) || anyType; } @@ -25320,7 +25443,7 @@ var ts; return addOptionality(declaredType, isOptional); } if ((noImplicitAny || ts.isInJavaScriptFile(declaration)) && - declaration.kind === 230 && !ts.isBindingPattern(declaration.name) && + declaration.kind === 231 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 2097152)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -25379,8 +25502,8 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var declarationInConstructor = false; - var expression = declaration.kind === 198 ? declaration : - declaration.kind === 183 ? ts.getAncestor(declaration, 198) : + var expression = declaration.kind === 199 ? declaration : + declaration.kind === 184 ? ts.getAncestor(declaration, 199) : undefined; if (!expression) { return unknownType; @@ -25388,8 +25511,8 @@ var ts; if (ts.isPropertyAccessExpression(expression.left) && expression.left.expression.kind === 99) { var thisContainer = ts.getThisContainer(expression, false); declarationInConstructor = thisContainer.kind === 154 || - thisContainer.kind === 232 || - (thisContainer.kind === 190 && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + thisContainer.kind === 233 || + (thisContainer.kind === 191 && !ts.isPrototypePropertyAssignment(thisContainer.parent)); if (declarationInConstructor) { definedInConstructor = true; } @@ -25494,7 +25617,7 @@ var ts; return result; } function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 178 + return pattern.kind === 179 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -25538,7 +25661,7 @@ var ts; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 247) { + if (declaration.kind === 248) { return links.type = checkExpression(declaration.expression); } if (ts.isInJavaScriptFile(declaration) && ts.isJSDocPropertyLikeTag(declaration) && declaration.typeExpression) { @@ -25548,8 +25671,8 @@ var ts; return unknownType; } var type = void 0; - if (declaration.kind === 198 || - declaration.kind === 183 && declaration.parent.kind === 198) { + if (declaration.kind === 199 || + declaration.kind === 184 && declaration.parent.kind === 199) { type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } else if (ts.isJSDocPropertyTag(declaration) @@ -25674,6 +25797,10 @@ var ts; if (symbol.flags & 1536 && ts.isShorthandAmbientModuleSymbol(symbol)) { links.type = anyType; } + else if (symbol.valueDeclaration.kind === 199 || + symbol.valueDeclaration.kind === 184 && symbol.valueDeclaration.parent.kind === 199) { + links.type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); + } else { var type = createObjectType(16, symbol); if (symbol.flags & 32) { @@ -25796,21 +25923,21 @@ var ts; return undefined; } switch (node.kind) { - case 233: - case 203: case 234: + case 204: + case 235: case 157: case 158: case 152: case 162: case 163: - case 280: - case 232: + case 281: + case 233: case 153: - case 190: case 191: - case 235: - case 290: + case 192: + case 236: + case 291: case 176: case 170: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); @@ -25822,22 +25949,22 @@ var ts; } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node) || ts.emptyArray); var thisType = includeThisTypes && - (node.kind === 233 || node.kind === 203 || node.kind === 234) && + (node.kind === 234 || node.kind === 204 || node.kind === 235) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 234); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 235); return getOuterTypeParameters(declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 234 || node.kind === 233 || - node.kind === 203 || node.kind === 235) { + if (node.kind === 235 || node.kind === 234 || + node.kind === 204 || node.kind === 236) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -25995,7 +26122,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 234 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 235 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -26024,7 +26151,7 @@ var ts; function isThislessInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 234) { + if (declaration.kind === 235) { if (declaration.flags & 64) { return false; } @@ -26075,9 +26202,9 @@ var ts; return unknownType; } var declaration = ts.find(symbol.declarations, function (d) { - return d.kind === 291 || d.kind === 235; + return d.kind === 292 || d.kind === 236; }); - var typeNode = declaration.kind === 291 ? declaration.typeExpression : declaration.type; + var typeNode = declaration.kind === 292 ? declaration.typeExpression : declaration.type; var type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -26104,7 +26231,7 @@ var ts; case 9: case 8: return true; - case 196: + case 197: return expr.operator === 38 && expr.operand.kind === 8; case 71: @@ -26121,7 +26248,7 @@ var ts; var hasNonLiteralMember = false; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 236) { + if (declaration.kind === 237) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && member.initializer.kind === 9) { @@ -26148,7 +26275,7 @@ var ts; var memberTypeList = []; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 236) { + if (declaration.kind === 237) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var memberType = getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member)); @@ -26950,14 +27077,22 @@ var ts; return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; } function getDefaultConstraintOfConditionalType(type) { - return getUnionType([getInferredTrueTypeFromConditionalType(type), getFalseTypeFromConditionalType(type)]); + if (!type.resolvedDefaultConstraint) { + var rootTrueType = type.root.trueType; + var rootTrueConstraint = rootTrueType.flags & 4194304 ? rootTrueType.substitute : rootTrueType; + type.resolvedDefaultConstraint = getUnionType([instantiateType(rootTrueConstraint, type.combinedMapper || type.mapper), getFalseTypeFromConditionalType(type)]); + } + return type.resolvedDefaultConstraint; } function getConstraintOfDistributiveConditionalType(type) { if (type.root.isDistributive) { var constraint = getConstraintOfType(type.checkType); if (constraint) { var mapper = createTypeMapper([type.root.checkType], [constraint]); - return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + var instantiated = getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + if (!(instantiated.flags & 16384)) { + return instantiated; + } } } return undefined; @@ -27116,7 +27251,7 @@ var ts; (modifiers & 16 ? 128 : 0) | (modifiers & 8 ? 256 : 0) | (modifiers & 32 ? 512 : 0); - if (!isMethodLike(prop)) { + if (!isPrototypeProperty(prop)) { syntheticFlag = 2; } } @@ -27249,10 +27384,10 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - return ts.isInJavaScriptFile(node) && (node.type && node.type.kind === 279 + return ts.isInJavaScriptFile(node) && (node.type && node.type.kind === 280 || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 279; + return isBracketed || !!typeExpression && typeExpression.type.kind === 280; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -27460,7 +27595,8 @@ var ts; return ts.emptyArray; var result = []; for (var i = 0; i < symbol.declarations.length; i++) { - var node = symbol.declarations[i]; + var decl = symbol.declarations[i]; + var node = ts.isPropertyAccessExpression(decl) ? ts.getAssignedJavascriptInitializer(decl) : decl; if (!ts.isFunctionLike(node)) continue; if (i > 0 && node.body) { @@ -27748,7 +27884,7 @@ var ts; var isJs = ts.isInJavaScriptFile(node); var isJsImplicitAny = !noImplicitAny && isJs; if (!isJsImplicitAny && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { - var missingAugmentsTag = isJs && node.parent.kind !== 285; + var missingAugmentsTag = isJs && node.parent.kind !== 286; var diag = minTypeArgumentCount === typeParameters.length ? missingAugmentsTag ? ts.Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag @@ -27798,7 +27934,7 @@ var ts; switch (node.kind) { case 161: return node.typeName; - case 205: + case 206: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { return expr; @@ -27868,7 +28004,7 @@ var ts; } function getConstrainedTypeVariable(typeVariable, node) { var constraints; - while (ts.isPartOfTypeNode(node)) { + while (node && !ts.isStatement(node)) { var parent = node.parent; if (parent.kind === 170 && node === parent.trueType) { var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType); @@ -27885,7 +28021,7 @@ var ts; } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : ts.declarationNameToString(node.typeName)); + error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? ts.declarationNameToString(node.typeName) : "(anonymous)"); return false; } return true; @@ -27976,9 +28112,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 233: case 234: - case 236: + case 235: + case 237: return declaration; } } @@ -28477,7 +28613,7 @@ var ts; return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 184 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 185 ? accessNode : undefined; var propName = isTypeUsableAsLateBoundName(indexType) ? getLateBoundNameFromType(indexType) : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ? ts.getPropertyNameForKnownSymbolName(ts.idText(accessExpression.argumentExpression.name)) : @@ -28527,7 +28663,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 184 ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 185 ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 | 64)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)); } @@ -28604,7 +28740,7 @@ var ts; if (objectType === wildcardType || indexType === wildcardType) { return wildcardType; } - if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind === 184) && isGenericObjectType(objectType)) { + if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind === 185) && isGenericObjectType(objectType)) { if (objectType.flags & 1) { return objectType; } @@ -28702,11 +28838,6 @@ var ts; function getFalseTypeFromConditionalType(type) { return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper)); } - function getInferredTrueTypeFromConditionalType(type) { - return type.combinedMapper ? - type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper)) : - getTrueTypeFromConditionalType(type); - } function getInferTypeParameters(node) { var result; if (node.locals) { @@ -28718,13 +28849,27 @@ var ts; } return result; } + function isPossiblyReferencedInConditionalType(tp, node) { + if (isTypeParameterPossiblyReferenced(tp, node)) { + return true; + } + while (node) { + if (node.kind === 170) { + if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) { + return true; + } + } + node = node.parent; + } + return false; + } function getTypeFromConditionalTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var checkType = getTypeFromTypeNode(node.checkType); var aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); var allOuterTypeParameters = getOuterTypeParameters(node, true); - var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); }); + var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); }); var root = { node: node, checkType: checkType, @@ -28753,6 +28898,75 @@ var ts; } return links.resolvedType; } + function getIdentifierChain(node) { + if (ts.isIdentifier(node)) { + return [node]; + } + else { + return ts.append(getIdentifierChain(node.left), node.right); + } + } + function getTypeFromImportTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + if (node.isTypeOf && node.typeArguments) { + error(node, ts.Diagnostics.Type_arguments_cannot_be_used_here); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + if (!ts.isLiteralImportTypeNode(node)) { + error(node.argument, ts.Diagnostics.String_literal_expected); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + var argumentType = getTypeFromTypeNode(node.argument); + var targetMeaning = node.isTypeOf ? 67216319 : 67901928; + var moduleName = argumentType.value; + var innerModuleSymbol = resolveExternalModule(node, moduleName, ts.Diagnostics.Cannot_find_module_0, node, false); + if (!innerModuleSymbol) { + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + var moduleSymbol = resolveExternalModuleSymbol(innerModuleSymbol, false); + if (!ts.nodeIsMissing(node.qualifier)) { + var nameStack = getIdentifierChain(node.qualifier); + var currentNamespace = moduleSymbol; + var current = void 0; + while (current = nameStack.shift()) { + var meaning = nameStack.length ? 1920 : targetMeaning; + var next = getSymbol(getExportsOfSymbol(getMergedSymbol(resolveSymbol(currentNamespace))), current.escapedText, meaning); + if (!next) { + error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current)); + return links.resolvedType = unknownType; + } + getNodeLinks(current).resolvedSymbol = next; + getNodeLinks(current.parent).resolvedSymbol = next; + currentNamespace = next; + } + resolveImportSymbolType(node, links, currentNamespace, targetMeaning); + } + else { + if (moduleSymbol.flags & targetMeaning) { + resolveImportSymbolType(node, links, moduleSymbol, targetMeaning); + } + else { + error(node, targetMeaning === 67216319 ? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here, moduleName); + links.resolvedSymbol = unknownSymbol; + links.resolvedType = unknownType; + } + } + } + return links.resolvedType; + } + function resolveImportSymbolType(node, links, symbol, meaning) { + links.resolvedSymbol = symbol; + if (meaning === 67216319) { + return links.resolvedType = getTypeOfSymbol(symbol); + } + else { + return links.resolvedType = getTypeReferenceType(node, symbol); + } + } function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -28773,7 +28987,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 235 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 236 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -28923,7 +29137,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 234)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 235)) { if (!ts.hasModifier(container, 32) && (container.kind !== 154 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -28942,8 +29156,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 119: - case 275: case 276: + case 277: return anyType; case 137: return stringType; @@ -28972,7 +29186,7 @@ var ts; return getTypeFromTypeReference(node); case 160: return booleanType; - case 205: + case 206: return getTypeFromTypeReference(node); case 164: return getTypeFromTypeQueryNode(node); @@ -28984,21 +29198,21 @@ var ts; return getTypeFromUnionTypeNode(node); case 169: return getTypeFromIntersectionTypeNode(node); - case 277: + case 278: return getTypeFromJSDocNullableTypeNode(node); - case 279: + case 280: return addOptionality(getTypeFromTypeNode(node.type)); case 172: - case 278: - case 274: + case 279: + case 275: return getTypeFromTypeNode(node.type); - case 281: + case 282: return getTypeFromJSDocVariadicType(node); case 162: case 163: case 165: - case 283: - case 280: + case 284: + case 281: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 174: return getTypeFromTypeOperatorNode(node); @@ -29010,6 +29224,8 @@ var ts; return getTypeFromConditionalTypeNode(node); case 171: return getTypeFromInferTypeNode(node); + case 178: + return getTypeFromImportTypeNode(node); case 71: case 145: var symbol = getSymbolAtLocation(node); @@ -29136,7 +29352,7 @@ var ts; symbol = links.target; mapper = combineTypeMappers(links.mapper, mapper); } - var result = createSymbol(symbol.flags, symbol.escapedName, 1); + var result = createSymbol(symbol.flags, symbol.escapedName, 1 | (ts.getCheckFlags(symbol) & 1024)); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -29180,10 +29396,14 @@ var ts; } return type; } + function maybeTypeParameterReference(node) { + return !(node.kind === 145 || + node.parent.kind === 161 && node.parent.typeArguments && node === node.parent.typeName); + } function isTypeParameterPossiblyReferenced(tp, node) { if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container_2 = tp.symbol.declarations[0].parent; - if (ts.findAncestor(node, function (n) { return n.kind === 211 ? "quit" : n === container_2; })) { + if (ts.findAncestor(node, function (n) { return n.kind === 212 ? "quit" : n === container_2; })) { return ts.forEachChild(node, containsReference); } } @@ -29193,7 +29413,8 @@ var ts; case 173: return tp.isThisType; case 71: - return !tp.isThisType && ts.isPartOfTypeNode(node) && getTypeFromTypeNode(node) === tp; + return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && + getTypeFromTypeNode(node) === tp; case 164: return true; } @@ -29311,29 +29532,29 @@ var ts; function isContextSensitive(node) { ts.Debug.assert(node.kind !== 153 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 190: case 191: + case 192: case 153: return isContextSensitiveFunctionLikeDeclaration(node); - case 182: + case 183: return ts.forEach(node.properties, isContextSensitive); - case 181: + case 182: return ts.forEach(node.elements, isContextSensitive); - case 199: + case 200: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 198: + case 199: return node.operatorToken.kind === 54 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 268: + case 269: return isContextSensitive(node.initializer); - case 189: + case 190: return isContextSensitive(node.expression); - case 261: + case 262: return ts.forEach(node.properties, isContextSensitive); - case 260: + case 261: return node.initializer && isContextSensitive(node.initializer); - case 263: + case 264: return node.expression && isContextSensitive(node.expression); } return false; @@ -29345,13 +29566,13 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 191) { + if (node.kind !== 192) { var parameter = ts.firstOrUndefined(node.parameters); if (!(parameter && ts.parameterIsThisKeyword(parameter))) { return true; } } - return node.body.kind === 211 ? false : isContextSensitive(node.body); + return node.body.kind === 212 ? false : isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (ts.isInJavaScriptFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && @@ -31164,7 +31385,7 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 198: + case 199: case 151: case 150: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; @@ -31174,16 +31395,16 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 180: + case 181: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 232: + case 233: case 153: case 152: case 155: case 156: - case 190: case 191: + case 192: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -31764,13 +31985,13 @@ var ts; if (node.kind === 99) { return "0"; } - if (node.kind === 183) { + if (node.kind === 184) { var key = getFlowCacheKey(node.expression); return key && key + "." + ts.idText(node.name); } - if (node.kind === 180) { + if (node.kind === 181) { var container = node.parent.parent; - var key = container.kind === 180 ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); + var key = container.kind === 181 ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); var text = getBindingElementNameText(node); var result = key && text && (key + "." + text); return result; @@ -31778,7 +31999,7 @@ var ts; return undefined; } function getBindingElementNameText(element) { - if (element.parent.kind === 178) { + if (element.parent.kind === 179) { var name = element.propertyName || element.name; switch (name.kind) { case 71: @@ -31800,26 +32021,26 @@ var ts; switch (source.kind) { case 71: return target.kind === 71 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 230 || target.kind === 180) && + (target.kind === 231 || target.kind === 181) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 99: return target.kind === 99; case 97: return target.kind === 97; - case 183: - return target.kind === 183 && + case 184: + return target.kind === 184 && source.name.escapedText === target.name.escapedText && isMatchingReference(source.expression, target.expression); - case 180: - if (target.kind !== 183) + case 181: + if (target.kind !== 184) return false; var t = target; if (t.name.escapedText !== getBindingElementNameText(source)) return false; - if (source.parent.parent.kind === 180 && isMatchingReference(source.parent.parent, t.expression)) { + if (source.parent.parent.kind === 181 && isMatchingReference(source.parent.parent, t.expression)) { return true; } - if (source.parent.parent.kind === 230) { + if (source.parent.parent.kind === 231) { var maybeId = source.parent.parent.initializer; return maybeId && isMatchingReference(maybeId, t.expression); } @@ -31827,7 +32048,7 @@ var ts; return false; } function containsMatchingReference(source, target) { - while (source.kind === 183) { + while (source.kind === 184) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -31836,7 +32057,7 @@ var ts; return false; } function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 183 && + return target.kind === 184 && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.escapedText); } @@ -31844,7 +32065,7 @@ var ts; if (expr.kind === 71) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 183) { + if (expr.kind === 184) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.escapedText); } @@ -31888,7 +32109,7 @@ var ts; } } } - if (callExpression.expression.kind === 183 && + if (callExpression.expression.kind === 184 && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -32017,15 +32238,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, undefined, false, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 181 && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 268 && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 182 && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 269 && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 198 && parent.parent.left === parent || - parent.parent.kind === 220 && parent.parent.initializer === parent; + return parent.parent.kind === 199 && parent.parent.left === parent || + parent.parent.kind === 221 && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -32042,21 +32263,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 219: - return stringType; case 220: + return stringType; + case 221: return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; - case 198: + case 199: return getAssignedTypeOfBinaryExpression(parent); - case 192: + case 193: return undefinedType; - case 181: + case 182: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 202: + case 203: return getAssignedTypeOfSpreadExpression(parent); - case 268: - return getAssignedTypeOfPropertyAssignment(parent); case 269: + return getAssignedTypeOfPropertyAssignment(parent); + case 270: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -32064,7 +32285,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 178 ? + var type = pattern.kind === 179 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -32079,35 +32300,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 219) { + if (node.parent.parent.kind === 220) { return stringType; } - if (node.parent.parent.kind === 220) { + if (node.parent.parent.kind === 221) { return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 230 ? + return node.kind === 231 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 230 || node.kind === 180 ? + return node.kind === 231 || node.kind === 181 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 230 && node.initializer && + return node.kind === 231 && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 180 && node.parent.kind === 198 && + node.kind !== 181 && node.parent.kind === 199 && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 189: + case 190: return getReferenceCandidate(node.expression); - case 198: + case 199: switch (node.operatorToken.kind) { case 58: return getReferenceCandidate(node.left); @@ -32119,13 +32340,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 189 || - parent.kind === 198 && parent.operatorToken.kind === 58 && parent.left === node || - parent.kind === 198 && parent.operatorToken.kind === 26 && parent.right === node ? + return parent.kind === 190 || + parent.kind === 199 && parent.operatorToken.kind === 58 && parent.left === node || + parent.kind === 199 && parent.operatorToken.kind === 26 && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 264) { + if (clause.kind === 265) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -32277,11 +32498,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 183 && (parent.name.escapedText === "length" || - parent.parent.kind === 185 && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 184 && + var isLengthPushOrUnshift = parent.kind === 184 && (parent.name.escapedText === "length" || + parent.parent.kind === 186 && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 185 && parent.expression === root && - parent.parent.kind === 198 && + parent.parent.kind === 199 && parent.parent.operatorToken.kind === 58 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -32325,7 +32546,7 @@ var ts; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); sharedFlowCount = sharedFlowStart; var resultType = ts.getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent && reference.parent.kind === 207 && getTypeWithFacts(resultType, 524288).flags & 16384) { + if (reference.parent && reference.parent.kind === 208 && getTypeWithFacts(resultType, 524288).flags & 16384) { return declaredType; } return resultType; @@ -32387,7 +32608,7 @@ var ts; } else if (flags & 2) { var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 183 && reference.kind !== 99) { + if (container && container !== flowContainer && reference.kind !== 184 && reference.kind !== 99) { flow = container.flowNode; continue; } @@ -32432,7 +32653,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 185 ? + var expr = node.kind === 186 ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -32440,7 +32661,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256) { var evolvedType_1 = type; - if (node.kind === 185) { + if (node.kind === 186) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -32564,7 +32785,7 @@ var ts; return result; } function isMatchingReferenceDiscriminant(expr, computedType) { - return expr.kind === 183 && + return expr.kind === 184 && computedType.flags & 131072 && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(computedType, expr.name.escapedText); @@ -32615,10 +32836,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 193 && ts.isStringLiteralLike(right_1)) { + if (left_1.kind === 194 && ts.isStringLiteralLike(right_1)) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 193 && ts.isStringLiteralLike(left_1)) { + if (right_1.kind === 194 && ts.isStringLiteralLike(left_1)) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -32809,7 +33030,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 184 || invokedExpression.kind === 183) { + if (invokedExpression.kind === 185 || invokedExpression.kind === 184) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -32827,15 +33048,15 @@ var ts; case 71: case 99: case 97: - case 183: + case 184: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 185: + case 186: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 189: + case 190: return narrowType(type, expr.expression, assumeTrue); - case 198: + case 199: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 196: + case 197: if (expr.operator === 51) { return narrowType(type, expr.operand, !assumeTrue); } @@ -32862,8 +33083,8 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 238 || - node.kind === 272 || + node.kind === 239 || + node.kind === 273 || node.kind === 151; }); } @@ -32907,10 +33128,10 @@ var ts; } function isConstraintPosition(node) { var parent = node.parent; - return parent.kind === 183 || + return parent.kind === 184 || + parent.kind === 186 && parent.expression === node || parent.kind === 185 && parent.expression === node || - parent.kind === 184 && parent.expression === node || - parent.kind === 180 && parent.name === node && !!parent.initializer; + parent.kind === 181 && parent.name === node && !!parent.initializer; } function typeHasNullableConstraint(type) { return type.flags & 7372800 && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 12288); @@ -32934,7 +33155,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2) { - if (container.kind === 191) { + if (container.kind === 192) { 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.hasModifier(container, 256)) { @@ -32950,7 +33171,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); var declaration = localOrExportSymbol.valueDeclaration; if (localOrExportSymbol.flags & 32) { - if (declaration.kind === 233 + if (declaration.kind === 234 && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -32962,7 +33183,7 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 203) { + else if (declaration.kind === 204) { var container = ts.getThisContainer(node, false); while (container !== undefined) { if (container.parent === declaration) { @@ -32976,9 +33197,6 @@ var ts; } } } - checkCollisionWithCapturedSuperVariable(node, node); - checkCollisionWithCapturedThisVariable(node, node); - checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getConstraintForLocation(getTypeOfSymbol(localOrExportSymbol), node); var assignmentKind = ts.getAssignmentTargetKind(node); @@ -33012,16 +33230,16 @@ var ts; var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; var isSpreadDestructuringAsignmentTarget = node.parent && node.parent.parent && ts.isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent); - while (flowContainer !== declarationContainer && (flowContainer.kind === 190 || - flowContainer.kind === 191 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 191 || + flowContainer.kind === 192 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAsignmentTarget || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0 || - isInTypeQuery(node) || node.parent.kind === 250) || - node.parent.kind === 207 || - declaration.kind === 230 && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 251) || + node.parent.kind === 208 || + declaration.kind === 231 && declaration.exclamationToken || declaration.flags & 2097152; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -33048,7 +33266,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 267) { + symbol.valueDeclaration.parent.kind === 268) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -33066,8 +33284,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 218 && - ts.getAncestor(symbol.valueDeclaration, 231).parent === container && + if (container.kind === 219 && + ts.getAncestor(symbol.valueDeclaration, 232).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -33079,14 +33297,14 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 189) { + while (current.parent.kind === 190) { current = current.parent; } var isAssigned = false; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 196 || current.parent.kind === 197)) { + else if ((current.parent.kind === 197 || current.parent.kind === 198)) { var expr = current.parent; isAssigned = expr.operator === 43 || expr.operator === 44; } @@ -33144,15 +33362,15 @@ var ts; if (container.kind === 154) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } - if (container.kind === 191) { + if (container.kind === 192) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 237: + case 238: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 236: + case 237: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 154: @@ -33183,8 +33401,8 @@ var ts; if (container === void 0) { container = ts.getThisContainer(node, false); } if (ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { - if (container.kind === 190 && - container.parent.kind === 198 && + if (container.kind === 191 && + container.parent.kind === 199 && ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { var className = container.parent .left @@ -33214,7 +33432,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 280) { + if (jsdocType && jsdocType.kind === 281) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -33227,11 +33445,11 @@ var ts; return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 148; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 185 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 186 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 191) { + while (container && container.kind === 192) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -33246,7 +33464,7 @@ var ts; 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 === 182)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 183)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -33275,7 +33493,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 182) { + if (container.parent.kind === 183) { 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 unknownType; @@ -33309,7 +33527,7 @@ var ts; return container.kind === 154; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 182) { + if (ts.isClassLike(container.parent) || container.parent.kind === 183) { if (ts.hasModifier(container, 32)) { return container.kind === 153 || container.kind === 152 || @@ -33333,8 +33551,8 @@ var ts; function getContainingObjectLiteral(func) { return (func.kind === 153 || func.kind === 155 || - func.kind === 156) && func.parent.kind === 182 ? func.parent : - func.kind === 190 && func.parent.kind === 268 ? func.parent.parent : + func.kind === 156) && func.parent.kind === 183 ? func.parent : + func.kind === 191 && func.parent.kind === 269 ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -33346,7 +33564,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 191) { + if (func.kind === 192) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -33370,7 +33588,7 @@ var ts; if (thisType) { return instantiateType(thisType, getContextualMapper(containingLiteral)); } - if (literal.parent.kind !== 268) { + if (literal.parent.kind !== 269) { break; } literal = literal.parent.parent; @@ -33379,9 +33597,9 @@ var ts; return contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral); } var parent = func.parent; - if (parent.kind === 198 && parent.operatorToken.kind === 58) { + if (parent.kind === 199 && parent.operatorToken.kind === 58) { var target = parent.left; - if (target.kind === 183 || target.kind === 184) { + if (target.kind === 184 || target.kind === 185) { var expression = target.expression; if (inJs && ts.isIdentifier(expression)) { var sourceFile = ts.getSourceFileOfNode(parent); @@ -33457,7 +33675,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; var name = declaration.propertyName || declaration.name; - if (parentDeclaration.kind !== 180) { + if (parentDeclaration.kind !== 181) { var parentTypeNode = ts.getEffectiveTypeAnnotationNode(parentDeclaration); if (parentTypeNode && !ts.isBindingPattern(name)) { var text = ts.getTextOfPropertyName(name); @@ -33532,7 +33750,7 @@ var ts; return getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 187) { + if (template.parent.kind === 188) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -33651,7 +33869,7 @@ var ts; var prop = _a[_i]; if (!prop.symbol) continue; - if (prop.kind !== 268) + if (prop.kind !== 269) continue; if (isDiscriminantProperty(contextualType, prop.symbol.escapedName)) { var discriminatingType = getTypeOfNode(prop.initializer); @@ -33681,51 +33899,51 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 230: + case 231: case 148: case 151: case 150: - case 180: + case 181: return getContextualTypeForInitializerExpression(node); - case 191: - case 223: + case 192: + case 224: return getContextualTypeForReturnExpression(node); - case 201: + case 202: return getContextualTypeForYieldOperand(parent); - case 185: case 186: + case 187: return getContextualTypeForArgument(parent, node); - case 188: - case 206: + case 189: + case 207: return getTypeFromTypeNode(parent.type); - case 198: + case 199: return getContextualTypeForBinaryOperand(node); - case 268: case 269: - return getContextualTypeForObjectLiteralElement(parent); case 270: + return getContextualTypeForObjectLiteralElement(parent); + case 271: return getApparentTypeOfContextualType(parent.parent); - case 181: { + case 182: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 199: + case 200: return getContextualTypeForConditionalOperand(node); - case 209: - ts.Debug.assert(parent.parent.kind === 200); + case 210: + ts.Debug.assert(parent.parent.kind === 201); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 189: { + case 190: { var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); } - case 263: + case 264: return getContextualTypeForJsxExpression(parent); - case 260: - case 262: + case 261: + case 263: return getContextualTypeForJsxAttribute(parent); + case 256: case 255: - case 254: return getContextualJsxElementAttributesType(parent); } return undefined; @@ -33776,59 +33994,53 @@ var ts; if (context.typeArguments) { signatures = ts.mapDefined(signatures, function (s) { return getJsxSignatureTypeArgumentInstantiation(s, context, isJs); }); } - return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromConstructSignature(t, isJs, context); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0); + return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, false); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0); } function getJsxPropsTypeFromCallSignature(sig, context) { - var propsType = getTypeOfFirstParameterOfSignature(sig); + var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType); var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (intrinsicAttribs !== unknownType) { propsType = intersectTypes(intrinsicAttribs, propsType); } return propsType; } - function getJsxPropsTypeFromClassType(hostClassType, isJs, context) { - if (isTypeAny(hostClassType)) { - return hostClassType; + function getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation) { + var instanceType = getReturnTypeOfSignature(sig); + return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation); + } + function getJsxPropsTypeFromClassType(sig, isJs, context, reportErrors) { + var forcedLookupLocation = getJsxElementPropertiesName(getJsxNamespaceAt(context)); + var attributesType = forcedLookupLocation === undefined + ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType) + : forcedLookupLocation === "" + ? getReturnTypeOfSignature(sig) + : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation); + if (!attributesType) { + if (reportErrors && !!forcedLookupLocation && !!ts.length(context.attributes.properties)) { + error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation)); + } + return emptyObjectType; } - var propsName = getJsxElementPropertiesName(getJsxNamespaceAt(context)); - if (propsName === undefined) { - return anyType; - } - else if (propsName === "") { - return hostClassType; + else if (isTypeAny(attributesType)) { + return attributesType; } else { - var attributesType = getTypeOfPropertyOfType(hostClassType, propsName); - if (!attributesType) { - return emptyObjectType; + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); + if (intrinsicClassAttribs !== unknownType) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + var hostClassType = getReturnTypeOfSignature(sig); + apparentAttributesType = intersectTypes(typeParams + ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) + : intrinsicClassAttribs, apparentAttributesType); } - else if (isTypeAny(attributesType)) { - return attributesType; - } - else { - var apparentAttributesType = attributesType; - var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); - if (intrinsicClassAttribs !== unknownType) { - var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) - : intrinsicClassAttribs, apparentAttributesType); - } - var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); - if (intrinsicAttribs !== unknownType) { - apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); - } - return apparentAttributesType; + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); } + return apparentAttributesType; } } - function getJsxPropsTypeFromConstructSignature(sig, isJs, context) { - var hostClassType = getReturnTypeOfSignature(sig); - if (hostClassType) { - return getJsxPropsTypeFromClassType(hostClassType, isJs, context); - } - return getJsxPropsTypeFromCallSignature(sig, context); - } function getContextualCallSignature(type, node) { var signatures = getSignaturesOfType(type, 0); if (signatures.length === 1) { @@ -33853,7 +34065,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 190 || node.kind === 191; + return node.kind === 191 || node.kind === 192; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -33915,8 +34127,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false, false); } function hasDefaultValue(node) { - return (node.kind === 180 && !!node.initializer) || - (node.kind === 198 && node.operatorToken.kind === 58); + return (node.kind === 181 && !!node.initializer) || + (node.kind === 199 && node.operatorToken.kind === 58); } function checkArrayLiteral(node, checkMode) { var elements = node.elements; @@ -33926,7 +34138,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); for (var index = 0; index < elements.length; index++) { var e = elements[index]; - if (inDestructuringPattern && e.kind === 202) { + if (inDestructuringPattern && e.kind === 203) { var restArrayType = checkExpression(e.expression, checkMode); var restElementType = getIndexTypeOfType(restArrayType, 1) || getIteratedTypeOrElementType(restArrayType, undefined, false, false, false); @@ -33939,7 +34151,7 @@ var ts; var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 202; + hasSpreadElement = hasSpreadElement || e.kind === 203; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -33949,7 +34161,7 @@ var ts; } if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 179 || pattern.kind === 181)) { + if (pattern && (pattern.kind === 180 || pattern.kind === 182)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -33957,7 +34169,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 204) { + if (patternElement.kind !== 205) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType); @@ -34029,7 +34241,7 @@ var ts; var propagatedFlags = 8388608; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 178 || contextualType.pattern.kind === 182); + (contextualType.pattern.kind === 179 || contextualType.pattern.kind === 183); var isInJSFile = ts.isInJavaScriptFile(node); var isJSObjectLiteral = !contextualType && isInJSFile; var typeFlags = 0; @@ -34050,15 +34262,15 @@ var ts; var memberDecl = node.properties[i]; var member = getSymbolOfNode(memberDecl); var literalName = void 0; - if (memberDecl.kind === 268 || - memberDecl.kind === 269 || + if (memberDecl.kind === 269 || + memberDecl.kind === 270 || ts.isObjectLiteralMethod(memberDecl)) { var jsdocType = void 0; if (isInJSFile) { jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); } var type = void 0; - if (memberDecl.kind === 268) { + if (memberDecl.kind === 269) { if (memberDecl.name.kind === 146) { var t = checkComputedPropertyName(memberDecl.name); if (t.flags & 224) { @@ -34071,7 +34283,7 @@ var ts; type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 269); + ts.Debug.assert(memberDecl.kind === 270); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } if (jsdocType) { @@ -34088,8 +34300,8 @@ var ts; prop.nameType = nameType; } if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 268 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 269 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 269 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 270 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216; } @@ -34115,7 +34327,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 270) { + else if (memberDecl.kind === 271) { if (languageVersion < 2) { checkExternalEmitHelpers(memberDecl, 2); } @@ -34225,7 +34437,7 @@ var ts; } function isJsxIntrinsicIdentifier(tagName) { switch (tagName.kind) { - case 183: + case 184: case 99: return false; case 71: @@ -34266,7 +34478,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 262); + ts.Debug.assert(attributeDecl.kind === 263); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, 0, 4096); attributesTable = ts.createSymbolTable(); @@ -34288,7 +34500,7 @@ var ts; spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, 0, 4096); } } - var parent = openingLikeElement.parent.kind === 253 ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 254 ? openingLikeElement.parent : undefined; if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { @@ -34371,19 +34583,7 @@ var ts; } return links.resolvedSymbol; } - function getJsxElementInstanceType(node, valueType) { - ts.Debug.assert(!(valueType.flags & 131072)); - if (isTypeAny(valueType)) { - return anyType; - } - var signatures = getSignaturesOfType(valueType, 1); - if (signatures.length === 0) { - signatures = getSignaturesOfType(valueType, 0); - if (signatures.length === 0) { - error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName)); - return unknownType; - } - } + function instantiateJsxSignatures(node, signatures) { var instantiatedSignatures = []; var candidateForTypeArgumentError; var hasTypeArgumentError = !!node.typeArguments; @@ -34417,7 +34617,7 @@ var ts; diagnostics.add(getTypeArgumentArityError(node, signatures, node.typeArguments)); } } - return getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2); + return instantiatedSignatures; } function getJsxSignatureTypeArgumentInstantiation(signature, node, isJavascript, reportErrors) { if (!node.typeArguments) { @@ -34552,7 +34752,10 @@ var ts; return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType); }), 2); } - if (elementType.flags & 2) { + if (isTypeAny(elementType)) { + return elementType; + } + else if (elementType.flags & 2) { return anyType; } else if (elementType.flags & 32) { @@ -34571,7 +34774,16 @@ var ts; } return anyType; } - var elemInstanceType = getJsxElementInstanceType(openingLikeElement, elementType); + var signatures = getSignaturesOfType(elementType, 1); + if (signatures.length === 0) { + signatures = getSignaturesOfType(elementType, 0); + if (signatures.length === 0) { + error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName)); + return unknownType; + } + } + var instantiatedSignatures = instantiateJsxSignatures(openingLikeElement, signatures); + var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2); var statelessAttributesType = shouldIncludeAllStatelessAttributesType ? tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) : defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType); @@ -34581,7 +34793,8 @@ var ts; if (elementClassType) { checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); } - return getJsxPropsTypeFromClassType(elemInstanceType, ts.isInJavaScriptFile(openingLikeElement), openingLikeElement); + var isJs = ts.isInJavaScriptFile(openingLikeElement); + return getUnionType(ts.map(instantiatedSignatures, function (sig) { return getJsxPropsTypeFromClassType(sig, isJs, openingLikeElement, true); })); } function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) { ts.Debug.assert(isJsxIntrinsicIdentifier(node.tagName)); @@ -34701,23 +34914,18 @@ var ts; getIntrinsicAttributesTypeFromJsxOpeningLikeElement(openingLikeElement) : getCustomJsxElementAttributesType(openingLikeElement, false); var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode); - if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || getPropertiesOfType(sourceAttributesType).length > 0)) { - error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(getJsxElementPropertiesName(getJsxNamespaceAt(openingLikeElement)))); - } - else { - var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); - if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { - for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { - var attribute = _a[_i]; - if (!ts.isJsxAttribute(attribute)) { - continue; - } - var attrName = attribute.name; - var isNotIgnoredJsxProperty = (isUnhyphenatedJsxName(ts.idText(attrName)) || !!(getPropertyOfType(targetAttributesType, attrName.escapedText))); - if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, true)) { - error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); - break; - } + var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); + if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { + for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { + var attribute = _a[_i]; + if (!ts.isJsxAttribute(attribute)) { + continue; + } + var attrName = attribute.name; + var isNotIgnoredJsxProperty = (isUnhyphenatedJsxName(ts.idText(attrName)) || !!(getPropertyOfType(targetAttributesType, attrName.escapedText))); + if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, true)) { + error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); + break; } } } @@ -34740,16 +34948,23 @@ var ts; function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } - function isMethodLike(symbol) { - return !!(symbol.flags & 8192 || - ts.getCheckFlags(symbol) & 4 || - ts.isInJavaScriptFile(symbol.valueDeclaration) && ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(symbol.valueDeclaration))); + function isPrototypeProperty(symbol) { + if (symbol.flags & 8192 || ts.getCheckFlags(symbol) & 4) { + return true; + } + if (ts.isInJavaScriptFile(symbol.valueDeclaration)) { + var parent = symbol.valueDeclaration.parent; + return parent && ts.isBinaryExpression(parent) && + ts.getSpecialPropertyAssignmentKind(parent) === 3; + } } function checkPropertyAccessibility(node, left, type, prop) { var flags = ts.getDeclarationModifierFlagsFromSymbol(prop); - var errorNode = node.kind === 183 || node.kind === 230 ? + var errorNode = node.kind === 184 || node.kind === 231 ? node.name : - node.right; + node.kind === 178 ? + node : + node.right; if (ts.getCheckFlags(prop) & 256) { error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); return false; @@ -34876,7 +35091,7 @@ var ts; } propType = getConstraintForLocation(getTypeOfSymbol(prop), node); } - if (node.kind !== 183 || + if (node.kind !== 184 || assignmentKind === 1 || prop && !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 131072)) { return propType; @@ -34908,7 +35123,7 @@ var ts; && !isPropertyDeclaredInAncestorClass(prop)) { error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.idText(right)); } - else if (valueDeclaration.kind === 233 && + else if (valueDeclaration.kind === 234 && node.parent.kind !== 161 && !(valueDeclaration.flags & 2097152) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { @@ -34920,7 +35135,7 @@ var ts; switch (node.kind) { case 151: return true; - case 268: + case 269: return false; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -34933,11 +35148,11 @@ var ts; } var classType = getTypeOfSymbol(prop.parent); while (true) { - classType = getSuperClass(classType); + classType = classType.symbol && getSuperClass(classType); if (!classType) { return false; } - var superProperty = getPropertyOfObjectType(classType, prop.escapedName); + var superProperty = getPropertyOfType(classType, prop.escapedName); if (superProperty && superProperty.valueDeclaration) { return true; } @@ -34948,8 +35163,7 @@ var ts; if (x.length === 0) { return undefined; } - ts.Debug.assert(x.length === 1); - return x[0]; + return getIntersectionType(x); } function reportNonexistentProperty(propNode, containingType) { var errorInfo; @@ -35079,11 +35293,17 @@ var ts; (ts.getCheckFlags(prop) & 1 ? getSymbolLinks(prop).target : prop).isReferenced = 67108863; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 183 ? node.expression : node.left; - return isValidPropertyAccessWithType(node, left, propertyName, getWidenedType(checkExpression(left))); + switch (node.kind) { + case 184: + return isValidPropertyAccessWithType(node, node.expression, propertyName, getWidenedType(checkExpression(node.expression))); + case 145: + return isValidPropertyAccessWithType(node, node.left, propertyName, getWidenedType(checkExpression(node.left))); + case 178: + return isValidPropertyAccessWithType(node, node, propertyName, getTypeFromTypeNode(node)); + } } function isValidPropertyAccessForCompletions(node, type, property) { - return isValidPropertyAccessWithType(node, node.expression, property.escapedName, type) + return isValidPropertyAccessWithType(node, node.kind === 178 ? node : node.expression, property.escapedName, type) && (!(property.flags & 8192) || isValidMethodAccess(property, type)); } function isValidMethodAccess(method, actualThisType) { @@ -35113,7 +35333,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 231) { + if (initializer.kind === 232) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -35135,7 +35355,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 219 && + if (node.kind === 220 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -35153,7 +35373,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 186 && node.parent.expression === node) { + if (node.parent.kind === 187 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -35212,7 +35432,7 @@ var ts; if (callLikeExpressionMayHaveTypeArguments(node)) { ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 187) { + if (node.kind === 188) { checkExpression(node.template); } else if (node.kind !== 149) { @@ -35266,7 +35486,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 202) { + if (arg && arg.kind === 203) { return i; } } @@ -35281,10 +35501,10 @@ var ts; if (ts.isJsxOpeningLikeElement(node)) { return true; } - if (node.kind === 187) { + if (node.kind === 188) { argCount = args.length; typeArguments = undefined; - if (node.template.kind === 200) { + if (node.template.kind === 201) { var lastSpan = ts.lastOrUndefined(node.template.templateSpans); ts.Debug.assert(lastSpan !== undefined); callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; @@ -35301,7 +35521,7 @@ var ts; } else { if (!node.arguments) { - ts.Debug.assert(node.kind === 186); + ts.Debug.assert(node.kind === 187); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -35385,7 +35605,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 204) { + if (arg === undefined || arg.kind !== 205) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -35450,7 +35670,7 @@ var ts; return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 186) { + if (thisType && thisType !== voidType && node.kind !== 187) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; @@ -35463,7 +35683,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 204) { + if (arg === undefined || arg.kind !== 205) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i) || checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); @@ -35477,21 +35697,18 @@ var ts; return true; } function getThisArgumentOfCall(node) { - if (node.kind === 185) { - var callee = node.expression; - if (callee.kind === 183) { - return callee.expression; - } - else if (callee.kind === 184) { + if (node.kind === 186) { + var callee = ts.skipOuterExpressions(node.expression); + if (callee.kind === 184 || callee.kind === 185) { return callee.expression; } } } function getEffectiveCallArguments(node) { - if (node.kind === 187) { + if (node.kind === 188) { var template = node.template; var args_4 = [undefined]; - if (template.kind === 200) { + if (template.kind === 201) { ts.forEach(template.templateSpans, function (span) { args_4.push(span.expression); }); @@ -35511,8 +35728,8 @@ var ts; function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 149) { switch (node.parent.kind) { - case 233: - case 203: + case 234: + case 204: return 1; case 151: return 2; @@ -35532,7 +35749,7 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 233) { + if (node.kind === 234) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } @@ -35553,7 +35770,7 @@ var ts; return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 233) { + if (node.kind === 234) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } @@ -35591,7 +35808,7 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 233) { + if (node.kind === 234) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } @@ -35628,14 +35845,14 @@ var ts; if (node.kind === 149) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 187) { + else if (argIndex === 0 && node.kind === 188) { return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { if (node.kind === 149 || - (argIndex === 0 && node.kind === 187)) { + (argIndex === 0 && node.kind === 188)) { return undefined; } return args[argIndex]; @@ -35644,7 +35861,7 @@ var ts; if (node.kind === 149) { return node.expression; } - else if (argIndex === 0 && node.kind === 187) { + else if (argIndex === 0 && node.kind === 188) { return node.template; } else { @@ -35663,7 +35880,7 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, paramCount, typeArguments.length); } function resolveCall(node, signatures, candidatesOutArray, fallbackError) { - var isTaggedTemplate = node.kind === 187; + var isTaggedTemplate = node.kind === 188; var isDecorator = node.kind === 149; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var typeArguments; @@ -35697,7 +35914,7 @@ var ts; var candidateForArgumentError; var candidateForTypeArgumentError; var result; - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 185 && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 186 && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma); } @@ -36006,8 +36223,8 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 233: - case 203: + case 234: + case 204: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 148: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; @@ -36075,16 +36292,16 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 185: - return resolveCallExpression(node, candidatesOutArray); case 186: - return resolveNewExpression(node, candidatesOutArray); + return resolveCallExpression(node, candidatesOutArray); case 187: + return resolveNewExpression(node, candidatesOutArray); + case 188: return resolveTaggedTemplateExpression(node, candidatesOutArray); case 149: return resolveDecorator(node, candidatesOutArray); + case 256: case 255: - case 254: return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray) || unknownSignature; } ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -36146,14 +36363,13 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 183) { + while (parent && parent.kind === 184) { parent = parent.parent; } - return parent && ts.isBinaryExpression(parent) && - ts.isPrototypeAccess(parent.left) && - parent.operatorToken.kind === 58 && - ts.isObjectLiteralExpression(parent.right) && - parent.right; + if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 58) { + var right = ts.getInitializerOfBinaryExpression(parent); + return ts.isObjectLiteralExpression(right) && right; + } } function getInferredClassType(symbol) { var links = getSymbolLinks(symbol); @@ -36174,7 +36390,7 @@ var ts; if (node.expression.kind === 97) { return voidType; } - if (node.kind === 186) { + if (node.kind === 187) { var declaration = signature.declaration; if (declaration && declaration.kind !== 154 && @@ -36281,9 +36497,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 232 + ? 233 : resolvedRequire.flags & 3 - ? 230 + ? 231 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -36347,7 +36563,10 @@ var ts; pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function getTypeOfFirstParameterOfSignature(signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType); + } + function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType; } function inferFromAnnotatedParameters(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -36443,7 +36662,7 @@ var ts; } var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 211) { + if (func.body.kind !== 212) { type = checkExpressionCached(func.body, checkMode); if (functionFlags & 2) { type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); @@ -36546,7 +36765,7 @@ var ts; if (!(func.flags & 128)) { return false; } - if (ts.some(func.body.statements, function (statement) { return statement.kind === 225 && isExhaustiveSwitchStatement(statement); })) { + if (ts.some(func.body.statements, function (statement) { return statement.kind === 226 && isExhaustiveSwitchStatement(statement); })) { return false; } return true; @@ -36583,11 +36802,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 190: case 191: + case 192: return true; case 153: - return func.parent.kind === 182; + return func.parent.kind === 183; default: return false; } @@ -36599,7 +36818,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 2048)) { return; } - if (func.kind === 152 || ts.nodeIsMissing(func.body) || func.body.kind !== 211 || !functionHasImplicitReturn(func)) { + if (func.kind === 152 || ts.nodeIsMissing(func.body) || func.body.kind !== 212 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -36631,7 +36850,7 @@ var ts; return anyFunctionType; } var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 190) { + if (!hasGrammarError && node.kind === 191) { checkGrammarForGenerator(node); } var links = getNodeLinks(node); @@ -36662,11 +36881,6 @@ var ts; checkNodeDeferred(node); } } - if (produceDiagnostics && node.kind !== 153) { - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); - } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { @@ -36684,7 +36898,7 @@ var ts; if (!returnTypeNode) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 211) { + if (node.body.kind === 212) { checkSourceElement(node.body); } else { @@ -36719,7 +36933,7 @@ var ts; function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 && - (expr.kind === 183 || expr.kind === 184) && + (expr.kind === 184 || expr.kind === 185) && expr.expression.kind === 99) { var func = ts.getContainingFunction(expr); if (!(func && func.kind === 154)) { @@ -36732,13 +36946,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 183 || expr.kind === 184) { + if (expr.kind === 184 || expr.kind === 185) { var node = ts.skipParentheses(expr.expression); if (node.kind === 71) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 2097152) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 244; + return declaration && declaration.kind === 245; } } } @@ -36746,7 +36960,7 @@ var ts; } function checkReferenceExpression(expr, invalidReferenceMessage) { var node = ts.skipOuterExpressions(expr, 2 | 1); - if (node.kind !== 71 && node.kind !== 183 && node.kind !== 184) { + if (node.kind !== 71 && node.kind !== 184 && node.kind !== 185) { error(expr, invalidReferenceMessage); return false; } @@ -36755,7 +36969,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 183 && expr.kind !== 184) { + if (expr.kind !== 184 && expr.kind !== 185) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -36906,6 +37120,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; + checkGrammarForDisallowedTrailingComma(properties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); if (strictNullChecks && properties.length === 0) { return checkNonNullType(sourceType, node); } @@ -36916,7 +37131,7 @@ var ts; return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 268 || property.kind === 269) { + if (property.kind === 269 || property.kind === 270) { var name = property.name; if (name.kind === 146) { checkComputedPropertyName(name); @@ -36931,7 +37146,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 269) { + if (property.kind === 270) { return checkDestructuringAssignment(property, type); } else { @@ -36942,7 +37157,7 @@ var ts; error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 270) { + else if (property.kind === 271) { if (languageVersion < 6) { checkExternalEmitHelpers(property, 4); } @@ -36960,11 +37175,12 @@ var ts; } } function checkArrayLiteralAssignment(node, sourceType, checkMode) { + var elements = node.elements; + checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); if (languageVersion < 2 && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512); } var elementType = checkIteratedTypeOrElementType(sourceType, node, false, false) || unknownType; - var elements = node.elements; for (var i = 0; i < elements.length; i++) { checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); } @@ -36973,8 +37189,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 204) { - if (element.kind !== 202) { + if (element.kind !== 205) { + if (element.kind !== 203) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -37000,7 +37216,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 198 && restExpression.operatorToken.kind === 58) { + if (restExpression.kind === 199 && restExpression.operatorToken.kind === 58) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -37013,7 +37229,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 269) { + if (exprOrAssignment.kind === 270) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -37027,21 +37243,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 198 && target.operatorToken.kind === 58) { + if (target.kind === 199 && target.operatorToken.kind === 58) { checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 182) { + if (target.kind === 183) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 181) { + if (target.kind === 182) { 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 === 270 ? + var error = target.parent.kind === 271 ? 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; if (checkReferenceExpression(target, error)) { @@ -37055,35 +37271,35 @@ var ts; case 71: case 9: case 12: - case 187: - case 200: + case 188: + case 201: case 13: case 8: case 101: case 86: case 95: case 140: - case 190: - case 203: case 191: - case 181: + case 204: + case 192: case 182: - case 193: - case 207: + case 183: + case 194: + case 208: + case 255: case 254: - case 253: return true; - case 199: + case 200: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 198: + case 199: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 196: case 197: + case 198: switch (node.operator) { case 51: case 37: @@ -37092,9 +37308,9 @@ var ts; return true; } return false; - case 194: - case 188: - case 206: + case 195: + case 189: + case 207: default: return false; } @@ -37110,7 +37326,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 58 && (left.kind === 182 || left.kind === 181)) { + if (operator === 58 && (left.kind === 183 || left.kind === 182)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); } var leftType = checkExpression(left, checkMode); @@ -37329,12 +37545,14 @@ var ts; } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { - checkExpression(templateSpan.expression); + if (maybeTypeOfKind(checkExpression(templateSpan.expression), 1536)) { + error(templateSpan.expression, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1, typeToString(esSymbolType), typeToString(stringType)); + } }); return stringType; } function getContextNode(node) { - if (node.kind === 261) { + if (node.kind === 262) { return node.parent.parent; } return node; @@ -37367,7 +37585,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 188 || node.kind === 206; + return node.kind === 189 || node.kind === 207; } function checkDeclarationInitializer(declaration) { var inJs = ts.isInJavaScriptFile(declaration); @@ -37451,7 +37669,7 @@ var ts; return type; } function getTypeOfExpression(node, cache) { - if (node.kind === 185 && node.expression.kind !== 97 && !ts.isRequireCall(node, true) && !isSymbolOrSymbolForCall(node)) { + if (node.kind === 186 && node.expression.kind !== 97 && !ts.isRequireCall(node, true) && !isSymbolOrSymbolForCall(node)) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -37477,8 +37695,8 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 183 && node.parent.expression === node) || - (node.parent.kind === 184 && node.parent.expression === node) || + var ok = (node.parent.kind === 184 && node.parent.expression === node) || + (node.parent.kind === 185 && node.parent.expression === node) || ((node.kind === 71 || node.kind === 145) && isInRightSideOfImportOrExportAssignment(node) || (node.parent.kind === 164 && node.parent.exprName === node)); if (!ok) { @@ -37514,73 +37732,73 @@ var ts; return trueType; case 86: return falseType; - case 200: + case 201: return checkTemplateExpression(node); case 12: return globalRegExpType; - case 181: - return checkArrayLiteral(node, checkMode); case 182: - return checkObjectLiteral(node, checkMode); + return checkArrayLiteral(node, checkMode); case 183: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, checkMode); case 184: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 185: + return checkIndexedAccess(node); + case 186: if (node.expression.kind === 91) { return checkImportCallExpression(node); } - case 186: - return checkCallExpression(node); case 187: - return checkTaggedTemplateExpression(node); - case 189: - return checkParenthesizedExpression(node, checkMode); - case 203: - return checkClassExpression(node); - case 190: - case 191: - return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 193: - return checkTypeOfExpression(node); + return checkCallExpression(node); case 188: - case 206: - return checkAssertion(node); - case 207: - return checkNonNullAssertion(node); - case 208: - return checkMetaProperty(node); - case 192: - return checkDeleteExpression(node); - case 194: - return checkVoidExpression(node); - case 195: - return checkAwaitExpression(node); - case 196: - return checkPrefixUnaryExpression(node); - case 197: - return checkPostfixUnaryExpression(node); - case 198: - return checkBinaryExpression(node, checkMode); - case 199: - return checkConditionalExpression(node, checkMode); - case 202: - return checkSpreadExpression(node, checkMode); + return checkTaggedTemplateExpression(node); + case 190: + return checkParenthesizedExpression(node, checkMode); case 204: + return checkClassExpression(node); + case 191: + case 192: + return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + case 194: + return checkTypeOfExpression(node); + case 189: + case 207: + return checkAssertion(node); + case 208: + return checkNonNullAssertion(node); + case 209: + return checkMetaProperty(node); + case 193: + return checkDeleteExpression(node); + case 195: + return checkVoidExpression(node); + case 196: + return checkAwaitExpression(node); + case 197: + return checkPrefixUnaryExpression(node); + case 198: + return checkPostfixUnaryExpression(node); + case 199: + return checkBinaryExpression(node, checkMode); + case 200: + return checkConditionalExpression(node, checkMode); + case 203: + return checkSpreadExpression(node, checkMode); + case 205: return undefinedWideningType; - case 201: + case 202: return checkYieldExpression(node); - case 263: + case 264: return checkJsxExpression(node, checkMode); - case 253: - return checkJsxElement(node, checkMode); case 254: - return checkJsxSelfClosingElement(node, checkMode); - case 257: - return checkJsxFragment(node, checkMode); - case 261: - return checkJsxAttributes(node, checkMode); + return checkJsxElement(node, checkMode); case 255: + return checkJsxSelfClosingElement(node, checkMode); + case 258: + return checkJsxFragment(node, checkMode); + case 262: + return checkJsxAttributes(node, checkMode); + case 256: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -37685,10 +37903,10 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 191: + case 192: case 157: - case 232: - case 190: + case 233: + case 191: case 162: case 153: case 152: @@ -37709,7 +37927,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 === 179 || name.kind === 178) { + else if (name.kind === 180 || name.kind === 179) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -37720,7 +37938,7 @@ var ts; if (node.kind === 159) { checkGrammarIndexSignature(node); } - else if (node.kind === 162 || node.kind === 232 || node.kind === 163 || + else if (node.kind === 162 || node.kind === 233 || node.kind === 163 || node.kind === 157 || node.kind === 154 || node.kind === 158) { checkGrammarFunctionLikeDeclaration(node); @@ -37890,7 +38108,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 234) { + if (node.kind === 235) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -37977,7 +38195,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 214 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 215 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -38136,7 +38354,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType))) { - if (accessNode.kind === 184 && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 185 && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 && getMappedTypeModifiers(objectType) & 1) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -38176,14 +38394,18 @@ var ts; } checkSourceElement(node.typeParameter); } + function checkImportType(node) { + checkSourceElement(node.argument); + getTypeFromTypeNode(node); + } function isPrivateWithinAmbient(node) { return ts.hasModifier(node, 8) && !!(node.flags & 2097152); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 234 && - n.parent.kind !== 233 && - n.parent.kind !== 203 && + if (n.parent.kind !== 235 && + n.parent.kind !== 234 && + n.parent.kind !== 204 && n.flags & 2097152) { if (!(flags & 2)) { flags |= 1; @@ -38296,11 +38518,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = node.flags & 2097152; - var inAmbientContextOrInterface = node.parent.kind === 234 || node.parent.kind === 165 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 235 || node.parent.kind === 165 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 232 || node.kind === 153 || node.kind === 152 || node.kind === 154) { + if (node.kind === 233 || node.kind === 153 || node.kind === 152 || node.kind === 154) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -38419,30 +38641,30 @@ var ts; })(DeclarationSpaces || (DeclarationSpaces = {})); function getDeclarationSpaces(d) { switch (d.kind) { - case 234: case 235: - case 291: + case 236: + case 292: return 2; - case 237: + case 238: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4 | 1 : 4; - case 233: - case 236: + case 234: + case 237: return 2 | 1; - case 272: + case 273: return 2 | 1 | 4; - case 241: + case 242: + case 245: case 244: - case 243: var result_2 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); }); return result_2; - case 230: - case 180: - case 232: - case 246: + case 231: + case 181: + case 233: + case 247: return 1; default: ts.Debug.fail(ts.Debug.showSyntaxKind(d)); @@ -38597,7 +38819,7 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 233: + case 234: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); @@ -38704,7 +38926,7 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 233: + case 234: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -38741,9 +38963,6 @@ var ts; if (produceDiagnostics) { checkFunctionOrMethodDeclaration(node); checkGrammarForGenerator(node); - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -38793,7 +39012,7 @@ var ts; switch (node.kind) { case 71: return node; - case 183: + case 184: return node.name; default: return undefined; @@ -38848,29 +39067,29 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 272: - case 237: + case 273: + case 238: checkUnusedModuleMembers(node); break; - case 233: - case 203: + case 234: + case 204: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 234: + case 235: checkUnusedTypeParameters(node); break; - case 211: - case 239: - case 218: + case 212: + case 240: case 219: case 220: + case 221: checkUnusedLocalsAndParameters(node); break; case 154: - case 190: - case 232: case 191: + case 233: + case 192: case 153: case 155: case 156: @@ -38884,7 +39103,7 @@ var ts; case 158: case 162: case 163: - case 235: + case 236: checkUnusedTypeParameters(node); break; default: @@ -38925,7 +39144,7 @@ var ts; var node = ts.getNameOfDeclaration(declaration) || declaration; if (isIdentifierThatStartsWithUnderScore(node)) { var declaration_2 = ts.getRootDeclaration(node.parent); - if ((declaration_2.kind === 230 && ts.isForInOrOfStatement(declaration_2.parent.parent)) || + if ((declaration_2.kind === 231 && ts.isForInOrOfStatement(declaration_2.parent.parent)) || declaration_2.kind === 147) { return; } @@ -38966,7 +39185,7 @@ var ts; } break; case 159: - case 210: + case 211: break; default: ts.Debug.fail(); @@ -39036,18 +39255,18 @@ var ts; } } function isImportedDeclaration(node) { - return node.kind === 243 || node.kind === 246 || node.kind === 244; + return node.kind === 244 || node.kind === 247 || node.kind === 245; } function importClauseFromImported(decl) { - return decl.kind === 243 ? decl : decl.kind === 244 ? decl.parent : decl.parent.parent; + return decl.kind === 244 ? decl : decl.kind === 245 ? decl.parent : decl.parent.parent; } function forEachImportedDeclaration(importClause, cb) { var defaultName = importClause.name, namedBindings = importClause.namedBindings; return (defaultName && cb(importClause)) || - namedBindings && (namedBindings.kind === 244 ? cb(namedBindings) : ts.forEach(namedBindings.elements, cb)); + namedBindings && (namedBindings.kind === 245 ? cb(namedBindings) : ts.forEach(namedBindings.elements, cb)); } function checkBlock(node) { - if (node.kind === 211) { + if (node.kind === 212) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -39093,16 +39312,6 @@ var ts; } return true; } - function checkCollisionWithCapturedThisVariable(node, name) { - if (languageVersion <= 1 && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_this")) { - potentialThisCollisions.push(node); - } - } - function checkCollisionWithCapturedNewTargetVariable(node, name) { - if (languageVersion <= 1 && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_newTarget")) { - potentialNewTargetCollisions.push(node); - } - } function checkIfThisIsCapturedInEnclosingScope(node) { ts.findAncestor(node, function (current) { if (getNodeCheckFlags(current) & 4) { @@ -39131,27 +39340,6 @@ var ts; } }); } - function checkCollisionWithCapturedSuperVariable(node, name) { - if (languageVersion >= 2 || compilerOptions.noEmit) { - return; - } - if (!needCollisionCheckForIdentifier(node, name, "_super")) { - return; - } - var enclosingClass = ts.getContainingClass(node); - if (!enclosingClass || enclosingClass.flags & 2097152) { - return; - } - if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_3 = node.kind !== 71; - if (isDeclaration_3) { - error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); - } - else { - error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference); - } - } - } function checkCollisionWithRequireExportsInGeneratedCode(node, name) { if (modulekind >= ts.ModuleKind.ES2015 || compilerOptions.noEmit) { return; @@ -39163,7 +39351,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 272 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 273 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -39175,7 +39363,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 272 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { + if (parent.kind === 273 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(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)); } } @@ -39183,7 +39371,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 230 && !node.initializer) { + if (node.kind === 231 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -39195,15 +39383,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 231); - var container = varDeclList.parent.kind === 212 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 232); + var container = varDeclList.parent.kind === 213 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 211 && ts.isFunctionLike(container.parent) || + (container.kind === 212 && ts.isFunctionLike(container.parent) || + container.kind === 239 || container.kind === 238 || - container.kind === 237 || - container.kind === 272); + container.kind === 273); 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); @@ -39222,7 +39410,7 @@ var ts; if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { return; } - if (n.kind === 183) { + if (n.kind === 184) { return visit(n.expression); } else if (n.kind === 71) { @@ -39237,7 +39425,7 @@ var ts; var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { if (symbol.valueDeclaration.kind === 148 || - symbol.valueDeclaration.kind === 180) { + symbol.valueDeclaration.kind === 181) { if (symbol.valueDeclaration.pos < node.pos) { return; } @@ -39278,8 +39466,8 @@ var ts; checkExpressionCached(node.initializer); } } - if (node.kind === 180) { - if (node.parent.kind === 178 && languageVersion < 6) { + if (node.kind === 181) { + if (node.parent.kind === 179 && languageVersion < 6) { checkExternalEmitHelpers(node, 4); } if (node.propertyName && node.propertyName.kind === 146) { @@ -39297,7 +39485,7 @@ var ts; } } if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 179 && languageVersion < 2 && compilerOptions.downlevelIteration) { + if (node.name.kind === 180 && languageVersion < 2 && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512); } ts.forEach(node.name.elements, checkSourceElement); @@ -39307,7 +39495,7 @@ var ts; return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 219) { + if (node.initializer && node.parent.parent.kind !== 220) { var initializerType = checkExpressionCached(node.initializer); if (strictNullChecks && node.name.elements.length === 0) { checkNonNullType(initializerType, node); @@ -39322,7 +39510,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfSymbol(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 219) { + if (node.initializer && node.parent.parent.kind !== 220) { var initializer = ts.isInJavaScriptFile(node) && ts.getDeclaredJavascriptInitializer(node) || node.initializer; checkTypeAssignableTo(checkExpressionCached(initializer), type, node, undefined); checkParameterInitializer(node); @@ -39345,12 +39533,9 @@ var ts; } if (node.kind !== 151 && node.kind !== 150) { checkExportsOnMergedDeclarations(node); - if (node.kind === 230 || node.kind === 180) { + if (node.kind === 231 || node.kind === 181) { checkVarDeclaredNamesNotShadowed(node); } - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -39363,8 +39548,8 @@ var ts; error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType)); } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 148 && right.kind === 230) || - (left.kind === 230 && right.kind === 148)) { + if ((left.kind === 148 && right.kind === 231) || + (left.kind === 231 && right.kind === 148)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -39399,7 +39584,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 213) { + if (node.thenStatement.kind === 214) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -39416,12 +39601,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 231) { + if (node.initializer && node.initializer.kind === 232) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 231) { + if (node.initializer.kind === 232) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -39439,24 +39624,22 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.kind === 220) { - if (node.awaitModifier) { - var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); - if ((functionFlags & (4 | 2)) === 2 && languageVersion < 6) { - checkExternalEmitHelpers(node, 16384); - } - } - else if (compilerOptions.downlevelIteration && languageVersion < 2) { - checkExternalEmitHelpers(node, 256); + if (node.awaitModifier) { + var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); + if ((functionFlags & (4 | 2)) === 2 && languageVersion < 6) { + checkExternalEmitHelpers(node, 16384); } } - if (node.initializer.kind === 231) { + else if (compilerOptions.downlevelIteration && languageVersion < 2) { + checkExternalEmitHelpers(node, 256); + } + if (node.initializer.kind === 232) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); - if (varExpr.kind === 181 || varExpr.kind === 182) { + if (varExpr.kind === 182 || varExpr.kind === 183) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -39475,7 +39658,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 231) { + if (node.initializer.kind === 232) { 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); @@ -39485,7 +39668,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 181 || varExpr.kind === 182) { + if (varExpr.kind === 182 || varExpr.kind === 183) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -39495,8 +39678,8 @@ var ts; checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - if (!isTypeAssignableToKind(rightType, 134217728 | 7372800)) { - error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); + if (rightType === neverType || !isTypeAssignableToKind(rightType, 134217728 | 7372800)) { + error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)); } checkSourceElement(node.statement); if (node.locals) { @@ -39521,6 +39704,10 @@ var ts; return getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables, true) || anyType; } function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables, checkAssignability) { + if (inputType === neverType) { + reportTypeNotIterableError(errorNode, inputType, allowAsyncIterables); + return undefined; + } var uplevelIteration = languageVersion >= 2; var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; if (uplevelIteration || downlevelIteration || allowAsyncIterables) { @@ -39558,13 +39745,18 @@ var ts; } if (!isArrayLikeType(arrayType)) { if (errorNode && !reportedError) { + var isIterable = !!getIteratedTypeOfIterable(inputType, undefined, allowAsyncIterables, true, checkAssignability); var diagnostic = !allowStringInput || hasStringConstituent ? downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator - : ts.Diagnostics.Type_0_is_not_an_array_type + : isIterable + ? ts.Diagnostics.Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators + : ts.Diagnostics.Type_0_is_not_an_array_type : downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + : isIterable + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(errorNode, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : undefined; @@ -39611,9 +39803,7 @@ var ts; var signatures = methodType && getSignaturesOfType(methodType, 0); if (!ts.some(signatures)) { if (errorNode) { - error(errorNode, allowAsyncIterables - ? ts.Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator - : ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); + reportTypeNotIterableError(errorNode, type, allowAsyncIterables); errorNode = undefined; } return undefined; @@ -39630,6 +39820,11 @@ var ts; : typeAsIterable.iteratedTypeOfIterable = iteratedType; } } + function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) { + error(errorNode, allowAsyncIterables + ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator, typeToString(type)); + } function getIteratedTypeOfIterator(type, errorNode, isAsyncIterator) { if (isTypeAny(type)) { return undefined; @@ -39767,7 +39962,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 265 && !hasDuplicateDefaultClause) { + if (clause.kind === 266 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -39779,7 +39974,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 264) { + if (produceDiagnostics && clause.kind === 265) { var caseType = checkExpression(clause.expression); var caseIsLiteral = isLiteralType(caseType); var comparedExpressionType = expressionType; @@ -39803,7 +39998,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 226 && current.label.escapedText === node.label.escapedText) { + if (current.kind === 227 && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -39896,7 +40091,7 @@ var ts; } var errorNode; if (propDeclaration && - (propDeclaration.kind === 198 || + (propDeclaration.kind === 199 || ts.getNameOfDeclaration(propDeclaration).kind === 146 || prop.parent === containingType.symbol)) { errorNode = propDeclaration; @@ -40024,8 +40219,6 @@ var ts; checkDecorators(node); if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -40154,7 +40347,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 233 || d.kind === 234; + return d.kind === 234 || d.kind === 235; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -40172,7 +40365,7 @@ var ts; if (derived === base) { var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128))) { - if (derivedClassDecl.kind === 203) { + if (derivedClassDecl.kind === 204) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -40185,11 +40378,11 @@ var ts; if (baseDeclarationFlags & 8 || derivedDeclarationFlags & 8) { continue; } - if (isMethodLike(base) && isMethodLike(derived) || base.flags & 98308 && derived.flags & 98308) { + if (isPrototypeProperty(base) && isPrototypeProperty(derived) || base.flags & 98308 && derived.flags & 98308) { continue; } var errorMessage = void 0; - if (isMethodLike(base)) { + if (isPrototypeProperty(base)) { if (derived.flags & 98304) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } @@ -40197,11 +40390,11 @@ var ts; errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } - else if (base.flags & 4) { - errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + else if (base.flags & 98304) { + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } @@ -40281,7 +40474,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 234); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 235); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -40377,7 +40570,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 196: + case 197: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -40387,7 +40580,7 @@ var ts; } } break; - case 198: + case 199: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -40412,18 +40605,18 @@ var ts; case 8: checkGrammarNumericLiteral(expr); return +expr.text; - case 189: + case 190: return evaluate(expr.expression); case 71: return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), expr.escapedText); + case 185: case 184: - case 183: var ex = expr; if (isConstantMemberAccess(ex)) { var type = getTypeOfExpression(ex.expression); if (type.symbol && type.symbol.flags & 384) { var name = void 0; - if (ex.kind === 183) { + if (ex.kind === 184) { name = ex.name.escapedText; } else { @@ -40455,8 +40648,8 @@ var ts; } function isConstantMemberAccess(node) { return node.kind === 71 || - node.kind === 183 && isConstantMemberAccess(node.expression) || - node.kind === 184 && isConstantMemberAccess(node.expression) && + node.kind === 184 && isConstantMemberAccess(node.expression) || + node.kind === 185 && isConstantMemberAccess(node.expression) && node.argumentExpression.kind === 9; } function checkEnumDeclaration(node) { @@ -40465,8 +40658,6 @@ var ts; } checkGrammarDecoratorsAndModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -40487,7 +40678,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 236) { + if (declaration.kind !== 237) { return false; } var enumDeclaration = declaration; @@ -40510,8 +40701,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { var declaration = declarations_7[_i]; - if ((declaration.kind === 233 || - (declaration.kind === 232 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 234 || + (declaration.kind === 233 && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 2097152)) { return declaration; } @@ -40551,7 +40742,6 @@ var ts; } } if (ts.isIdentifier(node.name)) { - checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -40570,7 +40760,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, 233); + var mergedClass = ts.getDeclarationOfKind(symbol, 234); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -40613,22 +40803,22 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 212: + case 213: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 247: case 248: + case 249: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 241: case 242: + case 243: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 180: - case 230: + case 181: + case 231: var name = node.name; if (ts.isBindingPattern(name)) { for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { @@ -40637,12 +40827,12 @@ var ts; } break; } - case 233: - case 236: - case 232: case 234: case 237: + case 233: case 235: + case 238: + case 236: if (isGlobalAugmentation) { return; } @@ -40665,7 +40855,7 @@ var ts; node = node.left; } while (node.kind !== 71); return node; - case 183: + case 184: do { node = node.expression; } while (node.kind !== 71); @@ -40681,9 +40871,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 238 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 272 && !inAmbientExternalModule) { - error(moduleName, node.kind === 248 ? + var inAmbientExternalModule = node.parent.kind === 239 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 273 && !inAmbientExternalModule) { + error(moduleName, node.kind === 249 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -40704,13 +40894,13 @@ var ts; (symbol.flags & 67901928 ? 67901928 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 250 ? + var message = node.kind === 251 ? 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)); } if (compilerOptions.isolatedModules - && node.kind === 250 + && node.kind === 251 && !(target.flags & 67216319) && !(node.flags & 2097152)) { error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided); @@ -40718,7 +40908,6 @@ var ts; } } function checkImportBinding(node) { - checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkAliasSymbol(node); @@ -40737,7 +40926,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 244) { + if (importClause.namedBindings.kind === 245) { checkImportBinding(importClause.namedBindings); } else { @@ -40757,7 +40946,7 @@ var ts; if (ts.hasModifier(node, 1)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 252) { + if (node.moduleReference.kind !== 253) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 67216319) { @@ -40788,10 +40977,10 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 238 && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 238 && + var inAmbientExternalModule = node.parent.kind === 239 && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 239 && !node.moduleSpecifier && node.flags & 2097152; - if (node.parent.kind !== 272 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 273 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -40807,7 +40996,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 272 || node.parent.kind === 238 || node.parent.kind === 237; + var isInAppropriateContext = node.parent.kind === 273 || node.parent.kind === 239 || node.parent.kind === 238; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -40833,8 +41022,8 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 272 ? node.parent : node.parent.parent; - if (container.kind === 237 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 273 ? node.parent : node.parent.parent; + if (container.kind === 238 && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -40913,7 +41102,7 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 232 && declaration.kind !== 153) || + return (declaration.kind !== 233 && declaration.kind !== 153) || !!declaration.body; } function checkSourceElement(node) { @@ -40929,10 +41118,10 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 237: - case 233: + case 238: case 234: - case 232: + case 235: + case 233: cancellationToken.throwIfCancellationRequested(); } } @@ -40982,95 +41171,97 @@ var ts; return checkConditionalType(node); case 171: return checkInferType(node); - case 285: + case 178: + return checkImportType(node); + case 286: return checkJSDocAugmentsTag(node); - case 291: + case 292: return checkJSDocTypedefTag(node); - case 287: + case 288: return checkJSDocParameterTag(node); - case 280: + case 281: checkSignatureDeclaration(node); + case 279: case 278: - case 277: - case 275: case 276: + case 277: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 281: + case 282: checkJSDocVariadicType(node); return; - case 274: + case 275: return checkSourceElement(node.type); case 175: return checkIndexedAccessType(node); case 176: return checkMappedType(node); - case 232: - return checkFunctionDeclaration(node); - case 211: - case 238: - return checkBlock(node); - case 212: - return checkVariableStatement(node); - case 214: - return checkExpressionStatement(node); - case 215: - return checkIfStatement(node); - case 216: - return checkDoStatement(node); - case 217: - return checkWhileStatement(node); - case 218: - return checkForStatement(node); - case 219: - return checkForInStatement(node); - case 220: - return checkForOfStatement(node); - case 221: - case 222: - return checkBreakOrContinueStatement(node); - case 223: - return checkReturnStatement(node); - case 224: - return checkWithStatement(node); - case 225: - return checkSwitchStatement(node); - case 226: - return checkLabeledStatement(node); - case 227: - return checkThrowStatement(node); - case 228: - return checkTryStatement(node); - case 230: - return checkVariableDeclaration(node); - case 180: - return checkBindingElement(node); case 233: - return checkClassDeclaration(node); - case 234: - return checkInterfaceDeclaration(node); - case 235: - return checkTypeAliasDeclaration(node); - case 236: - return checkEnumDeclaration(node); - case 237: - return checkModuleDeclaration(node); - case 242: - return checkImportDeclaration(node); - case 241: - return checkImportEqualsDeclaration(node); - case 248: - return checkExportDeclaration(node); - case 247: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); + case 212: + case 239: + return checkBlock(node); case 213: - checkGrammarStatementInAmbientContext(node); - return; + return checkVariableStatement(node); + case 215: + return checkExpressionStatement(node); + case 216: + return checkIfStatement(node); + case 217: + return checkDoStatement(node); + case 218: + return checkWhileStatement(node); + case 219: + return checkForStatement(node); + case 220: + return checkForInStatement(node); + case 221: + return checkForOfStatement(node); + case 222: + case 223: + return checkBreakOrContinueStatement(node); + case 224: + return checkReturnStatement(node); + case 225: + return checkWithStatement(node); + case 226: + return checkSwitchStatement(node); + case 227: + return checkLabeledStatement(node); + case 228: + return checkThrowStatement(node); case 229: + return checkTryStatement(node); + case 231: + return checkVariableDeclaration(node); + case 181: + return checkBindingElement(node); + case 234: + return checkClassDeclaration(node); + case 235: + return checkInterfaceDeclaration(node); + case 236: + return checkTypeAliasDeclaration(node); + case 237: + return checkEnumDeclaration(node); + case 238: + return checkModuleDeclaration(node); + case 243: + return checkImportDeclaration(node); + case 242: + return checkImportEqualsDeclaration(node); + case 249: + return checkExportDeclaration(node); + case 248: + return checkExportAssignment(node); + case 214: checkGrammarStatementInAmbientContext(node); return; - case 251: + case 230: + checkGrammarStatementInAmbientContext(node); + return; + case 252: return checkMissingDeclaration(node); } } @@ -41135,8 +41326,8 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 190: case 191: + case 192: case 153: case 152: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); @@ -41145,7 +41336,7 @@ var ts; case 156: checkAccessorDeclaration(node); break; - case 203: + case 204: checkClassExpressionDeferred(node); break; } @@ -41246,24 +41437,24 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 237: + case 238: copySymbols(getSymbolOfNode(location).exports, meaning & 2623475); break; - case 236: + case 237: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 203: + case 204: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 233: case 234: + case 235: if (!isStatic) { copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67901928); } break; - case 190: + case 191: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -41302,10 +41493,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 147: - case 233: case 234: case 235: case 236: + case 237: return true; } } @@ -41318,10 +41509,10 @@ var ts; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 183) { + while (node.parent && node.parent.kind === 184) { node = node.parent; } - return node.parent && node.parent.kind === 205; + return node.parent && node.parent.kind === 206; } function forEachEnclosingClass(node, callback) { var result; @@ -41352,10 +41543,10 @@ var ts; while (nodeOnRightSide.parent.kind === 145) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 241) { + if (nodeOnRightSide.parent.kind === 242) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 247) { + if (nodeOnRightSide.parent.kind === 248) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -41375,32 +41566,54 @@ var ts; return getSymbolOfNode(entityName.parent.parent); } } + function isImportTypeQualifierPart(node) { + var parent = node.parent; + while (ts.isQualifiedName(parent)) { + node = parent; + parent = parent.parent; + } + if (parent && parent.kind === 178 && parent.qualifier === node) { + return parent; + } + return undefined; + } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } if (ts.isInJavaScriptFile(entityName) && - entityName.parent.kind === 183 && + entityName.parent.kind === 184 && entityName.parent === entityName.parent.parent.left) { var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); if (specialPropertyAssignmentSymbol) { return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 247 && ts.isEntityNameExpression(entityName)) { - return resolveEntityName(entityName, 67216319 | 67901928 | 1920 | 2097152); + if (entityName.parent.kind === 248 && ts.isEntityNameExpression(entityName)) { + var success = resolveEntityName(entityName, 67216319 | 67901928 | 1920 | 2097152, true); + if (success && success !== unknownSymbol) { + return success; + } } - if (entityName.kind !== 183 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 241); + else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) { + var importEqualsDeclaration = ts.getAncestor(entityName, 242); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } - if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (!ts.isPropertyAccessExpression(entityName)) { + var possibleImportNode = isImportTypeQualifierPart(entityName); + if (possibleImportNode) { + getTypeFromTypeNode(possibleImportNode); + var sym = getNodeLinks(entityName).resolvedSymbol; + return sym === unknownSymbol ? undefined : sym; + } + } + while (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 205) { + if (entityName.parent.kind === 206) { meaning = 67901928; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 67216319; @@ -41415,10 +41628,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 287) { + if (entityName.parent.kind === 288) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 147 && entityName.parent.parent.kind === 290) { + if (entityName.parent.kind === 147 && entityName.parent.parent.kind === 291) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -41434,12 +41647,12 @@ var ts; } return resolveEntityName(entityName, 67216319, false, true); } - else if (entityName.kind === 183 || entityName.kind === 145) { + else if (entityName.kind === 184 || entityName.kind === 145) { var links = getNodeLinks(entityName); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (entityName.kind === 183) { + if (entityName.kind === 184) { checkPropertyAccessExpression(entityName); } else { @@ -41452,7 +41665,7 @@ var ts; var meaning = entityName.parent.kind === 161 ? 67901928 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 260) { + else if (entityName.parent.kind === 261) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 160) { @@ -41461,7 +41674,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 272) { + if (node.kind === 273) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (node.flags & 4194304) { @@ -41477,8 +41690,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 180 && - node.parent.parent.kind === 178 && + else if (node.parent.kind === 181 && + node.parent.parent.kind === 179 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.escapedText); @@ -41489,7 +41702,7 @@ var ts; } switch (node.kind) { case 71: - case 183: + case 184: case 145: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 99: @@ -41516,8 +41729,9 @@ var ts; case 9: case 13: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 242 || node.parent.kind === 248) && node.parent.moduleSpecifier === node) || - ((ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, false)) || ts.isImportCall(node.parent))) { + ((node.parent.kind === 243 || node.parent.kind === 249) && node.parent.moduleSpecifier === node) || + ((ts.isInJavaScriptFile(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); } case 8: @@ -41531,12 +41745,14 @@ var ts; case 89: case 36: return getSymbolOfNode(node.parent); + case 178: + return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined; default: return undefined; } } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 269) { + if (location && location.kind === 270) { return resolveEntityName(location.name, 67216319 | 2097152); } return undefined; @@ -41597,20 +41813,20 @@ var ts; return unknownType; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 182 || expr.kind === 181); - if (expr.parent.kind === 220) { + ts.Debug.assert(expr.kind === 183 || expr.kind === 182); + if (expr.parent.kind === 221) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 198) { + if (expr.parent.kind === 199) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 268) { + if (expr.parent.kind === 269) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } - ts.Debug.assert(expr.parent.kind === 181); + ts.Debug.assert(expr.parent.kind === 182); var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false, false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, expr.parent.elements.indexOf(expr), elementType || unknownType); @@ -41674,7 +41890,7 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - var isPropertyName_1 = node.parent.kind === 183 && node.parent.name === node; + var isPropertyName_1 = node.parent.kind === 184 && node.parent.name === node; return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } @@ -41717,7 +41933,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 272) { + if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 273) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -41751,7 +41967,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 211 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 212 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -41787,16 +42003,16 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 241: - case 243: + case 242: case 244: - case 246: - case 250: + case 245: + case 247: + case 251: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 248: + case 249: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 247: + case 248: return node.expression && node.expression.kind === 71 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -41806,7 +42022,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 272 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 273 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -41871,15 +42087,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 271: - case 183: + case 272: case 184: + case 185: return true; } return false; } function getConstantValue(node) { - if (node.kind === 271) { + if (node.kind === 272) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -42035,7 +42251,7 @@ var ts; if (resolvedTypeReferenceDirectives) { fileToDirective = ts.createMap(); resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { - if (!resolvedDirective) { + if (!resolvedDirective || !resolvedDirective.resolvedFileName) { return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); @@ -42092,13 +42308,17 @@ var ts; }, getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; } }; + function isInHeritageClause(node) { + return node.parent && node.parent.kind === 206 && node.parent.parent && node.parent.parent.kind === 267; + } function getTypeReferenceDirectivesForEntityName(node) { if (!fileToDirective) { return undefined; } - var meaning = (node.kind === 183) || (node.kind === 71 && isInTypeQuery(node)) - ? 67216319 | 1048576 - : 67901928 | 1920; + var meaning = 67901928 | 1920; + if ((node.kind === 71 && isInTypeQuery(node)) || (node.kind === 184 && !isInHeritageClause(node))) { + meaning = 67216319 | 1048576; + } var symbol = resolveEntityName(node, meaning, true); return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; } @@ -42139,7 +42359,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 272 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 273 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -42153,12 +42373,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 237 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 238 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 272); + return ts.getDeclarationOfKind(moduleSymbol, 273); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -42319,7 +42539,7 @@ var ts; } switch (modifier.kind) { case 76: - if (node.kind !== 236 && node.parent.kind === 233) { + if (node.kind !== 237 && node.parent.kind === 234) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(76)); } break; @@ -42339,7 +42559,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 238 || node.parent.kind === 272) { + else if (node.parent.kind === 239 || node.parent.kind === 273) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -42362,7 +42582,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 238 || node.parent.kind === 272) { + else if (node.parent.kind === 239 || node.parent.kind === 273) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 148) { @@ -42397,7 +42617,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 233) { + else if (node.parent.kind === 234) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 148) { @@ -42406,8 +42626,8 @@ var ts; flags |= 1; break; case 79: - var container = node.parent.kind === 272 ? node.parent : node.parent.parent; - if (container.kind === 237 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 273 ? node.parent : node.parent.parent; + if (container.kind === 238 && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } flags |= 512; @@ -42419,13 +42639,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 233) { + else if (node.parent.kind === 234) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 148) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 2097152) && node.parent.kind === 238) { + else if ((node.parent.flags & 2097152) && node.parent.kind === 239) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -42435,14 +42655,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 233) { + if (node.kind !== 234) { if (node.kind !== 153 && node.kind !== 151 && node.kind !== 155 && node.kind !== 156) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 233 && ts.hasModifier(node.parent, 128))) { + if (!(node.parent.kind === 234 && ts.hasModifier(node.parent, 128))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -42484,7 +42704,7 @@ var ts; } return; } - else if ((node.kind === 242 || node.kind === 241) && flags & 2) { + else if ((node.kind === 243 || node.kind === 242) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 148 && (flags & 92) && ts.isBindingPattern(node.name)) { @@ -42514,29 +42734,29 @@ var ts; case 153: case 152: case 159: - case 237: + case 238: + case 243: case 242: - case 241: + case 249: case 248: - case 247: - case 190: case 191: + case 192: case 148: return false; default: - if (node.parent.kind === 238 || node.parent.kind === 272) { + if (node.parent.kind === 239 || node.parent.kind === 273) { return false; } switch (node.kind) { - case 232: - return nodeHasAnyModifiersExcept(node, 120); case 233: - return nodeHasAnyModifiersExcept(node, 117); + return nodeHasAnyModifiersExcept(node, 120); case 234: - case 212: + return nodeHasAnyModifiersExcept(node, 117); case 235: - return true; + case 213: case 236: + return true; + case 237: return nodeHasAnyModifiersExcept(node, 76); default: ts.Debug.fail(); @@ -42550,18 +42770,17 @@ var ts; function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 153: - case 232: - case 190: + case 233: case 191: + case 192: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } - function checkGrammarForDisallowedTrailingComma(list) { + function checkGrammarForDisallowedTrailingComma(list, diag) { + if (diag === void 0) { diag = ts.Diagnostics.Trailing_comma_not_allowed; } if (list && list.hasTrailingComma) { - var start = list.end - ",".length; - var end = list.end; - return grammarErrorAtPos(list[0], start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); + return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag); } } function checkGrammarTypeParameterList(typeParameters, file) { @@ -42580,6 +42799,9 @@ var ts; if (i !== (parameterCount - 1)) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); } + if (!(parameter.flags & 2097152)) { + checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + } if (ts.isBindingPattern(parameter.name)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } @@ -42649,7 +42871,7 @@ var ts; if (type.flags & 2 || type.flags & 4) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type))); } - if (allTypesAssignableToKind(type, 32, true)) { + if (type.flags & 131072 && allTypesAssignableToKind(type, 32, true)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead); } return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); @@ -42677,7 +42899,7 @@ var ts; if (args) { for (var _i = 0, args_5 = args; _i < args_5.length; _i++) { var arg = args_5[_i]; - if (arg.kind === 204) { + if (arg.kind === 205) { return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -42754,14 +42976,14 @@ var ts; return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 198 && computedPropertyName.expression.operatorToken.kind === 26) { + if (computedPropertyName.expression.kind === 199 && computedPropertyName.expression.operatorToken.kind === 26) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 232 || - node.kind === 190 || + ts.Debug.assert(node.kind === 233 || + node.kind === 191 || node.kind === 153); if (node.flags & 2097152) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); @@ -42787,14 +43009,14 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 270) { + if (prop.kind === 271) { continue; } var name = prop.name; if (name.kind === 146) { checkGrammarComputedPropertyName(name); } - if (prop.kind === 269 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 270 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { @@ -42807,8 +43029,8 @@ var ts; } var currentKind = void 0; switch (prop.kind) { - case 268: case 269: + case 270: checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8) { checkGrammarNumericLiteral(name); @@ -42856,7 +43078,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 262) { + if (attr.kind === 263) { continue; } var name = attr.name, initializer = attr.initializer; @@ -42866,7 +43088,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 263 && !initializer.expression) { + if (initializer && initializer.kind === 264 && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -42875,12 +43097,12 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 220 && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 221 && forInOrOfStatement.awaitModifier) { if ((forInOrOfStatement.flags & 16384) === 0) { return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); } } - if (forInOrOfStatement.initializer.kind === 231) { + if (forInOrOfStatement.initializer.kind === 232) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -42888,20 +43110,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 219 + var diagnostic = forInOrOfStatement.kind === 220 ? 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 === 219 + var diagnostic = forInOrOfStatement.kind === 220 ? 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 === 219 + var diagnostic = forInOrOfStatement.kind === 220 ? 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); @@ -42965,7 +43187,7 @@ var ts; } var parent = ts.walkUpParenthesizedTypes(node.parent); switch (parent.kind) { - case 230: + case 231: var decl = parent; if (decl.name.kind !== 71) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -43003,7 +43225,7 @@ var ts; return true; } if (node.kind === 153) { - if (node.parent.kind === 182) { + if (node.parent.kind === 183) { if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 120)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } @@ -43026,7 +43248,7 @@ var ts; 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 === 234) { + else if (node.parent.kind === 235) { 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 === 165) { @@ -43040,9 +43262,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 226: + case 227: if (node.label && current.label.escapedText === node.label.escapedText) { - var isMisplacedContinueLabel = node.kind === 221 + var isMisplacedContinueLabel = node.kind === 222 && !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); @@ -43050,8 +43272,8 @@ var ts; return false; } break; - case 225: - if (node.kind === 222 && !node.label) { + case 226: + if (node.kind === 223 && !node.label) { return false; } break; @@ -43064,13 +43286,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 222 + var message = node.kind === 223 ? 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 === 222 + var message = node.kind === 223 ? 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); @@ -43082,7 +43304,8 @@ var ts; if (node !== ts.last(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 179 || node.name.kind === 178) { + checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + if (node.name.kind === 180 || node.name.kind === 179) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.propertyName) { @@ -43095,11 +43318,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 || expr.kind === 8 || - expr.kind === 196 && expr.operator === 38 && + expr.kind === 197 && expr.operator === 38 && expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 219 && node.parent.parent.kind !== 220) { + if (node.parent.parent.kind !== 220 && node.parent.parent.kind !== 221) { if (node.flags & 2097152) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -43126,7 +43349,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 212 || !node.type || node.initializer || node.flags & 2097152)) { + if (node.exclamationToken && (node.parent.parent.kind !== 213 || !node.type || node.initializer || node.flags & 2097152)) { return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); } if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && @@ -43179,15 +43402,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 215: case 216: case 217: - case 224: case 218: + case 225: case 219: case 220: + case 221: return false; - case 226: + case 227: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -43253,7 +43476,7 @@ var ts; return true; } } - else if (node.parent.kind === 234) { + else if (node.parent.kind === 235) { 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; } @@ -43278,13 +43501,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 234 || - node.kind === 235 || + if (node.kind === 235 || + node.kind === 236 || + node.kind === 243 || node.kind === 242 || - node.kind === 241 || + node.kind === 249 || node.kind === 248 || - node.kind === 247 || - node.kind === 240 || + node.kind === 241 || ts.hasModifier(node, 2 | 1 | 512)) { return false; } @@ -43293,7 +43516,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 === 212) { + if (ts.isDeclaration(decl) || decl.kind === 213) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -43312,7 +43535,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 211 || node.parent.kind === 238 || node.parent.kind === 272) { + if (node.parent.kind === 212 || node.parent.kind === 239 || node.parent.kind === 273) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -43331,7 +43554,7 @@ var ts; else if (ts.isChildOfNodeWithKind(node, 177)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 271)) { + else if (ts.isChildOfNodeWithKind(node, 272)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -43379,8 +43602,8 @@ var ts; ts.createTypeChecker = createTypeChecker; function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 246: - case 250: + case 247: + case 251: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -43388,13 +43611,13 @@ var ts; } function isSomeImportDeclaration(decl) { switch (decl.kind) { - case 243: - case 241: case 244: - case 246: + case 242: + case 245: + case 247: return true; case 71: - return decl.parent.kind === 246; + return decl.parent.kind === 247; default: return false; } @@ -43543,12 +43766,18 @@ var ts; ts.createUniqueName = createUniqueName; function createOptimisticUniqueName(text) { var name = createIdentifier(text); - name.autoGenerateFlags = 5; + name.autoGenerateFlags = 3 | 32; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createOptimisticUniqueName = createOptimisticUniqueName; + function createFileLevelUniqueName(text) { + var name = createOptimisticUniqueName(text); + name.autoGenerateFlags |= 64; + return name; + } + ts.createFileLevelUniqueName = createFileLevelUniqueName; function getGeneratedNameForNode(node, shouldSkipNameGenerationScope) { var name = createIdentifier(""); name.autoGenerateFlags = 4; @@ -43643,7 +43872,7 @@ var ts; ts.updateQualifiedName = updateQualifiedName; function parenthesizeForComputedName(expression) { return (ts.isBinaryExpression(expression) && expression.operatorToken.kind === 26) || - expression.kind === 296 ? + expression.kind === 297 ? createParen(expression) : expression; } @@ -44067,6 +44296,24 @@ var ts; : node; } ts.updateInferTypeNode = updateInferTypeNode; + function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) { + var node = createSynthesizedNode(178); + node.argument = argument; + node.qualifier = qualifier; + node.typeArguments = asNodeArray(typeArguments); + node.isTypeOf = isTypeOf; + return node; + } + ts.createImportTypeNode = createImportTypeNode; + function updateImportTypeNode(node, argument, qualifier, typeArguments, isTypeOf) { + return node.argument !== argument + || node.qualifier !== qualifier + || node.typeArguments !== typeArguments + || node.isTypeOf !== isTypeOf + ? updateNode(createImportTypeNode(argument, qualifier, typeArguments, isTypeOf), node) + : node; + } + ts.updateImportTypeNode = updateImportTypeNode; function createParenthesizedType(type) { var node = createSynthesizedNode(172); node.type = type; @@ -44139,7 +44386,7 @@ var ts; } ts.updateLiteralTypeNode = updateLiteralTypeNode; function createObjectBindingPattern(elements) { - var node = createSynthesizedNode(178); + var node = createSynthesizedNode(179); node.elements = createNodeArray(elements); return node; } @@ -44151,7 +44398,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements) { - var node = createSynthesizedNode(179); + var node = createSynthesizedNode(180); node.elements = createNodeArray(elements); return node; } @@ -44163,7 +44410,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createSynthesizedNode(180); + var node = createSynthesizedNode(181); node.dotDotDotToken = dotDotDotToken; node.propertyName = asName(propertyName); node.name = asName(name); @@ -44181,7 +44428,7 @@ var ts; } ts.updateBindingElement = updateBindingElement; function createArrayLiteral(elements, multiLine) { - var node = createSynthesizedNode(181); + var node = createSynthesizedNode(182); node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) node.multiLine = true; @@ -44195,7 +44442,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, multiLine) { - var node = createSynthesizedNode(182); + var node = createSynthesizedNode(183); node.properties = createNodeArray(properties); if (multiLine) node.multiLine = true; @@ -44209,7 +44456,7 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name) { - var node = createSynthesizedNode(183); + var node = createSynthesizedNode(184); node.expression = ts.parenthesizeForAccess(expression); node.name = asName(name); setEmitFlags(node, 131072); @@ -44224,7 +44471,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index) { - var node = createSynthesizedNode(184); + var node = createSynthesizedNode(185); node.expression = ts.parenthesizeForAccess(expression); node.argumentExpression = asExpression(index); return node; @@ -44238,7 +44485,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(185); + var node = createSynthesizedNode(186); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); @@ -44254,7 +44501,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(186); + var node = createSynthesizedNode(187); node.expression = ts.parenthesizeForNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -44270,7 +44517,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, template) { - var node = createSynthesizedNode(187); + var node = createSynthesizedNode(188); node.tag = ts.parenthesizeForAccess(tag); node.template = template; return node; @@ -44284,7 +44531,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createTypeAssertion(type, expression) { - var node = createSynthesizedNode(188); + var node = createSynthesizedNode(189); node.type = type; node.expression = ts.parenthesizePrefixOperand(expression); return node; @@ -44298,7 +44545,7 @@ var ts; } ts.updateTypeAssertion = updateTypeAssertion; function createParen(expression) { - var node = createSynthesizedNode(189); + var node = createSynthesizedNode(190); node.expression = expression; return node; } @@ -44310,7 +44557,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(190); + var node = createSynthesizedNode(191); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -44334,7 +44581,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createSynthesizedNode(191); + var node = createSynthesizedNode(192); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); @@ -44368,7 +44615,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression) { - var node = createSynthesizedNode(192); + var node = createSynthesizedNode(193); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -44380,7 +44627,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression) { - var node = createSynthesizedNode(193); + var node = createSynthesizedNode(194); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -44392,7 +44639,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression) { - var node = createSynthesizedNode(194); + var node = createSynthesizedNode(195); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -44404,7 +44651,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression) { - var node = createSynthesizedNode(195); + var node = createSynthesizedNode(196); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -44416,7 +44663,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand) { - var node = createSynthesizedNode(196); + var node = createSynthesizedNode(197); node.operator = operator; node.operand = ts.parenthesizePrefixOperand(operand); return node; @@ -44429,7 +44676,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator) { - var node = createSynthesizedNode(197); + var node = createSynthesizedNode(198); node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -44442,7 +44689,7 @@ var ts; } ts.updatePostfix = updatePostfix; function createBinary(left, operator, right) { - var node = createSynthesizedNode(198); + var node = createSynthesizedNode(199); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = ts.parenthesizeBinaryOperand(operatorKind, left, true, undefined); @@ -44459,7 +44706,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { - var node = createSynthesizedNode(199); + var node = createSynthesizedNode(200); node.condition = ts.parenthesizeForConditionalHead(condition); node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(55); node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); @@ -44489,7 +44736,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans) { - var node = createSynthesizedNode(200); + var node = createSynthesizedNode(201); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -44527,7 +44774,7 @@ var ts; } ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral; function createYield(asteriskTokenOrExpression, expression) { - var node = createSynthesizedNode(201); + var node = createSynthesizedNode(202); node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 39 ? asteriskTokenOrExpression : undefined; node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 39 ? asteriskTokenOrExpression : expression; return node; @@ -44541,7 +44788,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression) { - var node = createSynthesizedNode(202); + var node = createSynthesizedNode(203); node.expression = ts.parenthesizeExpressionForList(expression); return node; } @@ -44553,7 +44800,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(203); + var node = createSynthesizedNode(204); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -44574,11 +44821,11 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression() { - return createSynthesizedNode(204); + return createSynthesizedNode(205); } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression) { - var node = createSynthesizedNode(205); + var node = createSynthesizedNode(206); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); return node; @@ -44592,7 +44839,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createAsExpression(expression, type) { - var node = createSynthesizedNode(206); + var node = createSynthesizedNode(207); node.expression = expression; node.type = type; return node; @@ -44606,7 +44853,7 @@ var ts; } ts.updateAsExpression = updateAsExpression; function createNonNullExpression(expression) { - var node = createSynthesizedNode(207); + var node = createSynthesizedNode(208); node.expression = ts.parenthesizeForAccess(expression); return node; } @@ -44618,7 +44865,7 @@ var ts; } ts.updateNonNullExpression = updateNonNullExpression; function createMetaProperty(keywordToken, name) { - var node = createSynthesizedNode(208); + var node = createSynthesizedNode(209); node.keywordToken = keywordToken; node.name = name; return node; @@ -44631,7 +44878,7 @@ var ts; } ts.updateMetaProperty = updateMetaProperty; function createTemplateSpan(expression, literal) { - var node = createSynthesizedNode(209); + var node = createSynthesizedNode(210); node.expression = expression; node.literal = literal; return node; @@ -44645,11 +44892,11 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createSemicolonClassElement() { - return createSynthesizedNode(210); + return createSynthesizedNode(211); } ts.createSemicolonClassElement = createSemicolonClassElement; function createBlock(statements, multiLine) { - var block = createSynthesizedNode(211); + var block = createSynthesizedNode(212); block.statements = createNodeArray(statements); if (multiLine) block.multiLine = multiLine; @@ -44663,7 +44910,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList) { - var node = createSynthesizedNode(212); + var node = createSynthesizedNode(213); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -44678,11 +44925,11 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createEmptyStatement() { - return createSynthesizedNode(213); + return createSynthesizedNode(214); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression) { - var node = createSynthesizedNode(214); + var node = createSynthesizedNode(215); node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -44694,7 +44941,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement) { - var node = createSynthesizedNode(215); + var node = createSynthesizedNode(216); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -44710,7 +44957,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression) { - var node = createSynthesizedNode(216); + var node = createSynthesizedNode(217); node.statement = statement; node.expression = expression; return node; @@ -44724,7 +44971,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement) { - var node = createSynthesizedNode(217); + var node = createSynthesizedNode(218); node.expression = expression; node.statement = statement; return node; @@ -44738,7 +44985,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement) { - var node = createSynthesizedNode(218); + var node = createSynthesizedNode(219); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -44756,7 +45003,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement) { - var node = createSynthesizedNode(219); + var node = createSynthesizedNode(220); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -44772,7 +45019,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(awaitModifier, initializer, expression, statement) { - var node = createSynthesizedNode(220); + var node = createSynthesizedNode(221); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; @@ -44790,7 +45037,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label) { - var node = createSynthesizedNode(221); + var node = createSynthesizedNode(222); node.label = asName(label); return node; } @@ -44802,7 +45049,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label) { - var node = createSynthesizedNode(222); + var node = createSynthesizedNode(223); node.label = asName(label); return node; } @@ -44814,7 +45061,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression) { - var node = createSynthesizedNode(223); + var node = createSynthesizedNode(224); node.expression = expression; return node; } @@ -44826,7 +45073,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement) { - var node = createSynthesizedNode(224); + var node = createSynthesizedNode(225); node.expression = expression; node.statement = statement; return node; @@ -44840,7 +45087,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock) { - var node = createSynthesizedNode(225); + var node = createSynthesizedNode(226); node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -44854,7 +45101,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement) { - var node = createSynthesizedNode(226); + var node = createSynthesizedNode(227); node.label = asName(label); node.statement = statement; return node; @@ -44868,7 +45115,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression) { - var node = createSynthesizedNode(227); + var node = createSynthesizedNode(228); node.expression = expression; return node; } @@ -44880,7 +45127,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock) { - var node = createSynthesizedNode(228); + var node = createSynthesizedNode(229); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -44896,11 +45143,11 @@ var ts; } ts.updateTry = updateTry; function createDebuggerStatement() { - return createSynthesizedNode(229); + return createSynthesizedNode(230); } ts.createDebuggerStatement = createDebuggerStatement; function createVariableDeclaration(name, type, initializer) { - var node = createSynthesizedNode(230); + var node = createSynthesizedNode(231); node.name = asName(name); node.type = type; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -44916,7 +45163,7 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createVariableDeclarationList(declarations, flags) { - var node = createSynthesizedNode(231); + var node = createSynthesizedNode(232); node.flags |= flags & 3; node.declarations = createNodeArray(declarations); return node; @@ -44929,7 +45176,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(232); + var node = createSynthesizedNode(233); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; @@ -44955,7 +45202,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(233); + var node = createSynthesizedNode(234); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -44977,7 +45224,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(234); + var node = createSynthesizedNode(235); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -44999,7 +45246,7 @@ var ts; } ts.updateInterfaceDeclaration = updateInterfaceDeclaration; function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) { - var node = createSynthesizedNode(235); + var node = createSynthesizedNode(236); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -45019,7 +45266,7 @@ var ts; } ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration; function createEnumDeclaration(decorators, modifiers, name, members) { - var node = createSynthesizedNode(236); + var node = createSynthesizedNode(237); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -45037,7 +45284,7 @@ var ts; } ts.updateEnumDeclaration = updateEnumDeclaration; function createModuleDeclaration(decorators, modifiers, name, body, flags) { - var node = createSynthesizedNode(237); + var node = createSynthesizedNode(238); node.flags |= flags & (16 | 4 | 512); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -45056,7 +45303,7 @@ var ts; } ts.updateModuleDeclaration = updateModuleDeclaration; function createModuleBlock(statements) { - var node = createSynthesizedNode(238); + var node = createSynthesizedNode(239); node.statements = createNodeArray(statements); return node; } @@ -45068,7 +45315,7 @@ var ts; } ts.updateModuleBlock = updateModuleBlock; function createCaseBlock(clauses) { - var node = createSynthesizedNode(239); + var node = createSynthesizedNode(240); node.clauses = createNodeArray(clauses); return node; } @@ -45080,7 +45327,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createNamespaceExportDeclaration(name) { - var node = createSynthesizedNode(240); + var node = createSynthesizedNode(241); node.name = asName(name); return node; } @@ -45092,7 +45339,7 @@ var ts; } ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration; function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { - var node = createSynthesizedNode(241); + var node = createSynthesizedNode(242); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -45110,7 +45357,7 @@ var ts; } ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { - var node = createSynthesizedNode(242); + var node = createSynthesizedNode(243); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; @@ -45128,7 +45375,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings) { - var node = createSynthesizedNode(243); + var node = createSynthesizedNode(244); node.name = name; node.namedBindings = namedBindings; return node; @@ -45142,7 +45389,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name) { - var node = createSynthesizedNode(244); + var node = createSynthesizedNode(245); node.name = name; return node; } @@ -45154,7 +45401,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements) { - var node = createSynthesizedNode(245); + var node = createSynthesizedNode(246); node.elements = createNodeArray(elements); return node; } @@ -45166,7 +45413,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name) { - var node = createSynthesizedNode(246); + var node = createSynthesizedNode(247); node.propertyName = propertyName; node.name = name; return node; @@ -45180,7 +45427,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression) { - var node = createSynthesizedNode(247); + var node = createSynthesizedNode(248); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; @@ -45197,7 +45444,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { - var node = createSynthesizedNode(248); + var node = createSynthesizedNode(249); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; @@ -45215,7 +45462,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements) { - var node = createSynthesizedNode(249); + var node = createSynthesizedNode(250); node.elements = createNodeArray(elements); return node; } @@ -45227,7 +45474,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(propertyName, name) { - var node = createSynthesizedNode(250); + var node = createSynthesizedNode(251); node.propertyName = asName(propertyName); node.name = asName(name); return node; @@ -45241,7 +45488,7 @@ var ts; } ts.updateExportSpecifier = updateExportSpecifier; function createExternalModuleReference(expression) { - var node = createSynthesizedNode(252); + var node = createSynthesizedNode(253); node.expression = expression; return node; } @@ -45253,7 +45500,7 @@ var ts; } ts.updateExternalModuleReference = updateExternalModuleReference; function createJsxElement(openingElement, children, closingElement) { - var node = createSynthesizedNode(253); + var node = createSynthesizedNode(254); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -45269,7 +45516,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(254); + var node = createSynthesizedNode(255); node.tagName = tagName; node.typeArguments = typeArguments && createNodeArray(typeArguments); node.attributes = attributes; @@ -45285,7 +45532,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(255); + var node = createSynthesizedNode(256); node.tagName = tagName; node.typeArguments = typeArguments && createNodeArray(typeArguments); node.attributes = attributes; @@ -45301,7 +45548,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName) { - var node = createSynthesizedNode(256); + var node = createSynthesizedNode(257); node.tagName = tagName; return node; } @@ -45313,7 +45560,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxFragment(openingFragment, children, closingFragment) { - var node = createSynthesizedNode(257); + var node = createSynthesizedNode(258); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -45329,7 +45576,7 @@ var ts; } ts.updateJsxFragment = updateJsxFragment; function createJsxAttribute(name, initializer) { - var node = createSynthesizedNode(260); + var node = createSynthesizedNode(261); node.name = name; node.initializer = initializer; return node; @@ -45343,7 +45590,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(261); + var node = createSynthesizedNode(262); node.properties = createNodeArray(properties); return node; } @@ -45355,7 +45602,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(262); + var node = createSynthesizedNode(263); node.expression = expression; return node; } @@ -45367,7 +45614,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(263); + var node = createSynthesizedNode(264); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -45380,7 +45627,7 @@ var ts; } ts.updateJsxExpression = updateJsxExpression; function createCaseClause(expression, statements) { - var node = createSynthesizedNode(264); + var node = createSynthesizedNode(265); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -45394,7 +45641,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(265); + var node = createSynthesizedNode(266); node.statements = createNodeArray(statements); return node; } @@ -45406,7 +45653,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(266); + var node = createSynthesizedNode(267); node.token = token; node.types = createNodeArray(types); return node; @@ -45419,7 +45666,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(267); + var node = createSynthesizedNode(268); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -45433,7 +45680,7 @@ var ts; } ts.updateCatchClause = updateCatchClause; function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(268); + var node = createSynthesizedNode(269); node.name = asName(name); node.questionToken = undefined; node.initializer = ts.parenthesizeExpressionForList(initializer); @@ -45448,7 +45695,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(269); + var node = createSynthesizedNode(270); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -45462,7 +45709,7 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(270); + var node = createSynthesizedNode(271); node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; return node; } @@ -45474,7 +45721,7 @@ var ts; } ts.updateSpreadAssignment = updateSpreadAssignment; function createEnumMember(name, initializer) { - var node = createSynthesizedNode(271); + var node = createSynthesizedNode(272); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -45487,12 +45734,13 @@ var ts; : node; } ts.updateEnumMember = updateEnumMember; - function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences) { + function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib) { if (node.statements !== statements || (isDeclarationFile !== undefined && node.isDeclarationFile !== isDeclarationFile) || (referencedFiles !== undefined && node.referencedFiles !== referencedFiles) || - (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences)) { - var updated = createSynthesizedNode(272); + (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) || + (hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) { + var updated = createSynthesizedNode(273); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -45502,6 +45750,7 @@ var ts; updated.isDeclarationFile = isDeclarationFile === undefined ? node.isDeclarationFile : isDeclarationFile; updated.referencedFiles = referencedFiles === undefined ? node.referencedFiles : referencedFiles; updated.typeReferenceDirectives = typeReferences === undefined ? node.typeReferenceDirectives : typeReferences; + updated.hasNoDefaultLib = hasNoDefaultLib === undefined ? node.hasNoDefaultLib : hasNoDefaultLib; if (node.amdDependencies !== undefined) updated.amdDependencies = node.amdDependencies; if (node.moduleName !== undefined) @@ -45510,8 +45759,6 @@ var ts; updated.languageVariant = node.languageVariant; if (node.renamedDependencies !== undefined) updated.renamedDependencies = node.renamedDependencies; - if (node.hasNoDefaultLib !== undefined) - updated.hasNoDefaultLib = node.hasNoDefaultLib; if (node.languageVersion !== undefined) updated.languageVersion = node.languageVersion; if (node.scriptKind !== undefined) @@ -45564,28 +45811,28 @@ var ts; } ts.getMutableClone = getMutableClone; function createNotEmittedStatement(original) { - var node = createSynthesizedNode(294); + var node = createSynthesizedNode(295); node.original = original; setTextRange(node, original); return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(298); + var node = createSynthesizedNode(299); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(297); + var node = createSynthesizedNode(298); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(295); + var node = createSynthesizedNode(296); node.expression = expression; node.original = original; setTextRange(node, original); @@ -45601,7 +45848,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 296) { + if (node.kind === 297) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26) { @@ -45611,7 +45858,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(296); + var node = createSynthesizedNode(297); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -45623,7 +45870,7 @@ var ts; } ts.updateCommaList = updateCommaList; function createBundle(sourceFiles) { - var node = ts.createNode(273); + var node = ts.createNode(274); node.sourceFiles = sourceFiles; return node; } @@ -45726,7 +45973,7 @@ var ts; function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 272) { + if (node.kind === 273) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -46148,7 +46395,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 226 + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 227 ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -46166,13 +46413,13 @@ var ts; case 8: case 9: return false; - case 181: + case 182: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 182: + case 183: return target.properties.length > 0; default: return true; @@ -46198,7 +46445,7 @@ var ts; } else { switch (callee.kind) { - case 183: { + case 184: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = ts.createTempVariable(recordTempVariable); target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name); @@ -46210,7 +46457,7 @@ var ts; } break; } - case 184: { + case 185: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = ts.createTempVariable(recordTempVariable); target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression); @@ -46266,9 +46513,9 @@ var ts; case 155: case 156: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 268: - return createExpressionForPropertyAssignment(property, receiver); case 269: + return createExpressionForPropertyAssignment(property, receiver); + case 270: return createExpressionForShorthandPropertyAssignment(property, receiver); case 153: return createExpressionForMethodDeclaration(property, receiver); @@ -46470,7 +46717,7 @@ var ts; ts.ensureUseStrict = ensureUseStrict; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 189) { + if (skipped.kind === 190) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -46479,15 +46726,15 @@ var ts; } ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(198, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(198, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(199, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(199, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1: if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 - && operand.kind === 201) { + && operand.kind === 202) { return false; } return true; @@ -46526,7 +46773,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 198 && node.operatorToken.kind === 37) { + if (node.kind === 199 && node.operatorToken.kind === 37) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -46541,7 +46788,7 @@ var ts; return 0; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(199, 55); + var conditionalPrecedence = ts.getOperatorPrecedence(200, 55); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { @@ -46552,17 +46799,17 @@ var ts; ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; function parenthesizeSubexpressionOfConditionalExpression(e) { var emittedExpression = ts.skipPartiallyEmittedExpressions(e); - return emittedExpression.kind === 198 && emittedExpression.operatorToken.kind === 26 || - emittedExpression.kind === 296 + return emittedExpression.kind === 199 && emittedExpression.operatorToken.kind === 26 || + emittedExpression.kind === 297 ? ts.createParen(e) : e; } ts.parenthesizeSubexpressionOfConditionalExpression = parenthesizeSubexpressionOfConditionalExpression; function parenthesizeDefaultExpression(e) { var check = ts.skipPartiallyEmittedExpressions(e); - return (check.kind === 203 || - check.kind === 190 || - check.kind === 296 || + return (check.kind === 204 || + check.kind === 191 || + check.kind === 297 || ts.isBinaryExpression(check) && check.operatorToken.kind === 26) ? ts.createParen(e) : e; @@ -46571,9 +46818,9 @@ var ts; function parenthesizeForNew(expression) { var leftmostExpr = getLeftmostExpression(expression, true); switch (leftmostExpr.kind) { - case 185: - return ts.createParen(expression); case 186: + return ts.createParen(expression); + case 187: return !leftmostExpr.arguments ? ts.createParen(expression) : expression; @@ -46584,7 +46831,7 @@ var ts; function parenthesizeForAccess(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 186 || emittedExpression.arguments)) { + && (emittedExpression.kind !== 187 || emittedExpression.arguments)) { return expression; } return ts.setTextRange(ts.createParen(expression), expression); @@ -46622,7 +46869,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(198, 26); + var commaPrecedence = ts.getOperatorPrecedence(199, 26); return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(ts.createParen(expression), expression); @@ -46633,14 +46880,14 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 190 || kind === 191) { + if (kind === 191 || kind === 192) { var mutableCall = ts.getMutableClone(emittedExpression); mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreateOuterExpressions(expression, mutableCall, 4); } } var leftmostExpressionKind = getLeftmostExpression(emittedExpression, false).kind; - if (leftmostExpressionKind === 182 || leftmostExpressionKind === 190) { + if (leftmostExpressionKind === 183 || leftmostExpressionKind === 191) { return ts.setTextRange(ts.createParen(expression), expression); } return expression; @@ -46690,24 +46937,24 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 197: + case 198: node = node.operand; continue; - case 198: + case 199: node = node.left; continue; - case 199: + case 200: node = node.condition; continue; - case 185: + case 186: if (stopAtCallExpressions) { return node; } + case 185: case 184: - case 183: node = node.expression; continue; - case 295: + case 296: node = node.expression; continue; } @@ -46715,7 +46962,7 @@ var ts; } } function parenthesizeConciseBody(body) { - if (!ts.isBlock(body) && getLeftmostExpression(body, false).kind === 182) { + if (!ts.isBlock(body) && getLeftmostExpression(body, false).kind === 183) { return ts.setTextRange(ts.createParen(body), body); } return body; @@ -46731,13 +46978,13 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 7; } switch (node.kind) { - case 189: + case 190: return (kinds & 1) !== 0; - case 188: - case 206: + case 189: case 207: + case 208: return (kinds & 2) !== 0; - case 295: + case 296: return (kinds & 4) !== 0; } return false; @@ -46762,7 +47009,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipAssertions(node) { - while (ts.isAssertionExpression(node) || node.kind === 207) { + while (ts.isAssertionExpression(node) || node.kind === 208) { node = node.expression; } return node; @@ -46770,15 +47017,15 @@ var ts; ts.skipAssertions = skipAssertions; function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 189: return ts.updateParen(outerExpression, expression); - case 188: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 206: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); - case 207: return ts.updateNonNullExpression(outerExpression, expression); - case 295: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 190: return ts.updateParen(outerExpression, expression); + case 189: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 207: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); + case 208: return ts.updateNonNullExpression(outerExpression, expression); + case 296: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } function isIgnorableParen(node) { - return node.kind === 189 + return node.kind === 190 && ts.nodeIsSynthesized(node) && ts.nodeIsSynthesized(ts.getSourceMapRange(node)) && ts.nodeIsSynthesized(ts.getCommentRange(node)) @@ -46840,10 +47087,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 242 && node.importClause) { + if (node.kind === 243 && node.importClause) { return ts.getGeneratedNameForNode(node); } - if (node.kind === 248 && node.moduleSpecifier) { + if (node.kind === 249 && node.moduleSpecifier) { return ts.getGeneratedNameForNode(node); } return undefined; @@ -46905,11 +47152,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 268: - return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 269: - return bindingElement.name; + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 270: + return bindingElement.name; + case 271: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -46926,10 +47173,10 @@ var ts; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { case 148: - case 180: + case 181: return bindingElement.dotDotDotToken; - case 202: - case 270: + case 203: + case 271: return bindingElement; } return undefined; @@ -46937,7 +47184,7 @@ var ts; ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 180: + case 181: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -46945,7 +47192,7 @@ var ts; : propertyName; } break; - case 268: + case 269: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -46953,7 +47200,7 @@ var ts; : propertyName; } break; - case 270: + case 271: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -46967,11 +47214,11 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 178: case 179: - case 181: - return name.elements; + case 180: case 182: + return name.elements; + case 183: return name.properties; } } @@ -47010,11 +47257,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 179: - case 181: - return convertToArrayAssignmentPattern(node); - case 178: + case 180: case 182: + return convertToArrayAssignmentPattern(node); + case 179: + case 183: return convertToObjectAssignmentPattern(node); } } @@ -47211,6 +47458,8 @@ var ts; return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode)); case 171: return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + case 178: + return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); case 172: return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode)); case 174: @@ -47221,185 +47470,185 @@ var ts; return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode)); case 177: return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); - case 178: - return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); case 179: - return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); case 180: - return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); case 181: - return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); case 182: - return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); case 183: - return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); case 184: - return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); + return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); case 185: - return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); case 186: - return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); case 187: - return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); case 188: - return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); case 189: - return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); case 190: - return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 191: - return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context)); + return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 192: - return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context)); case 193: - return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 194: - return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); case 195: - return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); case 196: - return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); + return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); case 197: - return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); + return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); case 198: - return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken)); + return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); case 199: - return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression)); + return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken)); case 200: - return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression)); case 201: - return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); case 202: - return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); case 203: + return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + case 204: return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 205: - return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); case 206: - return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); + return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); case 207: - return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); case 208: - return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 209: + return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier)); + case 210: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 211: - return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 212: + return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 213: return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 214: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 215: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 216: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); case 217: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); case 218: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 219: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 220: - return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 221: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); + return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 222: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); case 223: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); case 224: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); case 225: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 226: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); case 227: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 228: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 229: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); - case 230: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 231: - return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 232: - return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); case 233: - return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 234: - return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); case 235: - return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); + return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); case 236: - return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); case 237: - return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); + return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); case 238: - return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); case 239: - return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 240: - return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); case 241: - return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); + return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier)); case 242: - return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); case 243: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); + return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 244: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); case 245: - return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); case 246: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); case 247: - return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); case 248: - return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); case 249: - return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 250: + return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + case 251: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); - case 252: - return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); case 253: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); + return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); case 254: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 255: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 256: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 257: + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + case 258: return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 260: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 261: - return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 262: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); case 263: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 264: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 265: - return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); case 266: - return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 267: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); case 268: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 269: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 270: - return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); case 271: - return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); case 272: + return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + case 273: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 295: - return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 296: + return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + case 297: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: return node; @@ -47433,11 +47682,11 @@ var ts; } var result = initial; switch (node.kind) { - case 210: - case 213: - case 204: - case 229: - case 294: + case 211: + case 214: + case 205: + case 230: + case 295: break; case 145: result = reduceNode(node.left, cbNode, result); @@ -47499,33 +47748,28 @@ var ts; result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 178: case 179: + case 180: result = reduceNodes(node.elements, cbNodes, result); break; - case 180: + case 181: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 181: + case 182: result = reduceNodes(node.elements, cbNodes, result); break; - case 182: - result = reduceNodes(node.properties, cbNodes, result); - break; case 183: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.properties, cbNodes, result); break; case 184: result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.argumentExpression, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 185: result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - result = reduceNodes(node.arguments, cbNodes, result); + result = reduceNode(node.argumentExpression, cbNode, result); break; case 186: result = reduceNode(node.expression, cbNode, result); @@ -47533,14 +47777,19 @@ var ts; result = reduceNodes(node.arguments, cbNodes, result); break; case 187: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); + break; + case 188: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 188: + case 189: result = reduceNode(node.type, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 190: + case 191: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -47548,262 +47797,262 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 191: + case 192: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 189: - case 192: + case 190: case 193: case 194: case 195: - case 201: + case 196: case 202: - case 207: + case 203: + case 208: result = reduceNode(node.expression, cbNode, result); break; - case 196: case 197: + case 198: result = reduceNode(node.operand, cbNode, result); break; - case 198: + case 199: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 199: + case 200: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 200: + case 201: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 203: + case 204: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 205: + case 206: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 206: + case 207: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.type, cbNode, result); break; - case 209: + case 210: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; - case 211: + case 212: result = reduceNodes(node.statements, cbNodes, result); break; - case 212: + case 213: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 214: + case 215: result = reduceNode(node.expression, cbNode, result); break; - case 215: + case 216: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 216: - result = reduceNode(node.statement, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; case 217: - case 224: - result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 218: + case 225: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 219: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 219: case 220: + case 221: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 223: - case 227: + case 224: + case 228: result = reduceNode(node.expression, cbNode, result); break; - case 225: + case 226: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 226: + case 227: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 228: + case 229: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 230: + case 231: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 231: - result = reduceNodes(node.declarations, cbNodes, result); - break; case 232: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); + result = reduceNodes(node.declarations, cbNodes, result); break; case 233: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.heritageClauses, cbNodes, result); - result = reduceNodes(node.members, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; - case 236: + case 234: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; case 237: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.body, cbNode, result); + result = reduceNodes(node.members, cbNodes, result); break; case 238: - result = reduceNodes(node.statements, cbNodes, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 239: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 240: result = reduceNodes(node.clauses, cbNodes, result); break; - case 241: + case 242: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.moduleReference, cbNode, result); break; - case 242: + case 243: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 243: + case 244: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 244: - result = reduceNode(node.name, cbNode, result); - break; case 245: - case 249: - result = reduceNodes(node.elements, cbNodes, result); + result = reduceNode(node.name, cbNode, result); break; case 246: case 250: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 247: + case 251: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 247: + case 248: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 248: + case 249: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 252: + case 253: result = reduceNode(node.expression, cbNode, result); break; - case 253: + case 254: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 257: + case 258: result = reduceNode(node.openingFragment, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingFragment, cbNode, result); break; - case 254: case 255: + case 256: result = reduceNode(node.tagName, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 261: + case 262: result = reduceNodes(node.properties, cbNodes, result); break; - case 256: + case 257: result = reduceNode(node.tagName, cbNode, result); break; - case 260: + case 261: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 262: - result = reduceNode(node.expression, cbNode, result); - break; case 263: result = reduceNode(node.expression, cbNode, result); break; case 264: result = reduceNode(node.expression, cbNode, result); + break; case 265: + result = reduceNode(node.expression, cbNode, result); + case 266: result = reduceNodes(node.statements, cbNodes, result); break; - case 266: + case 267: result = reduceNodes(node.types, cbNodes, result); break; - case 267: + case 268: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; - case 268: + case 269: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 269: + case 270: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 270: + case 271: result = reduceNode(node.expression, cbNode, result); break; - case 271: + case 272: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 272: + case 273: result = reduceNodes(node.statements, cbNodes, result); break; - case 295: + case 296: result = reduceNode(node.expression, cbNode, result); break; - case 296: + case 297: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -47856,7 +48105,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 205)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 206)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -47979,16 +48228,16 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 242: + case 243: externalImports.push(node); - hasImportStarOrImportDefault = getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); + hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); break; - case 241: - if (node.moduleReference.kind === 252) { + case 242: + if (node.moduleReference.kind === 253) { externalImports.push(node); } break; - case 248: + case 249: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -48015,12 +48264,12 @@ var ts; } } break; - case 247: + case 248: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 212: + case 213: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -48028,7 +48277,7 @@ var ts; } } break; - case 232: + case 233: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { @@ -48046,7 +48295,7 @@ var ts; } } break; - case 233: + case 234: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { @@ -48110,6 +48359,22 @@ var ts; ts.isIdentifier(expression); } ts.isSimpleCopiableExpression = isSimpleCopiableExpression; + function helperString(input) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return function (uniqueName) { + var result = ""; + for (var i = 0; i < args.length; i++) { + result += input[i]; + result += uniqueName(args[i]); + } + result += input[input.length - 1]; + return result; + }; + } + ts.helperString = helperString; })(ts || (ts = {})); var ts; (function (ts) { @@ -48501,8 +48766,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(183); context.enableSubstitution(184); + context.enableSubstitution(185); var currentSourceFile; var currentNamespace; var currentNamespaceContainerName; @@ -48536,15 +48801,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 272: + case 273: + case 240: case 239: - case 238: - case 211: + case 212: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; + case 234: case 233: - case 232: if (ts.hasModifier(node, 2)) { break; } @@ -48552,7 +48817,7 @@ var ts; recordEmittedDeclarationInScope(node); } else { - ts.Debug.assert(node.kind === 233 || ts.hasModifier(node, 512)); + ts.Debug.assert(node.kind === 234 || ts.hasModifier(node, 512)); } break; } @@ -48574,10 +48839,10 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { + case 243: case 242: - case 241: - case 247: case 248: + case 249: return visitEllidableStatement(node); default: return visitorWorker(node); @@ -48592,13 +48857,13 @@ var ts; return node; } switch (node.kind) { - case 242: + case 243: return visitImportDeclaration(node); - case 241: + case 242: return visitImportEqualsDeclaration(node); - case 247: - return visitExportAssignment(node); case 248: + return visitExportAssignment(node); + case 249: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -48608,11 +48873,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 248 || - node.kind === 242 || + if (node.kind === 249 || node.kind === 243 || - (node.kind === 241 && - node.moduleReference.kind === 252)) { + node.kind === 244 || + (node.kind === 242 && + node.moduleReference.kind === 253)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -48636,7 +48901,7 @@ var ts; case 156: case 153: return visitorWorker(node); - case 210: + case 211: return node; default: return ts.Debug.failBadSyntaxKind(node); @@ -48693,23 +48958,23 @@ var ts; case 177: case 159: case 149: - case 235: + case 236: return undefined; case 151: return visitPropertyDeclaration(node); - case 240: + case 241: return undefined; case 154: return visitConstructor(node); - case 234: + case 235: return ts.createNotEmittedStatement(node); - case 233: + case 234: return visitClassDeclaration(node); - case 203: + case 204: return visitClassExpression(node); - case 266: + case 267: return visitHeritageClause(node); - case 205: + case 206: return visitExpressionWithTypeArguments(node); case 153: return visitMethodDeclaration(node); @@ -48717,34 +48982,34 @@ var ts; return visitGetAccessor(node); case 156: return visitSetAccessor(node); - case 232: + case 233: return visitFunctionDeclaration(node); - case 190: - return visitFunctionExpression(node); case 191: + return visitFunctionExpression(node); + case 192: return visitArrowFunction(node); case 148: return visitParameter(node); - case 189: + case 190: return visitParenthesizedExpression(node); - case 188: - case 206: - return visitAssertionExpression(node); - case 185: - return visitCallExpression(node); - case 186: - return visitNewExpression(node); + case 189: case 207: + return visitAssertionExpression(node); + case 186: + return visitCallExpression(node); + case 187: + return visitNewExpression(node); + case 208: return visitNonNullExpression(node); - case 236: - return visitEnumDeclaration(node); - case 212: - return visitVariableStatement(node); - case 230: - return visitVariableDeclaration(node); case 237: + return visitEnumDeclaration(node); + case 213: + return visitVariableStatement(node); + case 231: + return visitVariableDeclaration(node); + case 238: return visitModuleDeclaration(node); - case 241: + case 242: return visitImportEqualsDeclaration(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -48964,7 +49229,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 214 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 215 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -49251,8 +49516,8 @@ var ts; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 233: - case 203: + case 234: + case 204: return ts.getFirstConstructorWithBody(node) !== undefined; case 153: case 155: @@ -49269,8 +49534,8 @@ var ts; return serializeTypeNode(node.type); case 156: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 233: - case 203: + case 234: + case 204: case 153: return ts.createIdentifier("Function"); default: @@ -49763,11 +50028,11 @@ var ts; function addVarForEnumOrModuleDeclaration(statements, node) { var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, false, true)) - ], currentScope.kind === 272 ? 0 : 1)); + ], currentScope.kind === 273 ? 0 : 1)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 236) { + if (node.kind === 237) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -49828,7 +50093,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 238) { + if (body.kind === 239) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -49852,13 +50117,13 @@ var ts; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true); ts.setTextRange(block, blockLocation); - if (body.kind !== 238) { + if (body.kind !== 239) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 237) { + if (moduleDeclaration.body.kind === 238) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -49878,7 +50143,7 @@ var ts; return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 244) { + if (node.kind === 245) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -50013,15 +50278,15 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(71); - context.enableSubstitution(269); - context.enableEmitNotification(237); + context.enableSubstitution(270); + context.enableEmitNotification(238); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 237; + return ts.getOriginalNode(node).kind === 238; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 236; + return ts.getOriginalNode(node).kind === 237; } function onEmitNode(hint, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; @@ -50067,9 +50332,9 @@ var ts; switch (node.kind) { case 71: return substituteExpressionIdentifier(node); - case 183: - return substitutePropertyAccessExpression(node); case 184: + return substitutePropertyAccessExpression(node); + case 185: return substituteElementAccessExpression(node); } return node; @@ -50099,9 +50364,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 !== 272) { - var substitute = (applicableSubstitutions & 2 && container.kind === 237) || - (applicableSubstitutions & 8 && container.kind === 236); + if (container && container.kind !== 273) { + var substitute = (applicableSubstitutions & 2 && container.kind === 238) || + (applicableSubstitutions & 8 && container.kind === 237); if (substitute) { return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), node); } @@ -50218,15 +50483,15 @@ var ts; switch (node.kind) { case 120: return undefined; - case 195: + case 196: return visitAwaitExpression(node); case 153: return visitMethodDeclaration(node); - case 232: + case 233: return visitFunctionDeclaration(node); - case 190: - return visitFunctionExpression(node); case 191: + return visitFunctionExpression(node); + case 192: return visitArrowFunction(node); default: return ts.visitEachChild(node, visitor, context); @@ -50235,27 +50500,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 212: + case 213: return visitVariableStatementInAsyncBody(node); - case 218: - return visitForStatementInAsyncBody(node); case 219: - return visitForInStatementInAsyncBody(node); + return visitForStatementInAsyncBody(node); case 220: + return visitForInStatementInAsyncBody(node); + case 221: return visitForOfStatementInAsyncBody(node); - case 267: + case 268: return visitCatchClauseInAsyncBody(node); - case 211: - case 225: - case 239: - case 264: - case 265: - case 228: - case 216: - case 217: - case 215: - case 224: + case 212: case 226: + case 240: + case 265: + case 266: + case 229: + case 217: + case 218: + case 216: + case 225: + case 227: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -50403,7 +50668,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 === 191; + var isArrowFunction = node.kind === 192; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; var savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; enclosingFunctionParameterNames = ts.createUnderscoreEscapedMap(); @@ -50467,10 +50732,10 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution(185); - context.enableSubstitution(183); + context.enableSubstitution(186); context.enableSubstitution(184); - context.enableEmitNotification(233); + context.enableSubstitution(185); + context.enableEmitNotification(234); context.enableEmitNotification(153); context.enableEmitNotification(155); context.enableEmitNotification(156); @@ -50499,11 +50764,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 183: - return substitutePropertyAccessExpression(node); case 184: - return substituteElementAccessExpression(node); + return substitutePropertyAccessExpression(node); case 185: + return substituteElementAccessExpression(node); + case 186: return substituteCallExpression(node); } return node; @@ -50534,7 +50799,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 233 + return kind === 234 || kind === 154 || kind === 153 || kind === 155 @@ -50542,10 +50807,10 @@ var ts; } function createSuperAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096) { - return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value"), location); + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createFileLevelUniqueName("_super"), undefined, [argumentExpression]), "value"), location); } else { - return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), location); + return ts.setTextRange(ts.createCall(ts.createFileLevelUniqueName("_super"), undefined, [argumentExpression]), location); } } } @@ -50570,12 +50835,12 @@ var ts; ts.asyncSuperHelper = { name: "typescript:async-super", scoped: true, - text: "\n const _super = name => super[name];" + text: ts.helperString(__makeTemplateObject(["\n const ", " = name => super[name];"], ["\n const ", " = name => super[name];"]), "_super") }; ts.advancedAsyncSuperHelper = { name: "typescript:advanced-async-super", scoped: true, - text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" + text: ts.helperString(__makeTemplateObject(["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"], ["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"]), "_super") }; })(ts || (ts = {})); var ts; @@ -50622,23 +50887,23 @@ var ts; return node; } switch (node.kind) { - case 195: + case 196: return visitAwaitExpression(node); - case 201: + case 202: return visitYieldExpression(node); - case 226: + case 227: return visitLabeledStatement(node); - case 182: + case 183: return visitObjectLiteralExpression(node); - case 198: + case 199: return visitBinaryExpression(node, noDestructuringValue); - case 230: + case 231: return visitVariableDeclaration(node); - case 220: + case 221: return visitForOfStatement(node, undefined); - case 218: + case 219: return visitForStatement(node); - case 194: + case 195: return visitVoidExpression(node); case 154: return visitConstructorDeclaration(node); @@ -50648,19 +50913,19 @@ var ts; return visitGetAccessorDeclaration(node); case 156: return visitSetAccessorDeclaration(node); - case 232: + case 233: return visitFunctionDeclaration(node); - case 190: - return visitFunctionExpression(node); case 191: + return visitFunctionExpression(node); + case 192: return visitArrowFunction(node); case 148: return visitParameter(node); - case 214: + case 215: return visitExpressionStatement(node); - case 189: + case 190: return visitParenthesizedExpression(node, noDestructuringValue); - case 267: + case 268: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -50682,7 +50947,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 220 && statement.awaitModifier) { + if (statement.kind === 221 && statement.awaitModifier) { return visitForOfStatement(statement, node); } return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node); @@ -50694,7 +50959,7 @@ var ts; var objects = []; for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { var e = elements_4[_i]; - if (e.kind === 270) { + if (e.kind === 271) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -50703,7 +50968,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 268 + chunkObject = ts.append(chunkObject, e.kind === 269 ? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -50716,7 +50981,7 @@ var ts; function visitObjectLiteralExpression(node) { if (node.transformFlags & 1048576) { var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 182) { + if (objects.length && objects[0].kind !== 183) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -50779,6 +51044,11 @@ var ts; bodyLocation = node.statement; statementsLocation = node.statement.statements; } + else if (node.statement) { + ts.append(statements, node.statement); + bodyLocation = node.statement; + statementsLocation = node.statement; + } return ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer) ], 1), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation)); @@ -50967,10 +51237,10 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution(185); - context.enableSubstitution(183); + context.enableSubstitution(186); context.enableSubstitution(184); - context.enableEmitNotification(233); + context.enableSubstitution(185); + context.enableEmitNotification(234); context.enableEmitNotification(153); context.enableEmitNotification(155); context.enableEmitNotification(156); @@ -50999,11 +51269,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 183: - return substitutePropertyAccessExpression(node); case 184: - return substituteElementAccessExpression(node); + return substitutePropertyAccessExpression(node); case 185: + return substituteElementAccessExpression(node); + case 186: return substituteCallExpression(node); } return node; @@ -51034,7 +51304,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 233 + return kind === 234 || kind === 154 || kind === 153 || kind === 155 @@ -51133,13 +51403,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 253: - return visitJsxElement(node, false); case 254: + return visitJsxElement(node, false); + case 255: return visitJsxSelfClosingElement(node, false); - case 257: + case 258: return visitJsxFragment(node, false); - case 263: + case 264: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -51149,13 +51419,13 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 263: + case 264: return visitJsxExpression(node); - case 253: - return visitJsxElement(node, true); case 254: + return visitJsxElement(node, true); + case 255: return visitJsxSelfClosingElement(node, true); - case 257: + case 258: return visitJsxFragment(node, true); default: return ts.Debug.failBadSyntaxKind(node); @@ -51219,7 +51489,7 @@ var ts; literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile); return ts.setTextRange(literal, node); } - else if (node.kind === 263) { + else if (node.kind === 264) { if (node.expression === undefined) { return ts.createTrue(); } @@ -51279,7 +51549,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 253) { + if (node.kind === 254) { return getTagName(node.openingElement); } else { @@ -51579,7 +51849,7 @@ var ts; return node; } switch (node.kind) { - case 198: + case 199: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -51738,13 +52008,13 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return hierarchyFacts & 4096 - && node.kind === 223 + && node.kind === 224 && !node.expression; } function shouldVisitNode(node) { return (node.transformFlags & 128) !== 0 || convertedLoopState !== undefined - || (hierarchyFacts & 4096 && (ts.isStatement(node) || (node.kind === 211))) + || (hierarchyFacts & 4096 && (ts.isStatement(node) || (node.kind === 212))) || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)) || (ts.getEmitFlags(node) & 33554432) !== 0; } @@ -51772,63 +52042,63 @@ var ts; switch (node.kind) { case 115: return undefined; - case 233: + case 234: return visitClassDeclaration(node); - case 203: + case 204: return visitClassExpression(node); case 148: return visitParameter(node); - case 232: + case 233: return visitFunctionDeclaration(node); - case 191: + case 192: return visitArrowFunction(node); - case 190: + case 191: return visitFunctionExpression(node); - case 230: + case 231: return visitVariableDeclaration(node); case 71: return visitIdentifier(node); - case 231: + case 232: return visitVariableDeclarationList(node); - case 225: - return visitSwitchStatement(node); - case 239: - return visitCaseBlock(node); - case 211: - return visitBlock(node, false); - case 222: - case 221: - return visitBreakOrContinueStatement(node); case 226: + return visitSwitchStatement(node); + case 240: + return visitCaseBlock(node); + case 212: + return visitBlock(node, false); + case 223: + case 222: + return visitBreakOrContinueStatement(node); + case 227: return visitLabeledStatement(node); - case 216: case 217: - return visitDoOrWhileStatement(node, undefined); case 218: - return visitForStatement(node, undefined); + return visitDoOrWhileStatement(node, undefined); case 219: - return visitForInStatement(node, undefined); + return visitForStatement(node, undefined); case 220: + return visitForInStatement(node, undefined); + case 221: return visitForOfStatement(node, undefined); - case 214: + case 215: return visitExpressionStatement(node); - case 182: + case 183: return visitObjectLiteralExpression(node); - case 267: + case 268: return visitCatchClause(node); - case 269: + case 270: return visitShorthandPropertyAssignment(node); case 146: return visitComputedPropertyName(node); - case 181: + case 182: return visitArrayLiteralExpression(node); - case 185: - return visitCallExpression(node); case 186: + return visitCallExpression(node); + case 187: return visitNewExpression(node); - case 189: + case 190: return visitParenthesizedExpression(node, true); - case 198: + case 199: return visitBinaryExpression(node, true); case 13: case 14: @@ -51839,28 +52109,28 @@ var ts; return visitStringLiteral(node); case 8: return visitNumericLiteral(node); - case 187: + case 188: return visitTaggedTemplateExpression(node); - case 200: - return visitTemplateExpression(node); case 201: - return visitYieldExpression(node); + return visitTemplateExpression(node); case 202: + return visitYieldExpression(node); + case 203: return visitSpreadElement(node); case 97: return visitSuperKeyword(false); case 99: return visitThisKeyword(node); - case 208: + case 209: return visitMetaProperty(node); case 153: return visitMethodDeclaration(node); case 155: case 156: return visitAccessorDeclaration(node); - case 212: + case 213: return visitVariableStatement(node); - case 223: + case 224: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); @@ -51898,7 +52168,7 @@ var ts; return updated; } function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + return ts.setOriginalNode(ts.createReturn(ts.createFileLevelUniqueName("_this")), node); } function visitReturnStatement(node) { if (convertedLoopState) { @@ -51941,13 +52211,13 @@ var ts; } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 222 ? 2 : 4; + var jump = node.kind === 223 ? 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; if (!node.label) { - if (node.kind === 222) { + if (node.kind === 223) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -51957,7 +52227,7 @@ var ts; } } else { - if (node.kind === 222) { + if (node.kind === 223) { labelMarker = "break-" + node.label.escapedText; setLabeledJump(convertedLoopState, true, ts.idText(node.label), labelMarker); } @@ -52017,7 +52287,7 @@ var ts; enableSubstitutionsForBlockScopedBindings(); } var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node); - var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, "_super")] : [], undefined, transformClassBody(node, extendsClauseElement)); + var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, ts.createFileLevelUniqueName("_super"))] : [], undefined, transformClassBody(node, extendsClauseElement)); ts.setEmitFlags(classFunction, (ts.getEmitFlags(node) & 65536) | 524288); var inner = ts.createPartiallyEmittedExpression(classFunction); inner.end = node.end; @@ -52107,7 +52377,7 @@ var ts; if (isDerivedClass && superCaptureStatus !== 2 && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { - statements.push(ts.createReturn(ts.createIdentifier("_this"))); + statements.push(ts.createReturn(ts.createFileLevelUniqueName("_this"))); } ts.addRange(statements, endLexicalEnvironment()); if (constructor) { @@ -52121,17 +52391,17 @@ var ts; return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 223) { + if (statement.kind === 224) { return true; } - else if (statement.kind === 215) { + else if (statement.kind === 216) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 211) { + else if (statement.kind === 212) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -52160,7 +52430,7 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 214 && ts.isSuperCall(firstStatement.expression)) { + if (firstStatement.kind === 215 && ts.isSuperCall(firstStatement.expression)) { superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } @@ -52168,8 +52438,8 @@ var ts; && statementOffset === ctorStatements.length - 1 && !(ctor.transformFlags & (16384 | 32768))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 198 - || superCallExpression.left.kind !== 185) { + if (superCallExpression.kind !== 199 + || superCallExpression.left.kind !== 186) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); @@ -52186,7 +52456,7 @@ var ts; return ts.setEmitFlags(ts.createThis(), 4); } function createDefaultSuperCallOrThis() { - return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createFileLevelUniqueName("_super"), ts.createNull()), ts.createFunctionApply(ts.createFileLevelUniqueName("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } function visitParameter(node) { if (node.dotDotDotToken) { @@ -52270,14 +52540,14 @@ var ts; statements.push(forStatement); } function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 && node.kind !== 191) { + if (node.transformFlags & 32768 && node.kind !== 192) { captureThisForNode(statements, node, ts.createThis()); } } function captureThisForNode(statements, node, initializer, originalStatement) { enableSubstitutionsForCapturedThis(); var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("_this", undefined, initializer) + ts.createVariableDeclaration(ts.createFileLevelUniqueName("_this"), undefined, initializer) ])); ts.setEmitFlags(captureThisStatement, 1536 | 1048576); ts.setTextRange(captureThisStatement, originalStatement); @@ -52288,7 +52558,7 @@ var ts; if (hierarchyFacts & 16384) { var newTarget = void 0; switch (node.kind) { - case 191: + case 192: return statements; case 153: case 155: @@ -52298,15 +52568,15 @@ var ts; case 154: newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); break; - case 232: - case 190: + case 233: + case 191: newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 93, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); break; default: return ts.Debug.failBadSyntaxKind(node); } var captureNewTargetStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("_newTarget", undefined, newTarget) + ts.createVariableDeclaration(ts.createFileLevelUniqueName("_newTarget"), undefined, newTarget) ])); if (copyOnWrite) { return [captureNewTargetStatement].concat(statements); @@ -52319,7 +52589,7 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 210: + case 211: statements.push(transformSemicolonClassElementToStatement(member)); break; case 153: @@ -52457,7 +52727,7 @@ var ts; : enterSubtree(16286, 65); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 16384 && !name && (node.kind === 232 || node.kind === 190)) { + if (hierarchyFacts & 16384 && !name && (node.kind === 233 || node.kind === 191)) { name = ts.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 49152, 0); @@ -52491,7 +52761,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 191); + ts.Debug.assert(node.kind === 192); statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { @@ -52543,9 +52813,9 @@ var ts; } function visitExpressionStatement(node) { switch (node.expression.kind) { - case 189: + case 190: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false)); - case 198: + case 199: return ts.updateStatement(node, visitBinaryExpression(node.expression, false)); } return ts.visitEachChild(node, visitor, context); @@ -52553,9 +52823,9 @@ var ts; function visitParenthesizedExpression(node, needsDestructuringValue) { if (!needsDestructuringValue) { switch (node.expression.kind) { - case 189: + case 190: return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); - case 198: + case 199: return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } @@ -52681,14 +52951,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 216: case 217: - return visitDoOrWhileStatement(node, outermostLabeledStatement); case 218: - return visitForStatement(node, outermostLabeledStatement); + return visitDoOrWhileStatement(node, outermostLabeledStatement); case 219: - return visitForInStatement(node, outermostLabeledStatement); + return visitForStatement(node, outermostLabeledStatement); case 220: + return visitForInStatement(node, outermostLabeledStatement); + case 221: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -52875,11 +53145,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 218: case 219: case 220: + case 221: var initializer = node.initializer; - if (initializer && initializer.kind === 231) { + if (initializer && initializer.kind === 232) { loopInitializer = initializer; } break; @@ -53115,10 +53385,10 @@ var ts; case 153: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 268: + case 269: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 269: + case 270: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -53288,7 +53558,7 @@ var ts; ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); resultingCall = assignToCapturedThis - ? ts.createAssignment(ts.createIdentifier("_this"), initializer) + ? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer) : initializer; } return ts.setOriginalNode(resultingCall, node); @@ -53322,7 +53592,7 @@ var ts; else { if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 181 + return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 182 ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -53432,8 +53702,8 @@ var ts; function visitSuperKeyword(isExpressionOfCall) { return hierarchyFacts & 8 && !isExpressionOfCall - ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") - : ts.createIdentifier("_super"); + ? ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), "prototype") + : ts.createFileLevelUniqueName("_super"); } function visitMetaProperty(node) { if (node.keywordToken === 94 && node.name.escapedText === "target") { @@ -53443,7 +53713,7 @@ var ts; else { hierarchyFacts |= 16384; } - return ts.createIdentifier("_newTarget"); + return ts.createFileLevelUniqueName("_newTarget"); } return node; } @@ -53472,9 +53742,9 @@ var ts; context.enableEmitNotification(153); context.enableEmitNotification(155); context.enableEmitNotification(156); + context.enableEmitNotification(192); context.enableEmitNotification(191); - context.enableEmitNotification(190); - context.enableEmitNotification(232); + context.enableEmitNotification(233); } } function onSubstituteNode(hint, node) { @@ -53499,10 +53769,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 180: - case 233: - case 236: - case 230: + case 181: + case 234: + case 237: + case 231: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -53546,7 +53816,7 @@ var ts; function substituteThisKeyword(node) { if (enabledSubstitutions & 1 && hierarchyFacts & 16) { - return ts.setTextRange(ts.createIdentifier("_this"), node); + return ts.setTextRange(ts.createFileLevelUniqueName("_this"), node); } return node; } @@ -53563,11 +53833,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 214) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 215) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 185) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 186) { return false; } var callTarget = statementExpression.expression; @@ -53575,7 +53845,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 202) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 203) { return false; } var expression = callArgument.expression; @@ -53587,7 +53857,7 @@ var ts; context.requestEmitHelper(extendsHelper); return ts.createCall(ts.getHelperName("__extends"), undefined, [ name, - ts.createIdentifier("_super") + ts.createFileLevelUniqueName("_super") ]); } function createTemplateObjectHelper(context, cooked, raw) { @@ -53727,13 +53997,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 216: - return visitDoStatement(node); case 217: + return visitDoStatement(node); + case 218: return visitWhileStatement(node); - case 225: - return visitSwitchStatement(node); case 226: + return visitSwitchStatement(node); + case 227: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -53741,24 +54011,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 232: + case 233: return visitFunctionDeclaration(node); - case 190: + case 191: return visitFunctionExpression(node); case 155: case 156: return visitAccessorDeclaration(node); - case 212: + case 213: return visitVariableStatement(node); - case 218: - return visitForStatement(node); case 219: + return visitForStatement(node); + case 220: return visitForInStatement(node); - case 222: - return visitBreakStatement(node); - case 221: - return visitContinueStatement(node); case 223: + return visitBreakStatement(node); + case 222: + return visitContinueStatement(node); + case 224: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -53774,21 +54044,21 @@ var ts; } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 198: - return visitBinaryExpression(node); case 199: + return visitBinaryExpression(node); + case 200: return visitConditionalExpression(node); - case 201: + case 202: return visitYieldExpression(node); - case 181: - return visitArrayLiteralExpression(node); case 182: + return visitArrayLiteralExpression(node); + case 183: return visitObjectLiteralExpression(node); - case 184: - return visitElementAccessExpression(node); case 185: - return visitCallExpression(node); + return visitElementAccessExpression(node); case 186: + return visitCallExpression(node); + case 187: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -53796,9 +54066,9 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 232: + case 233: return visitFunctionDeclaration(node); - case 190: + case 191: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -53954,10 +54224,10 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 183: + case 184: target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 184: + case 185: target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: @@ -54158,35 +54428,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 211: + case 212: return transformAndEmitBlock(node); - case 214: - return transformAndEmitExpressionStatement(node); case 215: - return transformAndEmitIfStatement(node); + return transformAndEmitExpressionStatement(node); case 216: - return transformAndEmitDoStatement(node); + return transformAndEmitIfStatement(node); case 217: - return transformAndEmitWhileStatement(node); + return transformAndEmitDoStatement(node); case 218: - return transformAndEmitForStatement(node); + return transformAndEmitWhileStatement(node); case 219: + return transformAndEmitForStatement(node); + case 220: return transformAndEmitForInStatement(node); - case 221: - return transformAndEmitContinueStatement(node); case 222: - return transformAndEmitBreakStatement(node); + return transformAndEmitContinueStatement(node); case 223: - return transformAndEmitReturnStatement(node); + return transformAndEmitBreakStatement(node); case 224: - return transformAndEmitWithStatement(node); + return transformAndEmitReturnStatement(node); case 225: - return transformAndEmitSwitchStatement(node); + return transformAndEmitWithStatement(node); case 226: - return transformAndEmitLabeledStatement(node); + return transformAndEmitSwitchStatement(node); case 227: - return transformAndEmitThrowStatement(node); + return transformAndEmitLabeledStatement(node); case 228: + return transformAndEmitThrowStatement(node); + case 229: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -54480,7 +54750,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 265 && defaultClauseIndex === -1) { + if (clause.kind === 266 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -54490,7 +54760,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 264) { + if (clause.kind === 265) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -55293,24 +55563,24 @@ var ts; if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(255); context.enableEmitNotification(256); - context.enableEmitNotification(254); + context.enableEmitNotification(257); + context.enableEmitNotification(255); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(183); - context.enableSubstitution(268); + context.enableSubstitution(184); + context.enableSubstitution(269); return transformSourceFile; function transformSourceFile(node) { return node; } function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 255: case 256: - case 254: + case 257: + case 255: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -55375,11 +55645,11 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(71); - context.enableSubstitution(198); - context.enableSubstitution(196); + context.enableSubstitution(199); context.enableSubstitution(197); - context.enableSubstitution(269); - context.enableEmitNotification(272); + context.enableSubstitution(198); + context.enableSubstitution(270); + context.enableEmitNotification(273); var moduleInfoMap = []; var deferredExports = []; var currentSourceFile; @@ -55564,23 +55834,23 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 242: + case 243: return visitImportDeclaration(node); - case 241: + case 242: return visitImportEqualsDeclaration(node); - case 248: + case 249: return visitExportDeclaration(node); - case 247: + case 248: return visitExportAssignment(node); - case 212: + case 213: return visitVariableStatement(node); - case 232: - return visitFunctionDeclaration(node); case 233: + return visitFunctionDeclaration(node); + case 234: return visitClassDeclaration(node); - case 297: - return visitMergeDeclarationMarker(node); case 298: + return visitMergeDeclarationMarker(node); + case 299: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -55869,7 +56139,7 @@ var ts; } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 212) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 213) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -55901,10 +56171,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 244: + case 245: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 245: + case 246: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -56012,7 +56282,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 272) { + if (node.kind === 273) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -56054,10 +56324,10 @@ var ts; switch (node.kind) { case 71: return substituteExpressionIdentifier(node); - case 198: + case 199: return substituteBinaryExpression(node); + case 198: case 197: - case 196: return substituteUnaryExpression(node); } return node; @@ -56072,7 +56342,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 272) { + if (exportContainer && exportContainer.kind === 273) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -56115,7 +56385,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 197 + var expression = node.kind === 198 ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 43 ? 59 : 60), ts.createLiteral(1)), node) : node; for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { @@ -56179,11 +56449,11 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(71); - context.enableSubstitution(269); - context.enableSubstitution(198); - context.enableSubstitution(196); + context.enableSubstitution(270); + context.enableSubstitution(199); context.enableSubstitution(197); - context.enableEmitNotification(272); + context.enableSubstitution(198); + context.enableEmitNotification(273); var moduleInfoMap = []; var deferredExports = []; var exportFunctionsMap = []; @@ -56287,7 +56557,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 248 && externalImport.exportClause) { + if (externalImport.kind === 249 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -56310,7 +56580,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 248) { + if (externalImport.kind !== 249) { continue; } if (!externalImport.exportClause) { @@ -56361,15 +56631,15 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 242: + case 243: if (!entry.importClause) { break; } - case 241: + case 242: ts.Debug.assert(importVariableName !== undefined); statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 248: + case 249: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { var properties = []; @@ -56391,13 +56661,13 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 242: + case 243: return visitImportDeclaration(node); - case 241: + case 242: return visitImportEqualsDeclaration(node); - case 248: + case 249: return undefined; - case 247: + case 248: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -56518,7 +56788,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 2097152) === 0 - && (enclosingBlockScopedContainer.kind === 272 + && (enclosingBlockScopedContainer.kind === 273 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -56540,7 +56810,7 @@ var ts; : preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 212) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 213) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -56557,6 +56827,12 @@ var ts; delete deferredExports[id]; return ts.append(statements, node); } + else { + var original = ts.getOriginalNode(node); + if (ts.isModuleOrEnumDeclaration(original)) { + return ts.append(appendExportsOfDeclaration(statements, original), node); + } + } return node; } function appendExportsOfImportDeclaration(statements, decl) { @@ -56573,10 +56849,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 244: + case 245: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 245: + case 246: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -56676,43 +56952,43 @@ var ts; } function nestedElementVisitor(node) { switch (node.kind) { - case 212: + case 213: return visitVariableStatement(node); - case 232: - return visitFunctionDeclaration(node); case 233: + return visitFunctionDeclaration(node); + case 234: return visitClassDeclaration(node); - case 218: - return visitForStatement(node); case 219: - return visitForInStatement(node); + return visitForStatement(node); case 220: + return visitForInStatement(node); + case 221: return visitForOfStatement(node); - case 216: - return visitDoStatement(node); case 217: + return visitDoStatement(node); + case 218: return visitWhileStatement(node); - case 226: + case 227: return visitLabeledStatement(node); - case 224: - return visitWithStatement(node); case 225: + return visitWithStatement(node); + case 226: return visitSwitchStatement(node); - case 239: + case 240: return visitCaseBlock(node); - case 264: - return visitCaseClause(node); case 265: + return visitCaseClause(node); + case 266: return visitDefaultClause(node); - case 228: + case 229: return visitTryStatement(node); - case 267: + case 268: return visitCatchClause(node); - case 211: + case 212: return visitBlock(node); - case 297: - return visitMergeDeclarationMarker(node); case 298: + return visitMergeDeclarationMarker(node); + case 299: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -56809,7 +57085,7 @@ var ts; } function destructuringAndImportCallVisitor(node) { if (node.transformFlags & 1024 - && node.kind === 198) { + && node.kind === 199) { return visitDestructuringAssignment(node); } else if (ts.isImportCall(node)) { @@ -56852,7 +57128,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 272; + return container !== undefined && container.kind === 273; } else { return false; @@ -56867,7 +57143,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 272) { + if (node.kind === 273) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -56901,7 +57177,7 @@ var ts; } function substituteUnspecified(node) { switch (node.kind) { - case 269: + case 270: return substituteShorthandPropertyAssignment(node); } return node; @@ -56925,10 +57201,10 @@ var ts; switch (node.kind) { case 71: return substituteExpressionIdentifier(node); - case 198: + case 199: return substituteBinaryExpression(node); - case 196: case 197: + case 198: return substituteUnaryExpression(node); } return node; @@ -56980,14 +57256,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 197 + var expression = node.kind === 198 ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 197) { + if (node.kind === 198) { expression = node.operator === 43 ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -57004,7 +57280,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 272) { + if (exportContainer && exportContainer.kind === 273) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -57032,7 +57308,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(272); + context.enableEmitNotification(273); context.enableSubstitution(71); var currentSourceFile; return transformSourceFile; @@ -57059,9 +57335,9 @@ var ts; } function visitor(node) { switch (node.kind) { - case 241: + case 242: return undefined; - case 247: + case 248: return visitExportAssignment(node); } return node; @@ -57147,7 +57423,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 === 233) { + else if (node.parent.kind === 234) { 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 : @@ -57176,7 +57452,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 === 233) { + else if (node.parent.kind === 234) { 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 : @@ -57223,7 +57499,7 @@ var ts; ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 230 || node.kind === 180) { + if (node.kind === 231 || node.kind === 181) { 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 : @@ -57239,7 +57515,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 === 233 || node.kind === 148) { + else if (node.parent.kind === 234 || node.kind === 148) { 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 : @@ -57324,7 +57600,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 === 233) { + else if (node.parent.kind === 234) { 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 : @@ -57337,7 +57613,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 232: + case 233: 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 : @@ -57390,7 +57666,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 === 233) { + else if (node.parent.parent.kind === 234) { 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 : @@ -57402,7 +57678,7 @@ 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 232: + case 233: case 162: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -57416,10 +57692,10 @@ var ts; function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 233: + case 234: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 234: + case 235: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 158: @@ -57433,17 +57709,17 @@ var ts; if (ts.hasModifier(node.parent, 32)) { 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 === 233) { + else if (node.parent.parent.kind === 234) { 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 232: + case 233: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 235: + case 236: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -57457,7 +57733,7 @@ var ts; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 233) { + if (node.parent.parent.kind === 234) { diagnosticMessage = node.parent.token === 108 ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1; @@ -57581,15 +57857,17 @@ var ts; } } function transformRoot(node) { - if (node.kind === 272 && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) { + if (node.kind === 273 && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) { return node; } - if (node.kind === 273) { + if (node.kind === 274) { isBundledEmit = true; var refs_1 = ts.createMap(); + var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) return; + hasNoDefaultLib_1 = hasNoDefaultLib_1 || sourceFile.hasNoDefaultLib; currentSourceFile = sourceFile; enclosingDeclaration = sourceFile; possibleImports = undefined; @@ -57601,15 +57879,16 @@ var ts; resultHasExternalModuleIndicator = false; needsDeclare = false; var statements_5 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements_5)), sourceFile.statements)))], true, [], []); + var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements_5)), sourceFile.statements)))], true, [], [], false); return newFile; } needsDeclare = true; var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - return ts.updateSourceFileNode(sourceFile, updated, true, [], []); + return ts.updateSourceFileNode(sourceFile, updated, true, [], [], false); })); bundle.syntheticFileReferences = []; bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences(); + bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); refs_1.forEach(referenceVisitor_1); @@ -57632,15 +57911,28 @@ var ts; refs.forEach(referenceVisitor); var statements = ts.visitNodes(node.statements, visitDeclarationStatements); var combinedStatements = ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements)), node.statements); + var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax); if (ts.isExternalModule(node) && !resultHasExternalModuleIndicator) { combinedStatements = ts.setTextRange(ts.createNodeArray(combinedStatements.concat([ts.createExportDeclaration(undefined, undefined, ts.createNamedExports([]), undefined)])), combinedStatements); } - var updated = ts.updateSourceFileNode(node, combinedStatements, true, references, getFileReferencesForUsedTypeReferences()); + var updated = ts.updateSourceFileNode(node, combinedStatements, true, references, getFileReferencesForUsedTypeReferences(), node.hasNoDefaultLib); return updated; function getFileReferencesForUsedTypeReferences() { - return necessaryTypeRefernces ? ts.map(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : []; + return necessaryTypeRefernces ? ts.mapDefined(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : []; } function getFileReferenceForTypeName(typeName) { + for (var _i = 0, emittedImports_1 = emittedImports; _i < emittedImports_1.length; _i++) { + var importStatement = emittedImports_1[_i]; + if (ts.isImportEqualsDeclaration(importStatement) && ts.isExternalModuleReference(importStatement.moduleReference)) { + var expr = importStatement.moduleReference.expression; + if (ts.isStringLiteralLike(expr) && expr.text === typeName) { + return undefined; + } + } + else if (ts.isImportDeclaration(importStatement) && ts.isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) { + return undefined; + } + } return { fileName: typeName, pos: -1, end: -1 }; } function mapReferencesIntoArray(references, outputFilePath) { @@ -57681,7 +57973,7 @@ var ts; return name; } else { - if (name.kind === 179) { + if (name.kind === 180) { return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -57689,7 +57981,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 204) { + if (elem.kind === 205) { return elem; } return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined); @@ -57741,7 +58033,7 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 230 || node.kind === 180) { + if (node.kind === 231 || node.kind === 181) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } if (node.kind === 148 @@ -57763,19 +58055,19 @@ var ts; function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 232: - case 237: - case 234: case 233: + case 238: case 235: + case 234: case 236: + case 237: return !resolver.isDeclarationVisible(node); - case 230: + case 231: return !getBindingNameVisible(node); - case 241: case 242: + case 243: + case 249: case 248: - case 247: return false; } return false; @@ -57828,7 +58120,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return; - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 237; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 238 && parent.kind !== 178); if (input.kind === 9 && isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); if (newName) { @@ -57840,7 +58132,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 252) { + if (decl.moduleReference.kind === 253) { var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return ts.updateImportEqualsDeclaration(decl, undefined, decl.modifiers, decl.name, ts.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); } @@ -57860,7 +58152,7 @@ var ts; if (!decl.importClause.namedBindings) { return visibleDefaultBinding && ts.updateImportDeclaration(decl, undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier)); } - if (decl.importClause.namedBindings.kind === 244) { + if (decl.importClause.namedBindings.kind === 245) { var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : undefined; return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined; } @@ -57877,7 +58169,7 @@ var ts; unconsideredImports.push(i); continue; } - if (i.kind === 241) { + if (i.kind === 242) { var result_3 = transformImportEqualsDeclaration(i); importDeclarationMap.set("" + ts.getNodeId(i), result_3); continue; @@ -57927,7 +58219,7 @@ var ts; if (ts.hasModifier(input, 8)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) return; - return cleanup(ts.createProperty(undefined, input.modifiers, input.name, undefined, undefined, undefined)); + return cleanup(ts.createProperty(undefined, ensureModifiers(input), input.name, undefined, undefined, undefined)); } } var canProdiceDiagnostic = ts.canProduceDiagnostics(input); @@ -57938,13 +58230,13 @@ var ts; checkEntityNameVisibility(input.exprName, enclosingDeclaration); } var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 165 || input.kind === 176) && input.parent.kind !== 235); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 165 || input.kind === 176) && input.parent.kind !== 236); if (shouldEnterSuppressNewDiagnosticsContextContext) { suppressNewDiagnosticContexts = true; } if (isProcessedComponent(input)) { switch (input.kind) { - case 205: { + case 206: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } @@ -57992,7 +58284,7 @@ var ts; case 159: { return cleanup(ts.updateIndexSignature(input, undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(119))); } - case 230: { + case 231: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -58022,6 +58314,11 @@ var ts; case 163: { return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } + case 178: { + if (!ts.isLiteralImportTypeNode(input)) + return cleanup(input); + return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); + } default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]); } } @@ -58055,13 +58352,13 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 248: { + case 249: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } return ts.updateExportDeclaration(input, undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier)); } - case 247: { + case 248: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -58079,8 +58376,8 @@ var ts; return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)]; } } - case 241: - case 242: { + case 242: + case 243: { possibleImports = possibleImports || []; ts.pushIfUnique(possibleImports, input); return input; @@ -58103,21 +58400,21 @@ var ts; } var oldPossibleImports; switch (input.kind) { - case 235: + case 236: return cleanup(ts.updateTypeAliasDeclaration(input, undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 234: { + case 235: { return cleanup(ts.updateInterfaceDeclaration(input, undefined, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 232: { + case 233: { return cleanup(ts.updateFunctionDeclaration(input, undefined, ensureModifiers(input), undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), undefined)); } - case 237: { + case 238: { previousNeedsDeclare = needsDeclare; needsDeclare = false; oldPossibleImports = possibleImports; possibleImports = undefined; var inner = input.body; - if (inner && inner.kind === 238) { + if (inner && inner.kind === 239) { var statements = ts.visitNodes(inner.statements, visitDeclarationStatements); var body = ts.updateModuleBlock(inner, filterCandidateImports(statements)); needsDeclare = previousNeedsDeclare; @@ -58131,7 +58428,7 @@ var ts; return cleanup(ts.updateModuleDeclaration(input, undefined, mods, input.name, ts.visitNode(inner, visitDeclarationStatements))); } } - case 233: { + case 234: { var modifiers = ts.createNodeArray(ensureModifiers(input)); var typeParameters = ensureTypeParams(input, input.typeParameters); var ctor = ts.getFirstConstructorWithBody(input); @@ -58193,7 +58490,7 @@ var ts; return cleanup(ts.updateClassDeclaration(input, undefined, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 212: { + case 213: { if (!ts.forEach(input.declarationList.declarations, getBindingNameVisible)) return; var nodes = ts.visitNodes(input.declarationList.declarations, visitDeclarationSubtree); @@ -58201,7 +58498,7 @@ var ts; return; return cleanup(ts.updateVariableStatement(input, ts.createNodeArray(ensureModifiers(input)), ts.updateVariableDeclarationList(input.declarationList, nodes))); } - case 236: { + case 237: { return cleanup(ts.updateEnumDeclaration(input, undefined, ts.createNodeArray(ensureModifiers(input)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -58215,7 +58512,7 @@ var ts; if (isEnclosingDeclaration(input)) { enclosingDeclaration = previousEnclosingDeclaration; } - if (input.kind === 237) { + if (input.kind === 238) { needsDeclare = previousNeedsDeclare; possibleImports = ts.concatenate(oldPossibleImports, possibleImports); } @@ -58237,7 +58534,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 204) { + if (e.kind === 205) { return; } if (e.name) { @@ -58291,7 +58588,7 @@ var ts; function ensureModifierFlags(node) { var mask = 3071 ^ (4 | 256); var additions = (needsDeclare && !isAlwaysType(node)) ? 2 : 0; - var parentIsFile = node.parent.kind === 272; + var parentIsFile = node.parent.kind === 273; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= ((isBundledEmit && parentIsFile ? 0 : 1) | 512 | 2); additions = 0; @@ -58338,7 +58635,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 234) { + if (node.kind === 235) { return true; } return false; @@ -58366,7 +58663,7 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 230: + case 231: case 151: case 150: case 148: @@ -58376,17 +58673,17 @@ var ts; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 232: - case 237: - case 241: - case 234: case 233: - case 235: - case 236: - case 212: + case 238: case 242: + case 235: + case 234: + case 236: + case 237: + case 213: + case 243: + case 249: case 248: - case 247: return true; } return false; @@ -58403,13 +58700,14 @@ var ts; case 152: case 157: case 159: - case 230: + case 231: case 147: - case 205: + case 206: case 161: case 170: case 162: case 163: + case 178: return true; } return false; @@ -58472,7 +58770,7 @@ var ts; } ts.getTransformers = getTransformers; function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(299); + var enabledSyntaxKindFeatures = new Array(300); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -58738,7 +59036,7 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (sourceFileOrBundle.kind === 272) { + if (sourceFileOrBundle.kind === 273) { sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); } if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { @@ -58849,7 +59147,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 294 + if (node.kind !== 295 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -58866,7 +59164,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 294 + if (node.kind !== 295 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -59008,7 +59306,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 294; + var isEmittedNode = node.kind !== 295; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0 || node.kind === 10; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 10; if (!skipLeadingComments) { @@ -59022,7 +59320,7 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 231) { + if (node.kind === 232) { declarationListContainerEnd = end; } } @@ -59329,7 +59627,7 @@ var ts; ts.forEachEmittedFile = forEachEmittedFile; function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 273) { + if (sourceFile.kind === 274) { var jsFilePath = options.outFile || options.out; var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); var declarationFilePath = (forceDtsPaths || options.declaration) ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; @@ -59364,7 +59662,6 @@ var ts; } function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); - var moduleKind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); @@ -59377,9 +59674,6 @@ var ts; mapRoot: compilerOptions.mapRoot, extendedDiagnostics: compilerOptions.extendedDiagnostics, }); - var currentSourceFile; - var bundledHelpers; - var isOwnFileEmit; var emitSkipped = false; ts.performance.mark("beforePrint"); forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile), emitOnlyDtsFiles); @@ -59416,14 +59710,13 @@ var ts; return; } var transform = ts.transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, false); - var printer = createPrinter(compilerOptions, { + var printer = createPrinter(__assign({}, compilerOptions, { noEmitHelpers: compilerOptions.noEmitHelpers }), { hasGlobalName: resolver.hasGlobalName, onEmitNode: transform.emitNodeWithNotification, substituteNode: transform.substituteNode, onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap, onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, onEmitSourceMapOfPosition: sourceMap.emitPos, - onEmitHelpers: emitHelpers, onSetSourceFile: setSourceFile, }); printSourceFileOrBundle(jsFilePath, sourceMapFilePath, ts.isSourceFile(sourceFileOrBundle) ? transform.transformed[0] : ts.createBundle(transform.transformed), printer, sourceMap); @@ -59443,7 +59736,7 @@ var ts; emitterDiagnostics.add(diagnostic); } } - var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: true }), { + var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: true, noEmitHelpers: true }), { hasGlobalName: resolver.hasGlobalName, onEmitSourceMapOfNode: declarationSourceMap.emitNodeWithSourceMap, onEmitSourceMapOfToken: declarationSourceMap.emitTokenWithSourceMap, @@ -59460,17 +59753,14 @@ var ts; declarationTransform.dispose(); } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapRecorder) { - var bundle = sourceFileOrBundle.kind === 273 ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 272 ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 274 ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 273 ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; mapRecorder.initialize(jsFilePath, sourceMapFilePath || "", sourceFileOrBundle, sourceMapDataList); if (bundle) { - bundledHelpers = ts.createMap(); - isOwnFileEmit = false; printer.writeBundle(bundle, writer); } else { - isOwnFileEmit = true; printer.writeFile(sourceFile, writer); } writer.writeLine(); @@ -59484,60 +59774,19 @@ var ts; ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); mapRecorder.reset(); writer.clear(); - currentSourceFile = undefined; - bundledHelpers = undefined; - isOwnFileEmit = false; } function setSourceFile(node) { - currentSourceFile = node; sourceMap.setSourceFile(node); } function setSourceFileForDeclarationSourceMaps(node) { - currentSourceFile = node; declarationSourceMap.setSourceFile(node); } - function emitHelpers(node, writeLines) { - var helpersEmitted = false; - var bundle = node.kind === 273 ? node : undefined; - if (bundle && moduleKind === ts.ModuleKind.None) { - return; - } - var numNodes = bundle ? bundle.sourceFiles.length : 1; - for (var i = 0; i < numNodes; i++) { - var currentNode = bundle ? bundle.sourceFiles[i] : node; - var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; - var shouldSkip = compilerOptions.noEmitHelpers || ts.getExternalHelpersModuleName(sourceFile) !== undefined; - var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; - var helpers = ts.getEmitHelpers(currentNode); - if (helpers) { - for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { - var helper = _b[_a]; - if (!helper.scoped) { - if (shouldSkip) - continue; - if (shouldBundle) { - if (bundledHelpers.get(helper.name)) { - continue; - } - bundledHelpers.set(helper.name, true); - } - } - else if (bundle) { - continue; - } - writeLines(helper.text); - helpersEmitted = true; - } - } - } - return helpersEmitted; - } } ts.emitFiles = emitFiles; function createPrinter(printerOptions, handlers) { if (printerOptions === void 0) { printerOptions = {}; } if (handlers === void 0) { handlers = {}; } - var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onEmitHelpers = handlers.onEmitHelpers, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; + var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; var newLine = ts.getNewLineCharacter(printerOptions); var comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition); var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition; @@ -59560,6 +59809,9 @@ var ts; writeSemicolon = deferWriteSemicolon; } var syntheticParent = { pos: -1, end: -1 }; + var moduleKind = ts.getEmitModuleKind(printerOptions); + var bundledHelpers = ts.createMap(); + var isOwnFileEmit; reset(); return { printNode: printNode, @@ -59584,8 +59836,8 @@ var ts; break; } switch (node.kind) { - case 272: return printFile(node); - case 273: return printBundle(node); + case 273: return printFile(node); + case 274: return printBundle(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -59620,11 +59872,12 @@ var ts; writer = previousWriter; } function writeBundle(bundle, output) { + isOwnFileEmit = false; var previousWriter = writer; setWriter(output); emitShebangIfNeeded(bundle); emitPrologueDirectivesIfNeeded(bundle); - emitHelpersIndirect(bundle); + emitHelpers(bundle); emitSyntheticTripleSlashReferencesIfNeeded(bundle); for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) { var sourceFile = _b[_a]; @@ -59634,6 +59887,7 @@ var ts; writer = previousWriter; } function writeFile(sourceFile, output) { + isOwnFileEmit = true; var previousWriter = writer; setWriter(output); emitShebangIfNeeded(sourceFile); @@ -59738,7 +59992,7 @@ var ts; writeSpace(); writeKeyword("in"); writeSpace(); - emit(node.constraint); + emitIfPresent(node.constraint); } function pipelineEmitUnspecified(node) { var kind = node.kind; @@ -59788,7 +60042,7 @@ var ts; return emitTypeReference(node); case 162: return emitFunctionType(node); - case 280: + case 281: return emitJSDocFunctionType(node); case 163: return emitConstructorType(node); @@ -59810,7 +60064,7 @@ var ts; return emitInferType(node); case 172: return emitParenthesizedType(node); - case 205: + case 206: return emitExpressionWithTypeArguments(node); case 173: return emitThisType(); @@ -59822,145 +60076,147 @@ var ts; return emitMappedType(node); case 177: return emitLiteralType(node); - case 275: + case 178: + return emitImportTypeNode(node); + case 276: write("*"); return; - case 276: + case 277: write("?"); return; - case 277: - return emitJSDocNullableType(node); case 278: - return emitJSDocNonNullableType(node); + return emitJSDocNullableType(node); case 279: + return emitJSDocNonNullableType(node); + case 280: return emitJSDocOptionalType(node); - case 281: + case 282: return emitJSDocVariadicType(node); - case 178: - return emitObjectBindingPattern(node); case 179: - return emitArrayBindingPattern(node); + return emitObjectBindingPattern(node); case 180: + return emitArrayBindingPattern(node); + case 181: return emitBindingElement(node); - case 209: - return emitTemplateSpan(node); case 210: - return emitSemicolonClassElement(); + return emitTemplateSpan(node); case 211: - return emitBlock(node); + return emitSemicolonClassElement(); case 212: - return emitVariableStatement(node); + return emitBlock(node); case 213: - return emitEmptyStatement(); + return emitVariableStatement(node); case 214: - return emitExpressionStatement(node); + return emitEmptyStatement(); case 215: - return emitIfStatement(node); + return emitExpressionStatement(node); case 216: - return emitDoStatement(node); + return emitIfStatement(node); case 217: - return emitWhileStatement(node); + return emitDoStatement(node); case 218: - return emitForStatement(node); + return emitWhileStatement(node); case 219: - return emitForInStatement(node); + return emitForStatement(node); case 220: - return emitForOfStatement(node); + return emitForInStatement(node); case 221: - return emitContinueStatement(node); + return emitForOfStatement(node); case 222: - return emitBreakStatement(node); + return emitContinueStatement(node); case 223: - return emitReturnStatement(node); + return emitBreakStatement(node); case 224: - return emitWithStatement(node); + return emitReturnStatement(node); case 225: - return emitSwitchStatement(node); + return emitWithStatement(node); case 226: - return emitLabeledStatement(node); + return emitSwitchStatement(node); case 227: - return emitThrowStatement(node); + return emitLabeledStatement(node); case 228: - return emitTryStatement(node); + return emitThrowStatement(node); case 229: - return emitDebuggerStatement(node); + return emitTryStatement(node); case 230: - return emitVariableDeclaration(node); + return emitDebuggerStatement(node); case 231: - return emitVariableDeclarationList(node); + return emitVariableDeclaration(node); case 232: - return emitFunctionDeclaration(node); + return emitVariableDeclarationList(node); case 233: - return emitClassDeclaration(node); + return emitFunctionDeclaration(node); case 234: - return emitInterfaceDeclaration(node); + return emitClassDeclaration(node); case 235: - return emitTypeAliasDeclaration(node); + return emitInterfaceDeclaration(node); case 236: - return emitEnumDeclaration(node); + return emitTypeAliasDeclaration(node); case 237: - return emitModuleDeclaration(node); + return emitEnumDeclaration(node); case 238: - return emitModuleBlock(node); + return emitModuleDeclaration(node); case 239: - return emitCaseBlock(node); + return emitModuleBlock(node); case 240: - return emitNamespaceExportDeclaration(node); + return emitCaseBlock(node); case 241: - return emitImportEqualsDeclaration(node); + return emitNamespaceExportDeclaration(node); case 242: - return emitImportDeclaration(node); + return emitImportEqualsDeclaration(node); case 243: - return emitImportClause(node); + return emitImportDeclaration(node); case 244: - return emitNamespaceImport(node); + return emitImportClause(node); case 245: - return emitNamedImports(node); + return emitNamespaceImport(node); case 246: - return emitImportSpecifier(node); + return emitNamedImports(node); case 247: - return emitExportAssignment(node); + return emitImportSpecifier(node); case 248: - return emitExportDeclaration(node); + return emitExportAssignment(node); case 249: - return emitNamedExports(node); + return emitExportDeclaration(node); case 250: - return emitExportSpecifier(node); + return emitNamedExports(node); case 251: - return; + return emitExportSpecifier(node); case 252: + return; + case 253: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 255: - case 258: - return emitJsxOpeningElementOrFragment(node); case 256: case 259: - return emitJsxClosingElementOrFragment(node); + return emitJsxOpeningElementOrFragment(node); + case 257: case 260: - return emitJsxAttribute(node); + return emitJsxClosingElementOrFragment(node); case 261: - return emitJsxAttributes(node); + return emitJsxAttribute(node); case 262: - return emitJsxSpreadAttribute(node); + return emitJsxAttributes(node); case 263: - return emitJsxExpression(node); + return emitJsxSpreadAttribute(node); case 264: - return emitCaseClause(node); + return emitJsxExpression(node); case 265: - return emitDefaultClause(node); + return emitCaseClause(node); case 266: - return emitHeritageClause(node); + return emitDefaultClause(node); case 267: - return emitCatchClause(node); + return emitHeritageClause(node); case 268: - return emitPropertyAssignment(node); + return emitCatchClause(node); case 269: - return emitShorthandPropertyAssignment(node); + return emitPropertyAssignment(node); case 270: - return emitSpreadAssignment(node); + return emitShorthandPropertyAssignment(node); case 271: + return emitSpreadAssignment(node); + case 272: return emitEnumMember(node); } if (ts.isExpression(node)) { @@ -59990,79 +60246,115 @@ var ts; case 91: writeTokenNode(node, writeKeyword); return; - case 181: - return emitArrayLiteralExpression(node); case 182: - return emitObjectLiteralExpression(node); + return emitArrayLiteralExpression(node); case 183: - return emitPropertyAccessExpression(node); + return emitObjectLiteralExpression(node); case 184: - return emitElementAccessExpression(node); + return emitPropertyAccessExpression(node); case 185: - return emitCallExpression(node); + return emitElementAccessExpression(node); case 186: - return emitNewExpression(node); + return emitCallExpression(node); case 187: - return emitTaggedTemplateExpression(node); + return emitNewExpression(node); case 188: - return emitTypeAssertionExpression(node); + return emitTaggedTemplateExpression(node); case 189: - return emitParenthesizedExpression(node); + return emitTypeAssertionExpression(node); case 190: - return emitFunctionExpression(node); + return emitParenthesizedExpression(node); case 191: - return emitArrowFunction(node); + return emitFunctionExpression(node); case 192: - return emitDeleteExpression(node); + return emitArrowFunction(node); case 193: - return emitTypeOfExpression(node); + return emitDeleteExpression(node); case 194: - return emitVoidExpression(node); + return emitTypeOfExpression(node); case 195: - return emitAwaitExpression(node); + return emitVoidExpression(node); case 196: - return emitPrefixUnaryExpression(node); + return emitAwaitExpression(node); case 197: - return emitPostfixUnaryExpression(node); + return emitPrefixUnaryExpression(node); case 198: - return emitBinaryExpression(node); + return emitPostfixUnaryExpression(node); case 199: - return emitConditionalExpression(node); + return emitBinaryExpression(node); case 200: - return emitTemplateExpression(node); + return emitConditionalExpression(node); case 201: - return emitYieldExpression(node); + return emitTemplateExpression(node); case 202: - return emitSpreadExpression(node); + return emitYieldExpression(node); case 203: - return emitClassExpression(node); + return emitSpreadExpression(node); case 204: + return emitClassExpression(node); + case 205: return; - case 206: - return emitAsExpression(node); case 207: - return emitNonNullExpression(node); + return emitAsExpression(node); case 208: + return emitNonNullExpression(node); + case 209: return emitMetaProperty(node); - case 253: - return emitJsxElement(node); case 254: + return emitJsxElement(node); + case 255: return emitJsxSelfClosingElement(node); - case 257: + case 258: return emitJsxFragment(node); - case 295: - return emitPartiallyEmittedExpression(node); case 296: + return emitPartiallyEmittedExpression(node); + case 297: return emitCommaList(node); } } function trySubstituteNode(hint, node) { return node && substituteNode && substituteNode(hint, node) || node; } - function emitHelpersIndirect(node) { - if (onEmitHelpers) { - onEmitHelpers(node, writeLines); + function emitHelpers(node) { + var helpersEmitted = false; + var bundle = node.kind === 274 ? node : undefined; + if (bundle && moduleKind === ts.ModuleKind.None) { + return; } + var numNodes = bundle ? bundle.sourceFiles.length : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? bundle.sourceFiles[i] : node; + var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; + var shouldSkip = printerOptions.noEmitHelpers || ts.getExternalHelpersModuleName(sourceFile) !== undefined; + var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; + var helpers = ts.getEmitHelpers(currentNode); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + if (shouldSkip) + continue; + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } + else if (bundle) { + continue; + } + if (typeof helper.text === "string") { + writeLines(helper.text); + } + else { + writeLines(helper.text(makeFileLevelOptmiisticUniqueName)); + } + helpersEmitted = true; + } + } + } + return helpersEmitted; } function emitNumericLiteral(node) { emitLiteral(node); @@ -60123,8 +60415,8 @@ var ts; emitNodeWithWriter(node.name, writeParameter); } emitIfPresent(node.questionToken); - if (node.parent && node.parent.kind === 280 && !node.name) { - emit(node.type); + if (node.parent && node.parent.kind === 281 && !node.name) { + emitIfPresent(node.type); } else { emitTypeAnnotation(node.type); @@ -60229,13 +60521,13 @@ var ts; writeSpace(); writePunctuation("=>"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); } function emitJSDocFunctionType(node) { write("function"); emitParameters(node, node.parameters); write(":"); - emit(node.type); + emitIfPresent(node.type); } function emitJSDocNullableType(node) { write("?"); @@ -60257,7 +60549,7 @@ var ts; writeSpace(); writePunctuation("=>"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); } function emitTypeQuery(node) { writeKeyword("typeof"); @@ -60357,7 +60649,7 @@ var ts; } writePunctuation(":"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); writeSemicolon(); if (emitFlags & 1) { writeSpace(); @@ -60371,6 +60663,21 @@ var ts; function emitLiteralType(node) { emitExpression(node.literal); } + function emitImportTypeNode(node) { + if (node.isTypeOf) { + writeKeyword("typeof"); + writeSpace(); + } + writeKeyword("import"); + writePunctuation("("); + emit(node.argument); + writePunctuation(")"); + if (node.qualifier) { + writePunctuation("."); + emit(node.qualifier); + } + emitTypeArguments(node, node.typeArguments); + } function emitObjectBindingPattern(node) { writePunctuation("{"); emitList(node, node.elements, 262576); @@ -60523,7 +60830,7 @@ var ts; } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; - return operand.kind === 196 + return operand.kind === 197 && ((node.operator === 37 && (operand.operator === 37 || operand.operator === 43)) || (node.operator === 38 && (operand.operator === 38 || operand.operator === 44))); } @@ -60567,7 +60874,7 @@ var ts; } function emitYieldExpression(node) { emitTokenWithComment(116, node.pos, writeKeyword, node); - emit(node.asteriskToken); + emitIfPresent(node.asteriskToken); emitExpressionWithLeadingSpace(node.expression); } function emitSpreadExpression(node) { @@ -60634,7 +60941,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node); emitTokenWithComment(82, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 215) { + if (node.elseStatement.kind === 216) { writeSpace(); emit(node.elseStatement); } @@ -60705,7 +61012,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 231) { + if (node.kind === 232) { emit(node); } else { @@ -60906,7 +61213,7 @@ var ts; function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) { var statementOffset = emitPrologueDirectives(body.statements, true); var pos = writer.getTextPos(); - emitHelpersIndirect(body); + emitHelpers(body); if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) { decreaseIndent(); emitList(body, body.statements, 384); @@ -60987,7 +61294,7 @@ var ts; var body = node.body; if (!body) return writeSemicolon(); - while (body.kind === 237) { + while (body.kind === 238) { writePunctuation("."); emit(body.name); body = body.body; @@ -61038,12 +61345,12 @@ var ts; writeSemicolon(); } function emitImportClause(node) { - emit(node.name); + emitIfPresent(node.name); if (node.name && node.namedBindings) { emitTokenWithComment(26, node.name.end, writePunctuation, node); writeSpace(); } - emit(node.namedBindings); + emitIfPresent(node.namedBindings); } function emitNamespaceImport(node) { var asPos = emitTokenWithComment(39, node.pos, writePunctuation, node); @@ -61280,20 +61587,40 @@ var ts; emitSourceFileWorker(node); } function emitSyntheticTripleSlashReferencesIfNeeded(node) { - emitTripleSlashDirectives(node.syntheticFileReferences || [], node.syntheticTypeReferences || []); + emitTripleSlashDirectives(node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || []); } function emitTripleSlashDirectivesIfNeeded(node) { if (node.isDeclarationFile) - emitTripleSlashDirectives(node.referencedFiles, node.typeReferenceDirectives); + emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives); } - function emitTripleSlashDirectives(files, types) { - for (var _a = 0, files_1 = files; _a < files_1.length; _a++) { - var directive = files_1[_a]; + function emitTripleSlashDirectives(hasNoDefaultLib, files, types) { + if (hasNoDefaultLib) { + write("/// "); + writeLine(); + } + if (currentSourceFile && currentSourceFile.moduleName) { + write("/// "); + writeLine(); + } + if (currentSourceFile && currentSourceFile.amdDependencies) { + for (var _a = 0, _b = currentSourceFile.amdDependencies; _a < _b.length; _a++) { + var dep = _b[_a]; + if (dep.name) { + write("/// "); + } + else { + write("/// "); + } + writeLine(); + } + } + for (var _c = 0, files_1 = files; _c < files_1.length; _c++) { + var directive = files_1[_c]; write("/// "); writeLine(); } - for (var _b = 0, types_18 = types; _b < types_18.length; _b++) { - var directive = types_18[_b]; + for (var _d = 0, types_18 = types; _d < types_18.length; _d++) { + var directive = types_18[_d]; write("/// "); writeLine(); } @@ -61301,7 +61628,7 @@ var ts; function emitSourceFileWorker(node) { var statements = node.statements; pushNameGenerationScope(node); - emitHelpersIndirect(node); + emitHelpers(node); var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); }); emitTripleSlashDirectivesIfNeeded(node); emitList(node, statements, 1, index === -1 ? statements.length : index); @@ -61818,7 +62145,7 @@ var ts; && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 189 && ts.nodeIsSynthesized(node)) { + while (node.kind === 190 && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -61897,11 +62224,13 @@ var ts; return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node)); } function isUniqueName(name) { - return !(hasGlobalName && hasGlobalName(name)) - && !currentSourceFile.identifiers.has(name) + return isFileLevelUniqueName(name) && !generatedNames.has(name) && !(reservedNames && reservedNames.has(name)); } + function isFileLevelUniqueName(name) { + return ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName); + } function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { if (node.locals) { @@ -61940,9 +62269,10 @@ var ts; } } } - function makeUniqueName(baseName, optimistic) { + function makeUniqueName(baseName, checkFn, optimistic) { + if (checkFn === void 0) { checkFn = isUniqueName; } if (optimistic) { - if (isUniqueName(baseName)) { + if (checkFn(baseName)) { generatedNames.set(baseName, true); return baseName; } @@ -61953,13 +62283,16 @@ var ts; var i = 1; while (true) { var generatedName = baseName + i; - if (isUniqueName(generatedName)) { + if (checkFn(generatedName)) { generatedNames.set(generatedName, true); return generatedName; } i++; } } + function makeFileLevelOptmiisticUniqueName(name) { + return makeUniqueName(name, isFileLevelUniqueName, true); + } function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); return isUniqueLocalName(name, node) ? name : makeUniqueName(name); @@ -61986,17 +62319,17 @@ var ts; switch (node.kind) { case 71: return makeUniqueName(getTextOfNode(node)); + case 238: case 237: - case 236: return generateNameForModuleOrEnum(node); - case 242: - case 248: + case 243: + case 249: return generateNameForImportOrExportDeclaration(node); - case 232: case 233: - case 247: + case 234: + case 248: return generateNameForExportDefault(); - case 203: + case 204: return generateNameForClassExpression(); case 153: case 155: @@ -62013,9 +62346,7 @@ var ts; case 2: return makeTempVariableName(268435456, !!(name.autoGenerateFlags & 16)); case 3: - return makeUniqueName(ts.idText(name)); - case 5: - return makeUniqueName(ts.idText(name), true); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 64) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 32)); } ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } @@ -62212,7 +62543,7 @@ var ts; } ts.createCompilerHost = createCompilerHost; function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { - var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + var diagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(cancellationToken), program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (program.getCompilerOptions().declaration) { ts.addRange(diagnostics, program.getDeclarationDiagnostics(sourceFile, cancellationToken)); } @@ -62401,6 +62732,12 @@ var ts; } } ts.isProgramUptoDate = isProgramUptoDate; + function getConfigFileParsingDiagnostics(configFileParseResult) { + return configFileParseResult.options.configFile ? + configFileParseResult.options.configFile.parseDiagnostics.concat(configFileParseResult.errors) : + configFileParseResult.errors; + } + ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics; function shouldProgramCreateNewSourceFiles(program, newOptions) { var oldOptions = program && program.getCompilerOptions(); return oldOptions && (oldOptions.target !== newOptions.target || @@ -62413,7 +62750,7 @@ var ts; oldOptions.baseUrl !== newOptions.baseUrl || !ts.equalOwnProperties(oldOptions.paths, newOptions.paths)); } - function createProgram(rootNames, options, host, oldProgram) { + function createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics) { var program; var files = []; var commonSourceDirectory; @@ -62443,7 +62780,7 @@ var ts; var resolveModuleNamesWorker; var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; if (host.resolveModuleNames) { - resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(checkAllDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { + resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { if (!resolved || resolved.extension !== undefined) { return resolved; } @@ -62455,15 +62792,15 @@ var ts; else { moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; - resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(checkAllDefined(moduleNames), containingFile, loader_1); }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; if (host.resolveTypeReferenceDirectives) { - resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(checkAllDefined(typeDirectiveNames), containingFile); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile); }; } else { var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; - resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(checkAllDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; } var packageIdToSourceFile = ts.createMap(); var sourceFileToPackageName = ts.createMap(); @@ -62485,8 +62822,9 @@ var ts; } } if (!skipDefaultLib) { - if (!options.lib) { - processRootFile(getDefaultLibraryFileName(), true); + var defaultLibraryFileName = getDefaultLibraryFileName(); + if (!options.lib && defaultLibraryFileName) { + processRootFile(defaultLibraryFileName, true); } else { ts.forEach(options.lib, function (libFileName) { @@ -62538,7 +62876,8 @@ var ts; getSourceFileFromReference: getSourceFileFromReference, sourceFileToPackageName: sourceFileToPackageName, redirectTargetsSet: redirectTargetsSet, - isEmittedFile: isEmittedFile + isEmittedFile: isEmittedFile, + getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics }; verifyCompilerOptions(); ts.performance.mark("afterProgram"); @@ -63009,51 +63348,51 @@ var ts; case 154: case 155: case 156: - case 190: - case 232: case 191: - case 230: + case 233: + case 192: + case 231: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); return; } } switch (node.kind) { - case 241: + case 242: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 247: + case 248: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 266: + case 267: var heritageClause = node; if (heritageClause.token === 108) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 234: + case 235: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 237: + case 238: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 235: + case 236: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 236: + case 237: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 207: + case 208: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file)); return; - case 206: + case 207: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; - case 188: + case 189: ts.Debug.fail(); } var prevParent = parent; @@ -63066,22 +63405,22 @@ 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_to_remove_this_warning)); } switch (parent.kind) { - case 233: + case 234: case 153: case 152: case 154: case 155: case 156: - case 190: - case 232: case 191: + case 233: + case 192: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - case 212: + case 213: if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 212); + return checkModifiers(nodes, parent.kind === 213); } break; case 151: @@ -63101,11 +63440,11 @@ var ts; return; } break; - case 185: case 186: - case 205: - case 254: + case 187: + case 206: case 255: + case 256: if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); return; @@ -63185,6 +63524,9 @@ var ts; function getGlobalDiagnostics() { return ts.sortAndDeduplicateDiagnostics(getDiagnosticsProducingTypeChecker().getGlobalDiagnostics().slice()); } + function getConfigFileParsingDiagnostics() { + return configFileParsingDiagnostics || ts.emptyArray; + } function processRootFile(fileName, isDefaultLib) { processSourceFile(ts.normalizePath(fileName), isDefaultLib, undefined); } @@ -63261,9 +63603,18 @@ var ts; else if (ts.isImportCall(node) && node.arguments.length === 1 && ts.isStringLiteralLike(node.arguments[0])) { imports = ts.append(imports, node.arguments[0]); } - else { - ts.forEachChild(node, collectDynamicImportOrRequireCalls); + else if (ts.isLiteralImportTypeNode(node)) { + imports = ts.append(imports, node.argument.literal); } + else { + collectDynamicImportOrRequireCallsForEachChild(node); + if (ts.hasJSDocNodes(node)) { + ts.forEach(node.jsDoc, collectDynamicImportOrRequireCallsForEachChild); + } + } + } + function collectDynamicImportOrRequireCallsForEachChild(node) { + ts.forEachChild(node, collectDynamicImportOrRequireCalls); } } function getSourceFileFromReference(referencingFile, ref) { @@ -63859,10 +64210,6 @@ var ts; } } ts.getResolutionDiagnostic = getResolutionDiagnostic; - function checkAllDefined(names) { - ts.Debug.assert(names.every(function (name) { return name !== undefined; }), "A name is undefined.", function () { return JSON.stringify(names); }); - return names; - } function getModuleNames(_a) { var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations; var res = imports.map(function (i) { return i.text; }); @@ -64840,7 +65187,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 268) { + if (element.kind !== 269) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -64909,13 +65256,13 @@ var ts; case 8: reportInvalidOptionValue(option && option.type !== "number"); return Number(valueExpression.text); - case 196: + case 197: if (valueExpression.operator !== 38 || valueExpression.operand.kind !== 8) { break; } reportInvalidOptionValue(option && option.type !== "number"); return -Number(valueExpression.operand.text); - case 182: + case 183: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; if (option) { @@ -64925,7 +65272,7 @@ var ts; else { return convertObjectLiteralExpressionToJson(objectLiteralExpression, undefined, undefined, undefined); } - case 181: + case 182: reportInvalidOptionValue(option && option.type !== "list"); return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element); } @@ -65034,12 +65381,18 @@ var ts; function makePadding(paddingLength) { return Array(paddingLength + 1).join(" "); } + function isAllowedOption(_a) { + var category = _a.category, name = _a.name; + return category !== undefined + && category !== ts.Diagnostics.Command_line_Options + && (category !== ts.Diagnostics.Advanced_Options || compilerOptionsMap.has(name)); + } function writeConfigurations() { var categorizedOptions = ts.createMultiMap(); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; var category = option.category; - if (category !== undefined && category !== ts.Diagnostics.Command_line_Options && category !== ts.Diagnostics.Advanced_Options) { + if (isAllowedOption(option)) { categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); } } @@ -65871,34 +66224,34 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 148: - case 230: - case 180: + case 231: + case 181: case 151: case 150: - case 268: case 269: + case 270: case 153: case 152: case 154: case 155: case 156: - case 232: - case 190: + case 233: case 191: - case 267: - case 260: + case 192: + case 268: + case 261: return 1; case 147: - case 234: case 235: + case 236: case 165: return 2; - case 291: + case 292: return node.name === undefined ? 1 | 2 : 2; - case 271: - case 233: + case 272: + case 234: return 1 | 2; - case 237: + case 238: if (ts.isAmbientModule(node)) { return 4 | 1; } @@ -65908,25 +66261,25 @@ var ts; else { return 4; } - case 236: - case 245: + case 237: case 246: - case 241: - case 242: case 247: + case 242: + case 243: case 248: + case 249: return 7; - case 272: + case 273: return 4 | 1; } return 7; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.kind === 272) { + if (node.kind === 273) { return 1; } - else if (node.parent.kind === 247) { + else if (node.parent.kind === 248) { return 7; } else if (isInRightSideOfInternalImportEqualsDeclaration(node)) { @@ -65952,7 +66305,7 @@ var ts; ts.getMeaningFromLocation = getMeaningFromLocation; function getMeaningFromRightHandSideOfImportEquals(node) { var name = node.kind === 145 ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 241 ? 7 : 4; + return name && name.parent.kind === 242 ? 7 : 4; } function isInRightSideOfInternalImportEqualsDeclaration(node) { while (node.parent.kind === 145) { @@ -65978,16 +66331,16 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 183) { - while (root.parent && root.parent.kind === 183) { + if (root.parent.kind === 184) { + while (root.parent && root.parent.kind === 184) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 205 && root.parent.parent.kind === 266) { + if (!isLastClause && root.parent.kind === 206 && root.parent.parent.kind === 267) { var decl = root.parent.parent.parent; - return (decl.kind === 233 && root.parent.parent.token === 108) || - (decl.kind === 234 && root.parent.parent.token === 85); + return (decl.kind === 234 && root.parent.parent.token === 108) || + (decl.kind === 235 && root.parent.parent.token === 85); } return false; } @@ -66004,17 +66357,17 @@ var ts; switch (node.parent.kind) { case 161: return true; - case 205: + case 206: return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent); } return false; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 185); + return isCallOrNewExpressionTarget(node, 186); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 186); + return isCallOrNewExpressionTarget(node, 187); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -66027,7 +66380,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 226 && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 227 && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -66052,11 +66405,11 @@ var ts; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 183 && node.parent.name === node; + return node && node.parent && node.parent.kind === 184 && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 237 && node.parent.name === node; + return node.parent.kind === 238 && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -66068,15 +66421,15 @@ var ts; switch (node.parent.kind) { case 151: case 150: - case 268: - case 271: + case 269: + case 272: case 153: case 152: case 155: case 156: - case 237: + case 238: return ts.getNameOfDeclaration(node.parent) === node; - case 184: + case 185: return node.parent.argumentExpression === node; case 146: return true; @@ -66091,7 +66444,7 @@ var ts; } ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; function getContainerNode(node) { - if (node.kind === 291) { + if (node.kind === 292) { node = node.parent.parent; } while (true) { @@ -66100,17 +66453,17 @@ var ts; return undefined; } switch (node.kind) { - case 272: + case 273: case 153: case 152: - case 232: - case 190: + case 233: + case 191: case 155: case 156: - case 233: case 234: - case 236: + case 235: case 237: + case 238: return node; } } @@ -66118,23 +66471,23 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 272: + case 273: return ts.isExternalModule(node) ? "module" : "script"; - case 237: + case 238: return "module"; - case 233: - case 203: + case 234: + case 204: return "class"; - case 234: return "interface"; - case 235: return "type"; - case 236: return "enum"; - case 230: + case 235: return "interface"; + case 236: return "type"; + case 237: return "enum"; + case 231: return getKindOfVariableDeclaration(node); - case 180: + case 181: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); + case 192: + case 233: case 191: - case 232: - case 190: return "function"; case 155: return "getter"; case 156: return "setter"; @@ -66149,17 +66502,17 @@ var ts; case 157: return "call"; case 154: return "constructor"; case 147: return "type parameter"; - case 271: return "enum member"; + case 272: return "enum member"; case 148: return ts.hasModifier(node, 92) ? "property" : "parameter"; - case 241: - case 246: - case 243: - case 250: + case 242: + case 247: case 244: + case 251: + case 245: return "alias"; - case 291: + case 292: return "type"; - case 198: + case 199: var kind = ts.getSpecialPropertyAssignmentKind(node); var right = node.right; switch (kind) { @@ -66244,26 +66597,26 @@ var ts; return false; } switch (n.kind) { - case 233: case 234: - case 236: - case 182: - case 178: + case 235: + case 237: + case 183: + case 179: case 165: - case 211: - case 238: + case 212: case 239: - case 245: - case 249: + case 240: + case 246: + case 250: return nodeEndsWith(n, 18, sourceFile); - case 267: + case 268: return isCompletedNode(n.block, sourceFile); - case 186: + case 187: if (!n.arguments) { return true; } - case 185: - case 189: + case 186: + case 190: case 172: return nodeEndsWith(n, 20, sourceFile); case 162: @@ -66272,13 +66625,13 @@ var ts; case 154: case 155: case 156: - case 232: - case 190: + case 233: + case 191: case 153: case 152: case 158: case 157: - case 191: + case 192: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -66286,19 +66639,19 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20, sourceFile); - case 237: + case 238: return n.body && isCompletedNode(n.body, sourceFile); - case 215: + case 216: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 214: + case 215: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 25, sourceFile); - case 181: - case 179: - case 184: + case 182: + case 180: + case 185: case 146: case 167: return nodeEndsWith(n, 22, sourceFile); @@ -66307,42 +66660,42 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 22, sourceFile); - case 264: case 265: + case 266: return false; - case 218: case 219: case 220: - case 217: + case 221: + case 218: return isCompletedNode(n.statement, sourceFile); - case 216: + case 217: return hasChildOfKind(n, 106, sourceFile) ? nodeEndsWith(n, 20, sourceFile) : isCompletedNode(n.statement, sourceFile); case 164: return isCompletedNode(n.exprName, sourceFile); - case 193: - case 192: case 194: - case 201: + case 193: + case 195: case 202: + case 203: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 187: + case 188: return isCompletedNode(n.template, sourceFile); - case 200: + case 201: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 209: + case 210: return ts.nodeIsPresent(n.literal); - case 248: - case 242: + case 249: + case 243: return ts.nodeIsPresent(n.moduleSpecifier); - case 196: + case 197: return isCompletedNode(n.operand, sourceFile); - case 198: - return isCompletedNode(n.right, sourceFile); case 199: + return isCompletedNode(n.right, sourceFile); + case 200: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -66486,7 +66839,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 272 || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 273 || ts.isJSDocCommentContainingNode(n)); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate, sourceFile); @@ -66542,13 +66895,13 @@ var ts; if (token.kind === 27 && token.parent.kind === 10) { return true; } - if (token.kind === 27 && token.parent.kind === 263) { + if (token.kind === 27 && token.parent.kind === 264) { return true; } - if (token && token.kind === 18 && token.parent.kind === 263) { + if (token && token.kind === 18 && token.parent.kind === 264) { return true; } - if (token.kind === 27 && token.parent.kind === 256) { + if (token.kind === 27 && token.parent.kind === 257) { return true; } return false; @@ -66682,10 +67035,10 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 161 || node.kind === 185) { + if (node.kind === 161 || node.kind === 186) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 233 || node.kind === 234) { + if (ts.isFunctionLike(node) || node.kind === 234 || node.kind === 235) { return node.typeParameters; } return undefined; @@ -66737,18 +67090,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 181 || - node.kind === 182) { - if (node.parent.kind === 198 && + if (node.kind === 182 || + node.kind === 183) { + if (node.parent.kind === 199 && node.parent.left === node && node.parent.operatorToken.kind === 58) { return true; } - if (node.parent.kind === 220 && + if (node.parent.kind === 221 && node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 268 ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 269 ? node.parent.parent : node.parent)) { return true; } } @@ -66833,6 +67186,16 @@ var ts; return result; } ts.repeatString = repeatString; + function skipConstraint(type) { + return type.isTypeParameter() ? type.getConstraint() : type; + } + ts.skipConstraint = skipConstraint; + function getNameFromPropertyName(name) { + return name.kind === 146 + ? ts.isStringOrNumericLiteral(name.expression) ? name.expression.text : undefined + : ts.getTextOfIdentifierOrLiteral(name); + } + ts.getNameFromPropertyName = getNameFromPropertyName; })(ts || (ts = {})); (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { @@ -67025,7 +67388,7 @@ var ts; ts.signatureToDisplayParts = signatureToDisplayParts; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 246 || location.parent.kind === 250) && + (location.parent.kind === 247 || location.parent.kind === 251) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -67160,89 +67523,89 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 212: + case 213: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 230: + case 231: case 151: case 150: return spanInVariableDeclaration(node); case 148: return spanInParameterDeclaration(node); - case 232: + case 233: case 153: case 152: case 155: case 156: case 154: - case 190: case 191: + case 192: return spanInFunctionDeclaration(node); - case 211: + case 212: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 238: + case 239: return spanInBlock(node); - case 267: + case 268: return spanInBlock(node.block); - case 214: - return textSpan(node.expression); - case 223: - return textSpan(node.getChildAt(0), node.expression); - case 217: - return textSpanEndingAtNextToken(node, node.expression); - case 216: - return spanInNode(node.statement); - case 229: - return textSpan(node.getChildAt(0)); case 215: - return textSpanEndingAtNextToken(node, node.expression); - case 226: - return spanInNode(node.statement); - case 222: - case 221: - return textSpan(node.getChildAt(0), node.label); + return textSpan(node.expression); + case 224: + return textSpan(node.getChildAt(0), node.expression); case 218: - return spanInForStatement(node); - case 219: return textSpanEndingAtNextToken(node, node.expression); - case 220: - return spanInInitializerOfForLike(node); - case 225: + case 217: + return spanInNode(node.statement); + case 230: + return textSpan(node.getChildAt(0)); + case 216: return textSpanEndingAtNextToken(node, node.expression); - case 264: - case 265: - return spanInNode(node.statements[0]); - case 228: - return spanInBlock(node.tryBlock); case 227: + return spanInNode(node.statement); + case 223: + case 222: + return textSpan(node.getChildAt(0), node.label); + case 219: + return spanInForStatement(node); + case 220: + return textSpanEndingAtNextToken(node, node.expression); + case 221: + return spanInInitializerOfForLike(node); + case 226: + return textSpanEndingAtNextToken(node, node.expression); + case 265: + case 266: + return spanInNode(node.statements[0]); + case 229: + return spanInBlock(node.tryBlock); + case 228: return textSpan(node, node.expression); - case 247: - return textSpan(node, node.expression); - case 241: - return textSpan(node, node.moduleReference); - case 242: - return textSpan(node, node.moduleSpecifier); case 248: + return textSpan(node, node.expression); + case 242: + return textSpan(node, node.moduleReference); + case 243: return textSpan(node, node.moduleSpecifier); - case 237: + case 249: + return textSpan(node, node.moduleSpecifier); + case 238: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 233: - case 236: - case 271: - case 180: + case 234: + case 237: + case 272: + case 181: return textSpan(node); - case 224: + case 225: return spanInNode(node.statement); case 149: return spanInNodeArray(node.parent.decorators); - case 178: case 179: + case 180: return spanInBindingPattern(node); - case 234: case 235: + case 236: return undefined; case 25: case 1: @@ -67277,13 +67640,13 @@ var ts; return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); } if ((node.kind === 71 || - node.kind === 202 || - node.kind === 268 || - node.kind === 269) && + node.kind === 203 || + node.kind === 269 || + node.kind === 270) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 198) { + if (node.kind === 199) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(left); @@ -67297,19 +67660,19 @@ var ts; } if (ts.isExpressionNode(node)) { switch (node.parent.kind) { - case 216: + case 217: return spanInPreviousNode(node); case 149: return spanInNode(node.parent); - case 218: - case 220: + case 219: + case 221: return textSpan(node); - case 198: + case 199: if (node.parent.operatorToken.kind === 26) { return textSpan(node); } break; - case 191: + case 192: if (node.parent.body === node) { return textSpan(node); } @@ -67317,18 +67680,18 @@ var ts; } } switch (node.parent.kind) { - case 268: + case 269: if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 188: + case 189: if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 230: + case 231: case 148: { var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -67336,7 +67699,7 @@ var ts; } break; } - case 198: { + case 199: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { return spanInPreviousNode(node); @@ -67360,7 +67723,7 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 219) { + if (variableDeclaration.parent.parent.kind === 220) { return spanInNode(variableDeclaration.parent.parent); } if (ts.isBindingPattern(variableDeclaration.name)) { @@ -67368,7 +67731,7 @@ var ts; } if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1) || - variableDeclaration.parent.parent.kind === 220) { + variableDeclaration.parent.parent.kind === 221) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -67401,7 +67764,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1) || - (functionDeclaration.parent.kind === 233 && functionDeclaration.kind !== 154); + (functionDeclaration.parent.kind === 234 && functionDeclaration.kind !== 154); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -67421,22 +67784,22 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 237: + case 238: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 217: - case 215: - case 219: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 218: + case 216: case 220: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 219: + case 221: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 231) { + if (forLikeStatement.initializer.kind === 232) { var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -67458,60 +67821,60 @@ var ts; } } function spanInBindingPattern(bindingPattern) { - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 204 ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 205 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - if (bindingPattern.parent.kind === 180) { + if (bindingPattern.parent.kind === 181) { return textSpan(bindingPattern.parent); } return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 179 && node.kind !== 178); - var elements = node.kind === 181 ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 204 ? element : undefined; }); + ts.Debug.assert(node.kind !== 180 && node.kind !== 179); + var elements = node.kind === 182 ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 205 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - return textSpan(node.parent.kind === 198 ? node.parent : node); + return textSpan(node.parent.kind === 199 ? node.parent : node); } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 236: + case 237: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 233: + case 234: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 239: + case 240: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 238: + case 239: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 236: - case 233: + case 237: + case 234: return textSpan(node); - case 211: + case 212: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 267: + case 268: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 239: + case 240: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 178: + case 179: var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -67524,7 +67887,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 179: + case 180: var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -67536,33 +67899,33 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 216 || - node.parent.kind === 185 || - node.parent.kind === 186) { + if (node.parent.kind === 217 || + node.parent.kind === 186 || + node.parent.kind === 187) { return spanInPreviousNode(node); } - if (node.parent.kind === 189) { + if (node.parent.kind === 190) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 190: - case 232: case 191: + case 233: + case 192: case 153: case 152: case 155: case 156: case 154: - case 217: - case 216: case 218: - case 220: - case 185: + case 217: + case 219: + case 221: case 186: - case 189: + case 187: + case 190: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -67570,26 +67933,26 @@ var ts; } function spanInColonToken(node) { if (ts.isFunctionLike(node.parent) || - node.parent.kind === 268 || + node.parent.kind === 269 || node.parent.kind === 148) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 188) { + if (node.parent.kind === 189) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 216) { + if (node.parent.kind === 217) { return textSpanEndingAtNextToken(node, node.parent.expression); } return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 220) { + if (node.parent.kind === 221) { return spanInNextNode(node); } return spanInNode(node.parent); @@ -67938,10 +68301,10 @@ var ts; ts.getSemanticClassifications = getSemanticClassifications; function checkForClassificationCancellation(cancellationToken, kind) { switch (kind) { - case 237: - case 233: + case 238: case 234: - case 232: + case 235: + case 233: cancellationToken.throwIfCancellationRequested(); } } @@ -68122,16 +68485,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 287: + case 288: processJSDocParameterTag(tag); break; - case 290: + case 291: processJSDocTemplateTag(tag); break; - case 289: + case 290: processElement(tag.typeExpression); break; - case 288: + case 289: processElement(tag.typeExpression); break; } @@ -68212,22 +68575,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 255: + case 256: if (token.parent.tagName === token) { return 19; } break; - case 256: + case 257: if (token.parent.tagName === token) { return 20; } break; - case 254: + case 255: if (token.parent.tagName === token) { return 21; } break; - case 260: + case 261: if (token.parent.name === token) { return 22; } @@ -68247,17 +68610,17 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 58) { - if (token.parent.kind === 230 || + if (token.parent.kind === 231 || token.parent.kind === 151 || token.parent.kind === 148 || - token.parent.kind === 260) { + token.parent.kind === 261) { return 5; } } - if (token.parent.kind === 198 || - token.parent.kind === 196 || + if (token.parent.kind === 199 || token.parent.kind === 197 || - token.parent.kind === 199) { + token.parent.kind === 198 || + token.parent.kind === 200) { return 5; } } @@ -68267,7 +68630,7 @@ var ts; return 4; } else if (tokenKind === 9) { - return token.parent.kind === 260 ? 24 : 6; + return token.parent.kind === 261 ? 24 : 6; } else if (tokenKind === 12) { return 6; @@ -68281,7 +68644,7 @@ var ts; else if (tokenKind === 71) { if (token) { switch (token.parent.kind) { - case 233: + case 234: if (token.parent.name === token) { return 11; } @@ -68291,17 +68654,17 @@ var ts; return 15; } return; - case 234: + case 235: if (token.parent.name === token) { return 13; } return; - case 236: + case 237: if (token.parent.name === token) { return 12; } return; - case 237: + case 238: if (token.parent.name === token) { return 14; } @@ -68747,7 +69110,9 @@ var ts; GlobalsSearch[GlobalsSearch["Success"] = 1] = "Success"; GlobalsSearch[GlobalsSearch["Fail"] = 2] = "Fail"; })(GlobalsSearch || (GlobalsSearch = {})); - function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position, allSourceFiles, preferences) { + function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences) { + var typeChecker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); if (ts.isInReferenceComment(sourceFile, position)) { var entries = Completions.PathCompletions.getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); return entries && convertPathCompletions(entries); @@ -68762,7 +69127,7 @@ var ts; && (contextToken.kind === 72 || contextToken.kind === 77 || contextToken.kind === 71)) { return getLabelCompletionAtPosition(contextToken.parent); } - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, preferences, compilerOptions.target); + var completionData = getCompletionData(program, log, sourceFile, position, preferences); if (!completionData) { return undefined; } @@ -68794,7 +69159,7 @@ var ts; } case 2: { var entries = completion.types.map(function (type) { return ({ name: type.value, kindModifiers: "", kind: "type", sortText: "0" }); }); - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, entries: entries }; } default: return ts.Debug.assertNever(completion); @@ -68875,23 +69240,21 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var insertText; var replacementSpan; - if (preferences.includeCompletionsWithInsertText) { - if (origin && origin.type === "this-type") { - insertText = needsConvertPropertyAccess ? "this[" + quote(name, preferences) + "]" : "this." + name; - } - else if (needsConvertPropertyAccess) { - insertText = "[" + quote(name, preferences) + "]"; - var dot = ts.findChildOfKind(propertyAccessToConvert, 23, sourceFile); - var end = ts.startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; - replacementSpan = ts.createTextSpanFromBounds(dot.getStart(sourceFile), end); - } - if (isJsxInitializer) { - if (insertText === undefined) - insertText = name; - insertText = "{" + insertText + "}"; - if (typeof isJsxInitializer !== "boolean") { - replacementSpan = ts.createTextSpanFromNode(isJsxInitializer, sourceFile); - } + if (origin && origin.type === "this-type") { + insertText = needsConvertPropertyAccess ? "this[" + quote(name, preferences) + "]" : "this." + name; + } + else if ((origin && origin.type === "symbol-member" || needsConvertPropertyAccess) && propertyAccessToConvert) { + insertText = needsConvertPropertyAccess ? "[" + quote(name, preferences) + "]" : "[" + name + "]"; + var dot = ts.findChildOfKind(propertyAccessToConvert, 23, sourceFile); + var end = ts.startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; + replacementSpan = ts.createTextSpanFromBounds(dot.getStart(sourceFile), end); + } + if (isJsxInitializer) { + if (insertText === undefined) + insertText = name; + insertText = "{" + insertText + "}"; + if (typeof isJsxInitializer !== "boolean") { + replacementSpan = ts.createTextSpanFromNode(isJsxInitializer, sourceFile); } } if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) { @@ -68994,64 +69357,74 @@ var ts; case 177: switch (node.parent.parent.kind) { case 161: - return { kind: 2, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(node.parent), typeChecker) }; + return { kind: 2, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(node.parent), typeChecker), isNewIdentifier: false }; case 175: return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(node.parent.parent.objectType)); + case 178: + return { kind: 0, paths: Completions.PathCompletions.getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) }; default: return undefined; } - case 268: + case 269: if (ts.isObjectLiteralExpression(node.parent.parent) && node.parent.name === node) { return stringLiteralCompletionsFromProperties(typeChecker.getContextualType(node.parent.parent)); } return fromContextualType(); - case 184: { + case 185: { var _a = node.parent, expression = _a.expression, argumentExpression = _a.argumentExpression; if (node === argumentExpression) { return stringLiteralCompletionsFromProperties(typeChecker.getTypeAtLocation(expression)); } return undefined; } - case 185: case 186: + case 187: if (!ts.isRequireCall(node.parent, false) && !ts.isImportCall(node.parent)) { - var argumentInfo_1 = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo_1) { - var candidates = []; - typeChecker.getResolvedSignature(argumentInfo_1.invocation, candidates, argumentInfo_1.argumentCount); - var uniques_1 = ts.createMap(); - return { kind: 2, types: ts.flatMap(candidates, function (candidate) { return getStringLiteralTypes(typeChecker.getParameterType(candidate, argumentInfo_1.argumentIndex), typeChecker, uniques_1); }) }; - } - return fromContextualType(); + var argumentInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo, typeChecker) : fromContextualType(); } - case 242: - case 248: - case 252: + case 243: + case 249: + case 253: return { kind: 0, paths: Completions.PathCompletions.getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) }; default: return fromContextualType(); } function fromContextualType() { - return { kind: 2, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker), typeChecker) }; + return { kind: 2, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker), typeChecker), isNewIdentifier: false }; } } + function getStringLiteralCompletionsFromSignature(argumentInfo, checker) { + var isNewIdentifier = false; + var uniques = ts.createMap(); + var candidates = []; + checker.getResolvedSignature(argumentInfo.invocation, candidates, argumentInfo.argumentCount); + var types = ts.flatMap(candidates, function (candidate) { + if (!candidate.hasRestParameter && argumentInfo.argumentCount > candidate.parameters.length) + return; + var type = checker.getParameterType(candidate, argumentInfo.argumentIndex); + isNewIdentifier = isNewIdentifier || !!(type.flags & 2); + return getStringLiteralTypes(type, checker, uniques); + }); + return { kind: 2, types: types, isNewIdentifier: isNewIdentifier }; + } function stringLiteralCompletionsFromProperties(type) { return type && { kind: 1, symbols: type.getApparentProperties(), hasIndexSignature: hasIndexSignature(type) }; } function getStringLiteralTypes(type, typeChecker, uniques) { if (uniques === void 0) { uniques = ts.createMap(); } - if (type && type.flags & 32768) { - type = type.getConstraint(); - } - return type && type.flags & 131072 + if (!type) + return ts.emptyArray; + type = ts.skipConstraint(type); + return type.isUnion() ? ts.flatMap(type.types, function (t) { return getStringLiteralTypes(t, typeChecker, uniques); }) - : type && type.flags & 32 && !(type.flags & 256) && ts.addToSeen(uniques, type.value) + : type.isStringLiteral() && !(type.flags & 256) && ts.addToSeen(uniques, type.value) ? [type] : ts.emptyArray; } - function getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, _a, allSourceFiles) { + function getSymbolCompletionFromEntryId(program, log, sourceFile, position, _a) { var name = _a.name, source = _a.source; - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }, compilerOptions.target); + var completionData = getCompletionData(program, log, sourceFile, position, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }); if (!completionData) { return { type: "none" }; } @@ -69061,7 +69434,7 @@ var ts; var symbols = completionData.symbols, location = completionData.location, completionKind = completionData.completionKind, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, previousToken = completionData.previousToken, isJsxInitializer = completionData.isJsxInitializer; return ts.firstDefined(symbols, function (symbol) { var origin = symbolToOriginInfoMap[ts.getSymbolId(symbol)]; - var info = getCompletionEntryDisplayNameForSymbol(symbol, compilerOptions.target, origin, completionKind); + var info = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, origin, completionKind); return info && info.name === name && getSourceFromOrigin(origin) === source ? { type: "symbol", symbol: symbol, location: location, symbolToOriginInfoMap: symbolToOriginInfoMap, previousToken: previousToken, isJsxInitializer: isJsxInitializer } : undefined; }) || { type: "none" }; } @@ -69071,8 +69444,9 @@ var ts; || ts.codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) : symbol.name; } - function getCompletionEntryDetails(program, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, formatContext, getCanonicalFileName, preferences) { + function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, getCanonicalFileName, preferences) { var typeChecker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); var name = entryId.name; var contextToken = ts.findPrecedingToken(position, sourceFile); if (ts.isInString(sourceFile, position, contextToken)) { @@ -69081,7 +69455,7 @@ var ts; : getStringLiteralCompletionEntries(sourceFile, contextToken, position, typeChecker, compilerOptions, host); return stringLiteralCompletions && stringLiteralCompletionDetails(name, contextToken, stringLiteralCompletions, sourceFile, typeChecker); } - var symbolCompletion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); + var symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); switch (symbolCompletion.type) { case "request": { var request = symbolCompletion.request; @@ -69098,7 +69472,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, symbolToOriginInfoMap = symbolCompletion.symbolToOriginInfoMap, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, program, typeChecker, host, compilerOptions, sourceFile, previousToken, formatContext, getCanonicalFileName, allSourceFiles, preferences), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, program, typeChecker, host, compilerOptions, sourceFile, previousToken, formatContext, getCanonicalFileName, program.getSourceFiles(), preferences), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, codeActions, sourceDisplay); } case "none": @@ -69139,8 +69513,8 @@ var ts; var _a = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, getSymbolName(symbol, symbolOriginInfo, compilerOptions.target), host, program, checker, compilerOptions, allSourceFiles, formatContext, getCanonicalFileName, previousToken, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } - function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles) { - var completion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); + function getCompletionEntrySymbol(program, log, sourceFile, position, entryId) { + var completion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); return completion.type === "symbol" ? completion.symbol : undefined; } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; @@ -69174,11 +69548,11 @@ var ts; return getContextualTypeFromParent(currentToken, checker); case 58: switch (parent.kind) { - case 230: + case 231: return checker.getContextualType(parent.initializer); - case 198: + case 199: return checker.getTypeAtLocation(parent.left); - case 260: + case 261: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -69188,7 +69562,7 @@ var ts; case 73: return getSwitchedType(ts.cast(parent, ts.isCaseClause), checker); case 17: - return ts.isJsxExpression(parent) && parent.parent.kind !== 253 ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined; + return ts.isJsxExpression(parent) && parent.parent.kind !== 254 ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined; default: var argInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(currentToken, position, sourceFile); return argInfo @@ -69201,15 +69575,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 186: + case 187: return checker.getContextualType(parent); - case 198: { + case 199: { 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 264: + case 265: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -69225,9 +69599,10 @@ var ts; return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); } function isModuleSymbol(symbol) { - return symbol.declarations.some(function (d) { return d.kind === 272; }); + return symbol.declarations.some(function (d) { return d.kind === 273; }); } - function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, preferences, target) { + function getCompletionData(program, log, sourceFile, position, preferences) { + var typeChecker = program.getTypeChecker(); var start = ts.timestamp(); var currentToken = ts.getTokenAtPosition(sourceFile, position, false); log("getCompletionData: Get current token: " + (ts.timestamp() - start)); @@ -69253,11 +69628,11 @@ var ts; if (tag.tagName.pos <= position && position <= tag.tagName.end) { return { kind: 1 }; } - if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 274) { + if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 275) { currentToken = ts.getTokenAtPosition(sourceFile, position, true); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 292 || + (currentToken.parent.kind !== 293 || currentToken.parent.name !== currentToken))) { insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression); } @@ -69296,56 +69671,59 @@ var ts; if (contextToken.kind === 23) { isRightOfDot = true; switch (parent.kind) { - case 183: + case 184: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; break; case 145: node = parent.left; break; + case 178: + node = parent; + break; default: return undefined; } } else if (sourceFile.languageVariant === 1) { - if (parent && parent.kind === 183) { + if (parent && parent.kind === 184) { contextToken = parent; parent = parent.parent; } if (currentToken.parent === location) { switch (currentToken.kind) { case 29: - if (currentToken.parent.kind === 253 || currentToken.parent.kind === 255) { + if (currentToken.parent.kind === 254 || currentToken.parent.kind === 256) { location = currentToken; } break; case 41: - if (currentToken.parent.kind === 254) { + if (currentToken.parent.kind === 255) { location = currentToken; } break; } } switch (parent.kind) { - case 256: + case 257: if (contextToken.kind === 41) { isStartingCloseTag = true; location = contextToken; } break; - case 198: + case 199: if (!(parent.left.flags & 32768)) { break; } - case 254: - case 253: case 255: + case 254: + case 256: if (contextToken.kind === 27) { isRightOfOpenTag = true; location = contextToken; } break; - case 260: + case 261: switch (previousToken.kind) { case 58: isJsxInitializer = true; @@ -69396,26 +69774,27 @@ var ts; return { kind: 0, symbols: symbols, completionKind: completionKind, isInSnippetScope: isInSnippetScope, propertyAccessToConvert: propertyAccessToConvert, isNewIdentifierLocation: isNewIdentifierLocation, location: location, keywordFilters: keywordFilters, symbolToOriginInfoMap: symbolToOriginInfoMap, recommendedCompletion: recommendedCompletion, previousToken: previousToken, isJsxInitializer: isJsxInitializer }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 287: - case 292: case 288: + case 293: case 289: - case 291: + case 290: + case 292: return true; } } function getTypeScriptMemberSymbols() { completionKind = 2; - var isTypeLocation = insideJsDocTagTypeExpression || ts.isPartOfTypeNode(node.parent); + var isImportType = ts.isLiteralImportTypeNode(node); + var isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !node.isTypeOf) || ts.isPartOfTypeNode(node.parent); var isRhsOfImportDeclaration = ts.isInRightSideOfInternalImportEqualsDeclaration(node); var allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile)); - if (ts.isEntityName(node)) { + if (ts.isEntityName(node) || isImportType) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { symbol = ts.skipAlias(symbol, typeChecker); if (symbol.flags & (1536 | 384)) { var exportedSymbols = ts.Debug.assertEachDefined(typeChecker.getExportsOfModule(symbol), "getExportsOfModule() should all be defined"); - var isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess((node.parent), symbol.name); }; + var isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess(isImportType ? node : (node.parent), symbol.name); }; var isValidTypeAccess_1 = function (symbol) { return symbolCanBeReferencedAtTypeLocation(symbol); }; var isValidAccess = allowTypeOrValue ? function (symbol) { return isValidTypeAccess_1(symbol) || isValidValueAccess_1(symbol); } : @@ -69426,7 +69805,7 @@ var ts; symbols.push(symbol_2); } } - if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 272 && d.kind !== 237 && d.kind !== 236; })) { + if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 273 && d.kind !== 238 && d.kind !== 237; })) { addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node)); } return; @@ -69445,12 +69824,29 @@ var ts; else { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; - if (typeChecker.isValidPropertyAccessForCompletions((node.parent), type, symbol)) { - symbols.push(symbol); + if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 178 ? node : node.parent, type, symbol)) { + addPropertySymbol(symbol); } } } } + function addPropertySymbol(symbol) { + var symbolSymbol = ts.firstDefined(symbol.declarations, function (decl) { + var name = ts.getNameOfDeclaration(decl); + var leftName = name.kind === 146 ? getLeftMostName(name.expression) : undefined; + return leftName && typeChecker.getSymbolAtLocation(leftName); + }); + if (symbolSymbol) { + symbols.push(symbolSymbol); + symbolToOriginInfoMap[ts.getSymbolId(symbolSymbol)] = { type: "symbol-member" }; + } + else { + symbols.push(symbol); + } + } + function getLeftMostName(e) { + return ts.isIdentifier(e) ? e : ts.isPropertyAccessExpression(e) ? getLeftMostName(e.expression) : undefined; + } function tryGetGlobalSymbols() { var result = tryGetObjectLikeCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() @@ -69494,7 +69890,7 @@ var ts; isInSnippetScope = isSnippetScope(scopeNode); var symbolMeanings = 67901928 | 67216319 | 1920 | 2097152; symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined"); - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 272) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 273) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode); if (thisType) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker, true); _i < _a.length; _i++) { @@ -69504,17 +69900,32 @@ var ts; } } } - if (preferences.includeCompletionsForModuleExports && !(sourceFile.commonJsModuleIndicator && !sourceFile.externalModuleIndicator)) { - getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", target); + if (shouldOfferImportCompletions()) { + getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", program.getCompilerOptions().target); } filterGlobalCompletion(symbols); } + function shouldOfferImportCompletions() { + if (!preferences.includeCompletionsForModuleExports) + return false; + if (sourceFile.externalModuleIndicator) + return true; + if (sourceFile.commonJsModuleIndicator) + return false; + if (program.getSourceFiles().some(function (s) { return !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!s.externalModuleIndicator; })) { + return true; + } + if (ts.isSourceFileJavaScript(sourceFile)) + return false; + var compilerOptions = program.getCompilerOptions(); + return !!compilerOptions.module || compilerOptions.target >= 2 || !!compilerOptions.noEmit; + } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 272: - case 200: - case 263: - case 211: + case 273: + case 201: + case 264: + case 212: return true; default: return ts.isStatement(scopeNode); @@ -69557,12 +69968,12 @@ var ts; return parentKind === 151 || parentKind === 150 || parentKind === 148 || - parentKind === 230 || + parentKind === 231 || ts.isFunctionLikeKind(parentKind); case 58: - return parentKind === 235; + return parentKind === 236; case 118: - return parentKind === 206; + return parentKind === 207; } } return false; @@ -69580,7 +69991,7 @@ var ts; } function getSymbolsFromOtherSourceFileExports(symbols, tokenText, target) { var tokenTextLowerCase = tokenText.toLowerCase(); - ts.codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, allSourceFiles, function (moduleSymbol) { + ts.codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, program.getSourceFiles(), function (moduleSymbol) { for (var _i = 0, _a = typeChecker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) { var symbol = _a[_i]; if (typeChecker.getMergedSymbol(symbol.parent) !== typeChecker.resolveExternalModuleSymbol(moduleSymbol) @@ -69635,11 +70046,11 @@ var ts; return true; } if (contextToken.kind === 29 && contextToken.parent) { - if (contextToken.parent.kind === 255) { + if (contextToken.parent.kind === 256) { return true; } - if (contextToken.parent.kind === 256 || contextToken.parent.kind === 254) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 253; + if (contextToken.parent.kind === 257 || contextToken.parent.kind === 255) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 254; } } return false; @@ -69649,36 +70060,36 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 26: - return containingNodeKind === 185 + return containingNodeKind === 186 || containingNodeKind === 154 - || containingNodeKind === 186 - || containingNodeKind === 181 - || containingNodeKind === 198 + || containingNodeKind === 187 + || containingNodeKind === 182 + || containingNodeKind === 199 || containingNodeKind === 162; case 19: - return containingNodeKind === 185 + return containingNodeKind === 186 || containingNodeKind === 154 - || containingNodeKind === 186 - || containingNodeKind === 189 + || containingNodeKind === 187 + || containingNodeKind === 190 || containingNodeKind === 172; case 21: - return containingNodeKind === 181 + return containingNodeKind === 182 || containingNodeKind === 159 || containingNodeKind === 146; case 129: case 130: return true; case 23: - return containingNodeKind === 237; + return containingNodeKind === 238; case 17: - return containingNodeKind === 233; + return containingNodeKind === 234; case 58: - return containingNodeKind === 230 - || containingNodeKind === 198; + return containingNodeKind === 231 + || containingNodeKind === 199; case 14: - return containingNodeKind === 200; + return containingNodeKind === 201; case 15: - return containingNodeKind === 209; + return containingNodeKind === 210; case 114: case 112: case 113: @@ -69716,7 +70127,7 @@ var ts; completionKind = 0; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 182) { + if (objectLikeContainer.kind === 183) { var typeForObject = typeChecker.getContextualType(objectLikeContainer); if (!typeForObject) return 2; @@ -69725,12 +70136,12 @@ var ts; existingMembers = objectLikeContainer.properties; } else { - ts.Debug.assert(objectLikeContainer.kind === 178); + ts.Debug.assert(objectLikeContainer.kind === 179); isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); if (!ts.isVariableLike(rootDeclaration)) return ts.Debug.fail("Root declaration is not variable-like."); - var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 220; + var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 221; if (!canGetType && rootDeclaration.kind === 148) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); @@ -69756,9 +70167,9 @@ var ts; var namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken); if (!namedImportsOrExports) return undefined; - var declarationKind = namedImportsOrExports.kind === 245 ? - 242 : - 248; + var declarationKind = namedImportsOrExports.kind === 246 ? + 243 : + 249; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -69825,8 +70236,8 @@ var ts; case 17: case 26: switch (contextToken.parent.kind) { - case 245: - case 249: + case 246: + case 250: return contextToken.parent; } } @@ -69873,29 +70284,29 @@ var ts; case 28: case 41: case 71: - case 183: - case 261: - case 260: + case 184: case 262: - if (parent && (parent.kind === 254 || parent.kind === 255)) { + case 261: + case 263: + if (parent && (parent.kind === 255 || parent.kind === 256)) { return parent; } - else if (parent.kind === 260) { + else if (parent.kind === 261) { return parent.parent.parent; } break; case 9: - if (parent && ((parent.kind === 260) || (parent.kind === 262))) { + if (parent && ((parent.kind === 261) || (parent.kind === 263))) { return parent.parent.parent; } break; case 18: if (parent && - parent.kind === 263 && - parent.parent && parent.parent.kind === 260) { + parent.kind === 264 && + parent.parent && parent.parent.kind === 261) { return parent.parent.parent.parent; } - if (parent && parent.kind === 262) { + if (parent && parent.kind === 263) { return parent.parent.parent; } break; @@ -69907,48 +70318,48 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 26: - return containingNodeKind === 230 || - containingNodeKind === 231 || - containingNodeKind === 212 || - containingNodeKind === 236 || + return containingNodeKind === 231 || + containingNodeKind === 232 || + containingNodeKind === 213 || + containingNodeKind === 237 || isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 234 || - containingNodeKind === 179 || containingNodeKind === 235 || + containingNodeKind === 180 || + containingNodeKind === 236 || (ts.isClassLike(contextToken.parent) && contextToken.parent.typeParameters && contextToken.parent.typeParameters.end >= contextToken.pos); case 23: - return containingNodeKind === 179; - case 56: return containingNodeKind === 180; + case 56: + return containingNodeKind === 181; case 21: - return containingNodeKind === 179; + return containingNodeKind === 180; case 19: - return containingNodeKind === 267 || + return containingNodeKind === 268 || isFunctionLikeButNotConstructor(containingNodeKind); case 17: - return containingNodeKind === 236; + return containingNodeKind === 237; case 27: - return containingNodeKind === 233 || - containingNodeKind === 203 || - containingNodeKind === 234 || + return containingNodeKind === 234 || + containingNodeKind === 204 || containingNodeKind === 235 || + containingNodeKind === 236 || ts.isFunctionLikeKind(containingNodeKind); case 115: return containingNodeKind === 151 && !ts.isClassLike(contextToken.parent.parent); case 24: return containingNodeKind === 148 || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 179); + contextToken.parent.parent.kind === 180); case 114: case 112: case 113: return containingNodeKind === 148 && !ts.isConstructorDeclaration(contextToken.parent.parent); case 118: - return containingNodeKind === 246 || - containingNodeKind === 250 || - containingNodeKind === 244; + return containingNodeKind === 247 || + containingNodeKind === 251 || + containingNodeKind === 245; case 125: case 136: if (isFromObjectTypeDeclaration(contextToken)) { @@ -70027,9 +70438,9 @@ var ts; var existingMemberNames = ts.createUnderscoreEscapedMap(); for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; - if (m.kind !== 268 && - m.kind !== 269 && - m.kind !== 180 && + if (m.kind !== 269 && + m.kind !== 270 && + m.kind !== 181 && m.kind !== 153 && m.kind !== 155 && m.kind !== 156) { @@ -70039,7 +70450,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 180 && m.propertyName) { + if (m.kind === 181 && m.propertyName) { if (m.propertyName.kind === 71) { existingName = m.propertyName.escapedText; } @@ -70089,7 +70500,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 260) { + if (attr.kind === 261) { seenNames.set(attr.name.escapedText, true); } } @@ -70216,18 +70627,17 @@ var ts; } } function getPropertiesForCompletion(type, checker, isForAccess) { - if (!(type.flags & 131072)) { + if (!(type.isUnion())) { return ts.Debug.assertEachDefined(type.getApparentProperties(), "getApparentProperties() should all be defined"); } - var types = type.types; - var filteredTypes = isForAccess ? types : types.filter(function (memberType) { + var filteredTypes = isForAccess ? type.types : type.types.filter(function (memberType) { return !(memberType.flags & 16382 || checker.isArrayLikeType(memberType) || ts.typeHasCallOrConstructSignatures(memberType, checker)); }); return ts.Debug.assertEachDefined(checker.getAllPossiblePropertiesOfTypes(filteredTypes), "getAllPossiblePropertiesOfTypes() should all be defined"); } function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) { switch (location.kind) { - case 293: + case 294: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -70361,7 +70771,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 272) { + if (ts.isFunctionBlock(parent) || parent.kind === 273) { return parent; } if (ts.isTryStatement(parent) && parent.tryBlock === child && parent.catchClause) { @@ -70391,15 +70801,15 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 225: - if (statement.kind === 221) { + case 226: + if (statement.kind === 222) { return false; } - case 218: case 219: case 220: + case 221: + case 218: case 217: - case 216: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: return (ts.isFunctionLike(node) && "quit"); @@ -70419,11 +70829,11 @@ var ts; function getNodesToSearchForModifier(declaration, modifierFlag) { var container = declaration.parent; switch (container.kind) { - case 238: - case 272: - case 211: - case 264: + case 239: + case 273: + case 212: case 265: + case 266: if (modifierFlag & 128 && ts.isClassDeclaration(declaration)) { return declaration.members.concat([declaration]); } @@ -70432,11 +70842,11 @@ var ts; } case 154: case 153: - case 232: { + case 233: { return container.parameters.concat((ts.isClassLike(container.parent) ? container.parent.members : [])); } - case 233: - case 203: + case 234: + case 204: var nodes = container.members; if (modifierFlag & 28) { var constructor = ts.find(container.members, ts.isConstructorDeclaration); @@ -70466,7 +70876,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 88, 106, 81)) { - if (loopNode.kind === 216) { + if (loopNode.kind === 217) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 106)) { @@ -70486,13 +70896,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 218: case 219: case 220: - case 216: + case 221: case 217: + case 218: return getLoopBreakContinueOccurrences(owner); - case 225: + case 226: return getSwitchCaseDefaultOccurrences(owner); } } @@ -70761,10 +71171,10 @@ var ts; } cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 185: + case 186: if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 && parent.kind === 230) { + if (exportKind === 2 && parent.kind === 231) { var name = parent.name; if (name.kind === 71) { directImports.push(name); @@ -70774,12 +71184,12 @@ var ts; addIndirectUser(direct.getSourceFile()); } break; - case 241: + case 242: handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1)); break; - case 242: + case 243: var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 244) { + if (namedBindings && namedBindings.kind === 245) { handleNamespaceImport(direct, namedBindings.name); } else if (ts.isDefaultImport(direct)) { @@ -70793,7 +71203,7 @@ var ts; directImports.push(direct); } break; - case 248: + case 249: if (!direct.exportClause) { handleDirectImports(getContainingModuleSymbol(direct, checker)); } @@ -70811,7 +71221,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 272 || sourceFileLike.kind === 237); + ts.Debug.assert(sourceFileLike.kind === 273 || sourceFileLike.kind === 238); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUsers(sourceFileLike); } @@ -70860,7 +71270,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 241) { + if (decl.kind === 242) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -70873,7 +71283,7 @@ var ts; if (decl.moduleSpecifier.kind !== 9) { return; } - if (decl.kind === 248) { + if (decl.kind === 249) { searchForNamedImport(decl.exportClause); return; } @@ -70882,7 +71292,7 @@ var ts; return; } var namedBindings = importClause.namedBindings; - if (namedBindings && namedBindings.kind === 244) { + if (namedBindings && namedBindings.kind === 245) { handleNamespaceImportLike(namedBindings.name); return; } @@ -70922,7 +71332,7 @@ var ts; } } else { - var localSymbol = element.kind === 250 && element.propertyName + var localSymbol = element.kind === 251 && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -70936,7 +71346,7 @@ var ts; function findNamespaceReExports(sourceFileLike, name, checker) { var namespaceImportSymbol = checker.getSymbolAtLocation(name); return forEachPossibleImportOrExportStatement(sourceFileLike, function (statement) { - if (statement.kind !== 248) + if (statement.kind !== 249) return; var _a = statement, exportClause = _a.exportClause, moduleSpecifier = _a.moduleSpecifier; if (moduleSpecifier || !exportClause) @@ -70955,7 +71365,7 @@ var ts; for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { var referencingFile = sourceFiles_4[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if (searchSourceFile.kind === 272) { + if (searchSourceFile.kind === 273) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -71000,7 +71410,7 @@ var ts; return map; } function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 272 ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 273 ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -71014,20 +71424,18 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 248: - case 242: { + case 249: + case 243: { var decl = statement; - if (decl.moduleSpecifier && decl.moduleSpecifier.kind === 9) { + if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 241: { + case 242: { var decl = statement; - var moduleReference = decl.moduleReference; - if (moduleReference.kind === 252 && - moduleReference.expression.kind === 9) { - action(decl, moduleReference.expression); + if (isExternalModuleImportEquals(decl)) { + action(decl, decl.moduleReference.expression); } break; } @@ -71040,7 +71448,7 @@ var ts; function getExport() { var parent = node.parent; if (symbol.exportSymbol) { - if (parent.kind === 183) { + if (parent.kind === 184) { return symbol.declarations.some(function (d) { return d === parent; }) && ts.isBinaryExpression(parent.parent) ? getSpecialPropertyExport(parent.parent, false) : undefined; @@ -71139,10 +71547,10 @@ var ts; return ts.Debug.fail(); } function getExportNode(parent, node) { - if (parent.kind === 230) { + if (parent.kind === 231) { var p = parent; return p.name !== node ? undefined : - p.parent.kind === 267 ? undefined : p.parent.parent.kind === 212 ? p.parent.parent : undefined; + p.parent.kind === 268 ? undefined : p.parent.parent.kind === 213 ? p.parent.parent : undefined; } else { return parent; @@ -71151,14 +71559,14 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 241: + case 242: return parent.name === node && isExternalModuleImportEquals(parent) ? { isNamedImport: false } : undefined; - case 246: + case 247: return parent.propertyName ? undefined : { isNamedImport: true }; - case 243: case 244: + case 245: ts.Debug.assert(parent.name === node); return { isNamedImport: false }; default: @@ -71197,22 +71605,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 185) { + if (node.kind === 186) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 272) { + if (parent.kind === 273) { return parent; } - ts.Debug.assert(parent.kind === 238); + ts.Debug.assert(parent.kind === 239); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 237 && node.name.kind === 9; + return node.kind === 238 && node.name.kind === 9; } - function isExternalModuleImportEquals(_a) { - var moduleReference = _a.moduleReference; - return moduleReference.kind === 252 && moduleReference.expression.kind === 9; + function isExternalModuleImportEquals(eq) { + return eq.moduleReference.kind === 253 && eq.moduleReference.expression.kind === 9; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -71242,11 +71649,11 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 272) { + if (node.kind === 273) { return undefined; } var checker = program.getTypeChecker(); - if (node.parent.kind === 269) { + if (node.parent.kind === 270) { var result_5 = []; FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_5.push(nodeEntry(node)); }); return result_5; @@ -71345,13 +71752,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 182) { + else if (node.kind === 183) { return { kind: "interface", displayParts: [ts.punctuationPart(19), ts.textPart("object literal"), ts.punctuationPart(20)] }; } - else if (node.kind === 203) { + else if (node.kind === 204) { return { kind: "local class", displayParts: [ts.punctuationPart(19), ts.textPart("anonymous local class"), ts.punctuationPart(20)] @@ -71424,12 +71831,12 @@ var ts; return false; } switch (node.parent.kind) { - case 237: - case 252: - case 242: - case 248: + case 238: + case 253: + case 243: + case 249: return true; - case 185: + case 186: return ts.isRequireCall(node.parent, false) || ts.isImportCall(node.parent); default: return false; @@ -71452,9 +71859,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 272: + case 273: break; - case 237: + case 238: references.push({ type: "node", node: decl.name }); break; default: @@ -71530,7 +71937,7 @@ var ts; } return ts.firstDefined(symbol.declarations, function (decl) { if (!decl.parent) { - ts.Debug.assert(decl.kind === 272); + ts.Debug.assert(decl.kind === 273); ts.Debug.fail("Unexpected symbol at " + ts.Debug.showSyntaxKind(node) + ": " + ts.Debug.showSymbol(symbol)); } return ts.isTypeLiteralNode(decl.parent) && ts.isUnionTypeNode(decl.parent.parent) @@ -71651,9 +72058,9 @@ var ts; checker.getPropertySymbolOfDestructuringAssignment(location); } function getObjectBindingElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 180); + var bindingElement = ts.getDeclarationOfKind(symbol, 181); if (bindingElement && - bindingElement.parent.kind === 178 && + bindingElement.parent.kind === 179 && !bindingElement.propertyName) { return bindingElement; } @@ -71672,7 +72079,7 @@ var ts; } function getSymbolScope(symbol) { var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 190 || valueDeclaration.kind === 203)) { + if (valueDeclaration && (valueDeclaration.kind === 191 || valueDeclaration.kind === 204)) { return valueDeclaration; } if (!declarations) { @@ -71681,7 +72088,7 @@ var ts; if (flags & (4 | 8192)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasModifier(d, 8); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 233); + return ts.getAncestor(privateDeclaration, 234); } return undefined; } @@ -71699,7 +72106,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (!container || container.kind === 272 && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 273 && !ts.isExternalOrCommonJsModule(container)) { return undefined; } scope = container; @@ -72005,7 +72412,7 @@ var ts; if (refNode.kind !== 71) { return; } - if (refNode.parent.kind === 269) { + if (refNode.parent.kind === 270) { getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } var containingClass = getContainingClassIfInHeritageClause(refNode); @@ -72021,7 +72428,7 @@ var ts; } else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { var body = parent.body; - if (body.kind === 211) { + if (body.kind === 212) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { addReference(returnStatement.expression); @@ -72044,7 +72451,7 @@ var ts; if (componentType.symbol && componentType.symbol.getFlags() & (32 | 64)) { result.push(componentType.symbol); } - if (componentType.getFlags() & 393216) { + if (componentType.isUnionOrIntersection()) { getSymbolsForClassAndInterfaceComponents(componentType, result); } } @@ -72062,12 +72469,12 @@ var ts; } function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { - if (node.kind === 205 - && node.parent.kind === 266 + if (node.kind === 206 + && node.parent.kind === 267 && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } - else if (node.kind === 71 || node.kind === 183) { + else if (node.kind === 71 || node.kind === 184) { return getContainingClassIfInHeritageClause(node.parent); } } @@ -72075,13 +72482,13 @@ var ts; } function isImplementationExpression(node) { switch (node.kind) { - case 189: - return isImplementationExpression(node.expression); - case 191: case 190: + return isImplementationExpression(node.expression); + case 192: + case 191: + case 183: + case 204: case 182: - case 203: - case 181: return true; default: return false; @@ -72154,22 +72561,22 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; - case 272: + case 273: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 232: - case 190: + case 233: + case 191: break; default: return undefined; } var references = []; - for (var _i = 0, _a = searchSpaceNode.kind === 272 ? sourceFiles : [searchSpaceNode.getSourceFile()]; _i < _a.length; _i++) { + for (var _i = 0, _a = searchSpaceNode.kind === 273 ? sourceFiles : [searchSpaceNode.getSourceFile()]; _i < _a.length; _i++) { var sourceFile = _a[_i]; cancellationToken.throwIfCancellationRequested(); var positions = getPossibleSymbolReferencePositions(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode); - getThisReferencesInFile(sourceFile, searchSpaceNode.kind === 272 ? sourceFile : searchSpaceNode, positions, staticFlag, references); + getThisReferencesInFile(sourceFile, searchSpaceNode.kind === 273 ? sourceFile : searchSpaceNode, positions, staticFlag, references); } return [{ definition: { type: "this", node: thisOrSuperKeyword }, @@ -72184,8 +72591,8 @@ var ts; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 190: - case 232: + case 191: + case 233: if (searchSpaceNode.symbol === container.symbol) { result.push(FindAllReferences.nodeEntry(node)); } @@ -72196,14 +72603,14 @@ var ts; result.push(FindAllReferences.nodeEntry(node)); } break; - case 203: - case 233: + case 204: + case 234: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) { result.push(FindAllReferences.nodeEntry(node)); } break; - case 272: - if (container.kind === 272 && !ts.isExternalModule(container)) { + case 273: + if (container.kind === 273 && !ts.isExternalModule(container)) { result.push(FindAllReferences.nodeEntry(node)); } break; @@ -72227,7 +72634,7 @@ var ts; var result = []; var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(location); if (containingObjectLiteralElement) { - if (containingObjectLiteralElement.kind !== 269) { + if (containingObjectLiteralElement.kind !== 270) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); if (propertySymbol) { result.push(propertySymbol); @@ -72255,7 +72662,7 @@ var ts; var rootSymbol = _a[_i]; result.push(rootSymbol); if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, result, ts.createSymbolTable(), checker); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, result); } } } @@ -72265,24 +72672,26 @@ var ts; ? checker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name) : undefined; } - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, checker) { - if (!symbol || previousIterationSymbolsCache.has(symbol.escapedName)) { - return; - } - if (symbol.flags & (32 | 64)) { + function getPropertySymbolsFromBaseTypes(symbol, propertyName, checker, result) { + if (result === void 0) { result = []; } + var seen = ts.createMap(); + recur(symbol); + return result; + function recur(symbol) { + if (!(symbol.flags & (32 | 64)) || !ts.addToSeen(seen, ts.getSymbolId(symbol))) + return; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; for (var _b = 0, _c = ts.getAllSuperTypeNodes(declaration); _b < _c.length; _b++) { var typeReference = _c[_b]; var type = checker.getTypeAtLocation(typeReference); - if (!type) + if (!(type && type.symbol)) continue; var propertySymbol = checker.getPropertyOfType(type, propertyName); if (propertySymbol) { result.push.apply(result, checker.getRootSymbols(propertySymbol)); } - previousIterationSymbolsCache.set(symbol.escapedName, symbol); - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, checker); + recur(type.symbol); } } } @@ -72326,30 +72735,18 @@ var ts; if (search.parents && !ts.some(search.parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker); })) { return undefined; } - var result = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, result, ts.createSymbolTable(), checker); - return result.some(search.includes) ? rootSymbol : undefined; + return getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker).some(search.includes) ? rootSymbol : undefined; } return undefined; }); } } - function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 146) { - var nameExpression = node.name.expression; - if (ts.isStringOrNumericLiteral(nameExpression)) { - return nameExpression.text; - } - return undefined; - } - return ts.getTextOfIdentifierOrLiteral(node.name); - } function getPropertySymbolsFromContextualType(node, checker) { var contextualType = checker.getContextualType(node.parent); - var name = getNameFromObjectLiteralElement(node); + var name = ts.getNameFromPropertyName(node.name); var symbol = contextualType && name && contextualType.getProperty(name); return symbol ? [symbol] : - contextualType && contextualType.flags & 131072 ? ts.mapDefined(contextualType.types, function (t) { return t.getProperty(name); }) : ts.emptyArray; + contextualType && contextualType.isUnion() ? ts.mapDefined(contextualType.types, function (t) { return t.getProperty(name); }) : ts.emptyArray; } function getIntersectingMeaningFromDeclarations(node, symbol) { var meaning = ts.getMeaningFromLocation(node); @@ -72402,19 +72799,12 @@ var ts; } function getParentSymbolsOfPropertyAccess(location, symbol, checker) { var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(location); - if (!propertyAccessExpression) { - return undefined; - } - var localParentType = checker.getTypeAtLocation(propertyAccessExpression.expression); - if (!localParentType) { - return undefined; - } - if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== symbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 393216) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } + var localParentType = propertyAccessExpression && checker.getTypeAtLocation(propertyAccessExpression.expression); + return localParentType && localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== symbol.parent + ? [localParentType.symbol] + : localParentType && localParentType.isUnionOrIntersection() + ? getSymbolsForClassAndInterfaceComponents(localParentType) + : undefined; } })(Core = FindAllReferences.Core || (FindAllReferences.Core = {})); })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); @@ -72451,7 +72841,7 @@ var ts; symbol = aliased; } } - if (node.parent.kind === 269) { + if (node.parent.kind === 270) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -72506,7 +72896,7 @@ var ts; if (!type) { return undefined; } - if (type.flags & 131072 && !(type.flags & 16)) { + if (type.isUnion() && !(type.flags & 16)) { return ts.flatMap(type.types, function (t) { return t.symbol && getDefinitionFromSymbol(typeChecker, t.symbol, node); }); } return type.symbol && getDefinitionFromSymbol(typeChecker, type.symbol, node); @@ -72534,11 +72924,11 @@ var ts; return true; } switch (declaration.kind) { - case 243: - case 241: + case 244: + case 242: return true; - case 246: - return declaration.parent.kind === 245; + case 247: + return declaration.parent.kind === 246; default: return false; } @@ -72571,7 +72961,7 @@ var ts; switch (node.kind) { case 154: case 158: - case 232: + case 233: case 153: case 152: return true; @@ -72712,9 +73102,9 @@ var ts; JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 292: + case 293: return [declaration]; - case 291: + case 292: return [declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -72734,15 +73124,15 @@ var ts; function getCommentText(tag) { var comment = tag.comment; switch (tag.kind) { - case 285: + case 286: return withNode(tag.class); - case 290: - return withList(tag.typeParameters); - case 289: - return withNode(tag.typeExpression); case 291: + return withList(tag.typeParameters); + case 290: + return withNode(tag.typeExpression); case 292: - case 287: + case 293: + case 288: var name = tag.name; return name ? withNode(name) : comment; default: @@ -72887,20 +73277,20 @@ var ts; function getCommentOwnerInfo(tokenAtPos) { for (var commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 232: + case 233: case 153: case 154: case 152: var parameters = commentOwner.parameters; return { commentOwner: commentOwner, parameters: parameters }; - case 233: case 234: - case 150: - case 236: - case 271: case 235: + case 150: + case 237: + case 272: + case 236: return { commentOwner: commentOwner }; - case 212: { + case 213: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; var parameters_1 = varDeclarations.length === 1 && varDeclarations[0].initializer @@ -72908,11 +73298,11 @@ var ts; : undefined; return { commentOwner: commentOwner, parameters: parameters_1 }; } - case 272: + case 273: return undefined; - case 237: - return commentOwner.parent.kind === 237 ? undefined : { commentOwner: commentOwner }; - case 198: { + case 238: + return commentOwner.parent.kind === 238 ? undefined : { commentOwner: commentOwner }; + case 199: { var be = commentOwner; if (ts.getSpecialPropertyAssignmentKind(be) === 0) { return undefined; @@ -72924,14 +73314,14 @@ var ts; } } function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 189) { + while (rightHandSide.kind === 190) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 190: case 191: + case 192: return rightHandSide.parameters; - case 203: + case 204: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; if (member.kind === 154) { @@ -73265,16 +73655,14 @@ var ts; continue; } } - var matchKind = bestMatchKind(containerMatches); - var isCaseSensitive = allMatchesAreCaseSensitive(containerMatches); - rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: isCaseSensitive, declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: Math.min.apply(Math, matches.map(function (m) { return m.kind; })), isCaseSensitive: matches.every(function (m) { return m.isCaseSensitive; }), declaration: declaration }); } } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 243: - case 246: - case 241: + case 244: + case 247: + case 242: var importer = checker.getSymbolAtLocation(declaration.name); var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -73282,16 +73670,6 @@ var ts; return true; } } - function allMatchesAreCaseSensitive(matches) { - ts.Debug.assert(matches.length > 0); - for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { - var match = matches_1[_i]; - if (!match.isCaseSensitive) { - return false; - } - } - return true; - } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); if (name && ts.isPropertyNameLiteral(name)) { @@ -73324,10 +73702,8 @@ var ts; function getContainers(declaration) { var containers = []; var name = ts.getNameOfDeclaration(declaration); - if (name.kind === 146) { - if (!tryAddComputedPropertyName(name.expression, containers, false)) { - return undefined; - } + if (name.kind === 146 && !tryAddComputedPropertyName(name.expression, containers, false)) { + return undefined; } declaration = ts.getContainerNode(declaration); while (declaration) { @@ -73338,18 +73714,6 @@ var ts; } return containers; } - function bestMatchKind(matches) { - ts.Debug.assert(matches.length > 0); - var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) { - var match = matches_2[_i]; - var kind = match.kind; - if (kind < bestMatchKind) { - bestMatchKind = kind; - } - } - return bestMatchKind; - } function compareNavigateToItems(i1, i2) { return ts.compareValues(i1.matchKind, i2.matchKind) || ts.compareStringsCaseSensitiveUI(i1.name, i2.name); @@ -73497,14 +73861,14 @@ var ts; addLeafNode(node); } break; - case 243: + case 244: var importClause = node; if (importClause.name) { addLeafNode(importClause); } var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 244) { + if (namedBindings.kind === 245) { addLeafNode(namedBindings); } else { @@ -73515,8 +73879,8 @@ var ts; } } break; - case 180: - case 230: + case 181: + case 231: var _d = node, name = _d.name, initializer = _d.initializer; if (ts.isBindingPattern(name)) { addChildrenRecursively(name); @@ -73535,12 +73899,12 @@ var ts; addNodeWithRecursiveChild(node, initializer); } break; + case 192: + case 233: case 191: - case 232: - case 190: addNodeWithRecursiveChild(node, node.body); break; - case 236: + case 237: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -73550,9 +73914,9 @@ var ts; } endNode(); break; - case 233: - case 203: case 234: + case 204: + case 235: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -73560,18 +73924,18 @@ var ts; } endNode(); break; - case 237: + case 238: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 250: - case 241: + case 251: + case 242: case 159: case 157: case 158: - case 235: + case 236: addLeafNode(node); break; - case 198: { + case 199: { var special = ts.getSpecialPropertyAssignmentKind(node); switch (special) { case 1: @@ -73592,7 +73956,7 @@ var ts; if (ts.hasJSDocNodes(node)) { ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 291) { + if (tag.kind === 292) { addLeafNode(tag); } }); @@ -73651,14 +74015,14 @@ var ts; case 155: case 156: return ts.hasModifier(a, 32) === ts.hasModifier(b, 32); - case 237: + case 238: return areSameModule(a, b); default: return true; } } function areSameModule(a, b) { - return a.body.kind === b.body.kind && (a.body.kind !== 237 || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 238 || areSameModule(a.body, b.body)); } function merge(target, source) { target.additionalNodes = target.additionalNodes || []; @@ -73681,7 +74045,7 @@ var ts; || ts.compareValues(navigationBarNodeKind(child1), navigationBarNodeKind(child2)); } function tryGetName(node) { - if (node.kind === 237) { + if (node.kind === 238) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -73689,18 +74053,18 @@ var ts; return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); } switch (node.kind) { - case 190: case 191: - case 203: + case 192: + case 204: return getFunctionOrClassName(node); - case 291: + case 292: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 237) { + if (node.kind === 238) { return getModuleName(node); } var name = ts.getNameOfDeclaration(node); @@ -73711,16 +74075,16 @@ var ts; } } switch (node.kind) { - case 272: + case 273: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 191: - case 232: - case 190: + case 192: case 233: - case 203: + case 191: + case 234: + case 204: if (ts.getModifierFlags(node) & 512) { return "default"; } @@ -73733,7 +74097,7 @@ var ts; return "()"; case 159: return "[]"; - case 291: + case 292: return getJSDocTypedefTagName(node); default: return ""; @@ -73745,7 +74109,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 212) { + if (parentNode && parentNode.kind === 213) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 71) { @@ -73773,24 +74137,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 233: - case 203: - case 236: case 234: + case 204: case 237: - case 272: case 235: - case 291: + case 238: + case 273: + case 236: + case 292: return true; case 154: case 153: case 155: case 156: - case 230: + case 231: return hasSomeImportantChild(item); + case 192: + case 233: case 191: - case 232: - case 190: return isTopLevelFunctionDeclaration(item); default: return false; @@ -73800,8 +74164,8 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 238: - case 272: + case 239: + case 273: case 153: case 154: return true; @@ -73812,7 +74176,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 230 && childKind !== 180; + return childKind !== 231 && childKind !== 181; }); } } @@ -73866,23 +74230,23 @@ var ts; } var result = []; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 237) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 238) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } return result.join("."); } function getInteriorModule(decl) { - return decl.body.kind === 237 ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 238 ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { return !member.name || member.name.kind === 146; } function getNodeSpan(node) { - return node.kind === 272 ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 273 ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 230) { + if (node.parent && node.parent.kind === 231) { node = node.parent; } return ts.getNodeModifiers(node); @@ -73891,14 +74255,14 @@ var ts; if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 230) { + else if (node.parent.kind === 231) { return ts.declarationNameToString(node.parent.name); } - else if (node.parent.kind === 198 && + else if (node.parent.kind === 199 && node.parent.operatorToken.kind === 58) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 268 && node.parent.name) { + else if (node.parent.kind === 269 && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512) { @@ -73910,9 +74274,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { + case 192: case 191: - case 190: - case 203: + case 204: return true; default: return false; @@ -74206,21 +74570,21 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 211: + case 212: if (ts.isFunctionBlock(n)) { - return spanForNode(n.parent, n.parent.kind !== 191); + return spanForNode(n.parent, n.parent.kind !== 192); } switch (n.parent.kind) { - case 216: - case 219: - case 220: - case 218: - case 215: case 217: - case 224: - case 267: + case 220: + case 221: + case 219: + case 216: + case 218: + case 225: + case 268: return spanForNode(n.parent); - case 228: + case 229: var tryStatement = n.parent; if (tryStatement.tryBlock === n) { return spanForNode(n.parent); @@ -74231,16 +74595,16 @@ var ts; default: return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile)); } - case 238: - return spanForNode(n.parent); - case 233: - case 234: - case 236: case 239: + return spanForNode(n.parent); + case 234: + case 235: + case 237: + case 240: return spanForNode(n); - case 182: + case 183: return spanForObjectOrArrayLiteral(n); - case 181: + case 182: return spanForObjectOrArrayLiteral(n, 21); } function spanForObjectOrArrayLiteral(node, open) { @@ -74278,12 +74642,10 @@ var ts; PatternMatchKind[PatternMatchKind["substring"] = 2] = "substring"; PatternMatchKind[PatternMatchKind["camelCase"] = 3] = "camelCase"; })(PatternMatchKind = ts.PatternMatchKind || (ts.PatternMatchKind = {})); - function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) { + function createPatternMatch(kind, isCaseSensitive) { return { kind: kind, - punctuationStripped: punctuationStripped, - isCaseSensitive: isCaseSensitive, - camelCaseWeight: camelCaseWeight + isCaseSensitive: isCaseSensitive }; } function createPatternMatcher(pattern) { @@ -74292,200 +74654,141 @@ var ts; var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { - getMatches: getMatches, - getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern, + getMatches: function (containers, candidate) { return skipMatch(candidate) ? undefined : getMatches(containers, candidate, dotSeparatedSegments, stringToWordSpans); }, + getMatchesForLastSegmentOfPattern: function (candidate) { return skipMatch(candidate) ? undefined : matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments), stringToWordSpans); }, patternContainsDots: dotSeparatedSegments.length > 1 }; function skipMatch(candidate) { return invalidPattern || !candidate; } - function getMatchesForLastSegmentOfPattern(candidate) { - if (skipMatch(candidate)) { - return undefined; - } - return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); - } - function getMatches(candidateContainers, candidate) { - if (skipMatch(candidate)) { - return undefined; - } - var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); - if (!candidateMatch) { - return undefined; - } - candidateContainers = candidateContainers || []; - if (dotSeparatedSegments.length - 1 > candidateContainers.length) { - return undefined; - } - var totalMatch = candidateMatch; - for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { - var segment = dotSeparatedSegments[i]; - var containerName = candidateContainers[j]; - var containerMatch = matchSegment(containerName, segment); - if (!containerMatch) { - return undefined; - } - ts.addRange(totalMatch, containerMatch); - } - return totalMatch; - } - function getWordSpans(word) { - var spans = stringToWordSpans.get(word); - if (!spans) { - stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); - } - return spans; - } - function matchTextChunk(candidate, chunk, punctuationStripped) { - var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); - if (index === 0) { - if (chunk.text.length === candidate.length) { - return createPatternMatch(PatternMatchKind.exact, punctuationStripped, candidate === chunk.text); - } - else { - return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, ts.startsWith(candidate, chunk.text)); - } - } - var isLowercase = chunk.isLowerCase; - if (isLowercase) { - if (index > 0) { - var wordSpans = getWordSpans(candidate); - for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { - var span = wordSpans_1[_i]; - if (partStartsWith(candidate, span, chunk.text, true)) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); - } - } - } - } - else { - if (candidate.indexOf(chunk.text) > 0) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, true); - } - } - if (!isLowercase) { - if (chunk.characterSpans.length > 0) { - var candidateParts = getWordSpans(candidate); - var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, false); - if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, true, camelCaseWeight); - } - camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true); - if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, false, camelCaseWeight); - } - } - } - if (isLowercase) { - if (chunk.text.length < candidate.length) { - if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, false); - } - } - } + } + ts.createPatternMatcher = createPatternMatcher; + function getMatches(candidateContainers, candidate, dotSeparatedSegments, stringToWordSpans) { + var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments), stringToWordSpans); + if (!candidateMatch) { return undefined; } - function containsSpaceOrAsterisk(text) { - for (var i = 0; i < text.length; i++) { - var ch = text.charCodeAt(i); - if (ch === 32 || ch === 42) { - return true; - } - } - return false; + candidateContainers = candidateContainers || []; + if (dotSeparatedSegments.length - 1 > candidateContainers.length) { + return undefined; } - function matchSegment(candidate, segment) { - if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { - var match = matchTextChunk(candidate, segment.totalTextChunk, false); - if (match) { - return [match]; - } + var totalMatch = candidateMatch; + for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { + var segment = dotSeparatedSegments[i]; + var containerName = candidateContainers[j]; + var containerMatch = matchSegment(containerName, segment, stringToWordSpans); + if (!containerMatch) { + return undefined; } - var subWordTextChunks = segment.subWordTextChunks; - var matches; - for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { - var subWordTextChunk = subWordTextChunks_1[_i]; - var result = matchTextChunk(candidate, subWordTextChunk, true); - if (!result) { - return undefined; - } - matches = matches || []; - matches.push(result); - } - return matches; + ts.addRange(totalMatch, containerMatch); } - function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { - var patternPartStart = patternSpan ? patternSpan.start : 0; - var patternPartLength = patternSpan ? patternSpan.length : pattern.length; - if (patternPartLength > candidateSpan.length) { - return false; - } - if (ignoreCase) { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (toLowerCase(ch1) !== toLowerCase(ch2)) { - return false; - } - } - } - else { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (ch1 !== ch2) { - return false; - } - } - } - return true; + return totalMatch; + } + function getWordSpans(word, stringToWordSpans) { + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { - var chunkCharacterSpans = chunk.characterSpans; - var currentCandidate = 0; - var currentChunkSpan = 0; - var firstMatch; - var contiguous; - while (true) { - if (currentChunkSpan === chunkCharacterSpans.length) { - var weight = 0; - if (contiguous) { - weight += 1; - } - if (firstMatch === 0) { - weight += 2; - } - return weight; + return spans; + } + function matchTextChunk(candidate, chunk, stringToWordSpans) { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + return createPatternMatch(chunk.text.length === candidate.length ? PatternMatchKind.exact : PatternMatchKind.prefix, ts.startsWith(candidate, chunk.text)); + } + if (chunk.isLowerCase) { + if (index === -1) + return undefined; + var wordSpans = getWordSpans(candidate, stringToWordSpans); + for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { + var span = wordSpans_1[_i]; + if (partStartsWith(candidate, span, chunk.text, true)) { + return createPatternMatch(PatternMatchKind.substring, partStartsWith(candidate, span, chunk.text, false)); } - else if (currentCandidate === candidateParts.length) { - return undefined; + } + if (chunk.text.length < candidate.length && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(PatternMatchKind.substring, false); + } + } + else { + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(PatternMatchKind.substring, true); + } + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate, stringToWordSpans); + var isCaseSensitive = tryCamelCaseMatch(candidate, candidateParts, chunk, false) ? true + : tryCamelCaseMatch(candidate, candidateParts, chunk, true) ? false : undefined; + if (isCaseSensitive !== undefined) { + return createPatternMatch(PatternMatchKind.camelCase, isCaseSensitive); } - var candidatePart = candidateParts[currentCandidate]; - var gotOneMatchThisCandidate = false; - for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { - var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; - if (gotOneMatchThisCandidate) { - if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || - !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { - break; - } - } - if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { - break; - } - gotOneMatchThisCandidate = true; - firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; - contiguous = contiguous === undefined ? true : contiguous; - candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); - } - if (!gotOneMatchThisCandidate && contiguous !== undefined) { - contiguous = false; - } - currentCandidate++; } } } - ts.createPatternMatcher = createPatternMatcher; + function matchSegment(candidate, segment, stringToWordSpans) { + if (every(segment.totalTextChunk.text, function (ch) { return ch !== 32 && ch !== 42; })) { + var match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans); + if (match) { + return [match]; + } + } + var subWordTextChunks = segment.subWordTextChunks; + var matches; + for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { + var subWordTextChunk = subWordTextChunks_1[_i]; + var result = matchTextChunk(candidate, subWordTextChunk, stringToWordSpans); + if (!result) { + return undefined; + } + matches = matches || []; + matches.push(result); + } + return matches; + } + function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { + if (patternSpan === void 0) { patternSpan = { start: 0, length: pattern.length }; } + return patternSpan.length <= candidateSpan.length + && everyInRange(0, patternSpan.length, function (i) { return equalChars(pattern.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase); }); + } + function equalChars(ch1, ch2, ignoreCase) { + return ignoreCase ? toLowerCase(ch1) === toLowerCase(ch2) : ch1 === ch2; + } + function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { + var chunkCharacterSpans = chunk.characterSpans; + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch; + var contiguous; + while (true) { + if (currentChunkSpan === chunkCharacterSpans.length) { + return true; + } + else if (currentCandidate === candidateParts.length) { + return false; + } + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + if (gotOneMatchThisCandidate) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + gotOneMatchThisCandidate = true; + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + contiguous = contiguous === undefined ? true : contiguous; + candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + currentCandidate++; + } + } function createSegment(text) { return { totalTextChunk: createTextChunk(text), @@ -74517,23 +74820,18 @@ var ts; } function indexOfIgnoringCase(str, value) { var n = str.length - value.length; - for (var i = 0; i <= n; i++) { - if (startsWithIgnoringCase(str, value, i)) { - return i; + var _loop_10 = function (start) { + if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) { + return { value: start }; } + }; + for (var start = 0; start <= n; start++) { + var state_3 = _loop_10(start); + if (typeof state_3 === "object") + return state_3.value; } return -1; } - function startsWithIgnoringCase(str, value, start) { - for (var i = 0; i < value.length; i++) { - var ch1 = toLowerCase(str.charCodeAt(i + start)); - var ch2 = value.charCodeAt(i); - if (ch1 !== ch2) { - return false; - } - } - return true; - } function toLowerCase(ch) { if (ch >= 65 && ch <= 90) { return 97 + (ch - 65); @@ -74597,7 +74895,7 @@ var ts; var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); - var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + var hasTransitionFromUpperToLower = word && transitionFromUpperToLower(identifier, i, wordStart); if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit !== currentIsDigit || @@ -74644,39 +74942,32 @@ var ts; return false; } function isAllPunctuation(identifier, start, end) { + return every(identifier, function (ch) { return charIsPunctuation(ch) && ch !== 95; }, start, end); + } + function transitionFromUpperToLower(identifier, index, wordStart) { + return index !== wordStart + && index + 1 < identifier.length + && isUpperCaseLetter(identifier.charCodeAt(index)) + && isLowerCaseLetter(identifier.charCodeAt(index + 1)) + && every(identifier, isUpperCaseLetter, wordStart, index); + } + function transitionFromLowerToUpper(identifier, word, index) { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + return currentIsUpper && (!word || !lastIsUpper); + } + function everyInRange(start, end, pred) { for (var i = start; i < end; i++) { - var ch = identifier.charCodeAt(i); - if (!charIsPunctuation(ch) || ch === 95 || ch === 36) { + if (!pred(i)) { return false; } } return true; } - function transitionFromUpperToLower(identifier, word, index, wordStart) { - if (word) { - if (index !== wordStart && - index + 1 < identifier.length) { - var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); - if (currentIsUpper && nextIsLower) { - for (var i = wordStart; i < index; i++) { - if (!isUpperCaseLetter(identifier.charCodeAt(i))) { - return false; - } - } - return true; - } - } - } - return false; - } - function transitionFromLowerToUpper(identifier, word, index) { - var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); - var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var transition = word - ? (currentIsUpper && !lastIsUpper) - : currentIsUpper; - return transition; + function every(s, pred, start, end) { + if (start === void 0) { start = 0; } + if (end === void 0) { end = s.length; } + return everyInRange(start, end, function (i) { return pred(s.charCodeAt(i), i); }); } })(ts || (ts = {})); var ts; @@ -75085,7 +75376,7 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 185) { + if (argumentInfo.invocation.kind !== 186) { return undefined; } var callExpression = argumentInfo.invocation; @@ -75140,23 +75431,23 @@ var ts; var argumentsSpan = getApplicableSpanForArguments(list, sourceFile); return { kind: kind, invocation: invocation, argumentsSpan: argumentsSpan, argumentIndex: argumentIndex, argumentCount: argumentCount }; } - else if (node.kind === 13 && node.parent.kind === 187) { + else if (node.kind === 13 && node.parent.kind === 188) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0, sourceFile); } } - else if (node.kind === 14 && node.parent.parent.kind === 187) { + else if (node.kind === 14 && node.parent.parent.kind === 188) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 200); + ts.Debug.assert(templateExpression.kind === 201); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 209 && node.parent.parent.parent.kind === 187) { + else if (node.parent.kind === 210 && node.parent.parent.parent.kind === 188) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 200); + ts.Debug.assert(templateExpression.kind === 201); if (node.kind === 16 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } @@ -75231,7 +75522,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 200) { + if (template.kind === 201) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -75240,7 +75531,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 272; n = n.parent) { + for (var n = node; n.kind !== 273; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -75370,8 +75661,8 @@ var ts; var isJsFile = ts.isSourceFileJavaScript(sourceFile); function check(node) { switch (node.kind) { - case 232: - case 190: + case 233: + case 191: if (isJsFile) { var symbol = node.symbol; if (symbol.members && (symbol.members.size > 0)) { @@ -75405,12 +75696,12 @@ var ts; ts.computeSuggestionDiagnostics = computeSuggestionDiagnostics; function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 242: + case 243: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings.kind === 244 && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings.kind === 245 && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 241: + case 242: return node.name; default: return undefined; @@ -75428,7 +75719,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32) { - return ts.getDeclarationOfKind(symbol, 203) ? + return ts.getDeclarationOfKind(symbol, 204) ? "local class" : "class"; } if (flags & 384) @@ -75502,11 +75793,11 @@ var ts; return unionPropertyKind; } switch (location.parent && location.parent.kind) { - case 255: - case 253: + case 256: case 254: + case 255: return location.kind === 71 ? "property" : "JSX attribute"; - case 260: + case 261: return "JSX attribute"; default: return "property"; @@ -75542,7 +75833,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location); - if (location.parent && location.parent.kind === 183) { + if (location.parent && location.parent.kind === 184) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; @@ -75561,7 +75852,7 @@ var ts; if (callExpressionLike) { var candidateSignatures = []; signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); - var useConstructSignatures = callExpressionLike.kind === 186 || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 97); + var useConstructSignatures = callExpressionLike.kind === 187 || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 97); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -75594,7 +75885,7 @@ var ts; case "local var": displayParts.push(ts.punctuationPart(56)); displayParts.push(ts.spacePart()); - if (!(type.flags & 65536 && type.objectFlags & 16) && type.symbol) { + if (!(ts.getObjectFlags(type) & 16) && type.symbol) { ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, 4 | 1)); displayParts.push(ts.lineBreakPart()); } @@ -75639,7 +75930,7 @@ var ts; } if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 203)) { + if (ts.getDeclarationOfKind(symbol, 204)) { pushTypePart("local class"); } else { @@ -75679,7 +75970,7 @@ var ts; } if (symbolFlags & 1536) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 237); + var declaration = ts.getDeclarationOfKind(symbol, 238); var isNamespace = declaration && declaration.name && declaration.name.kind === 71; displayParts.push(ts.keywordPart(isNamespace ? 130 : 129)); displayParts.push(ts.spacePart()); @@ -75714,7 +76005,7 @@ var ts; } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); } - else if (declaration.kind === 235) { + else if (declaration.kind === 236) { addInPrefix(); displayParts.push(ts.keywordPart(139)); displayParts.push(ts.spacePart()); @@ -75728,7 +76019,7 @@ var ts; symbolKind = "enum member"; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 271) { + if (declaration.kind === 272) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -75757,12 +76048,12 @@ var ts; } } switch (symbol.declarations[0].kind) { - case 240: + case 241: displayParts.push(ts.keywordPart(84)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(130)); break; - case 247: + case 248: displayParts.push(ts.keywordPart(84)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 58 : 79)); @@ -75773,7 +76064,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 241) { + if (declaration.kind === 242) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -75846,10 +76137,10 @@ var ts; documentation = symbol.getDocumentationComment(typeChecker); tags = symbol.getJsDocTags(); if (documentation.length === 0 && symbolFlags & 4) { - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 272; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 273; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 198) { + if (!declaration.parent || declaration.parent.kind !== 199) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -75953,14 +76244,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 190) { + if (declaration.kind === 191) { return true; } - if (declaration.kind !== 230 && declaration.kind !== 232) { + if (declaration.kind !== 231 && declaration.kind !== 233) { return false; } for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { - if (parent.kind === 272 || parent.kind === 238) { + if (parent.kind === 273 || parent.kind === 239) { return false; } } @@ -76044,7 +76335,7 @@ var ts; return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.cloneCompilerOptions(options); - var _loop_10 = function (opt) { + var _loop_11 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -76060,7 +76351,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_10(opt); + _loop_11(opt); } return options; } @@ -76232,10 +76523,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 260: - case 255: + case 261: case 256: - case 254: + case 257: + case 255: return ts.isKeyword(node.kind) || node.kind === 71; } } @@ -76510,7 +76801,7 @@ var ts; rule("NoSpaceBetweenCloseParenAndAngularBracket", 20, 27, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8), rule("NoSpaceAfterOpenAngularBracket", 27, anyToken, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8), rule("NoSpaceBeforeCloseAngularBracket", anyToken, 29, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8), - rule("NoSpaceAfterCloseAngularBracket", 29, [19, 21, 29, 26], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8), + rule("NoSpaceAfterCloseAngularBracket", 29, [19, 21, 29, 26], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext], 8), rule("SpaceBeforeAt", [20, 71], 57, [isNonJsxSameLineTokenContext], 2), rule("NoSpaceAfterAt", 57, anyToken, [isNonJsxSameLineTokenContext], 8), rule("SpaceAfterDecorator", anyToken, [ @@ -76632,36 +76923,36 @@ var ts; return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 218; + return context.contextNode.kind === 219; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 198: case 199: + case 200: case 170: - case 206: - case 250: - case 246: + case 207: + case 251: + case 247: case 160: case 168: case 169: return true; - case 180: - case 235: - case 241: - case 230: + case 181: + case 236: + case 242: + case 231: case 148: - case 271: + case 272: case 151: case 150: return context.currentTokenSpan.kind === 58 || context.nextTokenSpan.kind === 58; - case 219: + case 220: case 147: return context.currentTokenSpan.kind === 92 || context.nextTokenSpan.kind === 92; - case 220: + case 221: return context.currentTokenSpan.kind === 144 || context.nextTokenSpan.kind === 144; } return false; @@ -76677,18 +76968,18 @@ var ts; return contextKind === 151 || contextKind === 150 || contextKind === 148 || - contextKind === 230 || + contextKind === 231 || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 199 || + return context.contextNode.kind === 200 || context.contextNode.kind === 170; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 178 || + return context.contextNode.kind === 179 || context.contextNode.kind === 176 || isSingleLineBlockContext(context); } @@ -76712,64 +77003,67 @@ var ts; return true; } switch (node.kind) { - case 211: + case 212: + case 240: + case 183: case 239: - case 182: - case 238: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 232: + case 233: case 153: case 152: case 155: case 156: case 157: - case 190: - case 154: case 191: - case 234: + case 154: + case 192: + case 235: return true; } return false; } + function isNotFunctionDeclContext(context) { + return !isFunctionDeclContext(context); + } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 232 || context.contextNode.kind === 190; + return context.contextNode.kind === 233 || context.contextNode.kind === 191; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 233: - case 203: case 234: - case 236: - case 165: + case 204: + case 235: case 237: - case 248: + case 165: + case 238: case 249: - case 242: - case 245: + case 250: + case 243: + case 246: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 233: - case 237: - case 236: - case 267: + case 234: case 238: - case 225: + case 237: + case 268: + case 239: + case 226: return true; - case 211: { + case 212: { var blockParent = context.currentTokenParent.parent; - if (!blockParent || blockParent.kind !== 191 && blockParent.kind !== 190) { + if (!blockParent || blockParent.kind !== 192 && blockParent.kind !== 191) { return true; } } @@ -76778,29 +77072,29 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 215: - case 225: - case 218: + case 216: + case 226: case 219: case 220: + case 221: + case 218: + case 229: case 217: - case 228: - case 216: - case 224: - case 267: + case 225: + case 268: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 182; + return context.contextNode.kind === 183; } function isFunctionCallContext(context) { - return context.contextNode.kind === 185; + return context.contextNode.kind === 186; } function isNewContext(context) { - return context.contextNode.kind === 186; + return context.contextNode.kind === 187; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -76812,25 +77106,25 @@ var ts; return context.nextTokenSpan.kind !== 22; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 191; + return context.contextNode.kind === 192; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 253 && context.contextNode.kind !== 257; + return context.contextNode.kind !== 254 && context.contextNode.kind !== 258; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 263 || context.contextNode.kind === 262; + return context.contextNode.kind === 264 || context.contextNode.kind === 263; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 260; + return context.nextTokenParent.kind === 261; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 260; + return context.contextNode.kind === 261; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 254; + return context.contextNode.kind === 255; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -76848,14 +77142,14 @@ var ts; return node.kind === 149; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 231 && + return context.currentTokenParent.kind === 232 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2; } function isModuleDeclContext(context) { - return context.contextNode.kind === 237; + return context.contextNode.kind === 238; } function isObjectTypeContext(context) { return context.contextNode.kind === 165; @@ -76869,21 +77163,21 @@ var ts; } switch (parent.kind) { case 161: - case 188: + case 189: + case 236: + case 234: + case 204: case 235: case 233: - case 203: - case 234: - case 232: - case 190: case 191: + case 192: case 153: case 152: case 157: case 158: - case 185: case 186: - case 205: + case 187: + case 206: return true; default: return false; @@ -76894,16 +77188,16 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 188; + return context.contextNode.kind === 189; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 105 && context.currentTokenParent.kind === 194; + return context.currentTokenSpan.kind === 105 && context.currentTokenParent.kind === 195; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 201 && context.contextNode.expression !== undefined; + return context.contextNode.kind === 202 && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 207; + return context.contextNode.kind === 208; } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -77076,17 +77370,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 233: case 234: + case 235: return ts.rangeContainsRange(parent.members, node); - case 237: - var body = parent.body; - return body && body.kind === 238 && ts.rangeContainsRange(body.statements, node); - case 272: - case 211: case 238: + var body = parent.body; + return body && body.kind === 239 && ts.rangeContainsRange(body.statements, node); + case 273: + case 212: + case 239: return ts.rangeContainsRange(parent.statements, node); - case 267: + case 268: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -77156,7 +77450,7 @@ var ts; if (previousLine !== -1 && line !== previousLine) { break; } - if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) { + if (formatting.SmartIndenter.shouldIndentChildNode(options, n, child, sourceFile)) { return options.indentSize; } previousLine = line; @@ -77229,7 +77523,7 @@ var ts; return -1; } function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { - var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0; + var delta = formatting.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; if (effectiveParentStartLine === startLine) { return { indentation: startLine === lastIndentedLine ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(), @@ -77256,10 +77550,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 233: return 75; - case 234: return 109; - case 232: return 89; - case 236: return 236; + case 234: return 75; + case 235: return 109; + case 233: return 89; + case 237: return 237; case 155: return 125; case 156: return 136; case 153: @@ -77288,9 +77582,9 @@ var ts; getIndentation: function () { return indentation; }, getDelta: getDelta, recomputeIndentation: function (lineAdded) { - if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(options, node.parent, node, sourceFile)) { indentation += lineAdded ? options.indentSize : -options.indentSize; - delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0; + delta = formatting.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; } } }; @@ -77307,9 +77601,9 @@ var ts; case 41: case 29: switch (container.kind) { - case 255: case 256: - case 254: + case 257: + case 255: return false; } break; @@ -77324,7 +77618,7 @@ var ts; && !(node.decorators && kind === getFirstNonDecoratorTokenOfNode(node)); } function getDelta(child) { - return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0; + return formatting.SmartIndenter.nodeWillIndentChild(options, node, child, sourceFile, true) ? delta : 0; } } function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { @@ -77392,7 +77686,7 @@ var ts; indentMultilineCommentOrJsxText(range, childIndentation.indentation, true, false); } childContextNode = node; - if (isFirstListItem && parent.kind === 181 && inheritedIndentation === -1) { + if (isFirstListItem && parent.kind === 182 && inheritedIndentation === -1) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -77744,11 +78038,11 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 154: - case 232: - case 190: + case 233: + case 191: case 153: case 152: - case 191: + case 192: if (node.typeParameters === list) { return 27; } @@ -77756,8 +78050,8 @@ var ts; return 19; } break; - case 185: case 186: + case 187: if (node.typeArguments === list) { return 27; } @@ -77859,7 +78153,7 @@ var ts; if (options.indentStyle === ts.IndentStyle.Block) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 26 && precedingToken.parent.kind !== 198) { + if (precedingToken.kind === 26 && precedingToken.parent.kind !== 199) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -77899,7 +78193,7 @@ var ts; var previous; var current = precedingToken; while (current) { - if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous, true)) { + if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(options, current, previous, sourceFile, true)) { var currentStart = getStartLineAndCharacterForNode(current, sourceFile); var nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile); var indentationDelta = nextTokenKind !== 0 @@ -77956,7 +78250,7 @@ var ts; return actualIndentation + indentationDelta; } } - if (shouldIndentChildNode(parent, current, isNextChild) && !parentAndChildShareLine) { + if (shouldIndentChildNode(options, parent, current, sourceFile, isNextChild) && !parentAndChildShareLine) { indentationDelta += options.indentSize; } var useTrueStart = isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, current, currentStart.line, sourceFile); @@ -77982,7 +78276,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 272 || !parentAndChildShareLine); + (parent.kind === 273 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -78021,7 +78315,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 215 && parent.elseStatement === child) { + if (parent.kind === 216 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 82, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -78038,13 +78332,13 @@ var ts; switch (node.parent.kind) { case 161: return getListIfStartEndIsInListRange(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd()); - case 182: + case 183: return node.parent.properties; - case 181: + case 182: return node.parent.elements; - case 232: - case 190: + case 233: case 191: + case 192: case 153: case 152: case 157: @@ -78055,18 +78349,18 @@ var ts; return getListIfStartEndIsInListRange(node.parent.typeParameters, start, node.getEnd()) || getListIfStartEndIsInListRange(node.parent.parameters, start, node.getEnd()); } - case 233: + case 234: return getListIfStartEndIsInListRange(node.parent.typeParameters, node.getStart(sourceFile), node.getEnd()); - case 186: - case 185: { + case 187: + case 186: { var start = node.getStart(sourceFile); return getListIfStartEndIsInListRange(node.parent.typeArguments, start, node.getEnd()) || getListIfStartEndIsInListRange(node.parent.arguments, start, node.getEnd()); } - case 231: + case 232: return getListIfStartEndIsInListRange(node.parent.declarations, node.getStart(sourceFile), node.getEnd()); - case 245: - case 249: + case 246: + case 250: return getListIfStartEndIsInListRange(node.parent.elements, node.getStart(sourceFile), node.getEnd()); } } @@ -78104,10 +78398,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 185: case 186: - case 183: + case 187: case 184: + case 185: node = node.expression; break; default: @@ -78161,37 +78455,37 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 214: - case 233: - case 203: + case 215: case 234: - case 236: + case 204: case 235: - case 181: - case 211: - case 238: + case 237: + case 236: case 182: + case 212: + case 239: + case 183: case 165: case 176: case 167: - case 239: + case 240: + case 266: case 265: - case 264: - case 189: - case 183: - case 185: + case 190: + case 184: case 186: - case 212: - case 230: - case 247: - case 223: - case 199: + case 187: + case 213: + case 231: + case 248: + case 224: + case 200: + case 180: case 179: - case 178: + case 256: + case 259: case 255: - case 258: - case 254: - case 263: + case 264: case 152: case 157: case 158: @@ -78199,71 +78493,84 @@ var ts; case 162: case 163: case 172: - case 187: - case 195: - case 249: - case 245: + case 188: + case 196: case 250: case 246: - case 268: + case 251: + case 247: + case 269: case 151: return true; } return false; } - function nodeWillIndentChild(parent, child, indentByDefault) { + function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0; switch (parent.kind) { - case 216: + case 231: + case 269: + case 183: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 183) { + return rangeIsOnOneLine(sourceFile, child); + } + break; case 217: - case 219: - case 220: case 218: - case 215: - case 232: - case 190: - case 153: + case 220: + case 221: + case 219: + case 216: + case 233: case 191: + case 153: + case 192: case 154: case 155: case 156: - return childKind !== 211; - case 248: - return childKind !== 249; - case 242: - return childKind !== 243 || - (!!child.namedBindings && child.namedBindings.kind !== 245); - case 253: - return childKind !== 256; - case 257: - return childKind !== 259; + return childKind !== 212; + case 249: + return childKind !== 250; + case 243: + return childKind !== 244 || + (!!child.namedBindings && child.namedBindings.kind !== 246); + case 254: + return childKind !== 257; + case 258: + return childKind !== 260; } return indentByDefault; } SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 223: - case 227: { - if (parent.kind !== 211) { + case 224: + case 228: { + if (parent.kind !== 212) { return true; } var grandParent = parent.parent; - return !(grandParent && grandParent.kind === 190 || grandParent.kind === 232); + return !(grandParent && grandParent.kind === 191 || grandParent.kind === 233); } - case 221: case 222: + case 223: return true; default: return false; } } - function shouldIndentChildNode(parent, child, isNextChild) { + function shouldIndentChildNode(settings, parent, child, sourceFile, isNextChild) { if (isNextChild === void 0) { isNextChild = false; } - return (nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false)) + return (nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(settings, parent, child, sourceFile, false)) && !(isNextChild && child && isControlFlowEndingStatement(child.kind, parent)); } SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; + function rangeIsOnOneLine(sourceFile, range) { + var rangeStart = ts.skipTrivia(sourceFile.text, range.pos); + var startLine = sourceFile.getLineAndCharacterOfPosition(rangeStart).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(range.end).line; + return startLine === endLine; + } })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -78353,7 +78660,7 @@ var ts; : end; } function isSeparator(node, candidate) { - return candidate && node.parent && (candidate.kind === 26 || (candidate.kind === 25 && node.parent.kind === 182)); + return candidate && node.parent && (candidate.kind === 26 || (candidate.kind === 25 && node.parent.kind === 183)); } function spaces(count) { var s = ""; @@ -78499,11 +78806,20 @@ var ts; ChangeTracker.prototype.insertText = function (sourceFile, pos, text) { this.changes.push({ kind: ChangeKind.Text, sourceFile: sourceFile, range: { pos: pos, end: pos }, text: text }); }; - ChangeTracker.prototype.insertTypeAnnotation = function (sourceFile, node, type) { - var end = (ts.isFunctionLike(node) - ? ts.findChildOfKind(node, 20, sourceFile) || ts.first(node.parameters) - : node.kind !== 230 && node.questionToken ? node.questionToken : node.name).end; - this.insertNodeAt(sourceFile, end, type, { prefix: ": " }); + ChangeTracker.prototype.tryInsertTypeAnnotation = function (sourceFile, node, type) { + var endNode; + if (ts.isFunctionLike(node)) { + endNode = ts.findChildOfKind(node, 20, sourceFile); + if (!endNode) { + if (!ts.isArrowFunction(node)) + return; + endNode = ts.first(node.parameters); + } + } + else { + endNode = node.kind !== 231 && node.questionToken ? node.questionToken : node.name; + } + this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); }; ChangeTracker.prototype.insertTypeParameters = function (sourceFile, node, typeParameters) { var start = (ts.findChildOfKind(node, 19, sourceFile) || ts.first(node.parameters)).getStart(sourceFile); @@ -78658,7 +78974,7 @@ var ts; var _this = this; this.nodesInsertedAtClassStarts.forEach(function (_a) { var sourceFile = _a.sourceFile, cls = _a.cls, members = _a.members; - var newCls = cls.kind === 233 + var newCls = cls.kind === 234 ? ts.updateClassDeclaration(cls, cls.decorators, cls.modifiers, cls.name, cls.typeParameters, cls.heritageClauses, members) : ts.updateClassExpression(cls, cls.modifiers, cls.name, cls.typeParameters, cls.heritageClauses, members); _this.replaceNode(sourceFile, cls, newCls); @@ -78677,13 +78993,13 @@ var ts; return ts.group(changes, function (c) { return c.sourceFile.path; }).map(function (changesInFile) { var sourceFile = changesInFile[0].sourceFile; var normalized = ts.stableSort(changesInFile, function (a, b) { return a.range.pos - b.range.pos; }); - var _loop_11 = function (i) { + var _loop_12 = function (i) { ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () { return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range); }); }; for (var i = 0; i < normalized.length - 1; i++) { - _loop_11(i); + _loop_12(i); } var textChanges = normalized.map(function (c) { return ts.createTextChange(ts.createTextSpanFromRange(c.range), computeNewText(c, sourceFile, newLineCharacter, formatContext, validate)); @@ -78717,7 +79033,7 @@ var ts; ? indentation : ts.formatting.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix === newLineCharacter || ts.getLineStartPositionForPosition(pos, sourceFile) === pos); if (delta === undefined) { - delta = ts.formatting.SmartIndenter.shouldIndentChildNode(nodeIn) ? (formatOptions.indentSize || 0) : 0; + delta = ts.formatting.SmartIndenter.shouldIndentChildNode(formatContext.options, nodeIn) ? (formatOptions.indentSize || 0) : 0; } var file = { text: text, getLineAndCharacterOfPosition: function (pos) { return ts.getLineAndCharacterOfPosition(this, pos); } }; var changes = ts.formatting.formatNodeGivenIndentation(node, file, sourceFile.languageVariant, initialIndentation, delta, formatContext); @@ -79122,7 +79438,7 @@ var ts; if (!param.type) { var paramType = ts.getJSDocType(param); if (paramType) - changes.insertTypeAnnotation(sourceFile, param, transformJSDocType(paramType)); + changes.tryInsertTypeAnnotation(sourceFile, param, transformJSDocType(paramType)); } } if (needParens) @@ -79130,35 +79446,35 @@ var ts; if (!decl.type) { var returnType = ts.getJSDocReturnType(decl); if (returnType) - changes.insertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType)); + changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType)); } } else { var jsdocType = ts.Debug.assertDefined(ts.getJSDocType(decl)); ts.Debug.assert(!decl.type); - changes.insertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType)); + changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType)); } } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 230 || + node.kind === 231 || node.kind === 150 || node.kind === 151; } function transformJSDocType(node) { switch (node.kind) { - case 275: case 276: - return ts.createTypeReferenceNode("any", ts.emptyArray); - case 279: - return transformJSDocOptionalType(node); - case 278: - return transformJSDocType(node.type); case 277: - return transformJSDocNullableType(node); - case 281: - return transformJSDocVariadicType(node); + return ts.createTypeReferenceNode("any", ts.emptyArray); case 280: + return transformJSDocOptionalType(node); + case 279: + return transformJSDocType(node.type); + case 278: + return transformJSDocNullableType(node); + case 282: + return transformJSDocVariadicType(node); + case 281: return transformJSDocFunctionType(node); case 161: return transformJSDocTypeReference(node); @@ -79182,7 +79498,7 @@ var ts; } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 281 && index === node.parent.parameters.length - 1; + var isRest = node.type.kind === 282 && index === node.parent.parameters.length - 1; var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.createToken(24) : node.dotDotDotToken; return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -79251,12 +79567,12 @@ var ts; var precedingNode; var newClassDeclaration; switch (ctorDeclaration.kind) { - case 232: + case 233: precedingNode = ctorDeclaration; deleteNode(ctorDeclaration); newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration); break; - case 230: + case 231: precedingNode = ctorDeclaration.parent.parent; if (ctorDeclaration.parent.declarations.length === 1) { deleteNode(precedingNode); @@ -79310,7 +79626,7 @@ var ts; return ts.isFunctionLike(source); } function createClassElement(symbol, modifiers) { - if (!(symbol.flags & 4)) { + if (!(symbol.flags & 8192)) { return; } var memberDeclaration = symbol.valueDeclaration; @@ -79318,25 +79634,25 @@ var ts; if (!shouldConvertDeclaration(memberDeclaration, assignmentBinaryExpression.right)) { return; } - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 214 + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 215 ? assignmentBinaryExpression.parent : assignmentBinaryExpression; deleteNode(nodeToDelete); if (!assignmentBinaryExpression.right) { return ts.createProperty([], modifiers, symbol.name, undefined, undefined, undefined); } switch (assignmentBinaryExpression.right.kind) { - case 190: { + case 191: { var functionExpression = assignmentBinaryExpression.right; var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 120)); var method = ts.createMethod(undefined, fullModifiers, undefined, memberDeclaration.name, undefined, undefined, functionExpression.parameters, undefined, functionExpression.body); copyComments(assignmentBinaryExpression, method, sourceFile); return method; } - case 191: { + case 192: { var arrowFunction = assignmentBinaryExpression.right; var arrowFunctionBody = arrowFunction.body; var bodyBlock = void 0; - if (arrowFunctionBody.kind === 211) { + if (arrowFunctionBody.kind === 212) { bodyBlock = arrowFunctionBody; } else { @@ -79360,7 +79676,7 @@ var ts; } function createClassFromVariableDeclaration(node) { var initializer = node.initializer; - if (!initializer || initializer.kind !== 190) { + if (!initializer || initializer.kind !== 191) { return undefined; } if (node.name.kind !== 71) { @@ -79430,10 +79746,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 241: + case 242: changes.replaceNode(importingFile, importNode, makeImport(importNode.name, undefined, moduleSpecifier)); break; - case 185: + case 186: if (ts.isRequireCall(importNode, false)) { changes.replaceNode(importingFile, importNode, ts.createPropertyAccess(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -79484,19 +79800,19 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports) { switch (statement.kind) { - case 212: + case 213: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target); return false; - case 214: { + case 215: { var expression = statement.expression; switch (expression.kind) { - case 185: { + case 186: { if (ts.isRequireCall(expression, true)) { changes.replaceNode(sourceFile, statement, makeImport(undefined, undefined, expression.arguments[0])); } return false; } - case 198: { + case 199: { var _a = expression, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return operatorToken.kind === 58 && convertAssignment(sourceFile, checker, statement, left, right, changes, exports); } @@ -79533,8 +79849,8 @@ var ts; } function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers) { switch (name.kind) { - case 178: - case 179: { + case 179: + case 180: { var tmp = makeUniqueName(propertyName, identifiers); return [ makeSingleImport(tmp, propertyName, moduleSpecifier), @@ -79576,10 +79892,10 @@ var ts; switch (prop.kind) { case 155: case 156: - case 269: case 270: + case 271: return undefined; - case 268: + case 269: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals(prop.name.text, prop.initializer); case 153: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(84)], prop); @@ -79605,16 +79921,16 @@ var ts; function convertModuleExportsToExportDefault(exported, checker) { var modifiers = [ts.createToken(84), ts.createToken(79)]; switch (exported.kind) { - case 190: - case 191: { + case 191: + case 192: { var fn = exported; return [[functionExpressionToDeclaration(fn.name && fn.name.text, modifiers, fn)], true]; } - case 203: { + case 204: { var cls = exported; return [[classExpressionToDeclaration(cls.name && cls.name.text, modifiers, cls)], true]; } - case 185: + case 186: if (ts.isRequireCall(exported, true)) { return convertReExportAll(exported.arguments[0], checker); } @@ -79641,15 +79957,15 @@ var ts; function convertExportsDotXEquals(name, exported) { var modifiers = [ts.createToken(84)]; switch (exported.kind) { - case 190: { + case 191: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { return exportConst(); } } - case 191: + case 192: return functionExpressionToDeclaration(name, modifiers, exported); - case 203: + case 204: return classExpressionToDeclaration(name, modifiers, exported); default: return exportConst(); @@ -79660,7 +79976,7 @@ var ts; } function convertSingleImport(file, name, moduleSpecifier, changes, checker, identifiers, target) { switch (name.kind) { - case 178: { + case 179: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -79670,7 +79986,7 @@ var ts; return [makeImport(undefined, importSpecifiers, moduleSpecifier)]; } } - case 179: { + case 180: { var tmp = makeUniqueName(codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers); return [ makeImport(ts.createIdentifier(tmp), undefined, moduleSpecifier), @@ -79736,9 +80052,9 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 183: + case 184: return parent.name !== node; - case 180: + case 181: return parent.propertyName !== node; default: return true; @@ -79920,38 +80236,19 @@ var ts; if (!ts.isIdentifier(token)) { return undefined; } - var classAndMakeStatic = getClassAndMakeStatic(token, checker); - if (!classAndMakeStatic) { - return undefined; - } - var classDeclaration = classAndMakeStatic.classDeclaration, makeStatic = classAndMakeStatic.makeStatic; - var classDeclarationSourceFile = classDeclaration.getSourceFile(); - var inJs = ts.isInJavaScriptFile(classDeclarationSourceFile); - var call = ts.tryCast(token.parent.parent, ts.isCallExpression); - return { token: token, classDeclaration: classDeclaration, makeStatic: makeStatic, classDeclarationSourceFile: classDeclarationSourceFile, inJs: inJs, call: call }; - } - function getClassAndMakeStatic(token, checker) { var parent = token.parent; - if (!ts.isPropertyAccessExpression(parent)) { + if (!ts.isPropertyAccessExpression(parent)) return undefined; - } - if (parent.expression.kind === 99) { - var containingClassMemberDeclaration = ts.getThisContainer(token, false); - if (!ts.isClassElement(containingClassMemberDeclaration)) { - return undefined; - } - var classDeclaration = containingClassMemberDeclaration.parent; - return ts.isClassLike(classDeclaration) ? { classDeclaration: classDeclaration, makeStatic: ts.hasModifier(containingClassMemberDeclaration, 32) } : undefined; - } - else { - var leftExpressionType = checker.getTypeAtLocation(parent.expression); - var symbol = leftExpressionType.symbol; - if (!(symbol && leftExpressionType.flags & 65536 && symbol.flags & 32)) { - return undefined; - } - var classDeclaration = ts.cast(ts.first(symbol.declarations), ts.isClassLike); - return { classDeclaration: classDeclaration, makeStatic: leftExpressionType !== checker.getDeclaredTypeOfSymbol(symbol) }; - } + var leftExpressionType = ts.skipConstraint(checker.getTypeAtLocation(parent.expression)); + var symbol = leftExpressionType.symbol; + var classDeclaration = symbol && symbol.declarations && ts.find(symbol.declarations, ts.isClassLike); + if (!classDeclaration) + return undefined; + var makeStatic = leftExpressionType.target !== checker.getDeclaredTypeOfSymbol(symbol); + var classDeclarationSourceFile = classDeclaration.getSourceFile(); + var inJs = ts.isSourceFileJavaScript(classDeclarationSourceFile); + var call = ts.tryCast(parent.parent, ts.isCallExpression); + return { token: token, classDeclaration: classDeclaration, makeStatic: makeStatic, classDeclarationSourceFile: classDeclarationSourceFile, inJs: inJs, call: call }; } function getActionsForAddMissingMemberInJavaScriptFile(context, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingMemberInJs(t, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic); }); @@ -79960,7 +80257,7 @@ var ts; } function addMissingMemberInJs(changeTracker, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) { if (makeStatic) { - if (classDeclaration.kind === 203) { + if (classDeclaration.kind === 204) { return; } var className = classDeclaration.name.getText(); @@ -79986,7 +80283,7 @@ var ts; } function getTypeNode(checker, classDeclaration, token) { var typeNode; - if (token.parent.parent.kind === 198) { + if (token.parent.parent.kind === 199) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -80027,33 +80324,45 @@ var ts; var errorCodes = [ ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, + ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2.code, ]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile; - var info = getInfo(sourceFile, context.span.start, context.program.getTypeChecker()); + var info = getInfo(sourceFile, context.span.start, context); if (!info) return undefined; var node = info.node, suggestion = info.suggestion; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestion); }); + var target = context.host.getCompilationSettings().target; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestion, target); }); return [codefix.createCodeFixAction(changes, [ts.Diagnostics.Change_spelling_to_0, suggestion], fixId, ts.Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start, context.program.getTypeChecker()); + var info = getInfo(diag.file, diag.start, context); + var target = context.host.getCompilationSettings().target; if (info) - doChange(changes, context.sourceFile, info.node, info.suggestion); + doChange(changes, context.sourceFile, info.node, info.suggestion, target); }); }, }); - function getInfo(sourceFile, pos, checker) { + function getInfo(sourceFile, pos, context) { var node = ts.getTokenAtPosition(sourceFile, pos, false); + var checker = context.program.getTypeChecker(); var suggestion; if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) { ts.Debug.assert(node.kind === 71); var containingType = checker.getTypeAtLocation(node.parent.expression); suggestion = checker.getSuggestionForNonexistentProperty(node, containingType); } + else if (ts.isImportSpecifier(node.parent) && node.parent.name === node) { + ts.Debug.assert(node.kind === 71); + var importDeclaration = ts.findAncestor(node, ts.isImportDeclaration); + var resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration); + if (resolvedSourceFile && resolvedSourceFile.symbol) { + suggestion = checker.getSuggestionForNonexistentModule(node, resolvedSourceFile.symbol); + } + } else { var meaning = ts.getMeaningFromLocation(node); var name = ts.getTextOfNode(node); @@ -80062,8 +80371,13 @@ var ts; } return suggestion === undefined ? undefined : { node: node, suggestion: suggestion }; } - function doChange(changes, sourceFile, node, suggestion) { - changes.replaceNode(sourceFile, node, ts.createIdentifier(suggestion)); + function doChange(changes, sourceFile, node, suggestion, target) { + if (!ts.isIdentifierText(suggestion, target) && ts.isPropertyAccessExpression(node.parent)) { + changes.replaceNode(sourceFile, node.parent, ts.createElementAccess(node.parent.expression, ts.createLiteral(suggestion))); + } + else { + changes.replaceNode(sourceFile, node, ts.createIdentifier(suggestion)); + } } function convertSemanticMeaningToSymbolFlags(meaning) { var flags = 0; @@ -80078,6 +80392,14 @@ var ts; } return flags; } + function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) { + if (!importDeclaration || !ts.isStringLiteralLike(importDeclaration.moduleSpecifier)) + return undefined; + var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text); + if (!resolvedModule) + return undefined; + return context.program.getSourceFile(resolvedModule.resolvedFileName); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; @@ -80396,11 +80718,11 @@ var ts; switch (token.parent.kind) { case 148: return true; - case 230: { + case 231: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { + case 221: case 220: - case 219: return true; } } @@ -80413,7 +80735,7 @@ var ts; tryDeleteIdentifier(changes, sourceFile, token); break; case 151: - case 244: + case 245: changes.deleteNode(sourceFile, token.parent); break; default: @@ -80431,7 +80753,7 @@ var ts; function tryDeleteIdentifier(changes, sourceFile, identifier) { var parent = identifier.parent; switch (parent.kind) { - case 230: + case 231: tryDeleteVariableDeclaration(changes, sourceFile, parent); break; case 147: @@ -80461,11 +80783,11 @@ var ts; changes.deleteNodeInList(sourceFile, parent); } break; - case 241: - var importEquals = ts.getAncestor(identifier, 241); + case 242: + var importEquals = ts.getAncestor(identifier, 242); changes.deleteNode(sourceFile, importEquals); break; - case 246: + case 247: var namedImports = parent.parent; if (namedImports.elements.length === 1) { tryDeleteNamedImportBinding(changes, sourceFile, namedImports); @@ -80474,10 +80796,10 @@ var ts; changes.deleteNodeInList(sourceFile, parent); } break; - case 243: + case 244: var importClause = parent; if (!importClause.namedBindings) { - changes.deleteNode(sourceFile, ts.getAncestor(importClause, 242)); + changes.deleteNode(sourceFile, ts.getAncestor(importClause, 243)); } else { var start = importClause.name.getStart(sourceFile); @@ -80491,7 +80813,7 @@ var ts; } } break; - case 244: + case 245: tryDeleteNamedImportBinding(changes, sourceFile, parent); break; default: @@ -80507,13 +80829,13 @@ var ts; } } else { - var importDecl = ts.getAncestor(namedBindings, 242); + var importDecl = ts.getAncestor(namedBindings, 243); changes.deleteNode(sourceFile, importDecl); } } function tryDeleteVariableDeclaration(changes, sourceFile, varDecl) { switch (varDecl.parent.parent.kind) { - case 218: { + case 219: { var forStatement = varDecl.parent.parent; var forInitializer = forStatement.initializer; if (forInitializer.declarations.length === 1) { @@ -80524,14 +80846,14 @@ var ts; } break; } - case 220: + case 221: var forOfStatement = varDecl.parent.parent; - ts.Debug.assert(forOfStatement.initializer.kind === 231); + ts.Debug.assert(forOfStatement.initializer.kind === 232); var forOfInitializer = forOfStatement.initializer; changes.replaceNode(sourceFile, forOfInitializer.declarations[0], ts.createObjectLiteral()); break; - case 219: - case 228: + case 220: + case 229: break; default: var variableStatement = varDecl.parent.parent; @@ -80563,7 +80885,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 === 277) { + if (typeNode.kind === 278) { actions.push(fix(checker.getNullableType(type, 4096), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); } return actions; @@ -80581,7 +80903,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 277 && fixId === fixIdNullable ? checker.getNullableType(type, 4096) : type; + var fixedType = typeNode.kind === 278 && fixId === fixIdNullable ? checker.getNullableType(type, 4096) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -80596,10 +80918,10 @@ var ts; } function isTypeContainer(node) { switch (node.kind) { - case 206: + case 207: case 157: case 158: - case 232: + case 233: case 155: case 159: case 176: @@ -80609,9 +80931,9 @@ var ts; case 151: case 150: case 156: - case 235: - case 188: - case 230: + case 236: + case 189: + case 231: return true; default: return false; @@ -80667,11 +80989,11 @@ var ts; case 153: insertBefore = containingFunction.name; break; - case 232: - case 190: + case 233: + case 191: insertBefore = ts.findChildOfKind(containingFunction, 89, sourceFile); break; - case 191: + case 192: insertBefore = ts.findChildOfKind(containingFunction, 19, sourceFile) || ts.first(containingFunction.parameters); break; default: @@ -80776,9 +81098,9 @@ var ts; return useExistingImportActions.concat(getCodeActionsForAddImport(exportInfos, context, existingImports)); } function getNamespaceImportName(declaration) { - if (declaration.kind === 242) { + if (declaration.kind === 243) { var namedBindings = declaration.importClause && ts.isImportClause(declaration.importClause) && declaration.importClause.namedBindings; - return namedBindings && namedBindings.kind === 244 ? namedBindings.name : undefined; + return namedBindings && namedBindings.kind === 245 ? namedBindings.name : undefined; } else { return declaration.name; @@ -80793,7 +81115,7 @@ var ts; if (!cached) { cached = cachedImportDeclarations[moduleSymbolId] = ts.mapDefined(imports, function (moduleSpecifier) { var i = ts.importFromModuleSpecifier(moduleSpecifier); - return (i.kind === 242 || i.kind === 241) + return (i.kind === 243 || i.kind === 242) && checker.getSymbolAtLocation(moduleSpecifier) === moduleSymbol ? { declaration: i, importKind: importKind } : undefined; }); } @@ -81075,7 +81397,7 @@ var ts; function getCodeActionsForAddImport(exportInfos, ctx, existingImports) { var fromExistingImport = ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind; - if (declaration.kind === 242 && declaration.importClause) { + if (declaration.kind === 243 && declaration.importClause) { var changes = tryUpdateExistingImport(ctx, ts.isImportClause(declaration.importClause) && declaration.importClause || undefined, importKind); if (changes) { var moduleSpecifierWithoutQuotes = ts.stripQuotes(declaration.moduleSpecifier.getText()); @@ -81094,9 +81416,9 @@ var ts; } function newImportInfoFromExistingSpecifier(_a) { var declaration = _a.declaration, importKind = _a.importKind; - var expression = declaration.kind === 242 + var expression = declaration.kind === 243 ? declaration.moduleSpecifier - : declaration.moduleReference.kind === 252 + : declaration.moduleReference.kind === 253 ? declaration.moduleReference.expression : undefined; return expression && ts.isStringLiteral(expression) ? { moduleSpecifier: expression.text, importKind: importKind } : undefined; @@ -81104,7 +81426,7 @@ var ts; function tryUpdateExistingImport(context, importClause, importKind) { var symbolName = context.symbolName, sourceFile = context.sourceFile; var name = importClause.name; - var namedBindings = (importClause.kind !== 241 && importClause).namedBindings; + var namedBindings = (importClause.kind !== 242 && importClause).namedBindings; switch (importKind) { case 1: return name ? undefined : ChangeTracker.with(context, function (t) { @@ -81112,10 +81434,10 @@ var ts; }); case 0: { var newImportSpecifier_1 = ts.createImportSpecifier(undefined, ts.createIdentifier(symbolName)); - if (namedBindings && namedBindings.kind === 245 && namedBindings.elements.length !== 0) { + if (namedBindings && namedBindings.kind === 246 && namedBindings.elements.length !== 0) { return ChangeTracker.with(context, function (t) { return t.insertNodeInListAfter(sourceFile, namedBindings.elements[namedBindings.elements.length - 1], newImportSpecifier_1); }); } - if (!namedBindings || namedBindings.kind === 245 && namedBindings.elements.length === 0) { + if (!namedBindings || namedBindings.kind === 246 && namedBindings.elements.length === 0) { return ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, importClause, ts.createImportClause(name, ts.createNamedImports([newImportSpecifier_1]))); }); @@ -81154,7 +81476,7 @@ var ts; if (!ts.isUMDExportSymbol(umdSymbol)) { var parent = token.parent; var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(parent); - if ((ts.isJsxOpeningLikeElement && parent.tagName === token) || parent.kind === 258) { + if ((ts.isJsxOpeningLikeElement && parent.tagName === token) || parent.kind === 259) { umdSymbol = checker.resolveName(checker.getJsxNamespace(parent), isNodeOpeningLikeElement ? parent.tagName : parent, 67216319, false); } } @@ -81586,11 +81908,11 @@ var ts; } function isApplicableFunctionForInference(declaration) { switch (declaration.kind) { - case 232: + case 233: case 153: case 154: return true; - case 190: + case 191: return !!declaration.name; } return false; @@ -81621,7 +81943,7 @@ var ts; function annotate(changes, sourceFile, declaration, type, program) { var typeNode = type && getTypeNodeIfAccessible(type, declaration, program.getTypeChecker()); if (typeNode) - changes.insertTypeAnnotation(sourceFile, declaration, typeNode); + changes.tryInsertTypeAnnotation(sourceFile, declaration, typeNode); } function getTypeNodeIfAccessible(type, enclosingScope, checker) { var typeIsAccessible = true; @@ -81647,8 +81969,8 @@ var ts; function inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) { switch (containingFunction.kind) { case 154: - case 190: - case 232: + case 191: + case 233: case 153: var isConstructor = containingFunction.kind === 154; var searchToken = isConstructor ? @@ -81716,21 +82038,21 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 197: + case 198: usageContext.isNumber = true; break; - case 196: + case 197: inferTypeFromPrefixUnaryExpressionContext(node.parent, usageContext); break; - case 198: + case 199: inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext); break; - case 264: case 265: + case 266: inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext); break; - case 185: case 186: + case 187: if (node.parent.expression === node) { inferTypeFromCallExpressionContext(node.parent, checker, usageContext); } @@ -81738,10 +82060,10 @@ var ts; inferTypeFromContextualType(node, checker, usageContext); } break; - case 183: + case 184: inferTypeFromPropertyAccessExpressionContext(node.parent, checker, usageContext); break; - case 184: + case 185: inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext); break; default: @@ -81832,7 +82154,7 @@ var ts; break; case 54: if (node === parent.left && - (node.parent.parent.kind === 230 || ts.isAssignmentExpression(node.parent.parent, true))) { + (node.parent.parent.kind === 231 || ts.isAssignmentExpression(node.parent.parent, true))) { addCandidateType(usageContext, checker.getTypeAtLocation(parent.right)); } break; @@ -81857,7 +82179,7 @@ var ts; } } inferTypeFromContext(parent, checker, callContext.returnType); - if (parent.kind === 185) { + if (parent.kind === 186) { (usageContext.callContexts || (usageContext.callContexts = [])).push(callContext); } else { @@ -82030,7 +82352,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 185 : 186; + var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 186 : 187; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start, false), function (a) { return a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length); }); if (!node) { return []; @@ -82144,13 +82466,13 @@ var ts; else if (type.flags & 8) { return ts.createFalse(); } - else if (type.flags & 224) { + else if (type.isLiteral()) { return ts.createLiteral(type.value); } - else if (type.flags & 131072) { + else if (type.isUnion()) { return ts.firstDefined(type.types, function (t) { return getDefaultValueFromType(checker, t); }); } - else if (ts.getObjectFlags(type) & 1) { + else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); if (!classDeclaration || ts.hasModifier(classDeclaration, 128)) return undefined; @@ -82458,7 +82780,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 230) ? node.parent.parent : node; + var declaringNode = (node.kind === 231) ? node.parent.parent : node; if (ts.hasModifier(declaringNode, 1)) { (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; @@ -82466,11 +82788,11 @@ var ts; declarations.push(node.symbol); } switch (node.kind) { - case 242: + case 243: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; case 97: - if (node.parent.kind === 185) { + if (node.parent.kind === 186) { var containingClass_1 = ts.getContainingClass(node); if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractSuper)); @@ -82484,8 +82806,8 @@ var ts; } if (!node || ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node)) { switch (node.kind) { - case 232: case 233: + case 234: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); } @@ -82495,18 +82817,18 @@ var ts; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 215: + case 216: permittedJumps = 0; break; - case 228: + case 229: permittedJumps = 0; break; - case 211: - if (node.parent && node.parent.kind === 228 && node.parent.finallyBlock === node) { + case 212: + if (node.parent && node.parent.kind === 229 && node.parent.finallyBlock === node) { permittedJumps = 4; } break; - case 264: + case 265: permittedJumps |= 1; break; default: @@ -82520,7 +82842,7 @@ var ts; case 99: rangeFacts |= RangeFacts.UsesThis; break; - case 226: + case 227: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); @@ -82528,8 +82850,8 @@ var ts; seenLabels.pop(); break; } + case 223: case 222: - case 221: { var label = node.label; if (label) { @@ -82538,19 +82860,19 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 222 ? 1 : 2))) { + if (!(permittedJumps & (node.kind === 223 ? 1 : 2))) { (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 195: + case 196: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 201: + case 202: rangeFacts |= RangeFacts.IsGenerator; break; - case 223: + case 224: if (permittedJumps & 4) { rangeFacts |= RangeFacts.HasReturn; } @@ -82598,7 +82920,7 @@ var ts; } if (isScope(current)) { scopes.push(current); - if (current.kind === 272) { + if (current.kind === 273) { return scopes; } } @@ -82683,12 +83005,12 @@ var ts; switch (scope.kind) { case 154: return "constructor"; - case 190: - case 232: + case 191: + case 233: return scope.name ? "function '" + scope.name.text + "'" : "anonymous function"; - case 191: + case 192: return "arrow function"; case 153: return "method '" + scope.name.getText(); @@ -82701,12 +83023,12 @@ var ts; } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 233 + return scope.kind === 234 ? scope.name ? "class '" + scope.name.text + "'" : "anonymous class declaration" : scope.name ? "class expression '" + scope.name.text + "'" : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 238 + return scope.kind === 239 ? "namespace '" + scope.parent.name.getText() + "'" : scope.externalModuleIndicator ? 0 : 1; } @@ -82925,7 +83247,7 @@ var ts; var localReference = ts.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 214 && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 215 && scope === ts.findAncestor(node, isScope)) { var newVariableStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([newVariableDeclaration], 2)); changeTracker.replaceNode(context.file, node.parent, newVariableStatement); } @@ -82938,7 +83260,7 @@ var ts; else { changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, false); } - if (node.parent.kind === 214) { + if (node.parent.kind === 215) { changeTracker.deleteNode(context.file, node.parent, ts.textChanges.useNonAdjustedPositions); } else { @@ -83043,7 +83365,7 @@ var ts; return { body: ts.createBlock(statements, true), returnValueProperty: undefined }; } function visitor(node) { - if (!ignoreReturns && node.kind === 223 && hasWritesOrVariableDeclarations) { + if (!ignoreReturns && node.kind === 224 && hasWritesOrVariableDeclarations) { var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); if (node.expression) { if (!returnValueProperty) { @@ -83203,7 +83525,7 @@ var ts; var scope = scopes_1[_i]; usagesPerScope.push({ usages: ts.createMap(), typeParameterUsages: ts.createMap(), substitutions: ts.createMap() }); substitutionsPerScope.push(ts.createMap()); - functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 232 + functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 233 ? [ts.createDiagnosticForNode(scope, Messages.cannotExtractToOtherFunctionLike)] : []); var constantErrors = []; @@ -83255,7 +83577,7 @@ var ts; : ts.getEnclosingBlockScopeContainer(scopes[0]); ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations); } - var _loop_12 = function (i) { + var _loop_13 = function (i) { var scopeUsages = usagesPerScope[i]; if (i > 0 && (scopeUsages.usages.size > 0 || scopeUsages.typeParameterUsages.size > 0)) { var errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range; @@ -83291,7 +83613,7 @@ var ts; } }; for (var i = 0; i < scopes.length; i++) { - _loop_12(i); + _loop_13(i); } return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations }; function hasTypeParameters(node) { @@ -83312,7 +83634,7 @@ var ts; var visitedTypes = symbolWalker.walkType(type).visitedTypes; for (var _i = 0, visitedTypes_1 = visitedTypes; _i < visitedTypes_1.length; _i++) { var visitedType = visitedTypes_1[_i]; - if (visitedType.flags & 32768) { + if (visitedType.isTypeParameter()) { allTypeParameterUsages.set(visitedType.id.toString(), visitedType); } } @@ -83490,30 +83812,30 @@ var ts; } function isExtractableExpression(node) { switch (node.parent.kind) { - case 271: + case 272: return false; } switch (node.kind) { case 9: - return node.parent.kind !== 242 && - node.parent.kind !== 246; - case 202: - case 178: - case 180: + return node.parent.kind !== 243 && + node.parent.kind !== 247; + case 203: + case 179: + case 181: return false; case 71: - return node.parent.kind !== 180 && - node.parent.kind !== 246 && - node.parent.kind !== 250; + return node.parent.kind !== 181 && + node.parent.kind !== 247 && + node.parent.kind !== 251; } return true; } function isBlockLike(node) { switch (node.kind) { - case 211: - case 272: - case 238: - case 264: + case 212: + case 273: + case 239: + case 265: return true; default: return false; @@ -83809,7 +84131,7 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 274 || kid.kind > 292; }); + var child = ts.find(children, function (kid) { return kid.kind < 275 || kid.kind > 293; }); return child.kind < 145 ? child : child.getFirstToken(sourceFile); @@ -83874,7 +84196,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(293, nodes.pos, nodes.end, parent); + var list = createNode(294, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -83968,28 +84290,9 @@ var ts; return this.declarations; }; SymbolObject.prototype.getDocumentationComment = function (checker) { - if (this.documentationComment === undefined) { - if (this.declarations) { - this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations(this.declarations); - if (this.documentationComment.length === 0 || this.declarations.some(hasJSDocInheritDocTag)) { - if (checker) { - for (var _i = 0, _a = this.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - var inheritedDocs = findInheritedJSDocComments(declaration, this.getName(), checker); - if (inheritedDocs.length > 0) { - if (this.documentationComment.length > 0) { - inheritedDocs.push(ts.lineBreakPart()); - } - this.documentationComment = ts.concatenate(inheritedDocs, this.documentationComment); - break; - } - } - } - } - } - else { - this.documentationComment = []; - } + if (!this.documentationComment) { + this.documentationComment = ts.emptyArray; + this.documentationComment = getDocumentationComment(this.declarations, checker); } return this.documentationComment; }; @@ -84058,9 +84361,7 @@ var ts; return this.checker.getIndexTypeOfType(this, 1); }; TypeObject.prototype.getBaseTypes = function () { - return this.flags & 65536 && this.objectFlags & (1 | 2) - ? this.checker.getBaseTypes(this) - : undefined; + return this.isClassOrInterface() ? this.checker.getBaseTypes(this) : undefined; }; TypeObject.prototype.getNonNullableType = function () { return this.checker.getNonNullableType(this); @@ -84071,6 +84372,33 @@ var ts; TypeObject.prototype.getDefault = function () { return this.checker.getDefaultFromTypeParameter(this); }; + TypeObject.prototype.isUnion = function () { + return !!(this.flags & 131072); + }; + TypeObject.prototype.isIntersection = function () { + return !!(this.flags & 262144); + }; + TypeObject.prototype.isUnionOrIntersection = function () { + return !!(this.flags & 393216); + }; + TypeObject.prototype.isLiteral = function () { + return !!(this.flags & 224); + }; + TypeObject.prototype.isStringLiteral = function () { + return !!(this.flags & 32); + }; + TypeObject.prototype.isNumberLiteral = function () { + return !!(this.flags & 64); + }; + TypeObject.prototype.isTypeParameter = function () { + return !!(this.flags & 32768); + }; + TypeObject.prototype.isClassOrInterface = function () { + return !!(ts.getObjectFlags(this) & 3); + }; + TypeObject.prototype.isClass = function () { + return !!(ts.getObjectFlags(this) & 1); + }; return TypeObject; }()); var SignatureObject = (function () { @@ -84090,22 +84418,7 @@ var ts; return this.checker.getReturnTypeOfSignature(this); }; SignatureObject.prototype.getDocumentationComment = function () { - if (this.documentationComment === undefined) { - if (this.declaration) { - this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations([this.declaration]); - if (this.documentationComment.length === 0 || hasJSDocInheritDocTag(this.declaration)) { - var inheritedDocs = findInheritedJSDocComments(this.declaration, this.declaration.symbol.getName(), this.checker); - if (this.documentationComment.length > 0) { - inheritedDocs.push(ts.lineBreakPart()); - } - this.documentationComment = ts.concatenate(inheritedDocs, this.documentationComment); - } - } - else { - this.documentationComment = []; - } - } - return this.documentationComment; + return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker)); }; SignatureObject.prototype.getJsDocTags = function () { if (this.jsDocTags === undefined) { @@ -84118,23 +84431,26 @@ var ts; function hasJSDocInheritDocTag(node) { return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; }); } + function getDocumentationComment(declarations, checker) { + if (!declarations) + return ts.emptyArray; + var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations); + if (doc.length === 0 || declarations.some(hasJSDocInheritDocTag)) { + for (var _i = 0, declarations_13 = declarations; _i < declarations_13.length; _i++) { + var declaration = declarations_13[_i]; + var inheritedDocs = findInheritedJSDocComments(declaration, declaration.symbol.name, checker); + if (inheritedDocs) + doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc); + } + } + return doc; + } function findInheritedJSDocComments(declaration, propertyName, typeChecker) { - var foundDocs = false; - return ts.flatMap(declaration.parent ? ts.getAllSuperTypeNodes(declaration.parent) : ts.emptyArray, function (superTypeNode) { - if (foundDocs) { - return ts.emptyArray; - } + return ts.firstDefined(declaration.parent ? ts.getAllSuperTypeNodes(declaration.parent) : ts.emptyArray, function (superTypeNode) { var superType = typeChecker.getTypeAtLocation(superTypeNode); - if (!superType) { - return ts.emptyArray; - } - var baseProperty = typeChecker.getPropertyOfType(superType, propertyName); - if (!baseProperty) { - return ts.emptyArray; - } - var inheritedDocs = baseProperty.getDocumentationComment(typeChecker); - foundDocs = inheritedDocs.length > 0; - return inheritedDocs; + var baseProperty = superType && typeChecker.getPropertyOfType(superType, propertyName); + var inheritedDocs = baseProperty && baseProperty.getDocumentationComment(typeChecker); + return inheritedDocs && inheritedDocs.length ? inheritedDocs : undefined; }); } var SourceFileObject = (function (_super) { @@ -84192,13 +84508,13 @@ var ts; } function getDeclarationName(declaration) { var name = ts.getNameOfDeclaration(declaration); - return name && (ts.isPropertyNameLiteral(name) ? ts.getTextOfIdentifierOrLiteral(name) : - name.kind === 146 && ts.isPropertyAccessExpression(name.expression) ? name.expression.name.text : undefined); + return name && (ts.isComputedPropertyName(name) && ts.isPropertyAccessExpression(name.expression) ? name.expression.name.text + : ts.isPropertyName(name) ? ts.getNameFromPropertyName(name) : undefined); } function visit(node) { switch (node.kind) { - case 232: - case 190: + case 233: + case 191: case 153: case 152: var functionDeclaration = node; @@ -84217,17 +84533,17 @@ var ts; } ts.forEachChild(node, visit); break; - case 233: - case 203: case 234: + case 204: case 235: case 236: case 237: - case 241: - case 250: - case 246: - case 243: + case 238: + case 242: + case 251: + case 247: case 244: + case 245: case 155: case 156: case 165: @@ -84238,8 +84554,8 @@ var ts; if (!ts.hasModifier(node, 92)) { break; } - case 230: - case 180: { + case 231: + case 181: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -84249,24 +84565,24 @@ var ts; visit(decl.initializer); } } - case 271: + case 272: case 151: case 150: addDeclaration(node); break; - case 248: + case 249: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 242: + case 243: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 244) { + if (importClause.namedBindings.kind === 245) { addDeclaration(importClause.namedBindings); } else { @@ -84275,7 +84591,7 @@ var ts; } } break; - case 198: + case 199: if (ts.getSpecialPropertyAssignmentKind(node) !== 0) { addDeclaration(node); } @@ -84716,16 +85032,16 @@ var ts; if (options === void 0) { options = ts.defaultPreferences; } var fullPreferences = __assign({}, ts.identity(options), { includeCompletionsForModuleExports: options.includeCompletionsForModuleExports || options.includeExternalModuleExports, includeCompletionsWithInsertText: options.includeCompletionsWithInsertText || options.includeInsertTextCompletions }); synchronizeHostData(); - return ts.Completions.getCompletionsAtPosition(host, program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, program.getSourceFiles(), fullPreferences); + return ts.Completions.getCompletionsAtPosition(host, program, log, getValidSourceFile(fileName), position, fullPreferences); } function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences) { if (preferences === void 0) { preferences = ts.defaultPreferences; } synchronizeHostData(); - return ts.Completions.getCompletionEntryDetails(program, log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, formattingOptions && ts.formatting.getFormatContext(formattingOptions), getCanonicalFileName, preferences); + return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, formattingOptions && ts.formatting.getFormatContext(formattingOptions), getCanonicalFileName, preferences); } function getCompletionEntrySymbol(fileName, position, name, source) { synchronizeHostData(); - return ts.Completions.getCompletionEntrySymbol(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles()); + return ts.Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name: name, source: source }); } function getQuickInfoAtPosition(fileName, position) { synchronizeHostData(); @@ -84742,7 +85058,7 @@ var ts; if (ts.isLabelName(node)) { return undefined; } - case 183: + case 184: case 145: case 99: case 173: @@ -84781,7 +85097,7 @@ var ts; } return checker.getSymbolAtLocation(node); } - var sourceMapCommentRegExp = /^\/\/[@#] sourceMappingURL=(.+)$/gm; + var sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)$/gm; var base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/; function scanForSourcemapURL(fileName) { var mappedFile = sourcemappedFileCache.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); @@ -84994,7 +85310,7 @@ var ts; return; } switch (node.kind) { - case 183: + case 184: case 145: case 9: case 86: @@ -85014,7 +85330,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 237 && + if (nodeForStartPos.parent.parent.kind === 238 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -85352,7 +85668,7 @@ var ts; } function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 252 || + node.parent.kind === 253 || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -85365,7 +85681,7 @@ var ts; } case 71: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 182 || node.parent.parent.kind === 261) && + (node.parent.parent.kind === 183 || node.parent.parent.kind === 262) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -85402,7 +85718,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 184 && + node.parent.kind === 185 && node.parent.argumentExpression === node; } function getDefaultLibFilePath(options) { @@ -88682,7 +88998,7 @@ var ts; } var searchPaths = [ts.combinePaths(this.projectService.getExecutingFilePath(), "../../..")].concat(this.projectService.pluginProbeLocations); if (this.projectService.globalPlugins) { - var _loop_13 = function (globalPluginName) { + var _loop_14 = function (globalPluginName) { if (!globalPluginName) return "continue"; if (options.plugins && options.plugins.some(function (p) { return p.name === globalPluginName; })) @@ -88693,7 +89009,7 @@ var ts; var this_1 = this; for (var _i = 0, _a = this.projectService.globalPlugins; _i < _a.length; _i++) { var globalPluginName = _a[_i]; - _loop_13(globalPluginName); + _loop_14(globalPluginName); } } }; @@ -90045,7 +90361,7 @@ var ts; return projects; function combineProjects(toAddInfo) { if (toAddInfo !== info) { - var _loop_14 = function (project) { + var _loop_15 = function (project) { if (project.languageServiceEnabled && !project.getCompilerOptions().preserveSymlinks && !ts.contains(info.containingProjects, project)) { @@ -90060,7 +90376,7 @@ var ts; }; for (var _i = 0, _a = toAddInfo.containingProjects; _i < _a.length; _i++) { var project = _a[_i]; - _loop_14(project); + _loop_15(project); } } } @@ -90290,13 +90606,13 @@ var ts; this.printProjects(); }; ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { - var _loop_15 = function (proj) { + var _loop_16 = function (proj) { var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); }; for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { var proj = currentProjects_1[_i]; - _loop_15(proj); + _loop_16(proj); } }; ProjectService.prototype.synchronizeProjectList = function (knownProjects) { @@ -90396,7 +90712,7 @@ var ts; var excludeRules = []; var normalizedNames = rootFiles.map(function (f) { return ts.normalizeSlashes(f.fileName); }); var excludedFiles = []; - var _loop_16 = function (name) { + var _loop_17 = function (name) { var rule = this_2.safelist[name]; for (var _i = 0, normalizedNames_1 = normalizedNames; _i < normalizedNames_1.length; _i++) { var root = normalizedNames_1[_i]; @@ -90411,7 +90727,7 @@ var ts; } } if (rule.exclude) { - var _loop_17 = function (exclude) { + var _loop_18 = function (exclude) { var processedRule = root.replace(rule.match, function () { var groups = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -90434,7 +90750,7 @@ var ts; }; for (var _c = 0, _d = rule.exclude; _c < _d.length; _c++) { var exclude = _d[_c]; - _loop_17(exclude); + _loop_18(exclude); } } else { @@ -90449,11 +90765,11 @@ var ts; var this_2 = this; for (var _i = 0, _a = Object.keys(this.safelist); _i < _a.length; _i++) { var name = _a[_i]; - _loop_16(name); + _loop_17(name); } var excludeRegexes = excludeRules.map(function (e) { return new RegExp(e, "i"); }); var filesToKeep = []; - var _loop_18 = function (i) { + var _loop_19 = function (i) { if (excludeRegexes.some(function (re) { return re.test(normalizedNames[i]); })) { excludedFiles.push(normalizedNames[i]); } @@ -90487,7 +90803,7 @@ var ts; }; var this_3 = this; for (var i = 0; i < proj.rootFiles.length; i++) { - _loop_18(i); + _loop_19(i); } proj.rootFiles = filesToKeep; return excludedFiles; @@ -93584,11 +93900,12 @@ var ts; var len = args.length - 1; for (var i = 0; i < len; i += 2) { var option = args[i]; - var value = args[i + 1]; + var _a = getEntireValue(i + 1), value = _a.value, extraPartCounter = _a.extraPartCounter; + i += extraPartCounter; if (option && value) { switch (option) { case "-file": - logEnv.file = ts.stripQuotes(value); + logEnv.file = value; break; case "-level": var level = getLogLevel(value); @@ -93604,6 +93921,21 @@ var ts; } } return logEnv; + function getEntireValue(initialIndex) { + var pathStart = args[initialIndex]; + var extraPartCounter = 0; + if (pathStart.charCodeAt(0) === 34 && + pathStart.charCodeAt(pathStart.length - 1) !== 34) { + for (var i = initialIndex + 1; i < args.length; i++) { + pathStart += " "; + pathStart += args[i]; + extraPartCounter++; + if (pathStart.charCodeAt(pathStart.length - 1) === 34) + break; + } + } + return { value: ts.stripQuotes(pathStart), extraPartCounter: extraPartCounter }; + } } function getLogLevel(level) { if (level) { diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index 7a121848f47..3bb826b0fef 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -240,128 +240,129 @@ declare namespace ts { IndexedAccessType = 175, MappedType = 176, LiteralType = 177, - ObjectBindingPattern = 178, - ArrayBindingPattern = 179, - BindingElement = 180, - ArrayLiteralExpression = 181, - ObjectLiteralExpression = 182, - PropertyAccessExpression = 183, - ElementAccessExpression = 184, - CallExpression = 185, - NewExpression = 186, - TaggedTemplateExpression = 187, - TypeAssertionExpression = 188, - ParenthesizedExpression = 189, - FunctionExpression = 190, - ArrowFunction = 191, - DeleteExpression = 192, - TypeOfExpression = 193, - VoidExpression = 194, - AwaitExpression = 195, - PrefixUnaryExpression = 196, - PostfixUnaryExpression = 197, - BinaryExpression = 198, - ConditionalExpression = 199, - TemplateExpression = 200, - YieldExpression = 201, - SpreadElement = 202, - ClassExpression = 203, - OmittedExpression = 204, - ExpressionWithTypeArguments = 205, - AsExpression = 206, - NonNullExpression = 207, - MetaProperty = 208, - TemplateSpan = 209, - SemicolonClassElement = 210, - Block = 211, - VariableStatement = 212, - EmptyStatement = 213, - ExpressionStatement = 214, - IfStatement = 215, - DoStatement = 216, - WhileStatement = 217, - ForStatement = 218, - ForInStatement = 219, - ForOfStatement = 220, - ContinueStatement = 221, - BreakStatement = 222, - ReturnStatement = 223, - WithStatement = 224, - SwitchStatement = 225, - LabeledStatement = 226, - ThrowStatement = 227, - TryStatement = 228, - DebuggerStatement = 229, - VariableDeclaration = 230, - VariableDeclarationList = 231, - FunctionDeclaration = 232, - ClassDeclaration = 233, - InterfaceDeclaration = 234, - TypeAliasDeclaration = 235, - EnumDeclaration = 236, - ModuleDeclaration = 237, - ModuleBlock = 238, - CaseBlock = 239, - NamespaceExportDeclaration = 240, - ImportEqualsDeclaration = 241, - ImportDeclaration = 242, - ImportClause = 243, - NamespaceImport = 244, - NamedImports = 245, - ImportSpecifier = 246, - ExportAssignment = 247, - ExportDeclaration = 248, - NamedExports = 249, - ExportSpecifier = 250, - MissingDeclaration = 251, - ExternalModuleReference = 252, - JsxElement = 253, - JsxSelfClosingElement = 254, - JsxOpeningElement = 255, - JsxClosingElement = 256, - JsxFragment = 257, - JsxOpeningFragment = 258, - JsxClosingFragment = 259, - JsxAttribute = 260, - JsxAttributes = 261, - JsxSpreadAttribute = 262, - JsxExpression = 263, - CaseClause = 264, - DefaultClause = 265, - HeritageClause = 266, - CatchClause = 267, - PropertyAssignment = 268, - ShorthandPropertyAssignment = 269, - SpreadAssignment = 270, - EnumMember = 271, - SourceFile = 272, - Bundle = 273, - JSDocTypeExpression = 274, - JSDocAllType = 275, - JSDocUnknownType = 276, - JSDocNullableType = 277, - JSDocNonNullableType = 278, - JSDocOptionalType = 279, - JSDocFunctionType = 280, - JSDocVariadicType = 281, - JSDocComment = 282, - JSDocTypeLiteral = 283, - JSDocTag = 284, - JSDocAugmentsTag = 285, - JSDocClassTag = 286, - JSDocParameterTag = 287, - JSDocReturnTag = 288, - JSDocTypeTag = 289, - JSDocTemplateTag = 290, - JSDocTypedefTag = 291, - JSDocPropertyTag = 292, - SyntaxList = 293, - NotEmittedStatement = 294, - PartiallyEmittedExpression = 295, - CommaListExpression = 296, - MergeDeclarationMarker = 297, - EndOfDeclarationMarker = 298, - Count = 299, + ImportType = 178, + ObjectBindingPattern = 179, + ArrayBindingPattern = 180, + BindingElement = 181, + ArrayLiteralExpression = 182, + ObjectLiteralExpression = 183, + PropertyAccessExpression = 184, + ElementAccessExpression = 185, + CallExpression = 186, + NewExpression = 187, + TaggedTemplateExpression = 188, + TypeAssertionExpression = 189, + ParenthesizedExpression = 190, + FunctionExpression = 191, + ArrowFunction = 192, + DeleteExpression = 193, + TypeOfExpression = 194, + VoidExpression = 195, + AwaitExpression = 196, + PrefixUnaryExpression = 197, + PostfixUnaryExpression = 198, + BinaryExpression = 199, + ConditionalExpression = 200, + TemplateExpression = 201, + YieldExpression = 202, + SpreadElement = 203, + ClassExpression = 204, + OmittedExpression = 205, + ExpressionWithTypeArguments = 206, + AsExpression = 207, + NonNullExpression = 208, + MetaProperty = 209, + TemplateSpan = 210, + SemicolonClassElement = 211, + Block = 212, + VariableStatement = 213, + EmptyStatement = 214, + ExpressionStatement = 215, + IfStatement = 216, + DoStatement = 217, + WhileStatement = 218, + ForStatement = 219, + ForInStatement = 220, + ForOfStatement = 221, + ContinueStatement = 222, + BreakStatement = 223, + ReturnStatement = 224, + WithStatement = 225, + SwitchStatement = 226, + LabeledStatement = 227, + ThrowStatement = 228, + TryStatement = 229, + DebuggerStatement = 230, + VariableDeclaration = 231, + VariableDeclarationList = 232, + FunctionDeclaration = 233, + ClassDeclaration = 234, + InterfaceDeclaration = 235, + TypeAliasDeclaration = 236, + EnumDeclaration = 237, + ModuleDeclaration = 238, + ModuleBlock = 239, + CaseBlock = 240, + NamespaceExportDeclaration = 241, + ImportEqualsDeclaration = 242, + ImportDeclaration = 243, + ImportClause = 244, + NamespaceImport = 245, + NamedImports = 246, + ImportSpecifier = 247, + ExportAssignment = 248, + ExportDeclaration = 249, + NamedExports = 250, + ExportSpecifier = 251, + MissingDeclaration = 252, + ExternalModuleReference = 253, + JsxElement = 254, + JsxSelfClosingElement = 255, + JsxOpeningElement = 256, + JsxClosingElement = 257, + JsxFragment = 258, + JsxOpeningFragment = 259, + JsxClosingFragment = 260, + JsxAttribute = 261, + JsxAttributes = 262, + JsxSpreadAttribute = 263, + JsxExpression = 264, + CaseClause = 265, + DefaultClause = 266, + HeritageClause = 267, + CatchClause = 268, + PropertyAssignment = 269, + ShorthandPropertyAssignment = 270, + SpreadAssignment = 271, + EnumMember = 272, + SourceFile = 273, + Bundle = 274, + JSDocTypeExpression = 275, + JSDocAllType = 276, + JSDocUnknownType = 277, + JSDocNullableType = 278, + JSDocNonNullableType = 279, + JSDocOptionalType = 280, + JSDocFunctionType = 281, + JSDocVariadicType = 282, + JSDocComment = 283, + JSDocTypeLiteral = 284, + JSDocTag = 285, + JSDocAugmentsTag = 286, + JSDocClassTag = 287, + JSDocParameterTag = 288, + JSDocReturnTag = 289, + JSDocTypeTag = 290, + JSDocTemplateTag = 291, + JSDocTypedefTag = 292, + JSDocPropertyTag = 293, + SyntaxList = 294, + NotEmittedStatement = 295, + PartiallyEmittedExpression = 296, + CommaListExpression = 297, + MergeDeclarationMarker = 298, + EndOfDeclarationMarker = 299, + Count = 300, FirstAssignment = 58, LastAssignment = 70, FirstCompoundAssignment = 59, @@ -373,7 +374,7 @@ declare namespace ts { FirstFutureReservedWord = 108, LastFutureReservedWord = 116, FirstTypeNode = 160, - LastTypeNode = 177, + LastTypeNode = 178, FirstPunctuation = 17, LastPunctuation = 70, FirstToken = 0, @@ -387,10 +388,10 @@ declare namespace ts { FirstBinaryOperator = 27, LastBinaryOperator = 70, FirstNode = 145, - FirstJSDocNode = 274, - LastJSDocNode = 292, - FirstJSDocTagNode = 284, - LastJSDocTagNode = 292 + FirstJSDocNode = 275, + LastJSDocNode = 293, + FirstJSDocTagNode = 285, + LastJSDocTagNode = 293 } enum NodeFlags { None = 0, @@ -697,6 +698,12 @@ declare namespace ts { interface KeywordTypeNode extends TypeNode { kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.VoidKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.NullKeyword | SyntaxKind.NeverKeyword; } + interface ImportTypeNode extends NodeWithTypeArguments { + kind: SyntaxKind.ImportType; + isTypeOf?: boolean; + argument: TypeNode; + qualifier?: EntityName; + } interface ThisTypeNode extends TypeNode { kind: SyntaxKind.ThisType; } @@ -707,11 +714,13 @@ declare namespace ts { interface ConstructorTypeNode extends TypeNode, SignatureDeclarationBase { kind: SyntaxKind.ConstructorType; } + interface NodeWithTypeArguments extends TypeNode { + typeArguments?: NodeArray; + } type TypeReferenceType = TypeReferenceNode | ExpressionWithTypeArguments; - interface TypeReferenceNode extends TypeNode { + interface TypeReferenceNode extends NodeWithTypeArguments { kind: SyntaxKind.TypeReference; typeName: EntityName; - typeArguments?: NodeArray; } interface TypePredicateNode extends TypeNode { kind: SyntaxKind.TypePredicate; @@ -1027,11 +1036,10 @@ declare namespace ts { interface ImportCall extends CallExpression { expression: ImportExpression; } - interface ExpressionWithTypeArguments extends TypeNode { + interface ExpressionWithTypeArguments extends NodeWithTypeArguments { kind: SyntaxKind.ExpressionWithTypeArguments; parent?: HeritageClause; expression: LeftHandSideExpression; - typeArguments?: NodeArray; } interface NewExpression extends PrimaryExpression, Declaration { kind: SyntaxKind.NewExpression; @@ -1689,6 +1697,7 @@ declare namespace ts { getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + getConfigFileParsingDiagnostics(): ReadonlyArray; /** * Gets a type checker that can be used to semantically analyze source files in the program. */ @@ -1812,7 +1821,7 @@ declare namespace ts { isArgumentsSymbol(symbol: Symbol): boolean; isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; - isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean; /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; @@ -1824,6 +1833,7 @@ declare namespace ts { getApparentType(type: Type): Type; getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined; getSuggestionForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): string | undefined; + getSuggestionForNonexistentModule(node: Identifier, target: Symbol): string | undefined; getBaseConstraintOfType(type: Type): Type | undefined; getDefaultFromTypeParameter(type: Type): Type | undefined; } @@ -2583,9 +2593,10 @@ declare namespace ts { interface EmitHelper { readonly name: string; readonly scoped: boolean; - readonly text: string; + readonly text: string | ((node: EmitHelperUniqueNameCallback) => string); readonly priority?: number; } + type EmitHelperUniqueNameCallback = (name: string) => string; enum EmitHint { SourceFile = 0, Expression = 1, @@ -2757,6 +2768,7 @@ declare namespace ts { removeComments?: boolean; newLine?: NewLineKind; omitTrailingSemicolon?: boolean; + noEmitHelpers?: boolean; } /** @deprecated See comment on SymbolWriter */ interface SymbolTracker { @@ -3449,6 +3461,8 @@ declare namespace ts { function createUniqueName(text: string): Identifier; /** Create a unique name based on the supplied text. */ function createOptimisticUniqueName(text: string): Identifier; + /** Create a unique name based on the supplied text. This does not consider names injected by the transformer. */ + function createFileLevelUniqueName(text: string): Identifier; /** Create a unique name generated for a node. */ function getGeneratedNameForNode(node: Node): Identifier; function createToken(token: TKind): Token; @@ -3483,9 +3497,9 @@ declare namespace ts { function updateGetAccessor(node: GetAccessorDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: PropertyName, parameters: ReadonlyArray, type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; function createSetAccessor(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: string | PropertyName, parameters: ReadonlyArray, body: Block | undefined): SetAccessorDeclaration; function updateSetAccessor(node: SetAccessorDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: PropertyName, parameters: ReadonlyArray, body: Block | undefined): SetAccessorDeclaration; - function createCallSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration; + function createCallSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): CallSignatureDeclaration; function updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; - function createConstructSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; + function createConstructSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function createIndexSignature(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; function updateIndexSignature(node: IndexSignatureDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; @@ -3494,9 +3508,9 @@ declare namespace ts { function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; function createTypeReferenceNode(typeName: string | EntityName, typeArguments: ReadonlyArray | undefined): TypeReferenceNode; function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray | undefined): TypeReferenceNode; - function createFunctionTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): FunctionTypeNode; + function createFunctionTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): FunctionTypeNode; function updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): FunctionTypeNode; - function createConstructorTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructorTypeNode; + function createConstructorTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): ConstructorTypeNode; function updateConstructorTypeNode(node: ConstructorTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructorTypeNode; function createTypeQueryNode(exprName: EntityName): TypeQueryNode; function updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName): TypeQueryNode; @@ -3506,15 +3520,17 @@ declare namespace ts { function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; function createTupleTypeNode(elementTypes: ReadonlyArray): TupleTypeNode; function updateTypleTypeNode(node: TupleTypeNode, elementTypes: ReadonlyArray): TupleTypeNode; - function createUnionTypeNode(types: TypeNode[]): UnionTypeNode; + function createUnionTypeNode(types: ReadonlyArray): UnionTypeNode; function updateUnionTypeNode(node: UnionTypeNode, types: NodeArray): UnionTypeNode; - function createIntersectionTypeNode(types: TypeNode[]): IntersectionTypeNode; + function createIntersectionTypeNode(types: ReadonlyArray): IntersectionTypeNode; function updateIntersectionTypeNode(node: IntersectionTypeNode, types: NodeArray): IntersectionTypeNode; function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: ReadonlyArray): UnionOrIntersectionTypeNode; function createConditionalTypeNode(checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; function updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; function createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; function updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; + function createImportTypeNode(argument: TypeNode, qualifier?: EntityName, typeArguments?: ReadonlyArray, isTypeOf?: boolean): ImportTypeNode; + function updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, qualifier?: EntityName, typeArguments?: ReadonlyArray, isTypeOf?: boolean): ImportTypeNode; function createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; function createThisTypeNode(): ThisTypeNode; @@ -3713,7 +3729,7 @@ declare namespace ts { function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment; function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember; function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember; - function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"]): SourceFile; + function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean): SourceFile; /** * Creates a shallow, memberwise clone of a node for mutation. */ @@ -3739,10 +3755,10 @@ declare namespace ts { function updateCommaList(node: CommaListExpression, elements: ReadonlyArray): CommaListExpression; function createBundle(sourceFiles: ReadonlyArray): Bundle; function updateBundle(node: Bundle, sourceFiles: ReadonlyArray): Bundle; - function createImmediatelyInvokedFunctionExpression(statements: Statement[]): CallExpression; - function createImmediatelyInvokedFunctionExpression(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; - function createImmediatelyInvokedArrowFunction(statements: Statement[]): CallExpression; - function createImmediatelyInvokedArrowFunction(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; + function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray): CallExpression; + function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; + function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray): CallExpression; + function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; function createComma(left: Expression, right: Expression): Expression; function createLessThan(left: Expression, right: Expression): Expression; function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment; @@ -3930,6 +3946,7 @@ declare namespace ts { function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string; function formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; + function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): ReadonlyArray; /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' * that represent a compilation unit. @@ -3941,9 +3958,10 @@ declare namespace ts { * @param options - The compiler options which should be used. * @param host - The host interacts with the underlying file system. * @param oldProgram - Reuses an old program structure. + * @param configFileParsingDiagnostics - error during config file parsing * @returns A 'Program' object. */ - function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; + function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray): Program; } declare namespace ts { interface Node { @@ -3989,6 +4007,15 @@ declare namespace ts { getNonNullableType(): Type; getConstraint(): Type | undefined; getDefault(): Type | undefined; + isUnion(): this is UnionType; + isIntersection(): this is IntersectionType; + isUnionOrIntersection(): this is UnionOrIntersectionType; + isLiteral(): this is LiteralType; + isStringLiteral(): this is StringLiteralType; + isNumberLiteral(): this is NumberLiteralType; + isTypeParameter(): this is TypeParameter; + isClassOrInterface(): this is InterfaceType; + isClass(): this is InterfaceType; } interface Signature { getDeclaration(): SignatureDeclaration; @@ -4403,6 +4430,7 @@ declare namespace ts { placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; insertSpaceBeforeTypeAnnotation?: boolean; + indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean; } interface DefinitionInfo { fileName: string; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 35331332adf..0e0b6341bc5 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -22,6 +22,10 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { } return t; }; +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || @@ -239,144 +243,145 @@ var ts; SyntaxKind[SyntaxKind["IndexedAccessType"] = 175] = "IndexedAccessType"; SyntaxKind[SyntaxKind["MappedType"] = 176] = "MappedType"; SyntaxKind[SyntaxKind["LiteralType"] = 177] = "LiteralType"; + SyntaxKind[SyntaxKind["ImportType"] = 178] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 178] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 179] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 180] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 179] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 180] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 181] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 181] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 182] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 183] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 184] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 185] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 186] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 187] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 188] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 189] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 190] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 191] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 192] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 193] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 194] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 195] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 196] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 197] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 198] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 199] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 200] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 201] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 202] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 203] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 204] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 205] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 206] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 207] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 208] = "MetaProperty"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 182] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 183] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 184] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 185] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 186] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 187] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 188] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 189] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 190] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 191] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 192] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 193] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 194] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 195] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 196] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 197] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 198] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 199] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 200] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 201] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 202] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 203] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 204] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 205] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 206] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 207] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 208] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 209] = "MetaProperty"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 209] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 210] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 210] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 211] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 211] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 212] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 213] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 214] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 215] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 216] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 217] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 218] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 219] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 220] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 221] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 222] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 223] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 224] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 225] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 226] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 227] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 228] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 229] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 230] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 231] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 232] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 233] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 234] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 235] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 236] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 237] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 238] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 239] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 240] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 241] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 242] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 243] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 244] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 245] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 246] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 247] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 248] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 249] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 250] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 251] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 212] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 213] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 214] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 215] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 216] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 217] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 218] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 219] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 220] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 221] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 222] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 223] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 224] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 225] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 226] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 227] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 228] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 229] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 230] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 231] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 232] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 233] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 234] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 235] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 236] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 237] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 238] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 239] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 240] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 241] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 242] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 243] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 244] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 245] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 246] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 247] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 248] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 249] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 250] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 251] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 252] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 252] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 253] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 253] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 254] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 255] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 256] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 257] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 258] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 259] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 260] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 261] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 262] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 263] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 254] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 255] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 256] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 257] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 258] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 259] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 260] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 261] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 262] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 263] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 264] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 264] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 265] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 266] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 267] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 265] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 266] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 267] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 268] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 268] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 269] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 270] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 269] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 270] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 271] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 271] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 272] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 272] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 273] = "Bundle"; + SyntaxKind[SyntaxKind["SourceFile"] = 273] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 274] = "Bundle"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 274] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 275] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 275] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 276] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 276] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 277] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 278] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 279] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 280] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 281] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 282] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 283] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocTag"] = 284] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 285] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 286] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 287] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 288] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 289] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 290] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 291] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 292] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 277] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 278] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 279] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 280] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 281] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 282] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 283] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 284] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocTag"] = 285] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 286] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 287] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 288] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 289] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 290] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 291] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 292] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 293] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 294] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 296] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 297] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 298] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 295] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 296] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 297] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 298] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 299] = "EndOfDeclarationMarker"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 299] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 300] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment"; @@ -389,7 +394,7 @@ var ts; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 108] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 116] = "LastFutureReservedWord"; SyntaxKind[SyntaxKind["FirstTypeNode"] = 160] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 177] = "LastTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 178] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 17] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 70] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; @@ -403,10 +408,10 @@ var ts; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 27] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 145] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 274] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 292] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 284] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 275] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 293] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 285] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 293] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword"; /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 144] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); @@ -501,11 +506,12 @@ var ts; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Loop"] = 2] = "Loop"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Unique"] = 3] = "Unique"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Node"] = 4] = "Node"; - GeneratedIdentifierFlags[GeneratedIdentifierFlags["OptimisticUnique"] = 5] = "OptimisticUnique"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["KindMask"] = 7] = "KindMask"; // Flags GeneratedIdentifierFlags[GeneratedIdentifierFlags["SkipNameGenerationScope"] = 8] = "SkipNameGenerationScope"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["ReservedInNestedScopes"] = 16] = "ReservedInNestedScopes"; + GeneratedIdentifierFlags[GeneratedIdentifierFlags["Optimistic"] = 32] = "Optimistic"; + GeneratedIdentifierFlags[GeneratedIdentifierFlags["FileLevel"] = 64] = "FileLevel"; })(GeneratedIdentifierFlags = ts.GeneratedIdentifierFlags || (ts.GeneratedIdentifierFlags = {})); /* @internal */ var TokenFlags; @@ -3028,7 +3034,7 @@ var ts; ts.compose = compose; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (_match, index) { return Debug.assertDefined(args[+index + baseIndex]); }); } ts.formatStringFromArgs = formatStringFromArgs; function getLocaleSpecificMessage(message) { @@ -4801,13 +4807,18 @@ var ts; */ function watchChildDirectories(parentDir, existingChildWatches, callback) { var newChildWatches; - ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? host.getAccessileSortedChildDirectories(parentDir) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(ts.getNormalizedAbsolutePath(child, parentDir), childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); + ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? ts.mapDefined(host.getAccessibleSortedChildDirectories(parentDir), function (child) { + var childFullName = ts.getNormalizedAbsolutePath(child, parentDir); + // Filter our the symbolic link directories since those arent included in recursive watch + // which is same behaviour when recursive: true is passed to fs.watch + return host.filePathComparer(childFullName, host.realpath(childFullName)) === 0 /* EqualTo */ ? childFullName : undefined; + }) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); return newChildWatches || ts.emptyArray; /** * Create new childDirectoryWatcher and add it to the new ChildDirectoryWatcher list */ function createAndAddChildDirectoryWatcher(childName) { - var result = createDirectoryWatcher(ts.getNormalizedAbsolutePath(childName, parentDir), callback); + var result = createDirectoryWatcher(childName, callback); addChildDirectoryWatcher(result); } /** @@ -4916,14 +4927,7 @@ var ts; exit: function (exitCode) { process.exit(exitCode); }, - realpath: function (path) { - try { - return _fs.realpathSync(path); - } - catch (_a) { - return path; - } - }, + realpath: realpath, debugMode: ts.some(process.execArgv, function (arg) { return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg); }), tryEnableSourceMapsForHost: function () { try { @@ -5009,8 +5013,9 @@ var ts; var watchDirectoryRecursively = createRecursiveDirectoryWatcher({ filePathComparer: useCaseSensitiveFileNames ? ts.compareStringsCaseSensitive : ts.compareStringsCaseInsensitive, directoryExists: directoryExists, - getAccessileSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, - watchDirectory: watchDirectory + getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, + watchDirectory: watchDirectory, + realpath: realpath }); return function (directoryName, callback, recursive) { if (recursive) { @@ -5312,6 +5317,14 @@ var ts; function getDirectories(path) { return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); }); } + function realpath(path) { + try { + return _fs.realpathSync(path); + } + catch (_a) { + return path; + } + } function getModifiedTime(path) { try { return _fs.statSync(path).mtime; @@ -5428,6 +5441,7 @@ var ts; Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), Unexpected_token: diag(1012, ts.DiagnosticCategory.Error, "Unexpected_token_1012", "Unexpected token."), + A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma: diag(1013, ts.DiagnosticCategory.Error, "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013", "A rest parameter or binding pattern may not have a trailing comma."), A_rest_parameter_must_be_last_in_a_parameter_list: diag(1014, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."), Parameter_cannot_have_question_mark_and_initializer: diag(1015, ts.DiagnosticCategory.Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."), A_required_parameter_cannot_follow_an_optional_parameter: diag(1016, ts.DiagnosticCategory.Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."), @@ -5659,6 +5673,9 @@ var ts; An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead: diag(1336, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead_1336", "An index signature parameter type cannot be a type alias. Consider writing '[{0}: {1}]: {2}' instead."), An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead: diag(1337, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead_1337", "An index signature parameter type cannot be a union type. Consider using a mapped object type instead."), infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."), + Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."), + Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340", "Module '{0}' does not refer to a type, but is used as a type here."), + Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."), Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."), Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."), @@ -5764,7 +5781,7 @@ var ts; The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."), The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: diag(2405, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."), The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: diag(2406, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."), - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter."), + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."), Setters_cannot_return_a_value: diag(2408, ts.DiagnosticCategory.Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."), Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: diag(2409, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."), The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: diag(2410, ts.DiagnosticCategory.Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."), @@ -5838,7 +5855,7 @@ var ts; The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: diag(2483, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."), Export_declaration_conflicts_with_exported_declaration_of_0: diag(2484, ts.DiagnosticCategory.Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."), The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: diag(2487, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."), - Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type must have a '[Symbol.iterator]()' method that returns an iterator."), + Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."), An_iterator_must_have_a_next_method: diag(2489, ts.DiagnosticCategory.Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."), The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: diag(2490, ts.DiagnosticCategory.Error, "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the 'next()' method of an iterator must have a 'value' property."), The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: diag(2491, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."), @@ -5854,7 +5871,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: diag(2501, ts.DiagnosticCategory.Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."), _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: diag(2502, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."), Cannot_find_namespace_0: diag(2503, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."), - Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), + Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), A_generator_cannot_have_a_void_type_annotation: diag(2505, ts.DiagnosticCategory.Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."), _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: diag(2506, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."), Type_0_is_not_a_constructor_function_type: diag(2507, ts.DiagnosticCategory.Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."), @@ -5918,6 +5935,8 @@ var ts; Property_0_is_used_before_being_assigned: diag(2565, ts.DiagnosticCategory.Error, "Property_0_is_used_before_being_assigned_2565", "Property '{0}' is used before being assigned."), A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."), Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."), + Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2568, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568", "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), + Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."), The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."), JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."), @@ -6602,7 +6621,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 272 /* SourceFile */) { + while (node && node.kind !== 273 /* SourceFile */) { node = node.parent; } return node; @@ -6610,11 +6629,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 211 /* Block */: - case 239 /* CaseBlock */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 212 /* Block */: + case 240 /* CaseBlock */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: return true; } return false; @@ -6658,6 +6677,14 @@ var ts; } } ts.getEndLinePosition = getEndLinePosition; + /** + * Returns a value indicating whether a name is unique globally or within the current file + */ + function isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) { + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name); + } + ts.isFileLevelUniqueName = isFileLevelUniqueName; // Returns true if this node is missing from the actual source code. A 'missing' node is different // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes // in the tree), it is definitely missing. However, a node may be defined, but still be @@ -6723,7 +6750,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 === 293 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 294 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -6837,7 +6864,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 230 /* VariableDeclaration */ && node.parent.kind === 267 /* CatchClause */; + return node.kind === 231 /* VariableDeclaration */ && node.parent.kind === 268 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -6859,11 +6886,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 === 237 /* ModuleDeclaration */ && (!node.body); + return node && node.kind === 238 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 272 /* SourceFile */ || - node.kind === 237 /* ModuleDeclaration */ || + return node.kind === 273 /* SourceFile */ || + node.kind === 238 /* ModuleDeclaration */ || ts.isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -6880,9 +6907,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 272 /* SourceFile */: + case 273 /* SourceFile */: return ts.isExternalModule(node.parent); - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -6894,22 +6921,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 272 /* SourceFile */: - case 239 /* CaseBlock */: - case 267 /* CatchClause */: - case 237 /* ModuleDeclaration */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 273 /* SourceFile */: + case 240 /* CaseBlock */: + case 268 /* CatchClause */: + case 238 /* ModuleDeclaration */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: case 154 /* Constructor */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; - case 211 /* Block */: + case 212 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return parentNode && !ts.isFunctionLike(parentNode); @@ -6925,19 +6952,19 @@ var ts; case 159 /* IndexSignature */: case 162 /* FunctionType */: case 163 /* ConstructorType */: - case 280 /* JSDocFunctionType */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 290 /* JSDocTemplateTag */: - case 232 /* FunctionDeclaration */: + case 281 /* JSDocFunctionType */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 291 /* JSDocTemplateTag */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; default: ts.assertTypeIsNever(node); @@ -6947,8 +6974,8 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isAnyImportSyntax(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: return true; default: return false; @@ -7002,7 +7029,7 @@ var ts; return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); case 145 /* QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -7049,7 +7076,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 211 /* Block */) { + if (node.body && node.body.kind === 212 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -7063,7 +7090,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* 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 @@ -7072,23 +7099,23 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: errorNode = node.name; break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -7117,7 +7144,7 @@ var ts; } ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isConstEnumDeclaration(node) { - return node.kind === 236 /* EnumDeclaration */ && isConst(node); + return node.kind === 237 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -7130,15 +7157,21 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 185 /* CallExpression */ && n.expression.kind === 97 /* SuperKeyword */; + return n.kind === 186 /* CallExpression */ && n.expression.kind === 97 /* SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 185 /* CallExpression */ && n.expression.kind === 91 /* ImportKeyword */; + return n.kind === 186 /* CallExpression */ && n.expression.kind === 91 /* ImportKeyword */; } ts.isImportCall = isImportCall; + function isLiteralImportTypeNode(n) { + return n.kind === 178 /* ImportType */ && + n.argument.kind === 177 /* LiteralType */ && + ts.isStringLiteral(n.argument.literal); + } + ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 214 /* ExpressionStatement */ + return node.kind === 215 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -7149,9 +7182,9 @@ var ts; function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 148 /* Parameter */ || node.kind === 147 /* TypeParameter */ || - node.kind === 190 /* FunctionExpression */ || - node.kind === 191 /* ArrowFunction */ || - node.kind === 189 /* ParenthesizedExpression */) ? + node.kind === 191 /* FunctionExpression */ || + node.kind === 192 /* ArrowFunction */ || + node.kind === 190 /* ParenthesizedExpression */) ? 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 '/**/' @@ -7167,7 +7200,7 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (160 /* FirstTypeNode */ <= node.kind && node.kind <= 177 /* LastTypeNode */) { + if (160 /* FirstTypeNode */ <= node.kind && node.kind <= 178 /* LastTypeNode */) { return true; } switch (node.kind) { @@ -7180,8 +7213,8 @@ var ts; case 131 /* NeverKeyword */: return true; case 105 /* VoidKeyword */: - return node.parent.kind !== 194 /* VoidExpression */; - case 205 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 195 /* VoidExpression */; + case 206 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 147 /* TypeParameter */: return node.parent.kind === 176 /* MappedType */ || node.parent.kind === 171 /* InferType */; @@ -7192,41 +7225,44 @@ var ts; if (node.parent.kind === 145 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 184 /* 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 === 71 /* Identifier */ || node.kind === 145 /* QualifiedName */ || node.kind === 183 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 71 /* Identifier */ || node.kind === 145 /* QualifiedName */ || node.kind === 184 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through case 145 /* QualifiedName */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 99 /* ThisKeyword */: var parent = node.parent; if (parent.kind === 164 /* TypeQuery */) { return false; } + if (parent.kind === 178 /* ImportType */) { + return !parent.isTypeOf; + } // Do not recursively call isPartOfTypeNode on the parent. In the example: // // let a: A.B.C; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (160 /* FirstTypeNode */ <= parent.kind && parent.kind <= 177 /* LastTypeNode */) { + if (160 /* FirstTypeNode */ <= parent.kind && parent.kind <= 178 /* LastTypeNode */) { return true; } switch (parent.kind) { - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 147 /* TypeParameter */: return node === parent.constraint; case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 148 /* Parameter */: - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return node === parent.type; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 154 /* Constructor */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: @@ -7237,12 +7273,12 @@ var ts; case 158 /* ConstructSignature */: case 159 /* IndexSignature */: return node === parent.type; - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return node === parent.type; - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: return ts.contains(parent.typeArguments, node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -7266,23 +7302,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitor(node); - case 239 /* CaseBlock */: - case 211 /* Block */: - case 215 /* IfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 224 /* WithStatement */: - case 225 /* SwitchStatement */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: - case 226 /* LabeledStatement */: - case 228 /* TryStatement */: - case 267 /* CatchClause */: + case 240 /* CaseBlock */: + case 212 /* Block */: + case 216 /* IfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 225 /* WithStatement */: + case 226 /* SwitchStatement */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: + case 227 /* LabeledStatement */: + case 229 /* TryStatement */: + case 268 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -7292,19 +7328,19 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 236 /* EnumDeclaration */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 237 /* EnumDeclaration */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. @@ -7347,12 +7383,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 234 /* InterfaceDeclaration */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: case 165 /* TypeLiteral */: return node.members; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return node.properties; } } @@ -7360,14 +7396,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 180 /* BindingElement */: - case 271 /* EnumMember */: + case 181 /* BindingElement */: + case 272 /* EnumMember */: case 148 /* Parameter */: - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 269 /* ShorthandPropertyAssignment */: - case 230 /* VariableDeclaration */: + case 270 /* ShorthandPropertyAssignment */: + case 231 /* VariableDeclaration */: return true; } } @@ -7379,8 +7415,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 231 /* VariableDeclarationList */ - && node.parent.parent.kind === 212 /* VariableStatement */; + return node.parent.kind === 232 /* VariableDeclarationList */ + && node.parent.parent.kind === 213 /* VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isValidESSymbolDeclaration(node) { @@ -7396,8 +7432,8 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return true; } return false; @@ -7408,7 +7444,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 226 /* LabeledStatement */) { + if (node.statement.kind !== 227 /* LabeledStatement */) { return node.statement; } node = node.statement; @@ -7416,17 +7452,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 211 /* Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 212 /* Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 153 /* MethodDeclaration */ && node.parent.kind === 182 /* ObjectLiteralExpression */; + return node && node.kind === 153 /* MethodDeclaration */ && node.parent.kind === 183 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { return node.kind === 153 /* MethodDeclaration */ && - (node.parent.kind === 182 /* ObjectLiteralExpression */ || - node.parent.kind === 203 /* ClassExpression */); + (node.parent.kind === 183 /* ObjectLiteralExpression */ || + node.parent.kind === 204 /* ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -7439,7 +7475,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 268 /* PropertyAssignment */) { + if (property.kind === 269 /* PropertyAssignment */) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -7489,14 +7525,14 @@ var ts; node = node.parent; } break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 237 /* ModuleDeclaration */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 238 /* ModuleDeclaration */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 153 /* MethodDeclaration */: @@ -7507,8 +7543,8 @@ var ts; case 157 /* CallSignature */: case 158 /* ConstructSignature */: case 159 /* IndexSignature */: - case 236 /* EnumDeclaration */: - case 272 /* SourceFile */: + case 237 /* EnumDeclaration */: + case 273 /* SourceFile */: return node; } } @@ -7519,8 +7555,8 @@ var ts; if (container) { switch (container.kind) { case 154 /* Constructor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return container; } } @@ -7545,9 +7581,9 @@ var ts; case 146 /* ComputedPropertyName */: node = node.parent; break; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: if (!stopOnFunctions) { continue; } @@ -7578,14 +7614,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 190 /* FunctionExpression */ || func.kind === 191 /* ArrowFunction */) { + if (func.kind === 191 /* FunctionExpression */ || func.kind === 192 /* ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 189 /* ParenthesizedExpression */) { + while (parent.kind === 190 /* ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 185 /* CallExpression */ && parent.expression === prev) { + if (parent.kind === 186 /* CallExpression */ && parent.expression === prev) { return parent; } } @@ -7596,7 +7632,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 183 /* PropertyAccessExpression */ || kind === 184 /* ElementAccessExpression */) + return (kind === 184 /* PropertyAccessExpression */ || kind === 185 /* ElementAccessExpression */) && node.expression.kind === 97 /* SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -7605,7 +7641,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 183 /* PropertyAccessExpression */ || kind === 184 /* ElementAccessExpression */) + return (kind === 184 /* PropertyAccessExpression */ || kind === 185 /* ElementAccessExpression */) && node.expression.kind === 99 /* ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -7613,7 +7649,7 @@ var ts; switch (node.kind) { case 161 /* TypeReference */: return node.typeName; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; @@ -7626,10 +7662,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return node.tag; - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -7638,25 +7674,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node, parent, grandparent) { switch (node.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: // classes are valid targets return true; case 151 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 233 /* ClassDeclaration */; + return parent.kind === 234 /* ClassDeclaration */; case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 153 /* 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 === 233 /* ClassDeclaration */; + && parent.kind === 234 /* ClassDeclaration */; case 148 /* 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 === 154 /* Constructor */ || parent.kind === 153 /* MethodDeclaration */ || parent.kind === 156 /* SetAccessor */) - && grandparent.kind === 233 /* ClassDeclaration */; + && grandparent.kind === 234 /* ClassDeclaration */; } return false; } @@ -7672,7 +7708,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return ts.forEach(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); case 153 /* MethodDeclaration */: case 156 /* SetAccessor */: @@ -7682,9 +7718,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 255 /* JsxOpeningElement */ || - parent.kind === 254 /* JsxSelfClosingElement */ || - parent.kind === 256 /* JsxClosingElement */) { + if (parent.kind === 256 /* JsxOpeningElement */ || + parent.kind === 255 /* JsxSelfClosingElement */ || + parent.kind === 257 /* JsxClosingElement */) { return parent.tagName === node; } return false; @@ -7697,37 +7733,37 @@ var ts; case 101 /* TrueKeyword */: case 86 /* FalseKeyword */: case 12 /* RegularExpressionLiteral */: - case 181 /* ArrayLiteralExpression */: - case 182 /* ObjectLiteralExpression */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 187 /* TaggedTemplateExpression */: - case 206 /* AsExpression */: - case 188 /* TypeAssertionExpression */: - case 207 /* NonNullExpression */: - case 189 /* ParenthesizedExpression */: - case 190 /* FunctionExpression */: - case 203 /* ClassExpression */: - case 191 /* ArrowFunction */: - case 194 /* VoidExpression */: - case 192 /* DeleteExpression */: - case 193 /* TypeOfExpression */: - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: - case 198 /* BinaryExpression */: - case 199 /* ConditionalExpression */: - case 202 /* SpreadElement */: - case 200 /* TemplateExpression */: + case 182 /* ArrayLiteralExpression */: + case 183 /* ObjectLiteralExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 188 /* TaggedTemplateExpression */: + case 207 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 208 /* NonNullExpression */: + case 190 /* ParenthesizedExpression */: + case 191 /* FunctionExpression */: + case 204 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 195 /* VoidExpression */: + case 193 /* DeleteExpression */: + case 194 /* TypeOfExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 199 /* BinaryExpression */: + case 200 /* ConditionalExpression */: + case 203 /* SpreadElement */: + case 201 /* TemplateExpression */: case 13 /* NoSubstitutionTemplateLiteral */: - case 204 /* OmittedExpression */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 257 /* JsxFragment */: - case 201 /* YieldExpression */: - case 195 /* AwaitExpression */: - case 208 /* MetaProperty */: + case 205 /* OmittedExpression */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 258 /* JsxFragment */: + case 202 /* YieldExpression */: + case 196 /* AwaitExpression */: + case 209 /* MetaProperty */: return true; case 145 /* QualifiedName */: while (node.parent.kind === 145 /* QualifiedName */) { @@ -7751,47 +7787,47 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 271 /* EnumMember */: - case 268 /* PropertyAssignment */: - case 180 /* BindingElement */: + case 272 /* EnumMember */: + case 269 /* PropertyAssignment */: + case 181 /* BindingElement */: return parent.initializer === node; - case 214 /* ExpressionStatement */: - case 215 /* IfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 223 /* ReturnStatement */: - case 224 /* WithStatement */: - case 225 /* SwitchStatement */: - case 264 /* CaseClause */: - case 227 /* ThrowStatement */: + case 215 /* ExpressionStatement */: + case 216 /* IfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 224 /* ReturnStatement */: + case 225 /* WithStatement */: + case 226 /* SwitchStatement */: + case 265 /* CaseClause */: + case 228 /* ThrowStatement */: return parent.expression === node; - case 218 /* ForStatement */: + case 219 /* ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 231 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 232 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 231 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 232 /* VariableDeclarationList */) || forInStatement.expression === node; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: return node === parent.expression; - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return node === parent.expression; case 146 /* ComputedPropertyName */: return node === parent.expression; case 149 /* Decorator */: - case 263 /* JsxExpression */: - case 262 /* JsxSpreadAttribute */: - case 270 /* SpreadAssignment */: + case 264 /* JsxExpression */: + case 263 /* JsxSpreadAttribute */: + case 271 /* SpreadAssignment */: return true; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: return isExpressionNode(parent); @@ -7799,7 +7835,7 @@ var ts; } ts.isInExpressionContext = isInExpressionContext; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 252 /* ExternalModuleReference */; + return node.kind === 242 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 253 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7808,7 +7844,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 252 /* ExternalModuleReference */; + return node.kind === 242 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 253 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7836,7 +7872,7 @@ var ts; } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) { - if (callExpression.kind !== 185 /* CallExpression */) { + if (callExpression.kind !== 186 /* CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -7907,9 +7943,11 @@ var ts; function getJavascriptInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 190 /* FunctionExpression */ || e.kind === 191 /* ArrowFunction */ ? initializer : undefined; + return e.kind === 191 /* FunctionExpression */ || e.kind === 192 /* ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 190 /* FunctionExpression */ || initializer.kind === 203 /* ClassExpression */) { + if (initializer.kind === 191 /* FunctionExpression */ || + initializer.kind === 204 /* ClassExpression */ || + initializer.kind === 192 /* ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -8002,7 +8040,7 @@ var ts; return 2 /* ModuleExports */; } else if (isEntityNameExpression(lhs.expression)) { - if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(expr.right)) { + if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) { // F.prototype = { ... } return 6 /* Prototype */; } @@ -8027,24 +8065,31 @@ var ts; return 0 /* None */; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; + function getInitializerOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.right)) { + expr = expr.right; + } + return expr.right; + } + ts.getInitializerOfBinaryExpression = getInitializerOfBinaryExpression; function isPrototypePropertyAssignment(node) { return ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === 3 /* PrototypeProperty */; } ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJavaScriptFile(expr) && - expr.parent && expr.parent.kind === 214 /* ExpressionStatement */ && + expr.parent && expr.parent.kind === 215 /* ExpressionStatement */ && !!ts.getJSDocTypeTag(expr.parent); } ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration; function importFromModuleSpecifier(node) { switch (node.parent.kind) { - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return node.parent; - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return node.parent.parent; - case 185 /* CallExpression */: + case 186 /* CallExpression */: return node.parent; default: return ts.Debug.fail(ts.Debug.showSyntaxKind(node)); @@ -8053,11 +8098,13 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return node.moduleSpecifier; - case 241 /* ImportEqualsDeclaration */: - return node.moduleReference.kind === 252 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 242 /* ImportEqualsDeclaration */: + return node.moduleReference.kind === 253 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 178 /* ImportType */: + return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; default: return ts.Debug.assertNever(node); } @@ -8065,11 +8112,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return node; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return undefined; default: return ts.Debug.assertNever(node); @@ -8077,7 +8124,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 242 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 243 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function hasQuestionToken(node) { @@ -8086,8 +8133,8 @@ var ts; case 148 /* Parameter */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: - case 269 /* ShorthandPropertyAssignment */: - case 268 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return node.questionToken !== undefined; @@ -8097,7 +8144,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 280 /* JSDocFunctionType */ && + return node.kind === 281 /* JSDocFunctionType */ && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -8119,7 +8166,7 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; case 151 /* PropertyDeclaration */: @@ -8132,9 +8179,9 @@ var ts; node.declarationList.declarations[0]; } function getNestedModuleDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */ && + return node.kind === 238 /* ModuleDeclaration */ && node.body && - node.body.kind === 237 /* ModuleDeclaration */ && + node.body.kind === 238 /* ModuleDeclaration */ && node.body; } function getJSDocCommentsAndTags(node) { @@ -8143,7 +8190,10 @@ var ts; return result || ts.emptyArray; function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; - if (parent && (parent.kind === 268 /* PropertyAssignment */ || parent.kind === 151 /* PropertyDeclaration */ || getNestedModuleDeclaration(parent))) { + if (parent && + (parent.kind === 269 /* PropertyAssignment */ || + parent.kind === 151 /* PropertyDeclaration */ || + getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement. @@ -8161,7 +8211,8 @@ var ts; getJSDocCommentsAndTagsWorker(parent.parent.parent); } if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 /* None */ || - node.kind === 183 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 214 /* ExpressionStatement */) { + parent && ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 /* None */ || + node.kind === 184 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 215 /* ExpressionStatement */) { getJSDocCommentsAndTagsWorker(parent); } // Pull parameter comments from declaring function as well @@ -8206,7 +8257,7 @@ var ts; } ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 282 /* JSDocComment */); + ts.Debug.assert(node.parent.kind === 283 /* JSDocComment */); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -8222,7 +8273,7 @@ var ts; } ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { - return node.dotDotDotToken !== undefined || node.type && node.type.kind === 281 /* JSDocVariadicType */; + return node.dotDotDotToken !== undefined || node.type && node.type.kind === 282 /* JSDocVariadicType */; } ts.isRestParameter = isRestParameter; var AssignmentKind; @@ -8235,31 +8286,31 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 58 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 43 /* PlusPlusToken */ || unaryOperator === 44 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; - case 189 /* ParenthesizedExpression */: - case 181 /* ArrayLiteralExpression */: - case 202 /* SpreadElement */: - case 207 /* NonNullExpression */: + case 190 /* ParenthesizedExpression */: + case 182 /* ArrayLiteralExpression */: + case 203 /* SpreadElement */: + case 208 /* NonNullExpression */: node = parent; break; - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } node = parent.parent; break; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: if (parent.name === node) { return 0 /* None */; } @@ -8286,22 +8337,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 211 /* Block */: - case 212 /* VariableStatement */: - case 224 /* WithStatement */: - case 215 /* IfStatement */: - case 225 /* SwitchStatement */: - case 239 /* CaseBlock */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: - case 226 /* LabeledStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 228 /* TryStatement */: - case 267 /* CatchClause */: + case 212 /* Block */: + case 213 /* VariableStatement */: + case 225 /* WithStatement */: + case 216 /* IfStatement */: + case 226 /* SwitchStatement */: + case 240 /* CaseBlock */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: + case 227 /* LabeledStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 229 /* TryStatement */: + case 268 /* CatchClause */: return true; } return false; @@ -8322,11 +8373,11 @@ var ts; } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 189 /* ParenthesizedExpression */); + return walkUp(node, 190 /* ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; function skipParentheses(node) { - while (node.kind === 189 /* ParenthesizedExpression */) { + while (node.kind === 190 /* ParenthesizedExpression */) { node = node.expression; } return node; @@ -8334,11 +8385,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 !== 183 /* PropertyAccessExpression */ && node.kind !== 184 /* ElementAccessExpression */) { + if (node.kind !== 184 /* PropertyAccessExpression */ && node.kind !== 185 /* ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 192 /* DeleteExpression */; + return node && node.kind === 193 /* DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -8387,26 +8438,26 @@ var ts; case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 271 /* EnumMember */: - case 268 /* PropertyAssignment */: - case 183 /* PropertyAccessExpression */: + case 272 /* EnumMember */: + case 269 /* PropertyAssignment */: + case 184 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; case 145 /* QualifiedName */: - // Name on right hand side of dot in a type query + // Name on right hand side of dot in a type query or type reference if (parent.right === node) { while (parent.kind === 145 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 164 /* TypeQuery */; + return parent.kind === 164 /* TypeQuery */ || parent.kind === 161 /* TypeReference */; } return false; - case 180 /* BindingElement */: - case 246 /* ImportSpecifier */: + case 181 /* BindingElement */: + case 247 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 250 /* ExportSpecifier */: - case 260 /* JsxAttribute */: + case 251 /* ExportSpecifier */: + case 261 /* JsxAttribute */: // Any name in an export specifier or JSX Attribute return true; } @@ -8422,13 +8473,13 @@ var ts; // export = // export default function isAliasSymbolDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */ || - node.kind === 240 /* NamespaceExportDeclaration */ || - node.kind === 243 /* ImportClause */ && !!node.name || - node.kind === 244 /* NamespaceImport */ || - node.kind === 246 /* ImportSpecifier */ || - node.kind === 250 /* ExportSpecifier */ || - node.kind === 247 /* ExportAssignment */ && exportAssignmentIsAlias(node); + return node.kind === 242 /* ImportEqualsDeclaration */ || + node.kind === 241 /* NamespaceExportDeclaration */ || + node.kind === 244 /* ImportClause */ && !!node.name || + node.kind === 245 /* NamespaceImport */ || + node.kind === 247 /* ImportSpecifier */ || + node.kind === 251 /* ExportSpecifier */ || + node.kind === 248 /* ExportAssignment */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8521,14 +8572,14 @@ var ts; } var flags = 0 /* Normal */; switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* Generator */; } // falls through - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (hasModifier(node, 256 /* Async */)) { flags |= 2 /* Async */; } @@ -8542,9 +8593,9 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined @@ -8650,7 +8701,7 @@ var ts; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 180 /* BindingElement */) { + while (node.kind === 181 /* BindingElement */) { node = node.parent.parent; } return node; @@ -8659,14 +8710,14 @@ var ts; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; return kind === 154 /* Constructor */ - || kind === 190 /* FunctionExpression */ - || kind === 232 /* FunctionDeclaration */ - || kind === 191 /* ArrowFunction */ + || kind === 191 /* FunctionExpression */ + || kind === 233 /* FunctionDeclaration */ + || kind === 192 /* ArrowFunction */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ || kind === 156 /* SetAccessor */ - || kind === 237 /* ModuleDeclaration */ - || kind === 272 /* SourceFile */; + || kind === 238 /* ModuleDeclaration */ + || kind === 273 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -8685,23 +8736,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 /* NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 186 /* NewExpression */: + case 187 /* NewExpression */: return hasArguments ? 0 /* Left */ : 1 /* Right */; - case 196 /* PrefixUnaryExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 192 /* DeleteExpression */: - case 195 /* AwaitExpression */: - case 199 /* ConditionalExpression */: - case 201 /* YieldExpression */: + case 197 /* PrefixUnaryExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 193 /* DeleteExpression */: + case 196 /* AwaitExpression */: + case 200 /* ConditionalExpression */: + case 202 /* YieldExpression */: return 1 /* Right */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (operator) { case 40 /* AsteriskAsteriskToken */: case 58 /* EqualsToken */: @@ -8725,15 +8776,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 /* NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 198 /* BinaryExpression */) { + if (expression.kind === 199 /* BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 196 /* PrefixUnaryExpression */ || expression.kind === 197 /* PostfixUnaryExpression */) { + else if (expression.kind === 197 /* PrefixUnaryExpression */ || expression.kind === 198 /* PostfixUnaryExpression */) { return expression.operator; } else { @@ -8743,15 +8794,15 @@ var ts; ts.getOperator = getOperator; function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return 0; - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return 1; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return 2; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return 4; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (operatorKind) { case 26 /* CommaToken */: return 0; @@ -8772,21 +8823,21 @@ var ts; default: return getBinaryOperatorPrecedence(operatorKind); } - case 196 /* PrefixUnaryExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 192 /* DeleteExpression */: - case 195 /* AwaitExpression */: + case 197 /* PrefixUnaryExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 193 /* DeleteExpression */: + case 196 /* AwaitExpression */: return 16; - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return 17; - case 185 /* CallExpression */: + case 186 /* CallExpression */: return 18; - case 186 /* NewExpression */: + case 187 /* NewExpression */: return hasArguments ? 19 : 18; - case 187 /* TaggedTemplateExpression */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 188 /* TaggedTemplateExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: return 19; case 99 /* ThisKeyword */: case 97 /* SuperKeyword */: @@ -8796,19 +8847,19 @@ var ts; case 86 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - case 181 /* ArrayLiteralExpression */: - case 182 /* ObjectLiteralExpression */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 203 /* ClassExpression */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 257 /* JsxFragment */: + case 182 /* ArrayLiteralExpression */: + case 183 /* ObjectLiteralExpression */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 204 /* ClassExpression */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 258 /* JsxFragment */: case 12 /* RegularExpressionLiteral */: case 13 /* NoSubstitutionTemplateLiteral */: - case 200 /* TemplateExpression */: - case 189 /* ParenthesizedExpression */: - case 204 /* OmittedExpression */: + case 201 /* TemplateExpression */: + case 190 /* ParenthesizedExpression */: + case 205 /* OmittedExpression */: return 20; default: return -1; @@ -8865,17 +8916,12 @@ var ts; var filesWithDiagnostics = []; var fileDiagnostics = ts.createMap(); var hasReadNonFileDiagnostics = false; - var modificationCount = 0; return { add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount, reattachFileDiagnostics: reattachFileDiagnostics }; - function getModificationCount() { - return modificationCount; - } function reattachFileDiagnostics(newFile) { ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } @@ -8898,7 +8944,6 @@ var ts; diagnostics = nonFileDiagnostics; } ts.insertSorted(diagnostics, diagnostic, ts.compareDiagnostics); - modificationCount++; } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -9566,7 +9611,7 @@ var ts; ts.isAssignmentOperator = isAssignmentOperator; /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */ function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 205 /* ExpressionWithTypeArguments */ && + if (node.kind === 206 /* ExpressionWithTypeArguments */ && node.parent.token === 85 /* ExtendsKeyword */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; @@ -9584,8 +9629,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 182 /* ObjectLiteralExpression */ - || kind === 181 /* ArrayLiteralExpression */; + return kind === 183 /* ObjectLiteralExpression */ + || kind === 182 /* ArrayLiteralExpression */; } return false; } @@ -9595,7 +9640,7 @@ var ts; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isExpressionWithTypeArgumentsInClassImplementsClause(node) { - return node.kind === 205 /* ExpressionWithTypeArguments */ + return node.kind === 206 /* ExpressionWithTypeArguments */ && isEntityNameExpression(node.expression) && node.parent && node.parent.token === 108 /* ImplementsKeyword */ @@ -9617,16 +9662,16 @@ var ts; ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { return (node.parent.kind === 145 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node); + (node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteral(expression) { - return expression.kind === 182 /* ObjectLiteralExpression */ && + return expression.kind === 183 /* ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 181 /* ArrayLiteralExpression */ && + return expression.kind === 182 /* ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -9967,8 +10012,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 236 /* EnumDeclaration */: - case 237 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -10041,21 +10086,21 @@ var ts; if (!parent) return 0 /* Read */; switch (parent.kind) { - case 197 /* PostfixUnaryExpression */: - case 196 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: var operator = parent.operator; return operator === 43 /* PlusPlusToken */ || operator === 44 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? writeOrReadWrite() : 0 /* Read */; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return parent.name !== node ? 0 /* Read */ : accessKind(parent); default: return 0 /* 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 && parent.parent.kind === 214 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */; + return parent.parent && parent.parent.kind === 215 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */; } } function compareDataObjects(dst, src) { @@ -10419,7 +10464,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 147 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 234 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 235 /* InterfaceDeclaration */) { return current; } } @@ -10445,7 +10490,7 @@ var ts; } ts.isEmptyBindingElement = isEmptyBindingElement; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 180 /* BindingElement */ || ts.isBindingPattern(node))) { + while (node && (node.kind === 181 /* BindingElement */ || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -10453,14 +10498,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 230 /* VariableDeclaration */) { + if (node.kind === 231 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 231 /* VariableDeclarationList */) { + if (node && node.kind === 232 /* VariableDeclarationList */) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 212 /* VariableStatement */) { + if (node && node.kind === 213 /* VariableStatement */) { flags |= ts.getModifierFlags(node); } return flags; @@ -10476,14 +10521,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 230 /* VariableDeclaration */) { + if (node.kind === 231 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 231 /* VariableDeclarationList */) { + if (node && node.kind === 232 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 212 /* VariableStatement */) { + if (node && node.kind === 213 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -10620,17 +10665,17 @@ var ts; } // Covers remaining cases switch (hostNode.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } return undefined; - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: var expr = hostNode.expression; switch (expr.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return expr.name; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; @@ -10639,10 +10684,10 @@ var ts; return undefined; case 1 /* EndOfFileToken */: return undefined; - case 189 /* ParenthesizedExpression */: { + case 190 /* ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 226 /* LabeledStatement */: { + case 227 /* LabeledStatement */: { if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -10672,15 +10717,15 @@ var ts; switch (declaration.kind) { case 71 /* Identifier */: return declaration; - case 292 /* JSDocPropertyTag */: - case 287 /* JSDocParameterTag */: { + case 293 /* JSDocPropertyTag */: + case 288 /* JSDocParameterTag */: { var name = declaration.name; if (name.kind === 145 /* QualifiedName */) { return name.right; } break; } - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var expr = declaration; switch (ts.getSpecialPropertyAssignmentKind(expr)) { case 1 /* ExportsProperty */: @@ -10692,9 +10737,9 @@ var ts; return undefined; } } - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 247 /* ExportAssignment */: { + case 248 /* ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } @@ -10992,484 +11037,484 @@ var ts; ts.isLiteralTypeNode = isLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 178 /* ObjectBindingPattern */; + return node.kind === 179 /* ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 179 /* ArrayBindingPattern */; + return node.kind === 180 /* ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 180 /* BindingElement */; + return node.kind === 181 /* BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 181 /* ArrayLiteralExpression */; + return node.kind === 182 /* ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 182 /* ObjectLiteralExpression */; + return node.kind === 183 /* ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 183 /* PropertyAccessExpression */; + return node.kind === 184 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 184 /* ElementAccessExpression */; + return node.kind === 185 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 185 /* CallExpression */; + return node.kind === 186 /* CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 186 /* NewExpression */; + return node.kind === 187 /* NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 187 /* TaggedTemplateExpression */; + return node.kind === 188 /* TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertion(node) { - return node.kind === 188 /* TypeAssertionExpression */; + return node.kind === 189 /* TypeAssertionExpression */; } ts.isTypeAssertion = isTypeAssertion; function isParenthesizedExpression(node) { - return node.kind === 189 /* ParenthesizedExpression */; + return node.kind === 190 /* ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295 /* PartiallyEmittedExpression */) { + while (node.kind === 296 /* PartiallyEmittedExpression */) { node = node.expression; } return node; } ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; function isFunctionExpression(node) { - return node.kind === 190 /* FunctionExpression */; + return node.kind === 191 /* FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 191 /* ArrowFunction */; + return node.kind === 192 /* ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 192 /* DeleteExpression */; + return node.kind === 193 /* DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 193 /* TypeOfExpression */; + return node.kind === 194 /* TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 194 /* VoidExpression */; + return node.kind === 195 /* VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 195 /* AwaitExpression */; + return node.kind === 196 /* AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 196 /* PrefixUnaryExpression */; + return node.kind === 197 /* PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 197 /* PostfixUnaryExpression */; + return node.kind === 198 /* PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 198 /* BinaryExpression */; + return node.kind === 199 /* BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 199 /* ConditionalExpression */; + return node.kind === 200 /* ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 200 /* TemplateExpression */; + return node.kind === 201 /* TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 201 /* YieldExpression */; + return node.kind === 202 /* YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 202 /* SpreadElement */; + return node.kind === 203 /* SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 203 /* ClassExpression */; + return node.kind === 204 /* ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 204 /* OmittedExpression */; + return node.kind === 205 /* OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 205 /* ExpressionWithTypeArguments */; + return node.kind === 206 /* ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 206 /* AsExpression */; + return node.kind === 207 /* AsExpression */; } ts.isAsExpression = isAsExpression; function isNonNullExpression(node) { - return node.kind === 207 /* NonNullExpression */; + return node.kind === 208 /* NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 208 /* MetaProperty */; + return node.kind === 209 /* MetaProperty */; } ts.isMetaProperty = isMetaProperty; // Misc function isTemplateSpan(node) { - return node.kind === 209 /* TemplateSpan */; + return node.kind === 210 /* TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 210 /* SemicolonClassElement */; + return node.kind === 211 /* SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Block function isBlock(node) { - return node.kind === 211 /* Block */; + return node.kind === 212 /* Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 212 /* VariableStatement */; + return node.kind === 213 /* VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 213 /* EmptyStatement */; + return node.kind === 214 /* EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 214 /* ExpressionStatement */; + return node.kind === 215 /* ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 215 /* IfStatement */; + return node.kind === 216 /* IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 216 /* DoStatement */; + return node.kind === 217 /* DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 217 /* WhileStatement */; + return node.kind === 218 /* WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 218 /* ForStatement */; + return node.kind === 219 /* ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 219 /* ForInStatement */; + return node.kind === 220 /* ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 220 /* ForOfStatement */; + return node.kind === 221 /* ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 221 /* ContinueStatement */; + return node.kind === 222 /* ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 222 /* BreakStatement */; + return node.kind === 223 /* BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isBreakOrContinueStatement(node) { - return node.kind === 222 /* BreakStatement */ || node.kind === 221 /* ContinueStatement */; + return node.kind === 223 /* BreakStatement */ || node.kind === 222 /* ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isReturnStatement(node) { - return node.kind === 223 /* ReturnStatement */; + return node.kind === 224 /* ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 224 /* WithStatement */; + return node.kind === 225 /* WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 225 /* SwitchStatement */; + return node.kind === 226 /* SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 226 /* LabeledStatement */; + return node.kind === 227 /* LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 227 /* ThrowStatement */; + return node.kind === 228 /* ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 228 /* TryStatement */; + return node.kind === 229 /* TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 229 /* DebuggerStatement */; + return node.kind === 230 /* DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 230 /* VariableDeclaration */; + return node.kind === 231 /* VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 231 /* VariableDeclarationList */; + return node.kind === 232 /* VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 232 /* FunctionDeclaration */; + return node.kind === 233 /* FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 233 /* ClassDeclaration */; + return node.kind === 234 /* ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 234 /* InterfaceDeclaration */; + return node.kind === 235 /* InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 235 /* TypeAliasDeclaration */; + return node.kind === 236 /* TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 236 /* EnumDeclaration */; + return node.kind === 237 /* EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */; + return node.kind === 238 /* ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 238 /* ModuleBlock */; + return node.kind === 239 /* ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 239 /* CaseBlock */; + return node.kind === 240 /* CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 240 /* NamespaceExportDeclaration */; + return node.kind === 241 /* NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */; + return node.kind === 242 /* ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 242 /* ImportDeclaration */; + return node.kind === 243 /* ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 243 /* ImportClause */; + return node.kind === 244 /* ImportClause */; } ts.isImportClause = isImportClause; function isNamespaceImport(node) { - return node.kind === 244 /* NamespaceImport */; + return node.kind === 245 /* NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamedImports(node) { - return node.kind === 245 /* NamedImports */; + return node.kind === 246 /* NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 246 /* ImportSpecifier */; + return node.kind === 247 /* ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 247 /* ExportAssignment */; + return node.kind === 248 /* ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 248 /* ExportDeclaration */; + return node.kind === 249 /* ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 249 /* NamedExports */; + return node.kind === 250 /* NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 250 /* ExportSpecifier */; + return node.kind === 251 /* ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 251 /* MissingDeclaration */; + return node.kind === 252 /* MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; // Module References function isExternalModuleReference(node) { - return node.kind === 252 /* ExternalModuleReference */; + return node.kind === 253 /* ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 253 /* JsxElement */; + return node.kind === 254 /* JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 254 /* JsxSelfClosingElement */; + return node.kind === 255 /* JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 255 /* JsxOpeningElement */; + return node.kind === 256 /* JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 256 /* JsxClosingElement */; + return node.kind === 257 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 257 /* JsxFragment */; + return node.kind === 258 /* JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 258 /* JsxOpeningFragment */; + return node.kind === 259 /* JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 259 /* JsxClosingFragment */; + return node.kind === 260 /* JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 260 /* JsxAttribute */; + return node.kind === 261 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 261 /* JsxAttributes */; + return node.kind === 262 /* JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 262 /* JsxSpreadAttribute */; + return node.kind === 263 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 263 /* JsxExpression */; + return node.kind === 264 /* JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 264 /* CaseClause */; + return node.kind === 265 /* CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 265 /* DefaultClause */; + return node.kind === 266 /* DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 266 /* HeritageClause */; + return node.kind === 267 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 267 /* CatchClause */; + return node.kind === 268 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 268 /* PropertyAssignment */; + return node.kind === 269 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 269 /* ShorthandPropertyAssignment */; + return node.kind === 270 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 270 /* SpreadAssignment */; + return node.kind === 271 /* SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 271 /* EnumMember */; + return node.kind === 272 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 272 /* SourceFile */; + return node.kind === 273 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 273 /* Bundle */; + return node.kind === 274 /* Bundle */; } ts.isBundle = isBundle; // JSDoc function isJSDocTypeExpression(node) { - return node.kind === 274 /* JSDocTypeExpression */; + return node.kind === 275 /* JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 275 /* JSDocAllType */; + return node.kind === 276 /* JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 276 /* JSDocUnknownType */; + return node.kind === 277 /* JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 277 /* JSDocNullableType */; + return node.kind === 278 /* JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 278 /* JSDocNonNullableType */; + return node.kind === 279 /* JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 279 /* JSDocOptionalType */; + return node.kind === 280 /* JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 280 /* JSDocFunctionType */; + return node.kind === 281 /* JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 281 /* JSDocVariadicType */; + return node.kind === 282 /* JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 282 /* JSDocComment */; + return node.kind === 283 /* JSDocComment */; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 285 /* JSDocAugmentsTag */; + return node.kind === 286 /* JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocClassTag(node) { - return node.kind === 286 /* JSDocClassTag */; + return node.kind === 287 /* JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocParameterTag(node) { - return node.kind === 287 /* JSDocParameterTag */; + return node.kind === 288 /* JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 288 /* JSDocReturnTag */; + return node.kind === 289 /* JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 289 /* JSDocTypeTag */; + return node.kind === 290 /* JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 290 /* JSDocTemplateTag */; + return node.kind === 291 /* JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 291 /* JSDocTypedefTag */; + return node.kind === 292 /* JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 292 /* JSDocPropertyTag */; + return node.kind === 293 /* JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 292 /* JSDocPropertyTag */ || node.kind === 287 /* JSDocParameterTag */; + return node.kind === 293 /* JSDocPropertyTag */ || node.kind === 288 /* JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 283 /* JSDocTypeLiteral */; + return node.kind === 284 /* JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); @@ -11480,7 +11525,7 @@ var ts; (function (ts) { /* @internal */ function isSyntaxList(n) { - return n.kind === 293 /* SyntaxList */; + return n.kind === 294 /* SyntaxList */; } ts.isSyntaxList = isSyntaxList; /* @internal */ @@ -11592,8 +11637,8 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 71 /* Identifier */ - || kind === 178 /* ObjectBindingPattern */ - || kind === 179 /* ArrayBindingPattern */; + || kind === 179 /* ObjectBindingPattern */ + || kind === 180 /* ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -11608,13 +11653,13 @@ var ts; ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; default: return false; @@ -11628,7 +11673,7 @@ var ts; case 158 /* ConstructSignature */: case 159 /* IndexSignature */: case 162 /* FunctionType */: - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: case 163 /* ConstructorType */: return true; default: @@ -11650,12 +11695,12 @@ var ts; || kind === 155 /* GetAccessor */ || kind === 156 /* SetAccessor */ || kind === 159 /* IndexSignature */ - || kind === 210 /* SemicolonClassElement */ - || kind === 251 /* MissingDeclaration */; + || kind === 211 /* SemicolonClassElement */ + || kind === 252 /* MissingDeclaration */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 233 /* ClassDeclaration */ || node.kind === 203 /* ClassExpression */); + return node && (node.kind === 234 /* ClassDeclaration */ || node.kind === 204 /* ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { @@ -11682,23 +11727,23 @@ var ts; || kind === 150 /* PropertySignature */ || kind === 152 /* MethodSignature */ || kind === 159 /* IndexSignature */ - || kind === 251 /* MissingDeclaration */; + || kind === 252 /* MissingDeclaration */; } ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 268 /* PropertyAssignment */ - || kind === 269 /* ShorthandPropertyAssignment */ - || kind === 270 /* SpreadAssignment */ + return kind === 269 /* PropertyAssignment */ + || kind === 270 /* ShorthandPropertyAssignment */ + || kind === 271 /* SpreadAssignment */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ || kind === 156 /* SetAccessor */ - || kind === 251 /* MissingDeclaration */; + || kind === 252 /* MissingDeclaration */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type function isTypeNodeKind(kind) { - return (kind >= 160 /* FirstTypeNode */ && kind <= 177 /* LastTypeNode */) + return (kind >= 160 /* FirstTypeNode */ && kind <= 178 /* LastTypeNode */) || kind === 119 /* AnyKeyword */ || kind === 134 /* NumberKeyword */ || kind === 135 /* ObjectKeyword */ @@ -11710,14 +11755,14 @@ var ts; || kind === 140 /* UndefinedKeyword */ || kind === 95 /* NullKeyword */ || kind === 131 /* NeverKeyword */ - || kind === 205 /* ExpressionWithTypeArguments */ - || kind === 275 /* JSDocAllType */ - || kind === 276 /* JSDocUnknownType */ - || kind === 277 /* JSDocNullableType */ - || kind === 278 /* JSDocNonNullableType */ - || kind === 279 /* JSDocOptionalType */ - || kind === 280 /* JSDocFunctionType */ - || kind === 281 /* JSDocVariadicType */; + || kind === 206 /* ExpressionWithTypeArguments */ + || kind === 276 /* JSDocAllType */ + || kind === 277 /* JSDocUnknownType */ + || kind === 278 /* JSDocNullableType */ + || kind === 279 /* JSDocNonNullableType */ + || kind === 280 /* JSDocOptionalType */ + || kind === 281 /* JSDocFunctionType */ + || kind === 282 /* JSDocVariadicType */; } /** * Node test that determines whether a node is a valid type node. @@ -11742,8 +11787,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 179 /* ArrayBindingPattern */ - || kind === 178 /* ObjectBindingPattern */; + return kind === 180 /* ArrayBindingPattern */ + || kind === 179 /* ObjectBindingPattern */; } return false; } @@ -11751,15 +11796,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 181 /* ArrayLiteralExpression */ - || kind === 182 /* ObjectLiteralExpression */; + return kind === 182 /* ArrayLiteralExpression */ + || kind === 183 /* ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 180 /* BindingElement */ - || kind === 204 /* OmittedExpression */; + return kind === 181 /* BindingElement */ + || kind === 205 /* OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -11768,9 +11813,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: - case 180 /* BindingElement */: + case 181 /* BindingElement */: return true; } return false; @@ -11791,8 +11836,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 178 /* ObjectBindingPattern */: - case 182 /* ObjectLiteralExpression */: + case 179 /* ObjectBindingPattern */: + case 183 /* ObjectLiteralExpression */: return true; } return false; @@ -11804,27 +11849,35 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 179 /* ArrayBindingPattern */: - case 181 /* ArrayLiteralExpression */: + case 180 /* ArrayBindingPattern */: + case 182 /* ArrayLiteralExpression */: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; + /* @internal */ + function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { + var kind = node.kind; + return kind === 184 /* PropertyAccessExpression */ + || kind === 145 /* QualifiedName */ + || kind === 178 /* ImportType */; + } + ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 183 /* PropertyAccessExpression */ + return kind === 184 /* PropertyAccessExpression */ || kind === 145 /* QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 187 /* TaggedTemplateExpression */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 188 /* TaggedTemplateExpression */: case 149 /* Decorator */: return true; default: @@ -11833,12 +11886,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 185 /* CallExpression */ || node.kind === 186 /* NewExpression */; + return node.kind === 186 /* CallExpression */ || node.kind === 187 /* NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 200 /* TemplateExpression */ + return kind === 201 /* TemplateExpression */ || kind === 13 /* NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -11849,32 +11902,32 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: - case 186 /* NewExpression */: - case 185 /* CallExpression */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 257 /* JsxFragment */: - case 187 /* TaggedTemplateExpression */: - case 181 /* ArrayLiteralExpression */: - case 189 /* ParenthesizedExpression */: - case 182 /* ObjectLiteralExpression */: - case 203 /* ClassExpression */: - case 190 /* FunctionExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 187 /* NewExpression */: + case 186 /* CallExpression */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 258 /* JsxFragment */: + case 188 /* TaggedTemplateExpression */: + case 182 /* ArrayLiteralExpression */: + case 190 /* ParenthesizedExpression */: + case 183 /* ObjectLiteralExpression */: + case 204 /* ClassExpression */: + case 191 /* FunctionExpression */: case 71 /* Identifier */: case 12 /* RegularExpressionLiteral */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 13 /* NoSubstitutionTemplateLiteral */: - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: case 86 /* FalseKeyword */: case 95 /* NullKeyword */: case 99 /* ThisKeyword */: case 101 /* TrueKeyword */: case 97 /* SuperKeyword */: - case 207 /* NonNullExpression */: - case 208 /* MetaProperty */: + case 208 /* NonNullExpression */: + case 209 /* MetaProperty */: case 91 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -11888,13 +11941,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: - case 192 /* DeleteExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 195 /* AwaitExpression */: - case 188 /* TypeAssertionExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 193 /* DeleteExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 196 /* AwaitExpression */: + case 189 /* TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -11903,9 +11956,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return true; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return expr.operator === 43 /* PlusPlusToken */ || expr.operator === 44 /* MinusMinusToken */; default: @@ -11924,15 +11977,15 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 199 /* ConditionalExpression */: - case 201 /* YieldExpression */: - case 191 /* ArrowFunction */: - case 198 /* BinaryExpression */: - case 202 /* SpreadElement */: - case 206 /* AsExpression */: - case 204 /* OmittedExpression */: - case 296 /* CommaListExpression */: - case 295 /* PartiallyEmittedExpression */: + case 200 /* ConditionalExpression */: + case 202 /* YieldExpression */: + case 192 /* ArrowFunction */: + case 199 /* BinaryExpression */: + case 203 /* SpreadElement */: + case 207 /* AsExpression */: + case 205 /* OmittedExpression */: + case 297 /* CommaListExpression */: + case 296 /* PartiallyEmittedExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -11940,18 +11993,18 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 188 /* TypeAssertionExpression */ - || kind === 206 /* AsExpression */; + return kind === 189 /* TypeAssertionExpression */ + || kind === 207 /* AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ function isPartiallyEmittedExpression(node) { - return node.kind === 295 /* PartiallyEmittedExpression */; + return node.kind === 296 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; /* @internal */ function isNotEmittedStatement(node) { - return node.kind === 294 /* NotEmittedStatement */; + return node.kind === 295 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ @@ -11962,13 +12015,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return true; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -11976,7 +12029,7 @@ var ts; ts.isIterationStatement = isIterationStatement; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 219 /* ForInStatement */ || node.kind === 220 /* ForOfStatement */; + return node.kind === 220 /* ForInStatement */ || node.kind === 221 /* ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -12000,111 +12053,111 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 238 /* ModuleBlock */ - || kind === 237 /* ModuleDeclaration */ + return kind === 239 /* ModuleBlock */ + || kind === 238 /* ModuleDeclaration */ || kind === 71 /* Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 238 /* ModuleBlock */ - || kind === 237 /* ModuleDeclaration */; + return kind === 239 /* ModuleBlock */ + || kind === 238 /* ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 71 /* Identifier */ - || kind === 237 /* ModuleDeclaration */; + || kind === 238 /* ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 245 /* NamedImports */ - || kind === 244 /* NamespaceImport */; + return kind === 246 /* NamedImports */ + || kind === 245 /* NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */ || node.kind === 236 /* EnumDeclaration */; + return node.kind === 238 /* ModuleDeclaration */ || node.kind === 237 /* EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 191 /* ArrowFunction */ - || kind === 180 /* BindingElement */ - || kind === 233 /* ClassDeclaration */ - || kind === 203 /* ClassExpression */ + return kind === 192 /* ArrowFunction */ + || kind === 181 /* BindingElement */ + || kind === 234 /* ClassDeclaration */ + || kind === 204 /* ClassExpression */ || kind === 154 /* Constructor */ - || kind === 236 /* EnumDeclaration */ - || kind === 271 /* EnumMember */ - || kind === 250 /* ExportSpecifier */ - || kind === 232 /* FunctionDeclaration */ - || kind === 190 /* FunctionExpression */ + || kind === 237 /* EnumDeclaration */ + || kind === 272 /* EnumMember */ + || kind === 251 /* ExportSpecifier */ + || kind === 233 /* FunctionDeclaration */ + || kind === 191 /* FunctionExpression */ || kind === 155 /* GetAccessor */ - || kind === 243 /* ImportClause */ - || kind === 241 /* ImportEqualsDeclaration */ - || kind === 246 /* ImportSpecifier */ - || kind === 234 /* InterfaceDeclaration */ - || kind === 260 /* JsxAttribute */ + || kind === 244 /* ImportClause */ + || kind === 242 /* ImportEqualsDeclaration */ + || kind === 247 /* ImportSpecifier */ + || kind === 235 /* InterfaceDeclaration */ + || kind === 261 /* JsxAttribute */ || kind === 153 /* MethodDeclaration */ || kind === 152 /* MethodSignature */ - || kind === 237 /* ModuleDeclaration */ - || kind === 240 /* NamespaceExportDeclaration */ - || kind === 244 /* NamespaceImport */ + || kind === 238 /* ModuleDeclaration */ + || kind === 241 /* NamespaceExportDeclaration */ + || kind === 245 /* NamespaceImport */ || kind === 148 /* Parameter */ - || kind === 268 /* PropertyAssignment */ + || kind === 269 /* PropertyAssignment */ || kind === 151 /* PropertyDeclaration */ || kind === 150 /* PropertySignature */ || kind === 156 /* SetAccessor */ - || kind === 269 /* ShorthandPropertyAssignment */ - || kind === 235 /* TypeAliasDeclaration */ + || kind === 270 /* ShorthandPropertyAssignment */ + || kind === 236 /* TypeAliasDeclaration */ || kind === 147 /* TypeParameter */ - || kind === 230 /* VariableDeclaration */ - || kind === 291 /* JSDocTypedefTag */; + || kind === 231 /* VariableDeclaration */ + || kind === 292 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { - return kind === 232 /* FunctionDeclaration */ - || kind === 251 /* MissingDeclaration */ - || kind === 233 /* ClassDeclaration */ - || kind === 234 /* InterfaceDeclaration */ - || kind === 235 /* TypeAliasDeclaration */ - || kind === 236 /* EnumDeclaration */ - || kind === 237 /* ModuleDeclaration */ - || kind === 242 /* ImportDeclaration */ - || kind === 241 /* ImportEqualsDeclaration */ - || kind === 248 /* ExportDeclaration */ - || kind === 247 /* ExportAssignment */ - || kind === 240 /* NamespaceExportDeclaration */; + return kind === 233 /* FunctionDeclaration */ + || kind === 252 /* MissingDeclaration */ + || kind === 234 /* ClassDeclaration */ + || kind === 235 /* InterfaceDeclaration */ + || kind === 236 /* TypeAliasDeclaration */ + || kind === 237 /* EnumDeclaration */ + || kind === 238 /* ModuleDeclaration */ + || kind === 243 /* ImportDeclaration */ + || kind === 242 /* ImportEqualsDeclaration */ + || kind === 249 /* ExportDeclaration */ + || kind === 248 /* ExportAssignment */ + || kind === 241 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 222 /* BreakStatement */ - || kind === 221 /* ContinueStatement */ - || kind === 229 /* DebuggerStatement */ - || kind === 216 /* DoStatement */ - || kind === 214 /* ExpressionStatement */ - || kind === 213 /* EmptyStatement */ - || kind === 219 /* ForInStatement */ - || kind === 220 /* ForOfStatement */ - || kind === 218 /* ForStatement */ - || kind === 215 /* IfStatement */ - || kind === 226 /* LabeledStatement */ - || kind === 223 /* ReturnStatement */ - || kind === 225 /* SwitchStatement */ - || kind === 227 /* ThrowStatement */ - || kind === 228 /* TryStatement */ - || kind === 212 /* VariableStatement */ - || kind === 217 /* WhileStatement */ - || kind === 224 /* WithStatement */ - || kind === 294 /* NotEmittedStatement */ - || kind === 298 /* EndOfDeclarationMarker */ - || kind === 297 /* MergeDeclarationMarker */; + return kind === 223 /* BreakStatement */ + || kind === 222 /* ContinueStatement */ + || kind === 230 /* DebuggerStatement */ + || kind === 217 /* DoStatement */ + || kind === 215 /* ExpressionStatement */ + || kind === 214 /* EmptyStatement */ + || kind === 220 /* ForInStatement */ + || kind === 221 /* ForOfStatement */ + || kind === 219 /* ForStatement */ + || kind === 216 /* IfStatement */ + || kind === 227 /* LabeledStatement */ + || kind === 224 /* ReturnStatement */ + || kind === 226 /* SwitchStatement */ + || kind === 228 /* ThrowStatement */ + || kind === 229 /* TryStatement */ + || kind === 213 /* VariableStatement */ + || kind === 218 /* WhileStatement */ + || kind === 225 /* WithStatement */ + || kind === 295 /* NotEmittedStatement */ + || kind === 299 /* EndOfDeclarationMarker */ + || kind === 298 /* MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { if (node.kind === 147 /* TypeParameter */) { - return node.parent.kind !== 290 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); + return node.parent.kind !== 291 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -12131,10 +12184,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 211 /* Block */) + if (node.kind !== 212 /* Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 228 /* TryStatement */ || node.parent.kind === 267 /* CatchClause */) { + if (node.parent.kind === 229 /* TryStatement */ || node.parent.kind === 268 /* CatchClause */) { return false; } } @@ -12144,7 +12197,7 @@ var ts; /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 252 /* ExternalModuleReference */ + return kind === 253 /* ExternalModuleReference */ || kind === 145 /* QualifiedName */ || kind === 71 /* Identifier */; } @@ -12155,62 +12208,62 @@ var ts; var kind = node.kind; return kind === 99 /* ThisKeyword */ || kind === 71 /* Identifier */ - || kind === 183 /* PropertyAccessExpression */; + || kind === 184 /* PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 253 /* JsxElement */ - || kind === 263 /* JsxExpression */ - || kind === 254 /* JsxSelfClosingElement */ + return kind === 254 /* JsxElement */ + || kind === 264 /* JsxExpression */ + || kind === 255 /* JsxSelfClosingElement */ || kind === 10 /* JsxText */ - || kind === 257 /* JsxFragment */; + || kind === 258 /* JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 260 /* JsxAttribute */ - || kind === 262 /* JsxSpreadAttribute */; + return kind === 261 /* JsxAttribute */ + || kind === 263 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 263 /* JsxExpression */; + || kind === 264 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 255 /* JsxOpeningElement */ - || kind === 254 /* JsxSelfClosingElement */; + return kind === 256 /* JsxOpeningElement */ + || kind === 255 /* JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 264 /* CaseClause */ - || kind === 265 /* DefaultClause */; + return kind === 265 /* CaseClause */ + || kind === 266 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 274 /* FirstJSDocNode */ && node.kind <= 292 /* LastJSDocNode */; + return node.kind >= 275 /* FirstJSDocNode */ && node.kind <= 293 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 282 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); + return node.kind === 283 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 284 /* FirstJSDocTagNode */ && node.kind <= 292 /* LastJSDocTagNode */; + return node.kind >= 285 /* FirstJSDocTagNode */ && node.kind <= 293 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -12254,19 +12307,19 @@ var ts; case 172 /* ParenthesizedType */: case 174 /* TypeOperator */: case 176 /* MappedType */: - case 188 /* TypeAssertionExpression */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 206 /* AsExpression */: - case 230 /* VariableDeclaration */: - case 232 /* FunctionDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 274 /* JSDocTypeExpression */: - case 277 /* JSDocNullableType */: - case 278 /* JSDocNonNullableType */: - case 279 /* JSDocOptionalType */: - case 280 /* JSDocFunctionType */: - case 281 /* JSDocVariadicType */: + case 189 /* TypeAssertionExpression */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 207 /* AsExpression */: + case 231 /* VariableDeclaration */: + case 233 /* FunctionDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 275 /* JSDocTypeExpression */: + case 278 /* JSDocNullableType */: + case 279 /* JSDocNonNullableType */: + case 280 /* JSDocOptionalType */: + case 281 /* JSDocFunctionType */: + case 282 /* JSDocVariadicType */: return true; } return false; @@ -12286,10 +12339,10 @@ var ts; ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { switch (node.kind) { - case 260 /* JsxAttribute */: - case 262 /* JsxSpreadAttribute */: - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 261 /* JsxAttribute */: + case 263 /* JsxSpreadAttribute */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: @@ -12301,7 +12354,7 @@ var ts; ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 161 /* TypeReference */ || node.kind === 205 /* ExpressionWithTypeArguments */; + return node.kind === 161 /* TypeReference */ || node.kind === 206 /* ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14238,7 +14291,7 @@ var ts; var SourceFileConstructor; // tslint:enable variable-name function createNode(kind, pos, end) { - if (kind === 272 /* SourceFile */) { + if (kind === 273 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71 /* Identifier */) { @@ -14302,14 +14355,14 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return visitNode(cbNode, node.expression); case 148 /* Parameter */: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -14334,20 +14387,20 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.initializer); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || @@ -14369,9 +14422,9 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -14406,6 +14459,10 @@ var ts; visitNode(cbNode, node.falseType); case 171 /* InferType */: return visitNode(cbNode, node.typeParameter); + case 178 /* ImportType */: + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); case 172 /* ParenthesizedType */: case 174 /* TypeOperator */: return visitNode(cbNode, node.type); @@ -14419,262 +14476,262 @@ var ts; visitNode(cbNode, node.type); case 177 /* LiteralType */: return visitNode(cbNode, node.literal); - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: return visitNodes(cbNode, cbNodes, node.elements); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return visitNodes(cbNode, cbNodes, node.elements); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitNodes(cbNode, cbNodes, node.properties); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNodes(cbNode, cbNodes, node.arguments); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 206 /* AsExpression */: + case 207 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return visitNode(cbNode, node.expression); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return visitNode(cbNode, node.name); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 211 /* Block */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 239 /* ModuleBlock */: return visitNodes(cbNode, cbNodes, node.statements); - case 272 /* SourceFile */: + case 273 /* SourceFile */: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return visitNodes(cbNode, cbNodes, node.declarations); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitNode(cbNode, node.awaitModifier) || visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: return visitNode(cbNode, node.label); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return visitNodes(cbNode, cbNodes, node.clauses); - case 264 /* CaseClause */: + case 265 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return visitNodes(cbNode, cbNodes, node.statements); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 149 /* Decorator */: return visitNode(cbNode, node.expression); - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return visitNodes(cbNode, cbNodes, node.decorators) || 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 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || 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 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); - case 271 /* EnumMember */: + case 272 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return visitNodes(cbNode, cbNodes, node.elements); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 146 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return visitNodes(cbNode, cbNodes, node.types); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 251 /* MissingDeclaration */: + case 252 /* MissingDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators); - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); - case 253 /* JsxElement */: + case 254 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return visitNode(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingFragment); - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.attributes); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return visitNodes(cbNode, cbNodes, node.properties); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 274 /* JSDocTypeExpression */: + case 275 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 278 /* JSDocNonNullableType */: + case 279 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 282 /* JSDocComment */: + case 283 /* JSDocComment */: return visitNodes(cbNode, cbNodes, node.tags); - case 287 /* JSDocParameterTag */: - case 292 /* JSDocPropertyTag */: + case 288 /* JSDocParameterTag */: + case 293 /* JSDocPropertyTag */: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -14683,17 +14740,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 288 /* JSDocReturnTag */: + case 289 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 289 /* JSDocTypeTag */: + case 290 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 285 /* JSDocAugmentsTag */: + case 286 /* JSDocAugmentsTag */: return visitNode(cbNode, node.class); - case 290 /* JSDocTemplateTag */: + case 291 /* JSDocTemplateTag */: return visitNodes(cbNode, cbNodes, node.typeParameters); - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: if (node.typeExpression && - node.typeExpression.kind === 274 /* JSDocTypeExpression */) { + node.typeExpression.kind === 275 /* JSDocTypeExpression */) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -14701,7 +14758,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 283 /* JSDocTypeLiteral */: + case 284 /* JSDocTypeLiteral */: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -14709,7 +14766,7 @@ var ts; } } return; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); } } @@ -15032,7 +15089,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(272 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(273 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -15836,7 +15893,7 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 151 /* PropertyDeclaration */: - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: return true; case 153 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal @@ -15853,8 +15910,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: return true; } } @@ -15863,42 +15920,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 212 /* VariableStatement */: - case 211 /* Block */: - case 215 /* IfStatement */: - case 214 /* ExpressionStatement */: - case 227 /* ThrowStatement */: - case 223 /* ReturnStatement */: - case 225 /* SwitchStatement */: - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 218 /* ForStatement */: - case 217 /* WhileStatement */: - case 224 /* WithStatement */: - case 213 /* EmptyStatement */: - case 228 /* TryStatement */: - case 226 /* LabeledStatement */: - case 216 /* DoStatement */: - case 229 /* DebuggerStatement */: - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: - case 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 233 /* FunctionDeclaration */: + case 213 /* VariableStatement */: + case 212 /* Block */: + case 216 /* IfStatement */: + case 215 /* ExpressionStatement */: + case 228 /* ThrowStatement */: + case 224 /* ReturnStatement */: + case 226 /* SwitchStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 219 /* ForStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: + case 214 /* EmptyStatement */: + case 229 /* TryStatement */: + case 227 /* LabeledStatement */: + case 217 /* DoStatement */: + case 230 /* DebuggerStatement */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 236 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 271 /* EnumMember */; + return node.kind === 272 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { @@ -15914,7 +15971,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 230 /* VariableDeclaration */) { + if (node.kind !== 231 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -16101,7 +16158,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(200 /* TemplateExpression */); + var template = createNode(201 /* TemplateExpression */); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 14 /* TemplateHead */, "Template head has wrong token kind"); var list = []; @@ -16113,7 +16170,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(209 /* TemplateSpan */); + var span = createNode(210 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token() === 18 /* CloseBraceToken */) { @@ -16184,9 +16241,9 @@ var ts; return finishNode(node); } function parseJSDocAllType(postFixEquals) { - var result = createNode(275 /* JSDocAllType */); + var result = createNode(276 /* JSDocAllType */); if (postFixEquals) { - return createJSDocPostfixType(279 /* JSDocOptionalType */, result); + return createJSDocPostfixType(280 /* JSDocOptionalType */, result); } else { nextToken(); @@ -16194,7 +16251,7 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(278 /* JSDocNonNullableType */); + var result = createNode(279 /* JSDocNonNullableType */); nextToken(); result.type = parseNonArrayType(); return finishNode(result); @@ -16218,18 +16275,18 @@ var ts; token() === 29 /* GreaterThanToken */ || token() === 58 /* EqualsToken */ || token() === 49 /* BarToken */) { - var result = createNode(276 /* JSDocUnknownType */, pos); + var result = createNode(277 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(277 /* JSDocNullableType */, pos); + var result = createNode(278 /* JSDocNullableType */, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNodeWithJSDoc(280 /* JSDocFunctionType */); + var result = createNodeWithJSDoc(281 /* JSDocFunctionType */); nextToken(); fillSignature(56 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result); return finishNode(result); @@ -16251,12 +16308,12 @@ var ts; var dotdotdot = parseOptionalToken(24 /* DotDotDotToken */); var type = parseType(); if (dotdotdot) { - var variadic = createNode(281 /* JSDocVariadicType */, dotdotdot.pos); + var variadic = createNode(282 /* JSDocVariadicType */, dotdotdot.pos); variadic.type = type; type = finishNode(variadic); } if (token() === 58 /* EqualsToken */) { - return createJSDocPostfixType(279 /* JSDocOptionalType */, type); + return createJSDocPostfixType(280 /* JSDocOptionalType */, type); } return type; } @@ -16634,7 +16691,7 @@ var ts; var node = createNode(177 /* LiteralType */); var unaryMinusExpression; if (negative) { - unaryMinusExpression = createNode(196 /* PrefixUnaryExpression */); + unaryMinusExpression = createNode(197 /* PrefixUnaryExpression */); unaryMinusExpression.operator = 38 /* MinusToken */; nextToken(); } @@ -16649,6 +16706,26 @@ var ts; node.literal = expression; return finishNode(node); } + function isStartOfTypeOfImportType() { + nextToken(); + return token() === 91 /* ImportKeyword */; + } + function parseImportType() { + sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */; + var node = createNode(178 /* ImportType */); + if (parseOptional(103 /* TypeOfKeyword */)) { + node.isTypeOf = true; + } + parseExpected(91 /* ImportKeyword */); + parseExpected(19 /* OpenParenToken */); + node.argument = parseType(); + parseExpected(20 /* CloseParenToken */); + if (parseOptional(23 /* DotToken */)) { + node.qualifier = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected); + } + node.typeArguments = tryParseTypeArguments(); + return finishNode(node); + } function nextTokenIsNumericLiteral() { return nextToken() === 8 /* NumericLiteral */; } @@ -16695,13 +16772,15 @@ var ts; } } case 103 /* TypeOfKeyword */: - return parseTypeQuery(); + return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); case 17 /* OpenBraceToken */: return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); case 21 /* OpenBracketToken */: return parseTupleType(); case 19 /* OpenParenToken */: return parseParenthesizedType(); + case 91 /* ImportKeyword */: + return parseImportType(); default: return parseTypeReference(); } @@ -16736,6 +16815,7 @@ var ts; case 51 /* ExclamationToken */: case 24 /* DotDotDotToken */: case 126 /* InferKeyword */: + case 91 /* ImportKeyword */: return true; case 38 /* MinusToken */: return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral); @@ -16756,14 +16836,14 @@ var ts; while (!scanner.hasPrecedingLineBreak()) { switch (token()) { case 51 /* ExclamationToken */: - type = createJSDocPostfixType(278 /* JSDocNonNullableType */, type); + type = createJSDocPostfixType(279 /* JSDocNonNullableType */, type); break; case 55 /* QuestionToken */: // If not in JSDoc and next token is start of a type we have a conditional type if (!(contextFlags & 1048576 /* JSDoc */) && lookAhead(nextTokenIsStartOfType)) { return type; } - type = createJSDocPostfixType(277 /* JSDocNullableType */, type); + type = createJSDocPostfixType(278 /* JSDocNullableType */, type); break; case 21 /* OpenBracketToken */: parseExpected(21 /* OpenBracketToken */); @@ -17117,7 +17197,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(201 /* YieldExpression */); + var node = createNode(202 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -17139,11 +17219,11 @@ var ts; ts.Debug.assert(token() === 36 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(191 /* ArrowFunction */, asyncModifier.pos); + node = createNode(192 /* ArrowFunction */, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(191 /* ArrowFunction */, identifier.pos); + node = createNode(192 /* ArrowFunction */, identifier.pos); } var parameter = createNode(148 /* Parameter */, identifier.pos); parameter.name = identifier; @@ -17341,7 +17421,7 @@ var ts; return 0 /* False */; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNodeWithJSDoc(191 /* ArrowFunction */); + var node = createNodeWithJSDoc(192 /* ArrowFunction */); node.modifiers = parseModifiersForArrowFunction(); var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */; // Arrow functions are never generators. @@ -17407,7 +17487,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(199 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(200 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -17487,39 +17567,39 @@ var ts; return ts.getBinaryOperatorPrecedence(token()) > 0; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(198 /* BinaryExpression */, left.pos); + var node = createNode(199 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(206 /* AsExpression */, left.pos); + var node = createNode(207 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(196 /* PrefixUnaryExpression */); + var node = createNode(197 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(192 /* DeleteExpression */); + var node = createNode(193 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(193 /* TypeOfExpression */); + var node = createNode(194 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(194 /* VoidExpression */); + var node = createNode(195 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -17535,7 +17615,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(195 /* AwaitExpression */); + var node = createNode(196 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -17579,7 +17659,7 @@ var ts; if (token() === 40 /* AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 188 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 189 /* 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 { @@ -17676,7 +17756,7 @@ var ts; */ function parseUpdateExpression() { if (token() === 43 /* PlusPlusToken */ || token() === 44 /* MinusMinusToken */) { - var node = createNode(196 /* PrefixUnaryExpression */); + var node = createNode(197 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -17689,7 +17769,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 43 /* PlusPlusToken */ || token() === 44 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(197 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(198 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -17804,7 +17884,7 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(183 /* PropertyAccessExpression */, expression.pos); + var node = createNode(184 /* PropertyAccessExpression */, expression.pos); node.expression = expression; parseExpectedToken(23 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -17829,8 +17909,8 @@ var ts; function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 255 /* JsxOpeningElement */) { - var node = createNode(253 /* JsxElement */, opening.pos); + if (opening.kind === 256 /* JsxOpeningElement */) { + var node = createNode(254 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -17839,15 +17919,15 @@ var ts; } result = finishNode(node); } - else if (opening.kind === 258 /* JsxOpeningFragment */) { - var node = createNode(257 /* JsxFragment */, opening.pos); + else if (opening.kind === 259 /* JsxOpeningFragment */) { + var node = createNode(258 /* JsxFragment */, opening.pos); node.openingFragment = opening; node.children = parseJsxChildren(node.openingFragment); node.closingFragment = parseJsxClosingFragment(inExpressionContext); result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 254 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 255 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -17862,7 +17942,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(198 /* BinaryExpression */, result.pos); + var badNode = createNode(199 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -17920,7 +18000,7 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(261 /* JsxAttributes */); + var jsxAttributes = createNode(262 /* JsxAttributes */); jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute); return finishNode(jsxAttributes); } @@ -17929,7 +18009,7 @@ var ts; parseExpected(27 /* LessThanToken */); if (token() === 29 /* GreaterThanToken */) { // See below for explanation of scanJsxText - var node_1 = createNode(258 /* JsxOpeningFragment */, fullStart); + var node_1 = createNode(259 /* JsxOpeningFragment */, fullStart); scanJsxText(); return finishNode(node_1); } @@ -17941,7 +18021,7 @@ var ts; // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(255 /* JsxOpeningElement */, fullStart); + node = createNode(256 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -17953,7 +18033,7 @@ var ts; parseExpected(29 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(254 /* JsxSelfClosingElement */, fullStart); + node = createNode(255 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.typeArguments = typeArguments; @@ -17970,7 +18050,7 @@ var ts; var expression = token() === 99 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName(); while (parseOptional(23 /* DotToken */)) { - var propertyAccess = createNode(183 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(184 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17978,7 +18058,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(263 /* JsxExpression */); + var node = createNode(264 /* JsxExpression */); if (!parseExpected(17 /* OpenBraceToken */)) { return undefined; } @@ -18000,7 +18080,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(260 /* JsxAttribute */); + var node = createNode(261 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 58 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -18015,7 +18095,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(262 /* JsxSpreadAttribute */); + var node = createNode(263 /* JsxSpreadAttribute */); parseExpected(17 /* OpenBraceToken */); parseExpected(24 /* DotDotDotToken */); node.expression = parseExpression(); @@ -18023,7 +18103,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(256 /* JsxClosingElement */); + var node = createNode(257 /* JsxClosingElement */); parseExpected(28 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -18036,7 +18116,7 @@ var ts; return finishNode(node); } function parseJsxClosingFragment(inExpressionContext) { - var node = createNode(259 /* JsxClosingFragment */); + var node = createNode(260 /* JsxClosingFragment */); parseExpected(28 /* LessThanSlashToken */); if (ts.tokenIsIdentifierOrKeyword(token())) { parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); @@ -18051,7 +18131,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(188 /* TypeAssertionExpression */); + var node = createNode(189 /* TypeAssertionExpression */); parseExpected(27 /* LessThanToken */); node.type = parseType(); parseExpected(29 /* GreaterThanToken */); @@ -18062,7 +18142,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(23 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(183 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(184 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -18070,14 +18150,14 @@ var ts; } if (token() === 51 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(207 /* NonNullExpression */, expression.pos); + var nonNullExpression = createNode(208 /* NonNullExpression */, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(21 /* OpenBracketToken */)) { - var indexedAccess = createNode(184 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(185 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -18093,7 +18173,7 @@ var ts; continue; } if (token() === 13 /* NoSubstitutionTemplateLiteral */ || token() === 14 /* TemplateHead */) { - var tagExpression = createNode(187 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(188 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 13 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -18116,7 +18196,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(185 /* CallExpression */, expression.pos); + var callExpr = createNode(186 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -18124,7 +18204,7 @@ var ts; continue; } else if (token() === 19 /* OpenParenToken */) { - var callExpr = createNode(185 /* CallExpression */, expression.pos); + var callExpr = createNode(186 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -18234,28 +18314,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNodeWithJSDoc(189 /* ParenthesizedExpression */); + var node = createNodeWithJSDoc(190 /* ParenthesizedExpression */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(20 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(202 /* SpreadElement */); + var node = createNode(203 /* SpreadElement */); parseExpected(24 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 24 /* DotDotDotToken */ ? parseSpreadElement() : - token() === 26 /* CommaToken */ ? createNode(204 /* OmittedExpression */) : + token() === 26 /* CommaToken */ ? createNode(205 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(181 /* ArrayLiteralExpression */); + var node = createNode(182 /* ArrayLiteralExpression */); parseExpected(21 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -18267,7 +18347,7 @@ var ts; function parseObjectLiteralElement() { var node = createNodeWithJSDoc(0 /* Unknown */); if (parseOptionalToken(24 /* DotDotDotToken */)) { - node.kind = 270 /* SpreadAssignment */; + node.kind = 271 /* SpreadAssignment */; node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -18294,7 +18374,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 /* CommaToken */ || token() === 18 /* CloseBraceToken */ || token() === 58 /* EqualsToken */); if (isShorthandPropertyAssignment) { - node.kind = 269 /* ShorthandPropertyAssignment */; + node.kind = 270 /* ShorthandPropertyAssignment */; var equalsToken = parseOptionalToken(58 /* EqualsToken */); if (equalsToken) { node.equalsToken = equalsToken; @@ -18302,14 +18382,14 @@ var ts; } } else { - node.kind = 268 /* PropertyAssignment */; + node.kind = 269 /* PropertyAssignment */; parseExpected(56 /* ColonToken */); node.initializer = allowInAnd(parseAssignmentExpressionOrHigher); } return finishNode(node); } function parseObjectLiteralExpression() { - var node = createNode(182 /* ObjectLiteralExpression */); + var node = createNode(183 /* ObjectLiteralExpression */); parseExpected(17 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -18328,7 +18408,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNodeWithJSDoc(190 /* FunctionExpression */); + var node = createNodeWithJSDoc(191 /* FunctionExpression */); node.modifiers = parseModifiers(); parseExpected(89 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(39 /* AsteriskToken */); @@ -18353,12 +18433,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94 /* NewKeyword */); if (parseOptional(23 /* DotToken */)) { - var node_2 = createNode(208 /* MetaProperty */, fullStart); + var node_2 = createNode(209 /* MetaProperty */, fullStart); node_2.keywordToken = 94 /* NewKeyword */; node_2.name = parseIdentifierName(); return finishNode(node_2); } - var node = createNode(186 /* NewExpression */, fullStart); + var node = createNode(187 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 19 /* OpenParenToken */) { @@ -18368,7 +18448,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(211 /* Block */); + var node = createNode(212 /* Block */); if (parseExpected(17 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -18401,12 +18481,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(213 /* EmptyStatement */); + var node = createNode(214 /* EmptyStatement */); parseExpected(25 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(215 /* IfStatement */); + var node = createNode(216 /* IfStatement */); parseExpected(90 /* IfKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -18416,7 +18496,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(216 /* DoStatement */); + var node = createNode(217 /* DoStatement */); parseExpected(81 /* DoKeyword */); node.statement = parseStatement(); parseExpected(106 /* WhileKeyword */); @@ -18431,7 +18511,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(217 /* WhileStatement */); + var node = createNode(218 /* WhileStatement */); parseExpected(106 /* WhileKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -18455,7 +18535,7 @@ var ts; } var forOrForInOrForOfStatement; if (awaitToken ? parseExpected(144 /* OfKeyword */) : parseOptional(144 /* OfKeyword */)) { - var forOfStatement = createNode(220 /* ForOfStatement */, pos); + var forOfStatement = createNode(221 /* ForOfStatement */, pos); forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); @@ -18463,14 +18543,14 @@ var ts; forOrForInOrForOfStatement = forOfStatement; } else if (parseOptional(92 /* InKeyword */)) { - var forInStatement = createNode(219 /* ForInStatement */, pos); + var forInStatement = createNode(220 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(20 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } else { - var forStatement = createNode(218 /* ForStatement */, pos); + var forStatement = createNode(219 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(25 /* SemicolonToken */); if (token() !== 25 /* SemicolonToken */ && token() !== 20 /* CloseParenToken */) { @@ -18488,7 +18568,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 222 /* BreakStatement */ ? 72 /* BreakKeyword */ : 77 /* ContinueKeyword */); + parseExpected(kind === 223 /* BreakStatement */ ? 72 /* BreakKeyword */ : 77 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -18496,7 +18576,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(223 /* ReturnStatement */); + var node = createNode(224 /* ReturnStatement */); parseExpected(96 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -18505,7 +18585,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(224 /* WithStatement */); + var node = createNode(225 /* WithStatement */); parseExpected(107 /* WithKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -18514,7 +18594,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(264 /* CaseClause */); + var node = createNode(265 /* CaseClause */); parseExpected(73 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(56 /* ColonToken */); @@ -18522,7 +18602,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(265 /* DefaultClause */); + var node = createNode(266 /* DefaultClause */); parseExpected(79 /* DefaultKeyword */); parseExpected(56 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -18532,12 +18612,12 @@ var ts; return token() === 73 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(225 /* SwitchStatement */); + var node = createNode(226 /* SwitchStatement */); parseExpected(98 /* SwitchKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(20 /* CloseParenToken */); - var caseBlock = createNode(239 /* CaseBlock */); + var caseBlock = createNode(240 /* CaseBlock */); parseExpected(17 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(18 /* CloseBraceToken */); @@ -18552,7 +18632,7 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(227 /* ThrowStatement */); + var node = createNode(228 /* ThrowStatement */); parseExpected(100 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -18560,7 +18640,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(228 /* TryStatement */); + var node = createNode(229 /* TryStatement */); parseExpected(102 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token() === 74 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -18573,7 +18653,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(267 /* CatchClause */); + var result = createNode(268 /* CatchClause */); parseExpected(74 /* CatchKeyword */); if (parseOptional(19 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -18587,7 +18667,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(229 /* DebuggerStatement */); + var node = createNode(230 /* DebuggerStatement */); parseExpected(78 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -18599,12 +18679,12 @@ var ts; var node = createNodeWithJSDoc(0 /* Unknown */); var expression = allowInAnd(parseExpression); if (expression.kind === 71 /* Identifier */ && parseOptional(56 /* ColonToken */)) { - node.kind = 226 /* LabeledStatement */; + node.kind = 227 /* LabeledStatement */; node.label = expression; node.statement = parseStatement(); } else { - node.kind = 214 /* ExpressionStatement */; + node.kind = 215 /* ExpressionStatement */; node.expression = expression; parseSemicolon(); } @@ -18771,16 +18851,16 @@ var ts; case 17 /* OpenBraceToken */: return parseBlock(/*ignoreMissingOpenBrace*/ false); case 104 /* VarKeyword */: - return parseVariableStatement(createNodeWithJSDoc(230 /* VariableDeclaration */)); + return parseVariableStatement(createNodeWithJSDoc(231 /* VariableDeclaration */)); case 110 /* LetKeyword */: if (isLetDeclaration()) { - return parseVariableStatement(createNodeWithJSDoc(230 /* VariableDeclaration */)); + return parseVariableStatement(createNodeWithJSDoc(231 /* VariableDeclaration */)); } break; case 89 /* FunctionKeyword */: - return parseFunctionDeclaration(createNodeWithJSDoc(232 /* FunctionDeclaration */)); + return parseFunctionDeclaration(createNodeWithJSDoc(233 /* FunctionDeclaration */)); case 75 /* ClassKeyword */: - return parseClassDeclaration(createNodeWithJSDoc(233 /* ClassDeclaration */)); + return parseClassDeclaration(createNodeWithJSDoc(234 /* ClassDeclaration */)); case 90 /* IfKeyword */: return parseIfStatement(); case 81 /* DoKeyword */: @@ -18790,9 +18870,9 @@ var ts; case 88 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 77 /* ContinueKeyword */: - return parseBreakOrContinueStatement(221 /* ContinueStatement */); + return parseBreakOrContinueStatement(222 /* ContinueStatement */); case 72 /* BreakKeyword */: - return parseBreakOrContinueStatement(222 /* BreakStatement */); + return parseBreakOrContinueStatement(223 /* BreakStatement */); case 96 /* ReturnKeyword */: return parseReturnStatement(); case 107 /* WithKeyword */: @@ -18889,7 +18969,7 @@ var ts; if (node.decorators || node.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(251 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(252 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); missing.pos = node.pos; missing.decorators = node.decorators; missing.modifiers = node.modifiers; @@ -18911,16 +18991,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token() === 26 /* CommaToken */) { - return createNode(204 /* OmittedExpression */); + return createNode(205 /* OmittedExpression */); } - var node = createNode(180 /* BindingElement */); + var node = createNode(181 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(180 /* BindingElement */); + var node = createNode(181 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -18936,14 +19016,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(178 /* ObjectBindingPattern */); + var node = createNode(179 /* ObjectBindingPattern */); parseExpected(17 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(18 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(179 /* ArrayBindingPattern */); + var node = createNode(180 /* ArrayBindingPattern */); parseExpected(21 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(22 /* CloseBracketToken */); @@ -18965,7 +19045,7 @@ var ts; return parseVariableDeclaration(/*allowExclamation*/ true); } function parseVariableDeclaration(allowExclamation) { - var node = createNode(230 /* VariableDeclaration */); + var node = createNode(231 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); if (allowExclamation && node.name.kind === 71 /* Identifier */ && token() === 51 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { @@ -18978,7 +19058,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(231 /* VariableDeclarationList */); + var node = createNode(232 /* VariableDeclarationList */); switch (token()) { case 104 /* VarKeyword */: break; @@ -19016,13 +19096,13 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 20 /* CloseParenToken */; } function parseVariableStatement(node) { - node.kind = 212 /* VariableStatement */; + node.kind = 213 /* VariableStatement */; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(node) { - node.kind = 232 /* FunctionDeclaration */; + node.kind = 233 /* FunctionDeclaration */; parseExpected(89 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(39 /* AsteriskToken */); node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier(); @@ -19204,7 +19284,7 @@ var ts; } function parseClassElement() { if (token() === 25 /* SemicolonToken */) { - var result = createNode(210 /* SemicolonClassElement */); + var result = createNode(211 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -19241,10 +19321,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 203 /* ClassExpression */); + return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 204 /* ClassExpression */); } function parseClassDeclaration(node) { - return parseClassDeclarationOrExpression(node, 233 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(node, 234 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(node, kind) { node.kind = kind; @@ -19287,7 +19367,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 /* ExtendsKeyword */ || tok === 108 /* ImplementsKeyword */) { - var node = createNode(266 /* HeritageClause */); + var node = createNode(267 /* HeritageClause */); node.token = tok; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -19296,7 +19376,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(205 /* ExpressionWithTypeArguments */); + var node = createNode(206 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); node.typeArguments = tryParseTypeArguments(); return finishNode(node); @@ -19313,7 +19393,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(node) { - node.kind = 234 /* InterfaceDeclaration */; + node.kind = 235 /* InterfaceDeclaration */; parseExpected(109 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -19322,7 +19402,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(node) { - node.kind = 235 /* TypeAliasDeclaration */; + node.kind = 236 /* TypeAliasDeclaration */; parseExpected(139 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -19336,13 +19416,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNodeWithJSDoc(271 /* EnumMember */); + var node = createNodeWithJSDoc(272 /* EnumMember */); node.name = parsePropertyName(); node.initializer = allowInAnd(parseInitializer); return finishNode(node); } function parseEnumDeclaration(node) { - node.kind = 236 /* EnumDeclaration */; + node.kind = 237 /* EnumDeclaration */; parseExpected(83 /* EnumKeyword */); node.name = parseIdentifier(); if (parseExpected(17 /* OpenBraceToken */)) { @@ -19355,7 +19435,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(238 /* ModuleBlock */); + var node = createNode(239 /* ModuleBlock */); if (parseExpected(17 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(18 /* CloseBraceToken */); @@ -19366,7 +19446,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(node, flags) { - node.kind = 237 /* ModuleDeclaration */; + node.kind = 238 /* ModuleDeclaration */; // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 16 /* Namespace */; @@ -19378,7 +19458,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(node) { - node.kind = 237 /* ModuleDeclaration */; + node.kind = 238 /* ModuleDeclaration */; if (token() === 143 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); @@ -19424,7 +19504,7 @@ var ts; return nextToken() === 41 /* SlashToken */; } function parseNamespaceExportDeclaration(node) { - node.kind = 240 /* NamespaceExportDeclaration */; + node.kind = 241 /* NamespaceExportDeclaration */; parseExpected(118 /* AsKeyword */); parseExpected(130 /* NamespaceKeyword */); node.name = parseIdentifier(); @@ -19442,7 +19522,7 @@ var ts; } } // Import statement - node.kind = 242 /* ImportDeclaration */; + node.kind = 243 /* ImportDeclaration */; // ImportDeclaration: // import ImportClause from ModuleSpecifier ; // import ModuleSpecifier; @@ -19457,7 +19537,7 @@ var ts; return finishNode(node); } function parseImportEqualsDeclaration(node, identifier) { - node.kind = 241 /* ImportEqualsDeclaration */; + node.kind = 242 /* ImportEqualsDeclaration */; node.name = identifier; parseExpected(58 /* EqualsToken */); node.moduleReference = parseModuleReference(); @@ -19471,7 +19551,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(243 /* ImportClause */, fullStart); + var importClause = createNode(244 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -19481,7 +19561,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(26 /* CommaToken */)) { - importClause.namedBindings = token() === 39 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(245 /* NamedImports */); + importClause.namedBindings = token() === 39 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(246 /* NamedImports */); } return finishNode(importClause); } @@ -19491,7 +19571,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(252 /* ExternalModuleReference */); + var node = createNode(253 /* ExternalModuleReference */); parseExpected(133 /* RequireKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -19514,7 +19594,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(244 /* NamespaceImport */); + var namespaceImport = createNode(245 /* NamespaceImport */); parseExpected(39 /* AsteriskToken */); parseExpected(118 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -19529,14 +19609,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 245 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 17 /* OpenBraceToken */, 18 /* CloseBraceToken */); + node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 246 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 17 /* OpenBraceToken */, 18 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(250 /* ExportSpecifier */); + return parseImportOrExportSpecifier(251 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(246 /* ImportSpecifier */); + return parseImportOrExportSpecifier(247 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -19561,19 +19641,19 @@ var ts; else { node.name = identifierName; } - if (kind === 246 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 247 /* ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(node) { - node.kind = 248 /* ExportDeclaration */; + node.kind = 249 /* ExportDeclaration */; if (parseOptional(39 /* AsteriskToken */)) { parseExpected(142 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(249 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(250 /* 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. @@ -19586,7 +19666,7 @@ var ts; return finishNode(node); } function parseExportAssignment(node) { - node.kind = 247 /* ExportAssignment */; + node.kind = 248 /* ExportAssignment */; if (parseOptional(58 /* EqualsToken */)) { node.isExportEquals = true; } @@ -19600,10 +19680,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1 /* Export */) - || node.kind === 241 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 252 /* ExternalModuleReference */ - || node.kind === 242 /* ImportDeclaration */ - || node.kind === 247 /* ExportAssignment */ - || node.kind === 248 /* ExportDeclaration */ + || node.kind === 242 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 253 /* ExternalModuleReference */ + || node.kind === 243 /* ImportDeclaration */ + || node.kind === 248 /* ExportAssignment */ + || node.kind === 249 /* ExportDeclaration */ ? node : undefined; }); @@ -19656,7 +19736,7 @@ var ts; JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; // Parses out a JSDoc type expression. function parseJSDocTypeExpression(mayOmitBraces) { - var result = createNode(274 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(275 /* JSDocTypeExpression */, scanner.getTokenPos()); var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(17 /* OpenBraceToken */); result.type = doInsideOfContext(1048576 /* JSDoc */, parseJSDocType); if (!mayOmitBraces || hasBrace) { @@ -19827,7 +19907,7 @@ var ts; } } function createJSDocComment() { - var result = createNode(282 /* JSDocComment */, start); + var result = createNode(283 /* JSDocComment */, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -19952,7 +20032,7 @@ var ts; return comments.length === 0 ? undefined : comments.join(""); } function parseUnknownTag(atToken, tagName) { - var result = createNode(284 /* JSDocTag */, atToken.pos); + var result = createNode(285 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -20009,9 +20089,9 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 /* Parameter */ ? - createNode(287 /* JSDocParameterTag */, atToken.pos) : - createNode(292 /* JSDocPropertyTag */, atToken.pos); - var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); + createNode(288 /* JSDocParameterTag */, atToken.pos) : + createNode(293 /* JSDocPropertyTag */, atToken.pos); + var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; isNameFirst = true; @@ -20024,18 +20104,20 @@ var ts; result.isBracketed = isBracketed; return finishNode(result); } - function parseNestedTypeLiteral(typeExpression, name) { + function parseNestedTypeLiteral(typeExpression, name, target) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(274 /* JSDocTypeExpression */, scanner.getTokenPos()); + var typeLiteralExpression = createNode(275 /* JSDocTypeExpression */, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); var children = void 0; - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(1 /* Parameter */, name); })) { - children = ts.append(children, child); + while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, name); })) { + if (child.kind === 288 /* JSDocParameterTag */ || child.kind === 293 /* JSDocPropertyTag */) { + children = ts.append(children, child); + } } if (children) { - jsdocTypeLiteral = createNode(283 /* JSDocTypeLiteral */, start_2); + jsdocTypeLiteral = createNode(284 /* JSDocTypeLiteral */, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 166 /* ArrayType */) { jsdocTypeLiteral.isArrayType = true; @@ -20046,27 +20128,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 288 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 289 /* JSDocReturnTag */; })) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(288 /* JSDocReturnTag */, atToken.pos); + var result = createNode(289 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 289 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 290 /* JSDocTypeTag */; })) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(289 /* JSDocTypeTag */, atToken.pos); + var result = createNode(290 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(285 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(286 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -20074,7 +20156,7 @@ var ts; } function parseExpressionWithTypeArgumentsForAugments() { var usedBrace = parseOptional(17 /* OpenBraceToken */); - var node = createNode(205 /* ExpressionWithTypeArguments */); + var node = createNode(206 /* ExpressionWithTypeArguments */); node.expression = parsePropertyAccessEntityNameExpression(); node.typeArguments = tryParseTypeArguments(); var res = finishNode(node); @@ -20086,7 +20168,7 @@ var ts; function parsePropertyAccessEntityNameExpression() { var node = parseJSDocIdentifierName(/*createIfMissing*/ true); while (parseOptional(23 /* DotToken */)) { - var prop = createNode(183 /* PropertyAccessExpression */, node.pos); + var prop = createNode(184 /* PropertyAccessExpression */, node.pos); prop.expression = node; prop.name = parseJSDocIdentifierName(); node = finishNode(prop); @@ -20094,7 +20176,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(286 /* JSDocClassTag */, atToken.pos); + var tag = createNode(287 /* JSDocClassTag */, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -20102,7 +20184,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(291 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(292 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); @@ -20125,11 +20207,11 @@ var ts; var jsdocTypeLiteral = void 0; var childTypeTag = void 0; var start_3 = scanner.getStartPos(); - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0 /* Property */); })) { + while (child = tryParse(function () { return parseChildPropertyTag(); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(283 /* JSDocTypeLiteral */, start_3); + jsdocTypeLiteral = createNode(284 /* JSDocTypeLiteral */, start_3); } - if (child.kind === 289 /* JSDocTypeTag */) { + if (child.kind === 290 /* JSDocTypeTag */) { if (childTypeTag) { break; } @@ -20155,7 +20237,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(23 /* DotToken */)) { - var jsDocNamespaceNode = createNode(237 /* ModuleDeclaration */, pos); + var jsDocNamespaceNode = createNode(238 /* ModuleDeclaration */, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */); @@ -20179,6 +20261,9 @@ var ts; } return a.escapedText === b.escapedText; } + function parseChildPropertyTag() { + return parseChildParameterOrPropertyTag(0 /* Property */); + } function parseChildParameterOrPropertyTag(target, name) { var canParseTag = true; var seenAsterisk = false; @@ -20187,7 +20272,7 @@ var ts; case 57 /* AtToken */: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 287 /* JSDocParameterTag */ && + if (child && child.kind === 288 /* JSDocParameterTag */ && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -20272,7 +20357,7 @@ var ts; break; } } - var result = createNode(290 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(291 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -22039,7 +22124,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 268 /* PropertyAssignment */) { + if (element.kind !== 269 /* PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -22114,13 +22199,13 @@ var ts; case 8 /* NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return Number(valueExpression.text); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: if (valueExpression.operator !== 38 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return -Number(valueExpression.operand.text); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -22137,7 +22222,7 @@ var ts; return convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined); } - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element); } @@ -22260,13 +22345,21 @@ var ts; function makePadding(paddingLength) { return Array(paddingLength + 1).join(" "); } + function isAllowedOption(_a) { + var category = _a.category, name = _a.name; + // Skip options which do not have a category or have category `Command_line_Options` + // Exclude all possible `Advanced_Options` in tsconfig.json which were NOT defined in command line + return category !== undefined + && category !== ts.Diagnostics.Command_line_Options + && (category !== ts.Diagnostics.Advanced_Options || compilerOptionsMap.has(name)); + } function writeConfigurations() { // Filter applicable options to place in the file var categorizedOptions = ts.createMultiMap(); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; var category = option.category; - if (category !== undefined && category !== ts.Diagnostics.Command_line_Options && category !== ts.Diagnostics.Advanced_Options) { + if (isAllowedOption(option)) { categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); } } @@ -23701,6 +23794,7 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); } + ts.Debug.assert(host.fileExists(real), path + " linked to nonexistent file " + real); // tslint:disable-line return real; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { @@ -24161,24 +24255,24 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: return 0 /* NonInstantiated */; // 2. const enum declarations - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: if (ts.isConst(node)) { return 2 /* ConstEnumOnly */; } break; // 3. non-exported import declarations - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: if (!(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } break; // 4. other uninstantiated module declarations. - case 238 /* ModuleBlock */: { + case 239 /* ModuleBlock */: { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateWorker(n); @@ -24200,7 +24294,7 @@ var ts; }); return state_1; } - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return getModuleInstanceState(node); case 71 /* Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -24347,7 +24441,7 @@ var ts; if (symbolFlags & 67216319 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 237 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 238 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -24356,7 +24450,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 === 247 /* ExportAssignment */) { + if (node.kind === 248 /* ExportAssignment */) { return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */; } var name = ts.getNameOfDeclaration(node); @@ -24387,28 +24481,28 @@ var ts; return "__new" /* New */; case 159 /* IndexSignature */: return "__index" /* Index */; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return "__export" /* ExportStar */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (ts.getSpecialPropertyAssignmentKind(node) === 2 /* ModuleExports */) { // module.exports = ... return "export=" /* ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: return (ts.hasModifier(node, 512 /* Default */) ? "default" /* Default */ : undefined); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */); case 148 /* 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 === 280 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); + ts.Debug.assert(node.parent.kind === 281 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: var name_2 = ts.getNameOfJSDocTypedef(node); return typeof name_2 !== "undefined" ? name_2.escapedText : undefined; } @@ -24501,7 +24595,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 && - (isDefaultExport || (node.kind === 247 /* ExportAssignment */ && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 248 /* ExportAssignment */ && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -24526,7 +24620,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 2097152 /* Alias */) { - if (node.kind === 250 /* ExportSpecifier */ || (node.kind === 241 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 251 /* ExportSpecifier */ || (node.kind === 242 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -24548,7 +24642,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - if (node.kind === 291 /* JSDocTypedefTag */) + if (node.kind === 292 /* JSDocTypedefTag */) ts.Debug.assert(ts.isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. var isJSDocTypedefInJSDocNamespace = ts.isJSDocTypedefTag(node) && node.name && node.name.kind === 71 /* Identifier */ && node.name.isInJSDocNamespace; if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32 /* ExportContext */)) || isJSDocTypedefInJSDocNamespace) { @@ -24591,7 +24685,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 /* IsContainer */) { - if (node.kind !== 191 /* ArrowFunction */) { + if (node.kind !== 192 /* ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -24635,7 +24729,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { node.flags |= emitFlags; } if (currentReturnTarget) { @@ -24684,8 +24778,8 @@ var ts; } } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 232 /* FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 232 /* FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 233 /* FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 233 /* FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -24734,79 +24828,79 @@ var ts; return; } switch (node.kind) { - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: bindWhileStatement(node); break; - case 216 /* DoStatement */: + case 217 /* DoStatement */: bindDoStatement(node); break; - case 218 /* ForStatement */: + case 219 /* ForStatement */: bindForStatement(node); break; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 215 /* IfStatement */: + case 216 /* IfStatement */: bindIfStatement(node); break; - case 223 /* ReturnStatement */: - case 227 /* ThrowStatement */: + case 224 /* ReturnStatement */: + case 228 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 228 /* TryStatement */: + case 229 /* TryStatement */: bindTryStatement(node); break; - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: bindSwitchStatement(node); break; - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: bindCaseBlock(node); break; - case 264 /* CaseClause */: + case 265 /* CaseClause */: bindCaseClause(node); break; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: bindLabeledStatement(node); break; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: bindBinaryExpressionFlow(node); break; - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 185 /* CallExpression */: + case 186 /* CallExpression */: bindCallExpressionFlow(node); break; - case 282 /* JSDocComment */: + case 283 /* JSDocComment */: bindJSDocComment(node); break; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: bindJSDocTypedefTag(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 272 /* SourceFile */: + case 273 /* SourceFile */: bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; - case 211 /* Block */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 239 /* ModuleBlock */: bindEachFunctionsFirst(node.statements); break; default: @@ -24818,15 +24912,15 @@ var ts; switch (expr.kind) { case 71 /* Identifier */: case 99 /* ThisKeyword */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return isNarrowableReference(expr); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return hasNarrowableArgument(expr); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isNarrowingExpression(expr.expression); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return expr.operator === 51 /* ExclamationToken */ && isNarrowingExpression(expr.operand); } return false; @@ -24835,7 +24929,7 @@ var ts; return expr.kind === 71 /* Identifier */ || expr.kind === 99 /* ThisKeyword */ || expr.kind === 97 /* SuperKeyword */ || - expr.kind === 183 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); + expr.kind === 184 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -24846,7 +24940,7 @@ var ts; } } } - if (expr.expression.kind === 183 /* PropertyAccessExpression */ && + if (expr.expression.kind === 184 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression.expression)) { return true; } @@ -24879,9 +24973,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (expr.operatorToken.kind) { case 58 /* EqualsToken */: return isNarrowableOperand(expr.left); @@ -24959,33 +25053,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 215 /* IfStatement */: - case 217 /* WhileStatement */: - case 216 /* DoStatement */: + case 216 /* IfStatement */: + case 218 /* WhileStatement */: + case 217 /* DoStatement */: return parent.expression === node; - case 218 /* ForStatement */: - case 199 /* ConditionalExpression */: + case 219 /* ForStatement */: + case 200 /* ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 189 /* ParenthesizedExpression */) { + if (node.kind === 190 /* ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 196 /* PrefixUnaryExpression */ && node.operator === 51 /* ExclamationToken */) { + else if (node.kind === 197 /* PrefixUnaryExpression */ && node.operator === 51 /* ExclamationToken */) { node = node.operand; } else { - return node.kind === 198 /* BinaryExpression */ && (node.operatorToken.kind === 53 /* AmpersandAmpersandToken */ || + return node.kind === 199 /* BinaryExpression */ && (node.operatorToken.kind === 53 /* AmpersandAmpersandToken */ || node.operatorToken.kind === 54 /* BarBarToken */); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 189 /* ParenthesizedExpression */ || - node.parent.kind === 196 /* PrefixUnaryExpression */ && + while (node.parent.kind === 190 /* ParenthesizedExpression */ || + node.parent.kind === 197 /* PrefixUnaryExpression */ && node.parent.operator === 51 /* ExclamationToken */) { node = node.parent; } @@ -25027,7 +25121,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 226 /* LabeledStatement */ + var enclosingLabeledStatement = node.parent.kind === 227 /* LabeledStatement */ ? ts.lastOrUndefined(activeLabels) : undefined; // if do statement is wrapped in labeled statement then target labels for break/continue with or without @@ -25061,13 +25155,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 220 /* ForOfStatement */) { + if (node.kind === 221 /* ForOfStatement */) { bind(node.awaitModifier); } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 231 /* VariableDeclarationList */) { + if (node.initializer.kind !== 232 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -25089,7 +25183,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 223 /* ReturnStatement */) { + if (node.kind === 224 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -25109,7 +25203,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 222 /* BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 223 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -25205,7 +25299,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 265 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 266 /* 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). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -25272,14 +25366,14 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 216 /* DoStatement */) { + if (!node.statement || node.statement.kind !== 217 /* DoStatement */) { // do statement sets current flow inside bindDoStatement addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 198 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */) { + if (node.kind === 199 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -25290,10 +25384,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 181 /* ArrayLiteralExpression */) { + else if (node.kind === 182 /* ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 202 /* SpreadElement */) { + if (e.kind === 203 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -25301,16 +25395,16 @@ var ts; } } } - else if (node.kind === 182 /* ObjectLiteralExpression */) { + else if (node.kind === 183 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 268 /* PropertyAssignment */) { + if (p.kind === 269 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 269 /* ShorthandPropertyAssignment */) { + else if (p.kind === 270 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 270 /* SpreadAssignment */) { + else if (p.kind === 271 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -25366,7 +25460,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 58 /* EqualsToken */ && node.left.kind === 184 /* ElementAccessExpression */) { + if (operator === 58 /* EqualsToken */ && node.left.kind === 185 /* ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -25377,7 +25471,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 183 /* PropertyAccessExpression */) { + if (node.expression.kind === 184 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -25416,7 +25510,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 291 /* JSDocTypedefTag */) { + if (n.kind !== 292 /* JSDocTypedefTag */) { bind(n); } }); @@ -25437,10 +25531,10 @@ 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 = node.expression; - while (expr.kind === 189 /* ParenthesizedExpression */) { + while (expr.kind === 190 /* ParenthesizedExpression */) { expr = expr.expression; } - if (expr.kind === 190 /* FunctionExpression */ || expr.kind === 191 /* ArrowFunction */) { + if (expr.kind === 191 /* FunctionExpression */ || expr.kind === 192 /* ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -25448,7 +25542,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 183 /* PropertyAccessExpression */) { + if (node.expression.kind === 184 /* PropertyAccessExpression */) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -25457,21 +25551,21 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 182 /* ObjectLiteralExpression */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 183 /* ObjectLiteralExpression */: case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: - case 261 /* JsxAttributes */: + case 284 /* JSDocTypeLiteral */: + case 262 /* JsxAttributes */: return 1 /* IsContainer */; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 237 /* ModuleDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 238 /* ModuleDeclaration */: + case 236 /* TypeAliasDeclaration */: case 176 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 272 /* SourceFile */: + case 273 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; case 153 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -25479,31 +25573,31 @@ var ts; } // falls through case 154 /* Constructor */: - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 157 /* CallSignature */: - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: case 162 /* FunctionType */: case 158 /* ConstructSignature */: case 159 /* IndexSignature */: case 163 /* ConstructorType */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; case 151 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 267 /* CatchClause */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 239 /* CaseBlock */: + case 268 /* CatchClause */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 240 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 211 /* Block */: + case 212 /* 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 @@ -25536,20 +25630,20 @@ 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 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 272 /* SourceFile */: + case 273 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: - case 182 /* ObjectLiteralExpression */: - case 234 /* InterfaceDeclaration */: - case 261 /* JsxAttributes */: + case 284 /* JSDocTypeLiteral */: + case 183 /* ObjectLiteralExpression */: + case 235 /* InterfaceDeclaration */: + case 262 /* 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 @@ -25566,11 +25660,11 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 280 /* JSDocFunctionType */: - case 235 /* TypeAliasDeclaration */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 281 /* JSDocFunctionType */: + case 236 /* TypeAliasDeclaration */: case 176 /* MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, @@ -25592,11 +25686,11 @@ var ts; : declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 272 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 272 /* SourceFile */ || body.kind === 238 /* ModuleBlock */)) { + var body = node.kind === 273 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 273 /* SourceFile */ || body.kind === 239 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 248 /* ExportDeclaration */ || stat.kind === 247 /* ExportAssignment */) { + if (stat.kind === 249 /* ExportDeclaration */ || stat.kind === 248 /* ExportAssignment */) { return true; } } @@ -25680,7 +25774,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 270 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { + if (prop.kind === 271 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { continue; } var identifier = prop.name; @@ -25692,7 +25786,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 268 /* PropertyAssignment */ || prop.kind === 269 /* ShorthandPropertyAssignment */ || prop.kind === 153 /* MethodDeclaration */ + var currentKind = prop.kind === 269 /* PropertyAssignment */ || prop.kind === 270 /* ShorthandPropertyAssignment */ || prop.kind === 153 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); @@ -25723,10 +25817,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -25836,8 +25930,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 272 /* SourceFile */ && - blockScopeContainer.kind !== 237 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 273 /* SourceFile */ && + blockScopeContainer.kind !== 238 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -25939,7 +26033,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 291 /* JSDocTypedefTag */) { + if (tag.kind === 292 /* JSDocTypedefTag */) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -25978,7 +26072,7 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 291 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 292 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 67901928 /* TypeAliasExcludes */); @@ -25986,11 +26080,11 @@ var ts; } // falls through case 99 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 269 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 270 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } @@ -25998,7 +26092,7 @@ var ts; bindSpecialPropertyDeclaration(node); } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { case 1 /* ExportsProperty */: @@ -26026,17 +26120,17 @@ var ts; ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return checkStrictModeCatchClause(node); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return checkStrictModeWithStatement(node); case 173 /* ThisType */: seenThisKeyword = true; @@ -26047,18 +26141,18 @@ var ts; return bindTypeParameter(node); case 148 /* Parameter */: return bindParameter(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return bindPropertyWorker(node); - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 271 /* EnumMember */: + case 272 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */); case 157 /* CallSignature */: case 158 /* ConstructSignature */: @@ -26071,7 +26165,7 @@ var ts; // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67208127 /* MethodExcludes */); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return bindFunctionDeclaration(node); case 154 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); @@ -26080,78 +26174,78 @@ var ts; case 156 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67183551 /* SetAccessorExcludes */); case 162 /* FunctionType */: - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: case 163 /* ConstructorType */: return bindFunctionOrConstructorType(node); case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: + case 284 /* JSDocTypeLiteral */: case 176 /* MappedType */: return bindAnonymousTypeWorker(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return bindFunctionExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 67901832 /* InterfaceExcludes */); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67901928 /* TypeAliasExcludes */); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return bindJsxAttributes(node); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); // Imports and exports - case 241 /* ImportEqualsDeclaration */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 242 /* ImportEqualsDeclaration */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return bindImportClause(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return bindExportDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return bindExportAssignment(node); - case 272 /* SourceFile */: + case 273 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 211 /* Block */: + case 212 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } // falls through - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 287 /* JSDocParameterTag */: - if (node.parent.kind !== 283 /* JSDocTypeLiteral */) { + case 288 /* JSDocParameterTag */: + if (node.parent.kind !== 284 /* JSDocTypeLiteral */) { break; } // falls through - case 292 /* JSDocPropertyTag */: + case 293 /* JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 279 /* JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 280 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); - case 291 /* JSDocTypedefTag */: { + case 292 /* JSDocTypedefTag */: { var fullName = node.fullName; if (!fullName || fullName.kind === 71 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67901928 /* TypeAliasExcludes */); @@ -26181,7 +26275,7 @@ var ts; bindAnonymousDeclaration(node, 2097152 /* Alias */, getDeclarationName(node)); } else { - var flags = node.kind === 247 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 248 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) // An export default clause with an EntityNameExpression exports all meanings of that identifier ? 2097152 /* Alias */ // An export default clause with any other expression exports a value @@ -26195,7 +26289,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 272 /* SourceFile */) { + if (node.parent.kind !== 273 /* SourceFile */) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -26272,8 +26366,8 @@ var ts; ts.Debug.assert(ts.isInJavaScriptFile(node)); var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* 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 === 58 /* EqualsToken */) { @@ -26300,7 +26394,7 @@ var ts; var symbolTable = ts.hasModifier(thisContainer, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* Property */, 0 /* None */, /*isReplaceableByMethod*/ true); break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: // this.foo assignment in a source file // Do not bind. It would be nice to support this someday though. break; @@ -26312,7 +26406,7 @@ var ts; if (node.expression.kind === 99 /* ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 272 /* SourceFile */) { + else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 273 /* SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -26372,9 +26466,9 @@ var ts; function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) { var symbol = getJSInitializerSymbolFromName(name); var isToplevelNamespaceableInitializer = ts.isBinaryExpression(propertyAccess.parent) - ? propertyAccess.parent.parent.parent.kind === 272 /* SourceFile */ && - !!ts.getJavascriptInitializer(propertyAccess.parent.right, ts.isPrototypeAccess(propertyAccess.parent.left)) - : propertyAccess.parent.parent.kind === 272 /* SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 273 /* SourceFile */ && + !!ts.getJavascriptInitializer(ts.getInitializerOfBinaryExpression(propertyAccess.parent), ts.isPrototypeAccess(propertyAccess.parent.left)) + : propertyAccess.parent.parent.kind === 273 /* SourceFile */; if (!isPrototypeProperty && (!symbol || !(symbol.flags & 1920 /* Namespace */)) && isToplevelNamespaceableInitializer) { // make symbols or add declarations for intermediate containers var flags_1 = 1536 /* Module */ | 67108864 /* JSContainer */; @@ -26398,10 +26492,18 @@ var ts; (symbol.members || (symbol.members = ts.createSymbolTable())) : (symbol.exports || (symbol.exports = ts.createSymbolTable())); // Declare the method/property - var symbolFlags = 4 /* Property */ | (isToplevelNamespaceableInitializer ? 67108864 /* JSContainer */ : 0); - var symbolExcludes = 0 /* PropertyExcludes */ & ~(isToplevelNamespaceableInitializer ? 67108864 /* JSContainer */ : 0); + var jsContainerFlag = isToplevelNamespaceableInitializer ? 67108864 /* JSContainer */ : 0; + var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(propertyAccess)); + var symbolFlags = (isMethod ? 8192 /* Method */ : 4 /* Property */) | jsContainerFlag; + var symbolExcludes = (isMethod ? 67208127 /* MethodExcludes */ : 0 /* PropertyExcludes */) & ~jsContainerFlag; declareSymbol(symbolTable, symbol, propertyAccess, symbolFlags, symbolExcludes); } + function getParentOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.parent)) { + expr = expr.parent; + } + return expr.parent; + } function lookupSymbolForPropertyAccess(node, lookupContainer) { if (lookupContainer === void 0) { lookupContainer = container; } if (ts.isIdentifier(node)) { @@ -26433,7 +26535,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */); } else { @@ -26592,13 +26694,13 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 213 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 214 /* EmptyStatement */) || // report error on class declarations - node.kind === 233 /* ClassDeclaration */ || + node.kind === 234 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 237 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 238 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 236 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 237 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; // unreachable code is reported if @@ -26612,7 +26714,7 @@ var ts; // On the other side we do want to report errors on non-initialized 'lets' because of TDZ var reportUnreachableCode = !options.allowUnreachableCode && !(node.flags & 2097152 /* Ambient */) && - (node.kind !== 212 /* VariableStatement */ || + (node.kind !== 213 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -26655,43 +26757,43 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: return computeCallExpression(node, subtreeFlags); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return computeNewExpression(node, subtreeFlags); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return computeModuleDeclaration(node, subtreeFlags); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return computeParenthesizedExpression(node, subtreeFlags); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return computeBinaryExpression(node, subtreeFlags); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return computeExpressionStatement(node, subtreeFlags); case 148 /* Parameter */: return computeParameter(node, subtreeFlags); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return computeArrowFunction(node, subtreeFlags); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return computeFunctionExpression(node, subtreeFlags); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return computeFunctionDeclaration(node, subtreeFlags); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return computeVariableDeclaration(node, subtreeFlags); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return computeVariableDeclarationList(node, subtreeFlags); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return computeVariableStatement(node, subtreeFlags); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return computeLabeledStatement(node, subtreeFlags); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return computeClassDeclaration(node, subtreeFlags); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return computeCatchClause(node, subtreeFlags); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); case 154 /* Constructor */: return computeConstructor(node, subtreeFlags); @@ -26702,11 +26804,11 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: return computeAccessor(node, subtreeFlags); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return computeImportEquals(node, subtreeFlags); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return computePropertyAccess(node, subtreeFlags); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return computeElementAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -26758,12 +26860,12 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 182 /* ObjectLiteralExpression */) { + if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 183 /* ObjectLiteralExpression */) { // Destructuring object assignments with are ES2015 syntax // and possibly ESNext if they contain rest transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } - else if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 181 /* ArrayLiteralExpression */) { + else if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 182 /* ArrayLiteralExpression */) { // Destructuring assignments are ES2015 syntax. transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } @@ -26812,8 +26914,8 @@ var ts; // If the node is synthesized, it means the emitter put the parentheses there, // not the user. If we didn't want them, the emitter would not have put them // there. - if (expressionKind === 206 /* AsExpression */ - || expressionKind === 188 /* TypeAssertionExpression */) { + if (expressionKind === 207 /* AsExpression */ + || expressionKind === 189 /* TypeAssertionExpression */) { transformFlags |= 3 /* AssertTypeScript */; } // If the expression of a ParenthesizedExpression is a destructuring assignment, @@ -27190,13 +27292,13 @@ var ts; var excludeFlags = 939525441 /* NodeExcludes */; switch (kind) { case 120 /* AsyncKeyword */: - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: // async/await is ES2017 syntax, but may be ESNext syntax (for async generators) transformFlags |= 8 /* AssertESNext */ | 16 /* AssertES2017 */; break; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: - case 295 /* PartiallyEmittedExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: + case 296 /* PartiallyEmittedExpression */: // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; excludeFlags = 536872257 /* OuterExpressionExcludes */; @@ -27207,25 +27309,25 @@ var ts; case 117 /* AbstractKeyword */: case 124 /* DeclareKeyword */: case 76 /* ConstKeyword */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 207 /* NonNullExpression */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 208 /* NonNullExpression */: case 132 /* ReadonlyKeyword */: // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; break; - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: case 10 /* JsxText */: - case 256 /* JsxClosingElement */: - case 257 /* JsxFragment */: - case 258 /* JsxOpeningFragment */: - case 259 /* JsxClosingFragment */: - case 260 /* JsxAttribute */: - case 261 /* JsxAttributes */: - case 262 /* JsxSpreadAttribute */: - case 263 /* JsxExpression */: + case 257 /* JsxClosingElement */: + case 258 /* JsxFragment */: + case 259 /* JsxOpeningFragment */: + case 260 /* JsxClosingFragment */: + case 261 /* JsxAttribute */: + case 262 /* JsxAttributes */: + case 263 /* JsxSpreadAttribute */: + case 264 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; @@ -27233,11 +27335,11 @@ var ts; case 14 /* TemplateHead */: case 15 /* TemplateMiddle */: case 16 /* TemplateTail */: - case 200 /* TemplateExpression */: - case 187 /* TaggedTemplateExpression */: - case 269 /* ShorthandPropertyAssignment */: + case 201 /* TemplateExpression */: + case 188 /* TaggedTemplateExpression */: + case 270 /* ShorthandPropertyAssignment */: case 115 /* StaticKeyword */: - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: // These nodes are ES6 syntax. transformFlags |= 192 /* AssertES2015 */; break; @@ -27251,14 +27353,14 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: // This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of). if (node.awaitModifier) { transformFlags |= 8 /* AssertESNext */; } transformFlags |= 192 /* AssertES2015 */; break; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: // This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async // generator). transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; @@ -27290,14 +27392,14 @@ var ts; case 170 /* ConditionalType */: case 171 /* InferType */: case 172 /* ParenthesizedType */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: case 173 /* ThisType */: case 174 /* TypeOperator */: case 175 /* IndexedAccessType */: case 176 /* MappedType */: case 177 /* LiteralType */: - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: // Types and signatures are TypeScript syntax, and exclude all other facts. transformFlags = 3 /* AssertTypeScript */; excludeFlags = -3 /* TypeExcludes */; @@ -27319,10 +27421,10 @@ var ts; transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */; } break; - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 97 /* SuperKeyword */: @@ -27334,18 +27436,18 @@ var ts; // Mark this node and its ancestors as containing a lexical `this` keyword. transformFlags |= 16384 /* ContainsLexicalThis */; break; - case 178 /* ObjectBindingPattern */: + case 179 /* ObjectBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; if (subtreeFlags & 524288 /* ContainsRest */) { transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */; } excludeFlags = 940049729 /* BindingPatternExcludes */; break; - case 179 /* ArrayBindingPattern */: + case 180 /* ArrayBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; excludeFlags = 940049729 /* BindingPatternExcludes */; break; - case 180 /* BindingElement */: + case 181 /* BindingElement */: transformFlags |= 192 /* AssertES2015 */; if (node.dotDotDotToken) { transformFlags |= 524288 /* ContainsRest */; @@ -27355,7 +27457,7 @@ var ts; // This node is TypeScript syntax, and marks its container as also being TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */; break; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: excludeFlags = 942740801 /* ObjectLiteralExcludes */; if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) { // If an ObjectLiteralExpression contains a ComputedPropertyName, then it @@ -27373,8 +27475,8 @@ var ts; transformFlags |= 8 /* AssertESNext */; } break; - case 181 /* ArrayLiteralExpression */: - case 186 /* NewExpression */: + case 182 /* ArrayLiteralExpression */: + case 187 /* NewExpression */: excludeFlags = 940049729 /* ArrayLiteralOrCallOrNewExcludes */; if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadExpression, then it is an ES6 @@ -27382,23 +27484,23 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 223 /* ReturnStatement */: - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 224 /* ReturnStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } @@ -27414,27 +27516,27 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 160 /* FirstTypeNode */ && kind <= 177 /* LastTypeNode */) { + if (kind >= 160 /* FirstTypeNode */ && kind <= 178 /* LastTypeNode */) { return -3 /* TypeExcludes */; } switch (kind) { - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 181 /* ArrayLiteralExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 182 /* ArrayLiteralExpression */: return 940049729 /* ArrayLiteralOrCallOrNewExcludes */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return 977327425 /* ModuleExcludes */; case 148 /* Parameter */: return 939525441 /* ParameterExcludes */; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return 1003902273 /* ArrowFunctionExcludes */; - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: return 1003935041 /* FunctionExcludes */; - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return 948962625 /* VariableDeclarationListExcludes */; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return 942011713 /* ClassExcludes */; case 154 /* Constructor */: return 1003668801 /* ConstructorExcludes */; @@ -27456,24 +27558,24 @@ var ts; case 157 /* CallSignature */: case 158 /* ConstructSignature */: case 159 /* IndexSignature */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return 942740801 /* ObjectLiteralExcludes */; - case 267 /* CatchClause */: + case 268 /* CatchClause */: return 940574017 /* CatchClauseExcludes */; - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: return 940049729 /* BindingPatternExcludes */; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: - case 295 /* PartiallyEmittedExpression */: - case 189 /* ParenthesizedExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: + case 296 /* PartiallyEmittedExpression */: + case 190 /* ParenthesizedExpression */: case 97 /* SuperKeyword */: return 536872257 /* OuterExpressionExcludes */; - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: return 671089985 /* PropertyAccessExcludes */; default: return 939525441 /* NodeExcludes */; @@ -27863,7 +27965,7 @@ var ts; return node ? getConstantValue(node) : undefined; }, isValidPropertyAccess: function (node, propertyName) { - node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); + node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedNameOrImportTypeNode); return !!node && isValidPropertyAccess(node, ts.escapeLeadingUnderscores(propertyName)); }, isValidPropertyAccessForCompletions: function (node, type, property) { @@ -27932,6 +28034,7 @@ var ts; getAllPossiblePropertiesOfTypes: getAllPossiblePropertiesOfTypes, getSuggestionForNonexistentProperty: function (node, type) { return getSuggestionForNonexistentProperty(node, type); }, getSuggestionForNonexistentSymbol: function (location, name, meaning) { return getSuggestionForNonexistentSymbol(location, ts.escapeLeadingUnderscores(name), meaning); }, + getSuggestionForNonexistentModule: function (node, target) { return getSuggestionForNonexistentModule(node, target); }, getBaseConstraintOfType: getBaseConstraintOfType, getDefaultFromTypeParameter: function (type) { return type && type.flags & 32768 /* TypeParameter */ ? getDefaultFromTypeParameter(type) : undefined; }, resolveName: function (name, location, meaning, excludeGlobals) { @@ -28495,7 +28598,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 237 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 237 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 238 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 238 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } @@ -28625,7 +28728,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 }); } function isGlobalSourceFile(node) { - return node.kind === 272 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 273 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -28683,17 +28786,17 @@ var ts; } if (declaration.pos <= usage.pos) { // declaration is before usage - if (declaration.kind === 180 /* BindingElement */) { + if (declaration.kind === 181 /* 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, 180 /* BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 181 /* 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, 230 /* VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 231 /* VariableDeclaration */), usage); } - else if (declaration.kind === 230 /* VariableDeclaration */) { + else if (declaration.kind === 231 /* VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -28707,12 +28810,12 @@ var ts; // 5. inside a TS export= declaration (since we will move the export statement during emit to avoid TDZ) // or if usage is in a type context: // 1. inside a type query (typeof in type position) - if (usage.parent.kind === 250 /* ExportSpecifier */ || (usage.parent.kind === 247 /* ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 251 /* ExportSpecifier */ || (usage.parent.kind === 248 /* 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 === 247 /* ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 248 /* ExportAssignment */ && usage.isExportEquals) { return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -28720,9 +28823,9 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 212 /* VariableStatement */: - case 218 /* ForStatement */: - case 220 /* ForOfStatement */: + case 213 /* VariableStatement */: + case 219 /* ForStatement */: + case 221 /* 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, container)) { @@ -28792,7 +28895,7 @@ 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 & 67901928 /* Type */ && lastLocation.kind !== 282 /* JSDocComment */) { + if (meaning & result.flags & 67901928 /* Type */ && lastLocation.kind !== 283 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || @@ -28826,14 +28929,14 @@ var ts; } } switch (location.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 272 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 273 /* SourceFile */ || ts.isAmbientModule(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" /* Default */)) { @@ -28857,7 +28960,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && - ts.getDeclarationOfKind(moduleExport, 250 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExport, 251 /* ExportSpecifier */)) { break; } } @@ -28865,7 +28968,7 @@ var ts; break loop; } break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } @@ -28888,9 +28991,9 @@ var ts; } } break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: if (result = lookup(getMembersOfSymbol(getSymbolOfNode(location)), name, meaning & 67901928 /* Type */)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { // ignore type parameters not declared in this container @@ -28906,7 +29009,7 @@ var ts; } break loop; } - if (location.kind === 203 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 204 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -28914,7 +29017,7 @@ var ts; } } break; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 85 /* ExtendsKeyword */) { var container = location.parent.parent; @@ -28936,7 +29039,7 @@ var ts; // case 146 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 234 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 235 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67901928 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -28949,14 +29052,14 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -29001,12 +29104,12 @@ var ts; // We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`. // If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself. // That means that this is a self-reference of `lastLocation`, and shouldn't count this when considering whether `lastLocation` is used. - if (isUse && result && nameNotFoundMessage && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { + if (isUse && result && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { result.isReferenced |= meaning; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 272 /* SourceFile */); + ts.Debug.assert(lastLocation.kind === 273 /* SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports") { return lastLocation.symbol; } @@ -29067,9 +29170,9 @@ var ts; } } // If we're in an external module, we can't reference value symbols created from UMD export declarations - if (result && isInExternalModule && (meaning & 67216319 /* Value */) === 67216319 /* Value */) { + if (result && isInExternalModule && (meaning & 67216319 /* Value */) === 67216319 /* Value */ && !(originalLocation.flags & 1048576 /* JSDoc */)) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 240 /* NamespaceExportDeclaration */) { + if (decls && decls.length === 1 && decls[0].kind === 241 /* NamespaceExportDeclaration */) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); } } @@ -29078,12 +29181,12 @@ var ts; } function isSelfReferenceLocation(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 237 /* ModuleDeclaration */: // For `namespace N { N; }` + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 238 /* ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -29148,9 +29251,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 71 /* Identifier */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -29214,7 +29317,7 @@ var ts; function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */)); // Block-scoped variables cannot be used before their definition - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 236 /* EnumDeclaration */) ? d : undefined; }); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 237 /* EnumDeclaration */) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); if (!(declaration.flags & 2097152 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { if (result.flags & 2 /* BlockScopedVariable */) { @@ -29237,13 +29340,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return node; - case 243 /* ImportClause */: + case 244 /* ImportClause */: return node.parent; - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return node.parent.parent; - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -29253,7 +29356,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { - if (node.moduleReference.kind === 252 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 253 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); @@ -29274,8 +29377,8 @@ var ts; // Declaration files (and ambient modules) if (!file || file.isDeclarationFile) { // Definitely cannot have a synthetic default if they have a syntactic default member specified - var defaultExportSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, dontResolveAlias); - if (defaultExportSymbol && defaultExportSymbol.valueDeclaration && isSyntacticDefault(defaultExportSymbol.valueDeclaration)) { + var defaultExportSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, /*dontResolveAlias*/ true); // Dont resolve alias because we want the immediately exported symbol's declaration + if (defaultExportSymbol && ts.some(defaultExportSymbol.declarations, isSyntacticDefault)) { return false; } // It _might_ still be incorrect to assume there is no __esModule marker on the import at runtime, even if there is no `default` member @@ -29426,32 +29529,40 @@ var ts; resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias); } function getTargetOfExportAssignment(node, dontResolveAlias) { - return resolveEntityName(node.expression, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); + var aliasLike = resolveEntityName(node.expression, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias); + if (aliasLike) { + return aliasLike; + } + checkExpression(node.expression); + return getNodeLinks(node.expression).resolvedSymbol; } function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 250 /* ExportSpecifier */: + case 251 /* ExportSpecifier */: return getTargetOfExportSpecifier(node, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); } } /** * Indicates that a symbol is an alias that does not merge with a local declaration. + * OR Is a JSContainer which may merge an alias with a local declaration */ function isNonLocalAlias(symbol, excludes) { if (excludes === void 0) { excludes = 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */; } - return symbol && (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */; + if (!symbol) + return false; + return (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */ || (symbol.flags & 2097152 /* Alias */ && symbol.flags & 67108864 /* JSContainer */); } function resolveSymbol(symbol, dontResolveAlias) { var shouldResolve = !dontResolveAlias && isNonLocalAlias(symbol); @@ -29497,11 +29608,11 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 247 /* ExportAssignment */) { + if (node.kind === 248 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 250 /* ExportSpecifier */) { + else if (node.kind === 251 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -29529,7 +29640,7 @@ var ts; else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 241 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 242 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } @@ -29552,7 +29663,7 @@ var ts; return undefined; } } - else if (name.kind === 145 /* QualifiedName */ || name.kind === 183 /* PropertyAccessExpression */) { + else if (name.kind === 145 /* QualifiedName */ || name.kind === 184 /* PropertyAccessExpression */) { var left = name.kind === 145 /* QualifiedName */ ? name.left : name.expression; var right = name.kind === 145 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); @@ -29618,7 +29729,8 @@ var ts; if (ambientModule) { return ambientModule; } - var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference); + var currentSourceFile = ts.getSourceFileOfNode(location); + var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference); var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule); var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { @@ -29685,15 +29797,15 @@ var ts; // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may // combine other declarations with the module or variable (e.g. a class/module, function/module, interface/variable). - function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression, dontResolveAlias) { + function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) { var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) { - error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); + error(referencingLocation, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); return symbol; } if (compilerOptions.esModuleInterop) { - var referenceParent = moduleReferenceExpression.parent; + var referenceParent = referencingLocation.parent; if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) || ts.isImportCall(referenceParent)) { var type = getTypeOfSymbol(symbol); @@ -29936,12 +30048,12 @@ var ts; } } switch (location.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location).exports)) { return result; } @@ -29960,11 +30072,8 @@ var ts; return undefined; } var id = "" + getSymbolId(symbol); - var visitedSymbolTables; - if (visitedSymbolTablesMap.has(id)) { - visitedSymbolTables = visitedSymbolTablesMap.get(id); - } - else { + var visitedSymbolTables = visitedSymbolTablesMap.get(id); + if (!visitedSymbolTables) { visitedSymbolTablesMap.set(id, visitedSymbolTables = []); } return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); @@ -30036,7 +30145,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 250 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 251 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -30140,7 +30249,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 272 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 273 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -30180,8 +30289,8 @@ var ts; // Typeof value meaning = 67216319 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 145 /* QualifiedName */ || entityName.kind === 183 /* PropertyAccessExpression */ || - entityName.parent.kind === 241 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 145 /* QualifiedName */ || entityName.kind === 184 /* PropertyAccessExpression */ || + entityName.parent.kind === 242 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -30367,7 +30476,7 @@ var ts; if (type.flags & 1024 /* UniqueESSymbol */) { if (!(context.flags & 1048576 /* AllowUniqueESSymbolType */)) { if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) { - return ts.createTypeQueryNode(symbolToName(type.symbol, context, 67216319 /* Value */, /*expectsIdentifier*/ false)); + return symbolToTypeNode(type.symbol, context, 67216319 /* Value */); } if (context.tracker.reportInaccessibleUniqueSymbolError) { context.tracker.reportInaccessibleUniqueSymbolError(); @@ -30478,18 +30587,17 @@ var ts; var symbol = type.symbol; if (symbol) { // Always use 'typeof T' for type of class, enum, and module objects - if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 203 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) || + if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 204 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol()) { - return createTypeQueryNodeFromSymbol(symbol, 67216319 /* Value */); + return symbolToTypeNode(symbol, context, 67216319 /* Value */); } else if (ts.contains(context.symbolStack, symbol)) { // If type is an anonymous type literal in a type alias declaration, use type alias name var typeAlias = getTypeAliasForTypeLiteral(type); if (typeAlias) { // The specified symbol flags need to be reinterpreted as type flags - var entityName = symbolToName(typeAlias, context, 67901928 /* Type */, /*expectsIdentifier*/ false); - return ts.createTypeReferenceNode(entityName, /*typeArguments*/ undefined); + return symbolToTypeNode(typeAlias, context, 67901928 /* Type */); } else { return ts.createKeywordTypeNode(119 /* AnyKeyword */); @@ -30523,7 +30631,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 272 /* SourceFile */ || declaration.parent.kind === 238 /* ModuleBlock */; + return declaration.parent.kind === 273 /* SourceFile */ || declaration.parent.kind === 239 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -30559,10 +30667,6 @@ var ts; var typeLiteralNode = ts.createTypeLiteralNode(members); return ts.setEmitFlags(typeLiteralNode, (context.flags & 1024 /* MultilineObjectLiterals */) ? 0 : 1 /* SingleLine */); } - function createTypeQueryNodeFromSymbol(symbol, symbolFlags) { - var entityName = symbolToName(symbol, context, symbolFlags, /*expectsIdentifier*/ false); - return ts.createTypeQueryNode(entityName); - } function symbolToTypeReferenceName(symbol) { // Unnamed function expressions and arrow functions have reserved names that we don't want to display var entityName = symbol.flags & 32 /* Class */ || !isReservedMemberName(symbol.escapedName) ? symbolToName(symbol, context, 67901928 /* Type */, /*expectsIdentifier*/ false) : ts.createIdentifier(""); @@ -30718,6 +30822,10 @@ var ts; var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 152 /* MethodSignature */, context); methodDeclaration.name = propertyName; methodDeclaration.questionToken = optionalToken; + if (propertySymbol.valueDeclaration) { + // Copy comments to node for declaration emit + ts.setCommentRange(methodDeclaration, propertySymbol.valueDeclaration); + } typeElements.push(methodDeclaration); } } @@ -30729,6 +30837,10 @@ var ts; var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(132 /* ReadonlyKeyword */)] : undefined; var propertySignature = ts.createPropertySignature(modifiers, propertyName, optionalToken, propertyTypeNode, /*initializer*/ undefined); + if (propertySymbol.valueDeclaration) { + // Copy comments to node for declaration emit + ts.setCommentRange(propertySignature, propertySymbol.valueDeclaration); + } typeElements.push(propertySignature); } } @@ -30773,7 +30885,7 @@ var ts; else { typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); }); } - var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context); }); + var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 154 /* Constructor */); }); if (signature.thisParameter) { var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context); parameters.unshift(thisParameter); @@ -30812,7 +30924,7 @@ var ts; context.flags = savedContextFlags; return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); } - function symbolToParameterDeclaration(parameterSymbol, context) { + function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) { var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 148 /* Parameter */); ts.Debug.assert(!!parameterDeclaration || isTransientSymbol(parameterSymbol) && !!parameterSymbol.isRestParameter); var parameterType = getTypeOfSymbol(parameterSymbol); @@ -30820,7 +30932,7 @@ var ts; parameterType = getOptionalType(parameterType); } var parameterTypeNode = typeToTypeNodeHelper(parameterType, context); - var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone); + var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone); var dotDotDotToken = !parameterDeclaration || ts.isRestParameter(parameterDeclaration) ? ts.createToken(24 /* DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? @@ -30839,7 +30951,7 @@ var ts; function elideInitializerAndSetEmitFlags(node) { var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags); var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited); - if (clone.kind === 180 /* BindingElement */) { + if (clone.kind === 181 /* BindingElement */) { clone.initializer = undefined; } return ts.setEmitFlags(clone, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */); @@ -30914,6 +31026,35 @@ var ts; } return typeParameterNodes; } + function symbolToTypeNode(symbol, context, meaning) { + var chain = lookupSymbolChain(symbol, context, meaning); + context.flags |= 16777216 /* InInitialEntityName */; + var rootName = getNameOfSymbolAsWritten(chain[0], context); + context.flags ^= 16777216 /* InInitialEntityName */; + var isTypeOf = meaning === 67216319 /* Value */; + if (ambientModuleSymbolRegex.test(rootName)) { + // module is root, must use `ImportTypeNode` + var nonRootParts = chain.length > 1 ? createEntityNameFromSymbolChain(chain, chain.length - 1, 1) : undefined; + var typeParameterNodes = lookupTypeParameterNodes(chain, 0, context); + return ts.createImportTypeNode(ts.createLiteralTypeNode(ts.createLiteral(rootName.substring(1, rootName.length - 1))), nonRootParts, typeParameterNodes, isTypeOf); + } + var entityName = createEntityNameFromSymbolChain(chain, chain.length - 1, 0); + return isTypeOf ? ts.createTypeQueryNode(entityName) : ts.createTypeReferenceNode(entityName, /*typeArguments*/ undefined); + function createEntityNameFromSymbolChain(chain, index, stopper) { + var typeParameterNodes = lookupTypeParameterNodes(chain, index, context); + var symbol = chain[index]; + if (index === 0) { + context.flags |= 16777216 /* InInitialEntityName */; + } + var symbolName = getNameOfSymbolAsWritten(symbol, context); + if (index === 0) { + context.flags ^= 16777216 /* InInitialEntityName */; + } + var identifier = ts.setEmitFlags(ts.createIdentifier(symbolName, typeParameterNodes), 16777216 /* NoAsciiEscaping */); + identifier.symbol = symbol; + return index > stopper ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1, stopper), identifier) : identifier; + } + } function symbolToName(symbol, context, meaning, expectsIdentifier) { var chain = lookupSymbolChain(symbol, context, meaning); if (expectsIdentifier && chain.length !== 1 @@ -31028,7 +31169,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 172 /* ParenthesizedType */; }); - if (node.kind === 235 /* TypeAliasDeclaration */) { + if (node.kind === 236 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -31036,11 +31177,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 238 /* ModuleBlock */ && + node.parent.kind === 239 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 272 /* SourceFile */ || ts.isAmbientModule(location); + return location.kind === 273 /* SourceFile */ || ts.isAmbientModule(location); } /** * Gets a human-readable name for a symbol. @@ -31065,17 +31206,17 @@ var ts; if (name) { return ts.declarationNameToString(name); } - if (declaration.parent && declaration.parent.kind === 230 /* VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 231 /* VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) { context.encounteredError = true; } switch (declaration.kind) { - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return "(Anonymous class)"; - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -31098,22 +31239,22 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 180 /* BindingElement */: + case 181 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 230 /* VariableDeclaration */: + case 231 /* 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 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 232 /* FunctionDeclaration */: - case 236 /* EnumDeclaration */: - case 241 /* ImportEqualsDeclaration */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 233 /* FunctionDeclaration */: + case 237 /* EnumDeclaration */: + case 242 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -31121,7 +31262,7 @@ 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 /* Export */) && - !(node.kind !== 241 /* ImportEqualsDeclaration */ && parent.kind !== 272 /* SourceFile */ && parent.flags & 2097152 /* Ambient */)) { + !(node.kind !== 242 /* ImportEqualsDeclaration */ && parent.kind !== 273 /* SourceFile */ && parent.flags & 2097152 /* Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible @@ -31143,7 +31284,7 @@ var ts; case 157 /* CallSignature */: case 159 /* IndexSignature */: case 148 /* Parameter */: - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: case 162 /* FunctionType */: case 163 /* ConstructorType */: case 165 /* TypeLiteral */: @@ -31156,18 +31297,18 @@ var ts; return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: return false; // Type parameters are always visible case 147 /* TypeParameter */: // Source file and namespace export are always visible - case 272 /* SourceFile */: - case 240 /* NamespaceExportDeclaration */: + case 273 /* SourceFile */: + case 241 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return false; default: return false; @@ -31176,10 +31317,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 247 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 248 /* ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 250 /* ExportSpecifier */) { + else if (node.parent.kind === 251 /* ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */); } var result; @@ -31275,12 +31416,12 @@ var ts; function getDeclarationContainer(node) { node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 230 /* VariableDeclaration */: - case 231 /* VariableDeclarationList */: - case 246 /* ImportSpecifier */: - case 245 /* NamedImports */: - case 244 /* NamespaceImport */: - case 243 /* ImportClause */: + case 231 /* VariableDeclaration */: + case 232 /* VariableDeclarationList */: + case 247 /* ImportSpecifier */: + case 246 /* NamedImports */: + case 245 /* NamespaceImport */: + case 244 /* ImportClause */: return false; default: return true; @@ -31358,7 +31499,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 178 /* ObjectBindingPattern */) { + if (pattern.kind === 179 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -31445,7 +31586,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 181 /* ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 182 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, optional) { if (optional === void 0) { optional = true; } @@ -31455,11 +31596,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { // 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 === 219 /* ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 220 /* ForInStatement */) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (32768 /* TypeParameter */ | 524288 /* Index */) ? indexType : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 220 /* ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 221 /* 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, @@ -31478,7 +31619,7 @@ var ts; return addOptionality(declaredType, isOptional); } if ((noImplicitAny || ts.isInJavaScriptFile(declaration)) && - declaration.kind === 230 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + declaration.kind === 231 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 2097152 /* Ambient */)) { // If --noImplicitAny is on or the declaration is in a Javascript file, // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no @@ -31551,8 +31692,8 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var declarationInConstructor = false; - var expression = declaration.kind === 198 /* BinaryExpression */ ? declaration : - declaration.kind === 183 /* PropertyAccessExpression */ ? ts.getAncestor(declaration, 198 /* BinaryExpression */) : + var expression = declaration.kind === 199 /* BinaryExpression */ ? declaration : + declaration.kind === 184 /* PropertyAccessExpression */ ? ts.getAncestor(declaration, 199 /* BinaryExpression */) : undefined; if (!expression) { return unknownType; @@ -31562,8 +31703,8 @@ var ts; // Properties defined in a constructor (or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. declarationInConstructor = thisContainer.kind === 154 /* Constructor */ || - thisContainer.kind === 232 /* FunctionDeclaration */ || - (thisContainer.kind === 190 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + thisContainer.kind === 233 /* FunctionDeclaration */ || + (thisContainer.kind === 191 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); if (declarationInConstructor) { definedInConstructor = true; } @@ -31685,7 +31826,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 178 /* ObjectBindingPattern */ + return pattern.kind === 179 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -31744,7 +31885,7 @@ var ts; return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 247 /* ExportAssignment */) { + if (declaration.kind === 248 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } if (ts.isInJavaScriptFile(declaration) && ts.isJSDocPropertyLikeTag(declaration) && declaration.typeExpression) { @@ -31760,8 +31901,8 @@ var ts; // * exports.p = expr // * this.p = expr // * className.prototype.method = expr - if (declaration.kind === 198 /* BinaryExpression */ || - declaration.kind === 183 /* PropertyAccessExpression */ && declaration.parent.kind === 198 /* BinaryExpression */) { + if (declaration.kind === 199 /* BinaryExpression */ || + declaration.kind === 184 /* PropertyAccessExpression */ && declaration.parent.kind === 199 /* BinaryExpression */) { type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } else if (ts.isJSDocPropertyTag(declaration) @@ -31891,6 +32032,10 @@ var ts; if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { links.type = anyType; } + else if (symbol.valueDeclaration.kind === 199 /* BinaryExpression */ || + symbol.valueDeclaration.kind === 184 /* PropertyAccessExpression */ && symbol.valueDeclaration.parent.kind === 199 /* BinaryExpression */) { + links.type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); + } else { var type = createObjectType(16 /* Anonymous */, symbol); if (symbol.flags & 32 /* Class */) { @@ -32024,21 +32169,21 @@ var ts; return undefined; } switch (node.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: case 152 /* MethodSignature */: case 162 /* FunctionType */: case 163 /* ConstructorType */: - case 280 /* JSDocFunctionType */: - case 232 /* FunctionDeclaration */: + case 281 /* JSDocFunctionType */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 235 /* TypeAliasDeclaration */: - case 290 /* JSDocTemplateTag */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 236 /* TypeAliasDeclaration */: + case 291 /* JSDocTemplateTag */: case 176 /* MappedType */: case 170 /* ConditionalType */: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); @@ -32050,7 +32195,7 @@ var ts; } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node) || ts.emptyArray); var thisType = includeThisTypes && - (node.kind === 233 /* ClassDeclaration */ || node.kind === 203 /* ClassExpression */ || node.kind === 234 /* InterfaceDeclaration */) && + (node.kind === 234 /* ClassDeclaration */ || node.kind === 204 /* ClassExpression */ || node.kind === 235 /* InterfaceDeclaration */) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } @@ -32058,7 +32203,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 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 234 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 235 /* InterfaceDeclaration */); return getOuterTypeParameters(declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -32067,8 +32212,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 234 /* InterfaceDeclaration */ || node.kind === 233 /* ClassDeclaration */ || - node.kind === 203 /* ClassExpression */ || node.kind === 235 /* TypeAliasDeclaration */) { + if (node.kind === 235 /* InterfaceDeclaration */ || node.kind === 234 /* ClassDeclaration */ || + node.kind === 204 /* ClassExpression */ || node.kind === 236 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -32255,7 +32400,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 234 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 235 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -32291,7 +32436,7 @@ var ts; function isThislessInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 234 /* InterfaceDeclaration */) { + if (declaration.kind === 235 /* InterfaceDeclaration */) { if (declaration.flags & 64 /* ContainsThis */) { return false; } @@ -32349,9 +32494,9 @@ var ts; return unknownType; } var declaration = ts.find(symbol.declarations, function (d) { - return d.kind === 291 /* JSDocTypedefTag */ || d.kind === 235 /* TypeAliasDeclaration */; + return d.kind === 292 /* JSDocTypedefTag */ || d.kind === 236 /* TypeAliasDeclaration */; }); - var typeNode = declaration.kind === 291 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; + var typeNode = declaration.kind === 292 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; // If typeNode is missing, we will error in checkJSDocTypedefTag. var type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { @@ -32381,7 +32526,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return true; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return expr.operator === 38 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; case 71 /* Identifier */: @@ -32398,7 +32543,7 @@ var ts; var hasNonLiteralMember = false; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 236 /* EnumDeclaration */) { + if (declaration.kind === 237 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && member.initializer.kind === 9 /* StringLiteral */) { @@ -32425,7 +32570,7 @@ var ts; var memberTypeList = []; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 236 /* EnumDeclaration */) { + if (declaration.kind === 237 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var memberType = getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member)); @@ -33394,7 +33539,12 @@ var ts; return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; } function getDefaultConstraintOfConditionalType(type) { - return getUnionType([getInferredTrueTypeFromConditionalType(type), getFalseTypeFromConditionalType(type)]); + if (!type.resolvedDefaultConstraint) { + var rootTrueType = type.root.trueType; + var rootTrueConstraint = rootTrueType.flags & 4194304 /* Substitution */ ? rootTrueType.substitute : rootTrueType; + type.resolvedDefaultConstraint = getUnionType([instantiateType(rootTrueConstraint, type.combinedMapper || type.mapper), getFalseTypeFromConditionalType(type)]); + } + return type.resolvedDefaultConstraint; } function getConstraintOfDistributiveConditionalType(type) { // Check if we have a conditional type of the form 'T extends U ? X : Y', where T is a constrained @@ -33406,7 +33556,10 @@ var ts; var constraint = getConstraintOfType(type.checkType); if (constraint) { var mapper = createTypeMapper([type.root.checkType], [constraint]); - return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + var instantiated = getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + if (!(instantiated.flags & 16384 /* Never */)) { + return instantiated; + } } } return undefined; @@ -33593,7 +33746,7 @@ var ts; (modifiers & 16 /* Protected */ ? 128 /* ContainsProtected */ : 0) | (modifiers & 8 /* Private */ ? 256 /* ContainsPrivate */ : 0) | (modifiers & 32 /* Static */ ? 512 /* ContainsStatic */ : 0); - if (!isMethodLike(prop)) { + if (!isPrototypeProperty(prop)) { syntheticFlag = 2 /* SyntheticProperty */; } } @@ -33752,10 +33905,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJavaScriptFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 279 /* JSDocOptionalType */ + node.type && node.type.kind === 280 /* JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 279 /* JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 280 /* JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -33995,7 +34148,8 @@ var ts; return ts.emptyArray; var result = []; for (var i = 0; i < symbol.declarations.length; i++) { - var node = symbol.declarations[i]; + var decl = symbol.declarations[i]; + var node = ts.isPropertyAccessExpression(decl) ? ts.getAssignedJavascriptInitializer(decl) : decl; if (!ts.isFunctionLike(node)) continue; // Don't include signature if node is the implementation of an overloaded function. A node is considered @@ -34314,7 +34468,7 @@ var ts; var isJs = ts.isInJavaScriptFile(node); var isJsImplicitAny = !noImplicitAny && isJs; if (!isJsImplicitAny && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { - var missingAugmentsTag = isJs && node.parent.kind !== 285 /* JSDocAugmentsTag */; + var missingAugmentsTag = isJs && node.parent.kind !== 286 /* JSDocAugmentsTag */; var diag = minTypeArgumentCount === typeParameters.length ? missingAugmentsTag ? ts.Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag @@ -34373,7 +34527,7 @@ var ts; switch (node.kind) { case 161 /* TypeReference */: return node.typeName; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -34451,7 +34605,7 @@ var ts; } function getConstrainedTypeVariable(typeVariable, node) { var constraints; - while (ts.isPartOfTypeNode(node)) { + while (node && !ts.isStatement(node)) { var parent = node.parent; if (parent.kind === 170 /* ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType); @@ -34468,7 +34622,7 @@ var ts; } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : ts.declarationNameToString(node.typeName)); + error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? ts.declarationNameToString(node.typeName) : "(anonymous)"); return false; } return true; @@ -34565,9 +34719,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: return declaration; } } @@ -35115,7 +35269,7 @@ var ts; return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 184 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 185 /* ElementAccessExpression */ ? accessNode : undefined; var propName = isTypeUsableAsLateBoundName(indexType) ? getLateBoundNameFromType(indexType) : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ? ts.getPropertyNameForKnownSymbolName(ts.idText(accessExpression.argumentExpression.name)) : @@ -35165,7 +35319,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 184 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 185 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)); } @@ -35262,7 +35416,7 @@ var ts; // object type. Note that 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 === 184 /* ElementAccessExpression */) && isGenericObjectType(objectType)) { + if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind === 185 /* ElementAccessExpression */) && isGenericObjectType(objectType)) { if (objectType.flags & 1 /* Any */) { return objectType; } @@ -35383,11 +35537,6 @@ var ts; function getFalseTypeFromConditionalType(type) { return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper)); } - function getInferredTrueTypeFromConditionalType(type) { - return type.combinedMapper ? - type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper)) : - getTrueTypeFromConditionalType(type); - } function getInferTypeParameters(node) { var result; if (node.locals) { @@ -35399,13 +35548,27 @@ var ts; } return result; } + function isPossiblyReferencedInConditionalType(tp, node) { + if (isTypeParameterPossiblyReferenced(tp, node)) { + return true; + } + while (node) { + if (node.kind === 170 /* ConditionalType */) { + if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) { + return true; + } + } + node = node.parent; + } + return false; + } function getTypeFromConditionalTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var checkType = getTypeFromTypeNode(node.checkType); var aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true); - var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); }); + var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); }); var root = { node: node, checkType: checkType, @@ -35434,6 +35597,76 @@ var ts; } return links.resolvedType; } + function getIdentifierChain(node) { + if (ts.isIdentifier(node)) { + return [node]; + } + else { + return ts.append(getIdentifierChain(node.left), node.right); + } + } + function getTypeFromImportTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + if (node.isTypeOf && node.typeArguments) { // Only the non-typeof form can make use of type arguments + error(node, ts.Diagnostics.Type_arguments_cannot_be_used_here); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + if (!ts.isLiteralImportTypeNode(node)) { + error(node.argument, ts.Diagnostics.String_literal_expected); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + var argumentType = getTypeFromTypeNode(node.argument); + var targetMeaning = node.isTypeOf ? 67216319 /* Value */ : 67901928 /* Type */; + // TODO: Future work: support unions/generics/whatever via a deferred import-type + var moduleName = argumentType.value; + var innerModuleSymbol = resolveExternalModule(node, moduleName, ts.Diagnostics.Cannot_find_module_0, node, /*isForAugmentation*/ false); + if (!innerModuleSymbol) { + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + var moduleSymbol = resolveExternalModuleSymbol(innerModuleSymbol, /*dontResolveAlias*/ false); + if (!ts.nodeIsMissing(node.qualifier)) { + var nameStack = getIdentifierChain(node.qualifier); + var currentNamespace = moduleSymbol; + var current = void 0; + while (current = nameStack.shift()) { + var meaning = nameStack.length ? 1920 /* Namespace */ : targetMeaning; + var next = getSymbol(getExportsOfSymbol(getMergedSymbol(resolveSymbol(currentNamespace))), current.escapedText, meaning); + if (!next) { + error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current)); + return links.resolvedType = unknownType; + } + getNodeLinks(current).resolvedSymbol = next; + getNodeLinks(current.parent).resolvedSymbol = next; + currentNamespace = next; + } + resolveImportSymbolType(node, links, currentNamespace, targetMeaning); + } + else { + if (moduleSymbol.flags & targetMeaning) { + resolveImportSymbolType(node, links, moduleSymbol, targetMeaning); + } + else { + error(node, targetMeaning === 67216319 /* Value */ ? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here, moduleName); + links.resolvedSymbol = unknownSymbol; + links.resolvedType = unknownType; + } + } + } + return links.resolvedType; + } + function resolveImportSymbolType(node, links, symbol, meaning) { + links.resolvedSymbol = symbol; + if (meaning === 67216319 /* Value */) { + return links.resolvedType = getTypeOfSymbol(symbol); + } + else { + return links.resolvedType = getTypeReferenceType(node, symbol); + } + } function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -35455,7 +35688,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 235 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 236 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -35616,7 +35849,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 === 234 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 235 /* InterfaceDeclaration */)) { if (!ts.hasModifier(container, 32 /* Static */) && (container.kind !== 154 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -35635,8 +35868,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 119 /* AnyKeyword */: - case 275 /* JSDocAllType */: - case 276 /* JSDocUnknownType */: + case 276 /* JSDocAllType */: + case 277 /* JSDocUnknownType */: return anyType; case 137 /* StringKeyword */: return stringType; @@ -35665,7 +35898,7 @@ var ts; return getTypeFromTypeReference(node); case 160 /* TypePredicate */: return booleanType; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); case 164 /* TypeQuery */: return getTypeFromTypeQueryNode(node); @@ -35677,21 +35910,21 @@ var ts; return getTypeFromUnionTypeNode(node); case 169 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); case 172 /* ParenthesizedType */: - case 278 /* JSDocNonNullableType */: - case 274 /* JSDocTypeExpression */: + case 279 /* JSDocNonNullableType */: + case 275 /* JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); case 162 /* FunctionType */: case 163 /* ConstructorType */: case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: - case 280 /* JSDocFunctionType */: + case 284 /* JSDocTypeLiteral */: + case 281 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 174 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); @@ -35703,6 +35936,8 @@ var ts; return getTypeFromConditionalTypeNode(node); case 171 /* InferType */: return getTypeFromInferTypeNode(node); + case 178 /* ImportType */: + return getTypeFromImportTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 71 /* Identifier */: @@ -35850,7 +36085,7 @@ var ts; } // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and // also transient so that we can just store data on it directly. - var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */); + var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | (ts.getCheckFlags(symbol) & 1024 /* Late */)); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -35901,13 +36136,17 @@ var ts; } return type; } + function maybeTypeParameterReference(node) { + return !(node.kind === 145 /* QualifiedName */ || + node.parent.kind === 161 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName); + } function isTypeParameterPossiblyReferenced(tp, node) { // If the type parameter doesn't have exactly one declaration, if there are invening 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. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container_2 = tp.symbol.declarations[0].parent; - if (ts.findAncestor(node, function (n) { return n.kind === 211 /* Block */ ? "quit" : n === container_2; })) { + if (ts.findAncestor(node, function (n) { return n.kind === 212 /* Block */ ? "quit" : n === container_2; })) { return ts.forEachChild(node, containsReference); } } @@ -35917,7 +36156,8 @@ var ts; case 173 /* ThisType */: return tp.isThisType; case 71 /* Identifier */: - return !tp.isThisType && ts.isPartOfTypeNode(node) && getTypeFromTypeNode(node) === tp; + return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && + getTypeFromTypeNode(node) === tp; case 164 /* TypeQuery */: return true; } @@ -36051,30 +36291,30 @@ var ts; function isContextSensitive(node) { ts.Debug.assert(node.kind !== 153 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: return isContextSensitiveFunctionLikeDeclaration(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return node.operatorToken.kind === 54 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isContextSensitive(node.expression); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return ts.forEach(node.properties, isContextSensitive); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. return node.initializer && isContextSensitive(node.initializer); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: // It is possible to that node.expression is undefined (e.g
) return node.expression && isContextSensitive(node.expression); } @@ -36089,7 +36329,7 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 191 /* ArrowFunction */) { + if (node.kind !== 192 /* 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); @@ -36098,7 +36338,7 @@ var ts; } } // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return node.body.kind === 211 /* Block */ ? false : isContextSensitive(node.body); + return node.body.kind === 212 /* Block */ ? false : isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (ts.isInJavaScriptFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && @@ -38215,7 +38455,7 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; @@ -38225,16 +38465,16 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 180 /* BindingElement */: + case 181 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -38906,13 +39146,13 @@ var ts; if (node.kind === 99 /* ThisKeyword */) { return "0"; } - if (node.kind === 183 /* PropertyAccessExpression */) { + if (node.kind === 184 /* PropertyAccessExpression */) { var key = getFlowCacheKey(node.expression); return key && key + "." + ts.idText(node.name); } - if (node.kind === 180 /* BindingElement */) { + if (node.kind === 181 /* BindingElement */) { var container = node.parent.parent; - var key = container.kind === 180 /* BindingElement */ ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); + var key = container.kind === 181 /* BindingElement */ ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); var text = getBindingElementNameText(node); var result = key && text && (key + "." + text); return result; @@ -38920,7 +39160,7 @@ var ts; return undefined; } function getBindingElementNameText(element) { - if (element.parent.kind === 178 /* ObjectBindingPattern */) { + if (element.parent.kind === 179 /* ObjectBindingPattern */) { var name = element.propertyName || element.name; switch (name.kind) { case 71 /* Identifier */: @@ -38943,26 +39183,26 @@ var ts; switch (source.kind) { case 71 /* Identifier */: return target.kind === 71 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 230 /* VariableDeclaration */ || target.kind === 180 /* BindingElement */) && + (target.kind === 231 /* VariableDeclaration */ || target.kind === 181 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 99 /* ThisKeyword */: return target.kind === 99 /* ThisKeyword */; case 97 /* SuperKeyword */: return target.kind === 97 /* SuperKeyword */; - case 183 /* PropertyAccessExpression */: - return target.kind === 183 /* PropertyAccessExpression */ && + case 184 /* PropertyAccessExpression */: + return target.kind === 184 /* PropertyAccessExpression */ && source.name.escapedText === target.name.escapedText && isMatchingReference(source.expression, target.expression); - case 180 /* BindingElement */: - if (target.kind !== 183 /* PropertyAccessExpression */) + case 181 /* BindingElement */: + if (target.kind !== 184 /* PropertyAccessExpression */) return false; var t = target; if (t.name.escapedText !== getBindingElementNameText(source)) return false; - if (source.parent.parent.kind === 180 /* BindingElement */ && isMatchingReference(source.parent.parent, t.expression)) { + if (source.parent.parent.kind === 181 /* BindingElement */ && isMatchingReference(source.parent.parent, t.expression)) { return true; } - if (source.parent.parent.kind === 230 /* VariableDeclaration */) { + if (source.parent.parent.kind === 231 /* VariableDeclaration */) { var maybeId = source.parent.parent.initializer; return maybeId && isMatchingReference(maybeId, t.expression); } @@ -38970,7 +39210,7 @@ var ts; return false; } function containsMatchingReference(source, target) { - while (source.kind === 183 /* PropertyAccessExpression */) { + while (source.kind === 184 /* PropertyAccessExpression */) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -38983,7 +39223,7 @@ var ts; // a possible discriminant if its type differs in the constituents of containing union type, and if every // choice is a unit type or a union of unit types. function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 183 /* PropertyAccessExpression */ && + return target.kind === 184 /* PropertyAccessExpression */ && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.escapedText); } @@ -38991,7 +39231,7 @@ var ts; if (expr.kind === 71 /* Identifier */) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 183 /* PropertyAccessExpression */) { + if (expr.kind === 184 /* PropertyAccessExpression */) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.escapedText); } @@ -39035,7 +39275,7 @@ var ts; } } } - if (callExpression.expression.kind === 183 /* PropertyAccessExpression */ && + if (callExpression.expression.kind === 184 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -39169,15 +39409,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 181 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 268 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 182 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 269 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 198 /* BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 220 /* ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 199 /* BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 221 /* ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -39194,21 +39434,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return stringType; - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return undefinedType; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -39216,7 +39456,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 178 /* ObjectBindingPattern */ ? + var type = pattern.kind === 179 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -39234,35 +39474,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 219 /* ForInStatement */) { + if (node.parent.parent.kind === 220 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 220 /* ForOfStatement */) { + if (node.parent.parent.kind === 221 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 230 /* VariableDeclaration */ ? + return node.kind === 231 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */ ? + return node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */ ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 230 /* VariableDeclaration */ && node.initializer && + return node.kind === 231 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 180 /* BindingElement */ && node.parent.kind === 198 /* BinaryExpression */ && + node.kind !== 181 /* BindingElement */ && node.parent.kind === 199 /* BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (node.operatorToken.kind) { case 58 /* EqualsToken */: return getReferenceCandidate(node.left); @@ -39274,13 +39514,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 189 /* ParenthesizedExpression */ || - parent.kind === 198 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */ && parent.left === node || - parent.kind === 198 /* BinaryExpression */ && parent.operatorToken.kind === 26 /* CommaToken */ && parent.right === node ? + return parent.kind === 190 /* ParenthesizedExpression */ || + parent.kind === 199 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */ && parent.left === node || + parent.kind === 199 /* BinaryExpression */ && parent.operatorToken.kind === 26 /* CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 264 /* CaseClause */) { + if (clause.kind === 265 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -39453,11 +39693,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 183 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" || - parent.parent.kind === 185 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 184 /* ElementAccessExpression */ && + var isLengthPushOrUnshift = parent.kind === 184 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" || + parent.parent.kind === 186 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 185 /* ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 198 /* BinaryExpression */ && + parent.parent.kind === 199 /* BinaryExpression */ && parent.parent.operatorToken.kind === 58 /* EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -39505,7 +39745,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 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent && reference.parent.kind === 207 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 16384 /* Never */) { + if (reference.parent && reference.parent.kind === 208 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 16384 /* Never */) { return declaredType; } return resultType; @@ -39576,7 +39816,7 @@ var ts; else if (flags & 2 /* Start */) { // Check if we should continue with the control flow of the containing function. var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 183 /* PropertyAccessExpression */ && reference.kind !== 99 /* ThisKeyword */) { + if (container && container !== flowContainer && reference.kind !== 184 /* PropertyAccessExpression */ && reference.kind !== 99 /* ThisKeyword */) { flow = container.flowNode; continue; } @@ -39632,7 +39872,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 185 /* CallExpression */ ? + var expr = node.kind === 186 /* CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -39640,7 +39880,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 185 /* CallExpression */) { + if (node.kind === 186 /* CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -39805,7 +40045,7 @@ var ts; return result; } function isMatchingReferenceDiscriminant(expr, computedType) { - return expr.kind === 183 /* PropertyAccessExpression */ && + return expr.kind === 184 /* PropertyAccessExpression */ && computedType.flags & 131072 /* Union */ && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(computedType, expr.name.escapedText); @@ -39856,10 +40096,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 193 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) { + if (left_1.kind === 194 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 193 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) { + if (right_1.kind === 194 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -40071,7 +40311,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 184 /* ElementAccessExpression */ || invokedExpression.kind === 183 /* PropertyAccessExpression */) { + if (invokedExpression.kind === 185 /* ElementAccessExpression */ || invokedExpression.kind === 184 /* PropertyAccessExpression */) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -40091,15 +40331,15 @@ var ts; case 71 /* Identifier */: case 99 /* ThisKeyword */: case 97 /* SuperKeyword */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: if (expr.operator === 51 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -40135,8 +40375,8 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 238 /* ModuleBlock */ || - node.kind === 272 /* SourceFile */ || + node.kind === 239 /* ModuleBlock */ || + node.kind === 273 /* SourceFile */ || node.kind === 151 /* PropertyDeclaration */; }); } @@ -40182,10 +40422,10 @@ var ts; } function isConstraintPosition(node) { var parent = node.parent; - return parent.kind === 183 /* PropertyAccessExpression */ || - parent.kind === 185 /* CallExpression */ && parent.expression === node || - parent.kind === 184 /* ElementAccessExpression */ && parent.expression === node || - parent.kind === 180 /* BindingElement */ && parent.name === node && !!parent.initializer; + return parent.kind === 184 /* PropertyAccessExpression */ || + parent.kind === 186 /* CallExpression */ && parent.expression === node || + parent.kind === 185 /* ElementAccessExpression */ && parent.expression === node || + parent.kind === 181 /* BindingElement */ && parent.name === node && !!parent.initializer; } function typeHasNullableConstraint(type) { return type.flags & 7372800 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 12288 /* Nullable */); @@ -40219,7 +40459,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ES2015 */) { - if (container.kind === 191 /* ArrowFunction */) { + if (container.kind === 192 /* 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.hasModifier(container, 256 /* Async */)) { @@ -40240,7 +40480,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 === 233 /* ClassDeclaration */ + if (declaration.kind === 234 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -40252,7 +40492,7 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 203 /* ClassExpression */) { + else if (declaration.kind === 204 /* 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. @@ -40269,9 +40509,6 @@ var ts; } } } - checkCollisionWithCapturedSuperVariable(node, node); - checkCollisionWithCapturedThisVariable(node, node); - checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getConstraintForLocation(getTypeOfSymbol(localOrExportSymbol), node); var assignmentKind = ts.getAssignmentTargetKind(node); @@ -40313,8 +40550,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 === 190 /* FunctionExpression */ || - flowContainer.kind === 191 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 191 /* FunctionExpression */ || + flowContainer.kind === 192 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -40323,9 +40560,9 @@ var ts; // declaration container are the same). var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAsignmentTarget || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0 || - isInTypeQuery(node) || node.parent.kind === 250 /* ExportSpecifier */) || - node.parent.kind === 207 /* NonNullExpression */ || - declaration.kind === 230 /* VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 251 /* ExportSpecifier */) || + node.parent.kind === 208 /* NonNullExpression */ || + declaration.kind === 231 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 2097152 /* Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -40356,7 +40593,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 267 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 268 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -40381,8 +40618,8 @@ 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 (container.kind === 218 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 231 /* VariableDeclarationList */).parent === container && + if (container.kind === 219 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 232 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -40396,7 +40633,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 189 /* ParenthesizedExpression */) { + while (current.parent.kind === 190 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -40404,7 +40641,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 196 /* PrefixUnaryExpression */ || current.parent.kind === 197 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 197 /* PrefixUnaryExpression */ || current.parent.kind === 198 /* PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 43 /* PlusPlusToken */ || expr.operator === 44 /* MinusMinusToken */; } @@ -40489,17 +40726,17 @@ var ts; 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 === 191 /* ArrowFunction */) { + if (container.kind === 192 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES2015 */); } switch (container.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* 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 236 /* EnumDeclaration */: + case 237 /* 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; @@ -40537,8 +40774,8 @@ var ts; // Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated. // If this is a function in a JS file, it might be a class method. Check if it's the RHS // of a x.prototype.y = function [name]() { .... } - if (container.kind === 190 /* FunctionExpression */ && - container.parent.kind === 198 /* BinaryExpression */ && + if (container.kind === 191 /* FunctionExpression */ && + container.parent.kind === 199 /* BinaryExpression */ && ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') var className = container.parent // x.prototype.y = f @@ -40569,7 +40806,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 280 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 281 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -40582,12 +40819,12 @@ var ts; return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 148 /* Parameter */; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 185 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 186 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); 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 === 191 /* ArrowFunction */) { + while (container && container.kind === 192 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */; } @@ -40607,7 +40844,7 @@ var ts; 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 === 182 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 183 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -40695,7 +40932,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 182 /* ObjectLiteralExpression */) { + if (container.parent.kind === 183 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -40739,7 +40976,7 @@ 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 === 182 /* ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 183 /* ObjectLiteralExpression */) { if (ts.hasModifier(container, 32 /* Static */)) { return container.kind === 153 /* MethodDeclaration */ || container.kind === 152 /* MethodSignature */ || @@ -40763,8 +41000,8 @@ var ts; function getContainingObjectLiteral(func) { return (func.kind === 153 /* MethodDeclaration */ || func.kind === 155 /* GetAccessor */ || - func.kind === 156 /* SetAccessor */) && func.parent.kind === 182 /* ObjectLiteralExpression */ ? func.parent : - func.kind === 190 /* FunctionExpression */ && func.parent.kind === 268 /* PropertyAssignment */ ? func.parent.parent : + func.kind === 156 /* SetAccessor */) && func.parent.kind === 183 /* ObjectLiteralExpression */ ? func.parent : + func.kind === 191 /* FunctionExpression */ && func.parent.kind === 269 /* PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -40776,7 +41013,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 191 /* ArrowFunction */) { + if (func.kind === 192 /* ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -40803,7 +41040,7 @@ var ts; if (thisType) { return instantiateType(thisType, getContextualMapper(containingLiteral)); } - if (literal.parent.kind !== 268 /* PropertyAssignment */) { + if (literal.parent.kind !== 269 /* PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -40817,9 +41054,9 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = func.parent; - if (parent.kind === 198 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */) { + if (parent.kind === 199 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */) { var target = parent.left; - if (target.kind === 183 /* PropertyAccessExpression */ || target.kind === 184 /* ElementAccessExpression */) { + if (target.kind === 184 /* PropertyAccessExpression */ || target.kind === 185 /* ElementAccessExpression */) { var expression = target.expression; // Don't contextually type `this` as `exports` in `exports.Point = function(x, y) { this.x = x; this.y = y; }` if (inJs && ts.isIdentifier(expression)) { @@ -40906,7 +41143,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; var name = declaration.propertyName || declaration.name; - if (parentDeclaration.kind !== 180 /* BindingElement */) { + if (parentDeclaration.kind !== 181 /* BindingElement */) { var parentTypeNode = ts.getEffectiveTypeAnnotationNode(parentDeclaration); if (parentTypeNode && !ts.isBindingPattern(name)) { var text = ts.getTextOfPropertyName(name); @@ -40988,7 +41225,7 @@ var ts; return getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 187 /* TaggedTemplateExpression */) { + if (template.parent.kind === 188 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -41134,7 +41371,7 @@ var ts; var prop = _a[_i]; if (!prop.symbol) continue; - if (prop.kind !== 268 /* PropertyAssignment */) + if (prop.kind !== 269 /* PropertyAssignment */) continue; if (isDiscriminantProperty(contextualType, prop.symbol.escapedName)) { var discriminatingType = getTypeOfNode(prop.initializer); @@ -41182,52 +41419,52 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 180 /* BindingElement */: + case 181 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 191 /* ArrowFunction */: - case 223 /* ReturnStatement */: + case 192 /* ArrowFunction */: + case 224 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return getApparentTypeOfContextualType(parent.parent); - case 181 /* ArrayLiteralExpression */: { + case 182 /* ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 209 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 200 /* TemplateExpression */); + case 210 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 201 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 189 /* ParenthesizedExpression */: { + case 190 /* ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); } - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return getContextualTypeForJsxExpression(parent); - case 260 /* JsxAttribute */: - case 262 /* JsxSpreadAttribute */: + case 261 /* JsxAttribute */: + case 263 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent); } return undefined; @@ -41287,64 +41524,59 @@ var ts; if (context.typeArguments) { signatures = ts.mapDefined(signatures, function (s) { return getJsxSignatureTypeArgumentInstantiation(s, context, isJs); }); } - return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromConstructSignature(t, isJs, context); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0 /* None */); + return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, /*reportErrors*/ false); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0 /* None */); } function getJsxPropsTypeFromCallSignature(sig, context) { - var propsType = getTypeOfFirstParameterOfSignature(sig); + var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType); var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (intrinsicAttribs !== unknownType) { propsType = intersectTypes(intrinsicAttribs, propsType); } return propsType; } - function getJsxPropsTypeFromClassType(hostClassType, isJs, context) { - if (isTypeAny(hostClassType)) { - return hostClassType; + function getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation) { + var instanceType = getReturnTypeOfSignature(sig); + return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation); + } + function getJsxPropsTypeFromClassType(sig, isJs, context, reportErrors) { + var forcedLookupLocation = getJsxElementPropertiesName(getJsxNamespaceAt(context)); + var attributesType = forcedLookupLocation === undefined + // If there is no type ElementAttributesProperty, return the type of the first parameter of the signature, which should be the props type + ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType) + : forcedLookupLocation === "" + // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead + ? getReturnTypeOfSignature(sig) + // Otherwise get the type of the property on the signature return type + : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation); + if (!attributesType) { + // There is no property named 'props' on this instance type + if (reportErrors && !!forcedLookupLocation && !!ts.length(context.attributes.properties)) { + error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation)); + } + return emptyObjectType; } - var propsName = getJsxElementPropertiesName(getJsxNamespaceAt(context)); - if (propsName === undefined) { - // There is no type ElementAttributesProperty, return 'any' - return anyType; - } - else if (propsName === "") { - // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead - return hostClassType; + else if (isTypeAny(attributesType)) { + // Props is of type 'any' or unknown + return attributesType; } else { - var attributesType = getTypeOfPropertyOfType(hostClassType, propsName); - if (!attributesType) { - // There is no property named 'props' on this instance type - return emptyObjectType; + // Normal case -- add in IntrinsicClassElements and IntrinsicElements + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); + if (intrinsicClassAttribs !== unknownType) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + var hostClassType = getReturnTypeOfSignature(sig); + apparentAttributesType = intersectTypes(typeParams + ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) + : intrinsicClassAttribs, apparentAttributesType); } - else if (isTypeAny(attributesType)) { - // Props is of type 'any' or unknown - return attributesType; - } - else { - // Normal case -- add in IntrinsicClassElements and IntrinsicElements - var apparentAttributesType = attributesType; - var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); - if (intrinsicClassAttribs !== unknownType) { - var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) - : intrinsicClassAttribs, apparentAttributesType); - } - var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); - if (intrinsicAttribs !== unknownType) { - apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); - } - return apparentAttributesType; + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); } + return apparentAttributesType; } } - function getJsxPropsTypeFromConstructSignature(sig, isJs, context) { - var hostClassType = getReturnTypeOfSignature(sig); - if (hostClassType) { - return getJsxPropsTypeFromClassType(hostClassType, isJs, context); - } - return getJsxPropsTypeFromCallSignature(sig, context); - } // If the given type is an object or union type with a single signature, and if that signature has at // least as many parameters as the given function, return the signature. Otherwise return undefined. function getContextualCallSignature(type, node) { @@ -41372,7 +41604,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 190 /* FunctionExpression */ || node.kind === 191 /* ArrowFunction */; + return node.kind === 191 /* FunctionExpression */ || node.kind === 192 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -41444,8 +41676,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterables*/ false); } function hasDefaultValue(node) { - return (node.kind === 180 /* BindingElement */ && !!node.initializer) || - (node.kind === 198 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */); + return (node.kind === 181 /* BindingElement */ && !!node.initializer) || + (node.kind === 199 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */); } function checkArrayLiteral(node, checkMode) { var elements = node.elements; @@ -41455,7 +41687,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); for (var index = 0; index < elements.length; index++) { var e = elements[index]; - if (inDestructuringPattern && e.kind === 202 /* SpreadElement */) { + if (inDestructuringPattern && e.kind === 203 /* SpreadElement */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -41480,7 +41712,7 @@ var ts; var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 202 /* SpreadElement */; + hasSpreadElement = hasSpreadElement || e.kind === 203 /* SpreadElement */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -41494,7 +41726,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 179 /* ArrayBindingPattern */ || pattern.kind === 181 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 180 /* ArrayBindingPattern */ || pattern.kind === 182 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -41502,7 +41734,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 204 /* OmittedExpression */) { + if (patternElement.kind !== 205 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType); @@ -41600,7 +41832,7 @@ var ts; var propagatedFlags = 8388608 /* FreshLiteral */; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 178 /* ObjectBindingPattern */ || contextualType.pattern.kind === 182 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 179 /* ObjectBindingPattern */ || contextualType.pattern.kind === 183 /* ObjectLiteralExpression */); var isInJSFile = ts.isInJavaScriptFile(node); var isJSObjectLiteral = !contextualType && isInJSFile; var typeFlags = 0; @@ -41622,15 +41854,15 @@ var ts; var memberDecl = node.properties[i]; var member = getSymbolOfNode(memberDecl); var literalName = void 0; - if (memberDecl.kind === 268 /* PropertyAssignment */ || - memberDecl.kind === 269 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 269 /* PropertyAssignment */ || + memberDecl.kind === 270 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var jsdocType = void 0; if (isInJSFile) { jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); } var type = void 0; - if (memberDecl.kind === 268 /* PropertyAssignment */) { + if (memberDecl.kind === 269 /* PropertyAssignment */) { if (memberDecl.name.kind === 146 /* ComputedPropertyName */) { var t = checkComputedPropertyName(memberDecl.name); if (t.flags & 224 /* Literal */) { @@ -41643,7 +41875,7 @@ var ts; type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 269 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 270 /* ShorthandPropertyAssignment */); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } if (jsdocType) { @@ -41662,8 +41894,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 === 268 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 269 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 269 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 270 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* Optional */; } @@ -41691,7 +41923,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 270 /* SpreadAssignment */) { + else if (memberDecl.kind === 271 /* SpreadAssignment */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -41818,7 +42050,7 @@ var ts; function isJsxIntrinsicIdentifier(tagName) { // TODO (yuisu): comment switch (tagName.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 99 /* ThisKeyword */: return false; case 71 /* Identifier */: @@ -41868,7 +42100,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 262 /* JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 263 /* JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, /*typeFlags*/ 0, 4096 /* JsxAttributes */); attributesTable = ts.createSymbolTable(); @@ -41891,7 +42123,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 253 /* JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 254 /* 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); @@ -42000,29 +42232,7 @@ var ts; } return links.resolvedSymbol; } - /** - * Given a JSX element that is a class element, finds the Element Instance Type. If the - * element is not a class element, or the class element type cannot be determined, returns 'undefined'. - * For example, in the element , the element instance type is `MyClass` (not `typeof MyClass`). - */ - function getJsxElementInstanceType(node, valueType) { - ts.Debug.assert(!(valueType.flags & 131072 /* Union */)); - if (isTypeAny(valueType)) { - // Short-circuit if the class tag is using an element type 'any' - return anyType; - } - // Resolve the signatures, preferring constructor - var signatures = getSignaturesOfType(valueType, 1 /* Construct */); - if (signatures.length === 0) { - // No construct signatures, try call signatures - signatures = getSignaturesOfType(valueType, 0 /* Call */); - if (signatures.length === 0) { - // We found no signatures at all, which is an error - error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName)); - return unknownType; - } - } - // Instantiate in context of source type + function instantiateJsxSignatures(node, signatures) { var instantiatedSignatures = []; var candidateForTypeArgumentError; var hasTypeArgumentError = !!node.typeArguments; @@ -42057,7 +42267,7 @@ var ts; diagnostics.add(getTypeArgumentArityError(node, signatures, node.typeArguments)); } } - return getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2 /* Subtype */); + return instantiatedSignatures; } function getJsxSignatureTypeArgumentInstantiation(signature, node, isJavascript, reportErrors) { if (!node.typeArguments) { @@ -42256,8 +42466,12 @@ var ts; return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType); }), 2 /* Subtype */); } + // Shortcircuit any + if (isTypeAny(elementType)) { + return elementType; + } // If the elemType is a string type, we have to return anyType to prevent an error downstream as we will try to find construct or call signature of the type - if (elementType.flags & 2 /* String */) { + else if (elementType.flags & 2 /* String */) { return anyType; } else if (elementType.flags & 32 /* StringLiteral */) { @@ -42282,7 +42496,20 @@ var ts; return anyType; } // Get the element instance type (the result of newing or invoking this tag) - var elemInstanceType = getJsxElementInstanceType(openingLikeElement, elementType); + // Resolve the signatures, preferring constructor + var signatures = getSignaturesOfType(elementType, 1 /* Construct */); + if (signatures.length === 0) { + // No construct signatures, try call signatures + signatures = getSignaturesOfType(elementType, 0 /* Call */); + if (signatures.length === 0) { + // We found no signatures at all, which is an error + error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName)); + return unknownType; + } + } + // Instantiate in context of source type + var instantiatedSignatures = instantiateJsxSignatures(openingLikeElement, signatures); + var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2 /* Subtype */); // If we should include all stateless attributes type, then get all attributes type from all stateless function signature. // Otherwise get only attributes type from the signature picked by choose-overload logic. var statelessAttributesType = shouldIncludeAllStatelessAttributesType ? @@ -42295,7 +42522,8 @@ var ts; if (elementClassType) { checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); } - return getJsxPropsTypeFromClassType(elemInstanceType, ts.isInJavaScriptFile(openingLikeElement), openingLikeElement); + var isJs = ts.isInJavaScriptFile(openingLikeElement); + return getUnionType(ts.map(instantiatedSignatures, function (sig) { return getJsxPropsTypeFromClassType(sig, isJs, openingLikeElement, /*reportErrors*/ true); })); } /** * Get attributes type of the given intrinsic opening-like Jsx element by resolving the tag name. @@ -42481,29 +42709,22 @@ var ts; // i.e
// attr1 and attr2 are treated as JSXAttributes attached in the JsxOpeningLikeElement as "attributes". var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode); - // If the targetAttributesType is an emptyObjectType, indicating that there is no property named 'props' on this instance type. - // but there exists a sourceAttributesType, we need to explicitly give an error as normal assignability check allow excess properties and will pass. - if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || getPropertiesOfType(sourceAttributesType).length > 0)) { - error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(getJsxElementPropertiesName(getJsxNamespaceAt(openingLikeElement)))); - } - else { - // Check if sourceAttributesType assignable to targetAttributesType though this check will allow excess properties - var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); - // After we check for assignability, we will do another pass to check that all explicitly specified attributes have correct name corresponding in targetAttributeType. - // This will allow excess properties in spread type as it is very common pattern to spread outer attributes into React component in its render method. - if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { - for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { - var attribute = _a[_i]; - if (!ts.isJsxAttribute(attribute)) { - continue; - } - var attrName = attribute.name; - var isNotIgnoredJsxProperty = (isUnhyphenatedJsxName(ts.idText(attrName)) || !!(getPropertyOfType(targetAttributesType, attrName.escapedText))); - if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, /*isComparingJsxAttributes*/ true)) { - error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); - // We break here so that errors won't be cascading - break; - } + // Check if sourceAttributesType assignable to targetAttributesType though this check will allow excess properties + var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); + // After we check for assignability, we will do another pass to check that all explicitly specified attributes have correct name corresponding in targetAttributeType. + // This will allow excess properties in spread type as it is very common pattern to spread outer attributes into React component in its render method. + if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { + for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { + var attribute = _a[_i]; + if (!ts.isJsxAttribute(attribute)) { + continue; + } + var attrName = attribute.name; + var isNotIgnoredJsxProperty = (isUnhyphenatedJsxName(ts.idText(attrName)) || !!(getPropertyOfType(targetAttributesType, attrName.escapedText))); + if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, /*isComparingJsxAttributes*/ true)) { + error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); + // We break here so that errors won't be cascading + break; } } } @@ -42528,10 +42749,19 @@ var ts; function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } - function isMethodLike(symbol) { - return !!(symbol.flags & 8192 /* Method */ || - ts.getCheckFlags(symbol) & 4 /* SyntheticMethod */ || - ts.isInJavaScriptFile(symbol.valueDeclaration) && ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(symbol.valueDeclaration))); + /** + * Return whether this symbol is a member of a prototype somewhere + * Note that this is not tracked well within the compiler, so the answer may be incorrect. + */ + function isPrototypeProperty(symbol) { + if (symbol.flags & 8192 /* Method */ || ts.getCheckFlags(symbol) & 4 /* SyntheticMethod */) { + return true; + } + if (ts.isInJavaScriptFile(symbol.valueDeclaration)) { + var parent = symbol.valueDeclaration.parent; + return parent && ts.isBinaryExpression(parent) && + ts.getSpecialPropertyAssignmentKind(parent) === 3 /* PrototypeProperty */; + } } /** * Check whether the requested property access is valid. @@ -42543,9 +42773,11 @@ var ts; */ function checkPropertyAccessibility(node, left, type, prop) { var flags = ts.getDeclarationModifierFlagsFromSymbol(prop); - var errorNode = node.kind === 183 /* PropertyAccessExpression */ || node.kind === 230 /* VariableDeclaration */ ? + var errorNode = node.kind === 184 /* PropertyAccessExpression */ || node.kind === 231 /* VariableDeclaration */ ? node.name : - node.right; + node.kind === 178 /* ImportType */ ? + node : + node.right; if (ts.getCheckFlags(prop) & 256 /* ContainsPrivate */) { // Synthetic property with private constituent property error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); @@ -42698,7 +42930,7 @@ var ts; // Only compute control flow type if this is a property access expression that isn't an // assignment target, and the referenced property was declared as a variable, property, // accessor, or optional method. - if (node.kind !== 183 /* PropertyAccessExpression */ || + if (node.kind !== 184 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 131072 /* Union */)) { return propType; @@ -42735,7 +42967,7 @@ var ts; && !isPropertyDeclaredInAncestorClass(prop)) { error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.idText(right)); } - else if (valueDeclaration.kind === 233 /* ClassDeclaration */ && + else if (valueDeclaration.kind === 234 /* ClassDeclaration */ && node.parent.kind !== 161 /* TypeReference */ && !(valueDeclaration.flags & 2097152 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { @@ -42747,7 +42979,7 @@ var ts; switch (node.kind) { case 151 /* PropertyDeclaration */: return true; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: // We might be in `a = { b: this.b }`, so keep looking. See `tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts`. return false; default: @@ -42765,11 +42997,11 @@ var ts; } var classType = getTypeOfSymbol(prop.parent); while (true) { - classType = getSuperClass(classType); + classType = classType.symbol && getSuperClass(classType); if (!classType) { return false; } - var superProperty = getPropertyOfObjectType(classType, prop.escapedName); + var superProperty = getPropertyOfType(classType, prop.escapedName); if (superProperty && superProperty.valueDeclaration) { return true; } @@ -42780,8 +43012,7 @@ var ts; if (x.length === 0) { return undefined; } - ts.Debug.assert(x.length === 1); - return x[0]; + return getIntersectionType(x); } function reportNonexistentProperty(propNode, containingType) { var errorInfo; @@ -42935,11 +43166,17 @@ var ts; (ts.getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = 67108863 /* All */; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 183 /* PropertyAccessExpression */ ? node.expression : node.left; - return isValidPropertyAccessWithType(node, left, propertyName, getWidenedType(checkExpression(left))); + switch (node.kind) { + case 184 /* PropertyAccessExpression */: + return isValidPropertyAccessWithType(node, node.expression, propertyName, getWidenedType(checkExpression(node.expression))); + case 145 /* QualifiedName */: + return isValidPropertyAccessWithType(node, node.left, propertyName, getWidenedType(checkExpression(node.left))); + case 178 /* ImportType */: + return isValidPropertyAccessWithType(node, node, propertyName, getTypeFromTypeNode(node)); + } } function isValidPropertyAccessForCompletions(node, type, property) { - return isValidPropertyAccessWithType(node, node.expression, property.escapedName, type) + return isValidPropertyAccessWithType(node, node.kind === 178 /* ImportType */ ? node : node.expression, property.escapedName, type) && (!(property.flags & 8192 /* Method */) || isValidMethodAccess(property, type)); } function isValidMethodAccess(method, actualThisType) { @@ -42973,7 +43210,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 231 /* VariableDeclarationList */) { + if (initializer.kind === 232 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -43002,7 +43239,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 219 /* ForInStatement */ && + if (node.kind === 220 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -43020,7 +43257,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 186 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 187 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -43087,7 +43324,7 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 187 /* TaggedTemplateExpression */) { + if (node.kind === 188 /* TaggedTemplateExpression */) { checkExpression(node.template); } else if (node.kind !== 149 /* Decorator */) { @@ -43156,7 +43393,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 202 /* SpreadElement */) { + if (arg && arg.kind === 203 /* SpreadElement */) { return i; } } @@ -43172,12 +43409,12 @@ var ts; // The arity check will be done in "checkApplicableSignatureForJsxOpeningLikeElement". return true; } - if (node.kind === 187 /* TaggedTemplateExpression */) { + if (node.kind === 188 /* TaggedTemplateExpression */) { // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length argCount = args.length; typeArguments = undefined; - if (node.template.kind === 200 /* TemplateExpression */) { + if (node.template.kind === 201 /* 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.lastOrUndefined(node.template.templateSpans); @@ -43200,7 +43437,7 @@ var ts; else { if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 186 /* NewExpression */); + ts.Debug.assert(node.kind === 187 /* NewExpression */); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -43318,7 +43555,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 204 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 205 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); // If the effective argument type is 'undefined', there is no synthetic type @@ -43408,7 +43645,7 @@ var ts; return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 186 /* NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 187 /* 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. @@ -43425,7 +43662,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 204 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 205 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); // If the effective argument type is undefined, there is no synthetic type for the argument. @@ -43449,12 +43686,9 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - if (node.kind === 185 /* CallExpression */) { - var callee = node.expression; - if (callee.kind === 183 /* PropertyAccessExpression */) { - return callee.expression; - } - else if (callee.kind === 184 /* ElementAccessExpression */) { + if (node.kind === 186 /* CallExpression */) { + var callee = ts.skipOuterExpressions(node.expression); + if (callee.kind === 184 /* PropertyAccessExpression */ || callee.kind === 185 /* ElementAccessExpression */) { return callee.expression; } } @@ -43469,10 +43703,10 @@ var ts; * will be supplied from calls to `getEffectiveArgumentCount` and `getEffectiveArgumentType`. */ function getEffectiveCallArguments(node) { - if (node.kind === 187 /* TaggedTemplateExpression */) { + if (node.kind === 188 /* TaggedTemplateExpression */) { var template = node.template; var args_4 = [undefined]; - if (template.kind === 200 /* TemplateExpression */) { + if (template.kind === 201 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_4.push(span.expression); }); @@ -43508,8 +43742,8 @@ var ts; function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 149 /* Decorator */) { switch (node.parent.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; case 151 /* PropertyDeclaration */: @@ -43552,7 +43786,7 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); @@ -43597,7 +43831,7 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } @@ -43651,7 +43885,7 @@ var ts; function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a parameter decorator - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } @@ -43700,7 +43934,7 @@ var ts; if (node.kind === 149 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 187 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 188 /* TaggedTemplateExpression */) { return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' @@ -43713,7 +43947,7 @@ var ts; function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. if (node.kind === 149 /* Decorator */ || - (argIndex === 0 && node.kind === 187 /* TaggedTemplateExpression */)) { + (argIndex === 0 && node.kind === 188 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -43726,7 +43960,7 @@ var ts; // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 187 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 188 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -43746,7 +43980,7 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, paramCount, typeArguments.length); } function resolveCall(node, signatures, candidatesOutArray, fallbackError) { - var isTaggedTemplate = node.kind === 187 /* TaggedTemplateExpression */; + var isTaggedTemplate = node.kind === 188 /* TaggedTemplateExpression */; var isDecorator = node.kind === 149 /* Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var typeArguments; @@ -43821,7 +44055,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 = candidatesOutArray && node.kind === 185 /* CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 186 /* 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 @@ -44208,8 +44442,8 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 148 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; @@ -44305,16 +44539,16 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray); case 149 /* Decorator */: return resolveDecorator(node, candidatesOutArray); - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: // This code-path is called by language service return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray) || unknownSignature; } @@ -44397,14 +44631,13 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 183 /* PropertyAccessExpression */) { + while (parent && parent.kind === 184 /* PropertyAccessExpression */) { parent = parent.parent; } - return parent && ts.isBinaryExpression(parent) && - ts.isPrototypeAccess(parent.left) && - parent.operatorToken.kind === 58 /* EqualsToken */ && - ts.isObjectLiteralExpression(parent.right) && - parent.right; + if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 58 /* EqualsToken */) { + var right = ts.getInitializerOfBinaryExpression(parent); + return ts.isObjectLiteralExpression(right) && right; + } } function getInferredClassType(symbol) { var links = getSymbolLinks(symbol); @@ -44430,7 +44663,7 @@ var ts; if (node.expression.kind === 97 /* SuperKeyword */) { return voidType; } - if (node.kind === 186 /* NewExpression */) { + if (node.kind === 187 /* NewExpression */) { var declaration = signature.declaration; if (declaration && declaration.kind !== 154 /* Constructor */ && @@ -44552,9 +44785,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 232 /* FunctionDeclaration */ + ? 233 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 230 /* VariableDeclaration */ + ? 231 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -44619,7 +44852,10 @@ var ts; pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function getTypeOfFirstParameterOfSignature(signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType); + } + function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType; } function inferFromAnnotatedParameters(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -44721,7 +44957,7 @@ var ts; } var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 211 /* Block */) { + if (func.body.kind !== 212 /* Block */) { type = checkExpressionCached(func.body, checkMode); if (functionFlags & 2 /* Async */) { // From within an async function you can return either a non-promise value or a promise. Any @@ -44835,7 +45071,7 @@ var ts; if (!(func.flags & 128 /* HasImplicitReturn */)) { return false; } - if (ts.some(func.body.statements, function (statement) { return statement.kind === 225 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) { + if (ts.some(func.body.statements, function (statement) { return statement.kind === 226 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) { return false; } return true; @@ -44878,11 +45114,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; case 153 /* MethodDeclaration */: - return func.parent.kind === 182 /* ObjectLiteralExpression */; + return func.parent.kind === 183 /* ObjectLiteralExpression */; default: return false; } @@ -44906,7 +45142,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 === 152 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 211 /* Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 152 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 212 /* Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; @@ -44946,7 +45182,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 190 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 191 /* FunctionExpression */) { checkGrammarForGenerator(node); } var links = getNodeLinks(node); @@ -44981,11 +45217,6 @@ var ts; checkNodeDeferred(node); } } - if (produceDiagnostics && node.kind !== 153 /* MethodDeclaration */) { - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); - } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { @@ -45009,7 +45240,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 211 /* Block */) { + if (node.body.kind === 212 /* Block */) { checkSourceElement(node.body); } else { @@ -45056,7 +45287,7 @@ var ts; if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 183 /* PropertyAccessExpression */ || expr.kind === 184 /* ElementAccessExpression */) && + (expr.kind === 184 /* PropertyAccessExpression */ || expr.kind === 185 /* ElementAccessExpression */) && expr.expression.kind === 99 /* ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var func = ts.getContainingFunction(expr); @@ -45073,13 +45304,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 183 /* PropertyAccessExpression */ || expr.kind === 184 /* ElementAccessExpression */) { + if (expr.kind === 184 /* PropertyAccessExpression */ || expr.kind === 185 /* ElementAccessExpression */) { var node = ts.skipParentheses(expr.expression); if (node.kind === 71 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 2097152 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 244 /* NamespaceImport */; + return declaration && declaration.kind === 245 /* NamespaceImport */; } } } @@ -45088,7 +45319,7 @@ var ts; function checkReferenceExpression(expr, invalidReferenceMessage) { // References are combinations of identifiers, parentheses, and property accesses. var node = ts.skipOuterExpressions(expr, 2 /* Assertions */ | 1 /* Parentheses */); - if (node.kind !== 71 /* Identifier */ && node.kind !== 183 /* PropertyAccessExpression */ && node.kind !== 184 /* ElementAccessExpression */) { + if (node.kind !== 71 /* Identifier */ && node.kind !== 184 /* PropertyAccessExpression */ && node.kind !== 185 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } @@ -45097,7 +45328,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 183 /* PropertyAccessExpression */ && expr.kind !== 184 /* ElementAccessExpression */) { + if (expr.kind !== 184 /* PropertyAccessExpression */ && expr.kind !== 185 /* ElementAccessExpression */) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -45263,6 +45494,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; + checkGrammarForDisallowedTrailingComma(properties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); if (strictNullChecks && properties.length === 0) { return checkNonNullType(sourceType, node); } @@ -45274,7 +45506,7 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 268 /* PropertyAssignment */ || property.kind === 269 /* ShorthandPropertyAssignment */) { + if (property.kind === 269 /* PropertyAssignment */ || property.kind === 270 /* ShorthandPropertyAssignment */) { var name = property.name; if (name.kind === 146 /* ComputedPropertyName */) { checkComputedPropertyName(name); @@ -45289,7 +45521,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 269 /* ShorthandPropertyAssignment */) { + if (property.kind === 270 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -45301,7 +45533,7 @@ var ts; error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 270 /* SpreadAssignment */) { + else if (property.kind === 271 /* SpreadAssignment */) { if (languageVersion < 6 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); } @@ -45319,6 +45551,8 @@ var ts; } } function checkArrayLiteralAssignment(node, sourceType, checkMode) { + var elements = node.elements; + checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* Read */); } @@ -45326,7 +45560,6 @@ var ts; // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType; - var elements = node.elements; for (var i = 0; i < elements.length; i++) { checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); } @@ -45335,8 +45568,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 204 /* OmittedExpression */) { - if (element.kind !== 202 /* SpreadElement */) { + if (element.kind !== 205 /* OmittedExpression */) { + if (element.kind !== 203 /* SpreadElement */) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -45364,7 +45597,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 198 /* BinaryExpression */ && restExpression.operatorToken.kind === 58 /* EqualsToken */) { + if (restExpression.kind === 199 /* BinaryExpression */ && restExpression.operatorToken.kind === 58 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -45377,7 +45610,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 269 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 270 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -45393,21 +45626,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 198 /* BinaryExpression */ && target.operatorToken.kind === 58 /* EqualsToken */) { + if (target.kind === 199 /* BinaryExpression */ && target.operatorToken.kind === 58 /* EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 182 /* ObjectLiteralExpression */) { + if (target.kind === 183 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 181 /* ArrayLiteralExpression */) { + if (target.kind === 182 /* 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 === 270 /* SpreadAssignment */ ? + var error = target.parent.kind === 271 /* 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; if (checkReferenceExpression(target, error)) { @@ -45429,35 +45662,35 @@ var ts; case 71 /* Identifier */: case 9 /* StringLiteral */: case 12 /* RegularExpressionLiteral */: - case 187 /* TaggedTemplateExpression */: - case 200 /* TemplateExpression */: + case 188 /* TaggedTemplateExpression */: + case 201 /* TemplateExpression */: case 13 /* NoSubstitutionTemplateLiteral */: case 8 /* NumericLiteral */: case 101 /* TrueKeyword */: case 86 /* FalseKeyword */: case 95 /* NullKeyword */: case 140 /* UndefinedKeyword */: - case 190 /* FunctionExpression */: - case 203 /* ClassExpression */: - case 191 /* ArrowFunction */: - case 181 /* ArrayLiteralExpression */: - case 182 /* ObjectLiteralExpression */: - case 193 /* TypeOfExpression */: - case 207 /* NonNullExpression */: - case 254 /* JsxSelfClosingElement */: - case 253 /* JsxElement */: + case 191 /* FunctionExpression */: + case 204 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 182 /* ArrayLiteralExpression */: + case 183 /* ObjectLiteralExpression */: + case 194 /* TypeOfExpression */: + case 208 /* NonNullExpression */: + case 255 /* JsxSelfClosingElement */: + case 254 /* JsxElement */: return true; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -45469,9 +45702,9 @@ var ts; } return false; // Some forms listed here for clarity - case 194 /* VoidExpression */: // Explicit opt-out - case 188 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 206 /* AsExpression */: // Not SEF, but can produce useful type warnings + case 195 /* VoidExpression */: // Explicit opt-out + case 189 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 207 /* AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -45487,7 +45720,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 58 /* EqualsToken */ && (left.kind === 182 /* ObjectLiteralExpression */ || left.kind === 181 /* ArrayLiteralExpression */)) { + if (operator === 58 /* EqualsToken */ && (left.kind === 183 /* ObjectLiteralExpression */ || left.kind === 182 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); } var leftType = checkExpression(left, checkMode); @@ -45737,12 +45970,14 @@ var ts; // A place where we actually *are* concerned with the expressions' types are // in tagged templates. ts.forEach(node.templateSpans, function (templateSpan) { - checkExpression(templateSpan.expression); + if (maybeTypeOfKind(checkExpression(templateSpan.expression), 1536 /* ESSymbolLike */)) { + error(templateSpan.expression, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1, typeToString(esSymbolType), typeToString(stringType)); + } }); return stringType; } function getContextNode(node) { - if (node.kind === 261 /* JsxAttributes */) { + if (node.kind === 262 /* JsxAttributes */) { 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; @@ -45778,7 +46013,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 188 /* TypeAssertionExpression */ || node.kind === 206 /* AsExpression */; + return node.kind === 189 /* TypeAssertionExpression */ || node.kind === 207 /* AsExpression */; } function checkDeclarationInitializer(declaration) { var inJs = ts.isInJavaScriptFile(declaration); @@ -45882,7 +46117,7 @@ var ts; function getTypeOfExpression(node, cache) { // Optimize for the common case of a call to a function with a single non-generic call // signature where we can just fetch the return type without checking the arguments. - if (node.kind === 185 /* CallExpression */ && node.expression.kind !== 97 /* SuperKeyword */ && !ts.isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(node)) { + if (node.kind === 186 /* CallExpression */ && node.expression.kind !== 97 /* SuperKeyword */ && !ts.isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(node)) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -45929,8 +46164,8 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 184 /* ElementAccessExpression */ && node.parent.expression === node) || + var ok = (node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 185 /* ElementAccessExpression */ && node.parent.expression === node) || ((node.kind === 71 /* Identifier */ || node.kind === 145 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || (node.parent.kind === 164 /* TypeQuery */ && node.parent.exprName === node)); if (!ok) { @@ -45966,74 +46201,74 @@ var ts; return trueType; case 86 /* FalseKeyword */: return falseType; - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return checkTemplateExpression(node); case 12 /* RegularExpressionLiteral */: return globalRegExpType; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (node.expression.kind === 91 /* ImportKeyword */) { return checkImportCallExpression(node); } /* falls through */ - case 186 /* NewExpression */: + case 187 /* NewExpression */: return checkCallExpression(node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return checkClassExpression(node); - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: return checkAssertion(node); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return checkNonNullAssertion(node); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return checkMetaProperty(node); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return checkDeleteExpression(node); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return checkVoidExpression(node); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return checkAwaitExpression(node); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return checkSpreadExpression(node, checkMode); - case 204 /* OmittedExpression */: + case 205 /* OmittedExpression */: return undefinedWideningType; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return checkYieldExpression(node); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return checkJsxExpression(node, checkMode); - case 253 /* JsxElement */: + case 254 /* JsxElement */: return checkJsxElement(node, checkMode); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return checkJsxFragment(node, checkMode); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 255 /* JsxOpeningElement */: + case 256 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -46148,10 +46383,10 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: case 157 /* CallSignature */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 162 /* FunctionType */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: @@ -46172,7 +46407,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 === 179 /* ArrayBindingPattern */ || name.kind === 178 /* ObjectBindingPattern */) { + else if (name.kind === 180 /* ArrayBindingPattern */ || name.kind === 179 /* ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -46185,7 +46420,7 @@ var ts; checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 162 /* FunctionType */ || node.kind === 232 /* FunctionDeclaration */ || node.kind === 163 /* ConstructorType */ || + else if (node.kind === 162 /* FunctionType */ || node.kind === 233 /* FunctionDeclaration */ || node.kind === 163 /* ConstructorType */ || node.kind === 157 /* CallSignature */ || node.kind === 154 /* Constructor */ || node.kind === 158 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); @@ -46377,7 +46612,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 234 /* InterfaceDeclaration */) { + if (node.kind === 235 /* 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 @@ -46488,7 +46723,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 214 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 215 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -46658,7 +46893,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType))) { - if (accessNode.kind === 184 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 185 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -46700,6 +46935,10 @@ var ts; } checkSourceElement(node.typeParameter); } + function checkImportType(node) { + checkSourceElement(node.argument); + getTypeFromTypeNode(node); + } function isPrivateWithinAmbient(node) { return ts.hasModifier(node, 8 /* Private */) && !!(node.flags & 2097152 /* Ambient */); } @@ -46707,9 +46946,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 !== 234 /* InterfaceDeclaration */ && - n.parent.kind !== 233 /* ClassDeclaration */ && - n.parent.kind !== 203 /* ClassExpression */ && + if (n.parent.kind !== 235 /* InterfaceDeclaration */ && + n.parent.kind !== 234 /* ClassDeclaration */ && + n.parent.kind !== 204 /* ClassExpression */ && n.flags & 2097152 /* Ambient */) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported @@ -46839,7 +47078,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = node.flags & 2097152 /* Ambient */; - var inAmbientContextOrInterface = node.parent.kind === 234 /* InterfaceDeclaration */ || node.parent.kind === 165 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 235 /* InterfaceDeclaration */ || node.parent.kind === 165 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -46850,7 +47089,7 @@ 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 === 232 /* FunctionDeclaration */ || node.kind === 153 /* MethodDeclaration */ || node.kind === 152 /* MethodSignature */ || node.kind === 154 /* Constructor */) { + if (node.kind === 233 /* FunctionDeclaration */ || node.kind === 153 /* MethodDeclaration */ || node.kind === 152 /* MethodSignature */ || node.kind === 154 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -46978,32 +47217,32 @@ var ts; })(DeclarationSpaces || (DeclarationSpaces = {})); function getDeclarationSpaces(d) { switch (d.kind) { - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: // A jsdoc typedef is, by definition, a type alias - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return 2 /* ExportType */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4 /* ExportNamespace */ | 1 /* ExportValue */ : 4 /* ExportNamespace */; - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: return 2 /* ExportType */ | 1 /* ExportValue */; - case 272 /* SourceFile */: + case 273 /* SourceFile */: return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */; // The below options all declare an Alias, which is allowed to merge with other values within the importing module - case 241 /* ImportEqualsDeclaration */: - case 244 /* NamespaceImport */: - case 243 /* ImportClause */: + case 242 /* ImportEqualsDeclaration */: + case 245 /* NamespaceImport */: + case 244 /* ImportClause */: var result_2 = 0 /* None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); }); return result_2; - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: - case 232 /* FunctionDeclaration */: - case 246 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 233 /* FunctionDeclaration */: + case 247 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 return 1 /* ExportValue */; default: ts.Debug.fail(ts.Debug.showSyntaxKind(d)); @@ -47273,7 +47512,7 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); @@ -47402,7 +47641,7 @@ var ts; checkExternalEmitHelpers(firstDecorator, 16 /* 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 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -47439,9 +47678,6 @@ var ts; if (produceDiagnostics) { checkFunctionOrMethodDeclaration(node); checkGrammarForGenerator(node); - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -47495,7 +47731,7 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return node; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return node.name; default: return undefined; @@ -47573,29 +47809,29 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 272 /* SourceFile */: - case 237 /* ModuleDeclaration */: + case 273 /* SourceFile */: + case 238 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: checkUnusedTypeParameters(node); break; - case 211 /* Block */: - case 239 /* CaseBlock */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 212 /* Block */: + case 240 /* CaseBlock */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: checkUnusedLocalsAndParameters(node); break; case 154 /* Constructor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: @@ -47609,7 +47845,7 @@ var ts; case 158 /* ConstructSignature */: case 162 /* FunctionType */: case 163 /* ConstructorType */: - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: checkUnusedTypeParameters(node); break; default: @@ -47652,7 +47888,7 @@ var ts; var node = ts.getNameOfDeclaration(declaration) || declaration; if (isIdentifierThatStartsWithUnderScore(node)) { var declaration_2 = ts.getRootDeclaration(node.parent); - if ((declaration_2.kind === 230 /* VariableDeclaration */ && ts.isForInOrOfStatement(declaration_2.parent.parent)) || + if ((declaration_2.kind === 231 /* VariableDeclaration */ && ts.isForInOrOfStatement(declaration_2.parent.parent)) || declaration_2.kind === 147 /* TypeParameter */) { return; } @@ -47694,7 +47930,7 @@ var ts; } break; case 159 /* IndexSignature */: - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: // Can't be private break; default: @@ -47768,19 +48004,19 @@ var ts; } } function isImportedDeclaration(node) { - return node.kind === 243 /* ImportClause */ || node.kind === 246 /* ImportSpecifier */ || node.kind === 244 /* NamespaceImport */; + return node.kind === 244 /* ImportClause */ || node.kind === 247 /* ImportSpecifier */ || node.kind === 245 /* NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 243 /* ImportClause */ ? decl : decl.kind === 244 /* NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 244 /* ImportClause */ ? decl : decl.kind === 245 /* NamespaceImport */ ? decl.parent : decl.parent.parent; } function forEachImportedDeclaration(importClause, cb) { var defaultName = importClause.name, namedBindings = importClause.namedBindings; return (defaultName && cb(importClause)) || - namedBindings && (namedBindings.kind === 244 /* NamespaceImport */ ? cb(namedBindings) : ts.forEach(namedBindings.elements, cb)); + namedBindings && (namedBindings.kind === 245 /* NamespaceImport */ ? cb(namedBindings) : ts.forEach(namedBindings.elements, cb)); } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 211 /* Block */) { + if (node.kind === 212 /* Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -47830,16 +48066,6 @@ var ts; } return true; } - function checkCollisionWithCapturedThisVariable(node, name) { - if (languageVersion <= 1 /* ES5 */ && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_this")) { - potentialThisCollisions.push(node); - } - } - function checkCollisionWithCapturedNewTargetVariable(node, name) { - if (languageVersion <= 1 /* ES5 */ && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_newTarget")) { - potentialNewTargetCollisions.push(node); - } - } // this function will run after checking the source file so 'CaptureThis' is correct for all nodes function checkIfThisIsCapturedInEnclosingScope(node) { ts.findAncestor(node, function (current) { @@ -47869,29 +48095,6 @@ var ts; } }); } - function checkCollisionWithCapturedSuperVariable(node, name) { - if (languageVersion >= 2 /* ES2015 */ || compilerOptions.noEmit) { - return; - } - if (!needCollisionCheckForIdentifier(node, name, "_super")) { - return; - } - // bubble up and find containing type - var enclosingClass = ts.getContainingClass(node); - // if containing type was not found or it is ambient - exit (no codegen) - if (!enclosingClass || enclosingClass.flags & 2097152 /* Ambient */) { - return; - } - if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_3 = node.kind !== 71 /* Identifier */; - if (isDeclaration_3) { - error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); - } - else { - error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference); - } - } - } function checkCollisionWithRequireExportsInGeneratedCode(node, name) { // No need to check for require or exports for ES6 modules and later if (modulekind >= ts.ModuleKind.ES2015 || compilerOptions.noEmit) { @@ -47906,7 +48109,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 === 272 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 273 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -47921,7 +48124,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 === 272 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 273 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(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)); } @@ -47956,7 +48159,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 === 230 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 231 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -47968,17 +48171,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 231 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 212 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 232 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 213 /* 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 === 211 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 238 /* ModuleBlock */ || - container.kind === 237 /* ModuleDeclaration */ || - container.kind === 272 /* SourceFile */); + (container.kind === 212 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 239 /* ModuleBlock */ || + container.kind === 238 /* ModuleDeclaration */ || + container.kind === 273 /* 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 @@ -48004,7 +48207,7 @@ var ts; // skip declaration names (i.e. in object literal expressions) return; } - if (n.kind === 183 /* PropertyAccessExpression */) { + if (n.kind === 184 /* PropertyAccessExpression */) { // skip property names in property access expression return visit(n.expression); } @@ -48024,7 +48227,7 @@ var ts; var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { if (symbol.valueDeclaration.kind === 148 /* Parameter */ || - symbol.valueDeclaration.kind === 180 /* BindingElement */) { + symbol.valueDeclaration.kind === 181 /* BindingElement */) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { @@ -48077,8 +48280,8 @@ var ts; checkExpressionCached(node.initializer); } } - if (node.kind === 180 /* BindingElement */) { - if (node.parent.kind === 178 /* ObjectBindingPattern */ && languageVersion < 6 /* ESNext */) { + if (node.kind === 181 /* BindingElement */) { + if (node.parent.kind === 179 /* ObjectBindingPattern */ && languageVersion < 6 /* ESNext */) { checkExternalEmitHelpers(node, 4 /* Rest */); } // check computed properties inside property names of binding elements @@ -48099,7 +48302,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 179 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 180 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -48112,7 +48315,7 @@ var ts; // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 219 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 220 /* ForInStatement */) { var initializerType = checkExpressionCached(node.initializer); if (strictNullChecks && node.name.elements.length === 0) { checkNonNullType(initializerType, node); @@ -48129,7 +48332,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 219 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 220 /* ForInStatement */) { var initializer = ts.isInJavaScriptFile(node) && ts.getDeclaredJavascriptInitializer(node) || node.initializer; checkTypeAssignableTo(checkExpressionCached(initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); @@ -48155,12 +48358,9 @@ var ts; if (node.kind !== 151 /* PropertyDeclaration */ && node.kind !== 150 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */) { + if (node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -48173,8 +48373,8 @@ var ts; error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType)); } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 148 /* Parameter */ && right.kind === 230 /* VariableDeclaration */) || - (left.kind === 230 /* VariableDeclaration */ && right.kind === 148 /* Parameter */)) { + if ((left.kind === 148 /* Parameter */ && right.kind === 231 /* VariableDeclaration */) || + (left.kind === 231 /* VariableDeclaration */ && right.kind === 148 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -48213,7 +48413,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 213 /* EmptyStatement */) { + if (node.thenStatement.kind === 214 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -48233,12 +48433,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 231 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 232 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 231 /* VariableDeclarationList */) { + if (node.initializer.kind === 232 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -48256,32 +48456,30 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.kind === 220 /* ForOfStatement */) { - if (node.awaitModifier) { - var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); - if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 6 /* ESNext */) { - // for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper - checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */); - } - } - else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ES2015 */) { - // for..of prior to ES2015 requires the __values helper when downlevelIteration is enabled - checkExternalEmitHelpers(node, 256 /* ForOfIncludes */); + if (node.awaitModifier) { + var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); + if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 6 /* ESNext */) { + // for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper + checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */); } } + else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ES2015 */) { + // for..of prior to ES2015 requires the __values helper when downlevelIteration is enabled + checkExternalEmitHelpers(node, 256 /* ForOfIncludes */); + } // Check the LHS and RHS // If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS // 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 === 231 /* VariableDeclarationList */) { + if (node.initializer.kind === 232 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); // There may be a destructuring assignment on the left side - if (varExpr.kind === 181 /* ArrayLiteralExpression */ || varExpr.kind === 182 /* ObjectLiteralExpression */) { + if (varExpr.kind === 182 /* ArrayLiteralExpression */ || varExpr.kind === 183 /* 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. @@ -48313,7 +48511,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 === 231 /* VariableDeclarationList */) { + if (node.initializer.kind === 232 /* 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); @@ -48327,7 +48525,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 === 181 /* ArrayLiteralExpression */ || varExpr.kind === 182 /* ObjectLiteralExpression */) { + if (varExpr.kind === 182 /* ArrayLiteralExpression */ || varExpr.kind === 183 /* 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)) { @@ -48340,8 +48538,8 @@ var ts; } // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeAssignableToKind(rightType, 134217728 /* NonPrimitive */ | 7372800 /* InstantiableNonPrimitive */)) { - error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); + if (rightType === neverType || !isTypeAssignableToKind(rightType, 134217728 /* NonPrimitive */ | 7372800 /* InstantiableNonPrimitive */)) { + error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)); } checkSourceElement(node.statement); if (node.locals) { @@ -48372,6 +48570,10 @@ var ts; * of a iterable (if defined globally) or element type of an array like for ES2015 or earlier. */ function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables, checkAssignability) { + if (inputType === neverType) { + reportTypeNotIterableError(errorNode, inputType, allowAsyncIterables); + return undefined; + } var uplevelIteration = languageVersion >= 2 /* ES2015 */; var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; // Get the iterated type of an `Iterable` or `IterableIterator` only in ES2015 @@ -48425,13 +48627,18 @@ var ts; // want to say that number is not an array type. But if the input was just // number and string input is allowed, we want to say that number is not an // array type or a string type. + var isIterable = !!getIteratedTypeOfIterable(inputType, /* errorNode */ undefined, allowAsyncIterables, /*allowSyncIterables*/ true, checkAssignability); var diagnostic = !allowStringInput || hasStringConstituent ? downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator - : ts.Diagnostics.Type_0_is_not_an_array_type + : isIterable + ? ts.Diagnostics.Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators + : ts.Diagnostics.Type_0_is_not_an_array_type : downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + : isIterable + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(errorNode, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : undefined; @@ -48521,10 +48728,8 @@ var ts; var signatures = methodType && getSignaturesOfType(methodType, 0 /* Call */); if (!ts.some(signatures)) { if (errorNode) { - error(errorNode, allowAsyncIterables - ? ts.Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator - : ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); // only report on the first error + reportTypeNotIterableError(errorNode, type, allowAsyncIterables); errorNode = undefined; } return undefined; @@ -48544,6 +48749,11 @@ var ts; : typeAsIterable.iteratedTypeOfIterable = iteratedType; } } + function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) { + error(errorNode, allowAsyncIterables + ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator, typeToString(type)); + } /** * This function has very similar logic as getIteratedTypeOfIterable, except that it operates on * Iterators instead of Iterables. Here is the structure: @@ -48728,7 +48938,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 === 265 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 266 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -48740,7 +48950,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 264 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 265 /* CaseClause */) { // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable // to or from the type of the 'switch' expression. @@ -48769,7 +48979,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 226 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 227 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -48874,7 +49084,7 @@ var ts; // this allows us to rule out cases when both property and indexer are inherited from the base class var errorNode; if (propDeclaration && - (propDeclaration.kind === 198 /* BinaryExpression */ || + (propDeclaration.kind === 199 /* BinaryExpression */ || ts.getNameOfDeclaration(propDeclaration).kind === 146 /* ComputedPropertyName */ || prop.parent === containingType.symbol)) { errorNode = propDeclaration; @@ -49020,8 +49230,6 @@ var ts; checkDecorators(node); if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -49160,7 +49368,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 233 /* ClassDeclaration */ || d.kind === 234 /* InterfaceDeclaration */; + return d.kind === 234 /* ClassDeclaration */ || d.kind === 235 /* InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -49199,7 +49407,7 @@ var ts; // 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 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) { - if (derivedClassDecl.kind === 203 /* ClassExpression */) { + if (derivedClassDecl.kind === 204 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -49214,12 +49422,12 @@ var ts; // either base or derived property is private - not override, skip it continue; } - if (isMethodLike(base) && isMethodLike(derived) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) { + if (isPrototypeProperty(base) && isPrototypeProperty(derived) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) { // method is overridden with method or property/accessor is overridden with property/accessor - correct case continue; } var errorMessage = void 0; - if (isMethodLike(base)) { + if (isPrototypeProperty(base)) { if (derived.flags & 98304 /* Accessor */) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } @@ -49227,11 +49435,11 @@ var ts; errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } - else if (base.flags & 4 /* Property */) { - errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + else if (base.flags & 98304 /* Accessor */) { + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } @@ -49313,7 +49521,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 234 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 235 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -49418,7 +49626,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -49428,7 +49636,7 @@ var ts; } } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -49453,18 +49661,18 @@ var ts; case 8 /* NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return evaluate(expr.expression); case 71 /* Identifier */: return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), expr.escapedText); - case 184 /* ElementAccessExpression */: - case 183 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 184 /* PropertyAccessExpression */: var ex = expr; if (isConstantMemberAccess(ex)) { var type = getTypeOfExpression(ex.expression); if (type.symbol && type.symbol.flags & 384 /* Enum */) { var name = void 0; - if (ex.kind === 183 /* PropertyAccessExpression */) { + if (ex.kind === 184 /* PropertyAccessExpression */) { name = ex.name.escapedText; } else { @@ -49496,8 +49704,8 @@ var ts; } function isConstantMemberAccess(node) { return node.kind === 71 /* Identifier */ || - node.kind === 183 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 184 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 184 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 185 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) && node.argumentExpression.kind === 9 /* StringLiteral */; } function checkEnumDeclaration(node) { @@ -49507,8 +49715,6 @@ var ts; // Grammar checking checkGrammarDecoratorsAndModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -49537,7 +49743,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 !== 236 /* EnumDeclaration */) { + if (declaration.kind !== 237 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -49560,8 +49766,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { var declaration = declarations_7[_i]; - if ((declaration.kind === 233 /* ClassDeclaration */ || - (declaration.kind === 232 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 234 /* ClassDeclaration */ || + (declaration.kind === 233 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 2097152 /* Ambient */)) { return declaration; } @@ -49603,7 +49809,6 @@ var ts; } } if (ts.isIdentifier(node.name)) { - checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -49625,7 +49830,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, 233 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 234 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -49675,23 +49880,23 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 247 /* ExportAssignment */: - case 248 /* ExportDeclaration */: + case 248 /* ExportAssignment */: + case 249 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 180 /* BindingElement */: - case 230 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 231 /* VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { @@ -49702,12 +49907,12 @@ var ts; break; } // falls through - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 232 /* FunctionDeclaration */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 233 /* FunctionDeclaration */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 236 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -49735,7 +49940,7 @@ var ts; node = node.left; } while (node.kind !== 71 /* Identifier */); return node; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 71 /* Identifier */); @@ -49752,9 +49957,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 238 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 272 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 248 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 239 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 273 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 249 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -49787,14 +49992,14 @@ var ts; (symbol.flags & 67901928 /* Type */ ? 67901928 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 250 /* ExportSpecifier */ ? + var message = node.kind === 251 /* 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)); } // Don't allow to re-export something with no value side when `--isolatedModules` is set. if (compilerOptions.isolatedModules - && node.kind === 250 /* ExportSpecifier */ + && node.kind === 251 /* ExportSpecifier */ && !(target.flags & 67216319 /* Value */) && !(node.flags & 2097152 /* Ambient */)) { error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided); @@ -49802,7 +50007,6 @@ var ts; } } function checkImportBinding(node) { - checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkAliasSymbol(node); @@ -49822,7 +50026,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 244 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 245 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -49843,7 +50047,7 @@ var ts; if (ts.hasModifier(node, 1 /* Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 252 /* ExternalModuleReference */) { + if (node.moduleReference.kind !== 253 /* ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 67216319 /* Value */) { @@ -49879,10 +50083,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 238 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 238 /* ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 239 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 239 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 2097152 /* Ambient */; - if (node.parent.kind !== 272 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 273 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -49899,7 +50103,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 272 /* SourceFile */ || node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 237 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 273 /* SourceFile */ || node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 238 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -49928,8 +50132,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 === 272 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 237 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 273 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 238 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -50017,7 +50221,7 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 232 /* FunctionDeclaration */ && declaration.kind !== 153 /* MethodDeclaration */) || + return (declaration.kind !== 233 /* FunctionDeclaration */ && declaration.kind !== 153 /* MethodDeclaration */) || !!declaration.body; } function checkSourceElement(node) { @@ -50035,10 +50239,10 @@ 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 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 232 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 233 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -50088,96 +50292,98 @@ var ts; return checkConditionalType(node); case 171 /* InferType */: return checkInferType(node); - case 285 /* JSDocAugmentsTag */: + case 178 /* ImportType */: + return checkImportType(node); + case 286 /* JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return checkJSDocTypedefTag(node); - case 287 /* JSDocParameterTag */: + case 288 /* JSDocParameterTag */: return checkJSDocParameterTag(node); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: checkSignatureDeclaration(node); // falls through - case 278 /* JSDocNonNullableType */: - case 277 /* JSDocNullableType */: - case 275 /* JSDocAllType */: - case 276 /* JSDocUnknownType */: + case 279 /* JSDocNonNullableType */: + case 278 /* JSDocNullableType */: + case 276 /* JSDocAllType */: + case 277 /* JSDocUnknownType */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 274 /* JSDocTypeExpression */: + case 275 /* JSDocTypeExpression */: return checkSourceElement(node.type); case 175 /* IndexedAccessType */: return checkIndexedAccessType(node); case 176 /* MappedType */: return checkMappedType(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 211 /* Block */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 239 /* ModuleBlock */: return checkBlock(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return checkVariableStatement(node); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return checkExpressionStatement(node); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return checkIfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return checkDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return checkWhileStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return checkForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return checkForInStatement(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return checkForOfStatement(node); - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return checkReturnStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return checkWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return checkSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return checkLabeledStatement(node); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return checkThrowStatement(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return checkTryStatement(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return checkBindingElement(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return checkClassDeclaration(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return checkImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return checkExportDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return checkExportAssignment(node); - case 213 /* EmptyStatement */: + case 214 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 229 /* DebuggerStatement */: + case 230 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 251 /* MissingDeclaration */: + case 252 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -50261,8 +50467,8 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); @@ -50271,7 +50477,7 @@ var ts; case 156 /* SetAccessor */: checkAccessorDeclaration(node); break; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: checkClassExpressionDeferred(node); break; } @@ -50391,13 +50597,13 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* ModuleMember */); break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -50405,8 +50611,8 @@ var ts; // falls through // 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 - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* 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. @@ -50415,7 +50621,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67901928 /* Type */); } break; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -50464,10 +50670,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 147 /* TypeParameter */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: return true; } } @@ -50481,10 +50687,10 @@ var ts; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 183 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 184 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 205 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 206 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -50515,10 +50721,10 @@ var ts; while (nodeOnRightSide.parent.kind === 145 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 241 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 242 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 247 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 248 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -50538,12 +50744,23 @@ var ts; return getSymbolOfNode(entityName.parent.parent); } } + function isImportTypeQualifierPart(node) { + var parent = node.parent; + while (ts.isQualifiedName(parent)) { + node = parent; + parent = parent.parent; + } + if (parent && parent.kind === 178 /* ImportType */ && parent.qualifier === node) { + return parent; + } + return undefined; + } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } if (ts.isInJavaScriptFile(entityName) && - entityName.parent.kind === 183 /* PropertyAccessExpression */ && + entityName.parent.kind === 184 /* PropertyAccessExpression */ && entityName.parent === entityName.parent.parent.left) { // Check if this is a special property assignment var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); @@ -50551,23 +50768,35 @@ var ts; return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 247 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { - return resolveEntityName(entityName, - /*all meanings*/ 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */); + if (entityName.parent.kind === 248 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression + var success = resolveEntityName(entityName, + /*all meanings*/ 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true); + if (success && success !== unknownSymbol) { + return success; + } } - if (entityName.kind !== 183 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { + else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 241 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 242 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } - if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (!ts.isPropertyAccessExpression(entityName)) { + var possibleImportNode = isImportTypeQualifierPart(entityName); + if (possibleImportNode) { + getTypeFromTypeNode(possibleImportNode); + var sym = getNodeLinks(entityName).resolvedSymbol; + return sym === unknownSymbol ? undefined : sym; + } + } + while (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 205 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 206 /* ExpressionWithTypeArguments */) { meaning = 67901928 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -50583,10 +50812,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 287 /* JSDocParameterTag */) { + if (entityName.parent.kind === 288 /* JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 147 /* TypeParameter */ && entityName.parent.parent.kind === 290 /* JSDocTemplateTag */) { + if (entityName.parent.kind === 147 /* TypeParameter */ && entityName.parent.parent.kind === 291 /* JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -50603,12 +50832,12 @@ var ts; } return resolveEntityName(entityName, 67216319 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.kind === 183 /* PropertyAccessExpression */ || entityName.kind === 145 /* QualifiedName */) { + else if (entityName.kind === 184 /* PropertyAccessExpression */ || entityName.kind === 145 /* QualifiedName */) { var links = getNodeLinks(entityName); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (entityName.kind === 183 /* PropertyAccessExpression */) { + if (entityName.kind === 184 /* PropertyAccessExpression */) { checkPropertyAccessExpression(entityName); } else { @@ -50621,7 +50850,7 @@ var ts; var meaning = entityName.parent.kind === 161 /* TypeReference */ ? 67901928 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 260 /* JsxAttribute */) { + else if (entityName.parent.kind === 261 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 160 /* TypePredicate */) { @@ -50631,7 +50860,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (node.flags & 4194304 /* InWithStatement */) { @@ -50649,8 +50878,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 180 /* BindingElement */ && - node.parent.parent.kind === 178 /* ObjectBindingPattern */ && + else if (node.parent.kind === 181 /* BindingElement */ && + node.parent.parent.kind === 179 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.escapedText); @@ -50661,7 +50890,7 @@ var ts; } switch (node.kind) { case 71 /* Identifier */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 145 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 99 /* ThisKeyword */: @@ -50692,9 +50921,11 @@ var ts; // 1). import x = require("./mo/*gotToDefinitionHere*/d") // 2). External module name in an import declaration // 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 === 242 /* ImportDeclaration */ || node.parent.kind === 248 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) || - ((ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent))) { + ((node.parent.kind === 243 /* ImportDeclaration */ || node.parent.kind === 249 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((ts.isInJavaScriptFile(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); } // falls through @@ -50710,6 +50941,8 @@ var ts; case 89 /* FunctionKeyword */: case 36 /* EqualsGreaterThanToken */: return getSymbolOfNode(node.parent); + case 178 /* ImportType */: + return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined; default: return undefined; } @@ -50718,7 +50951,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 269 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 270 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 67216319 /* Value */ | 2097152 /* Alias */); } return undefined; @@ -50791,28 +51024,28 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 182 /* ObjectLiteralExpression */ || expr.kind === 181 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 183 /* ObjectLiteralExpression */ || expr.kind === 182 /* ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 220 /* ForOfStatement */) { + if (expr.parent.kind === 221 /* ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 198 /* BinaryExpression */) { + if (expr.parent.kind === 199 /* BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 268 /* PropertyAssignment */) { + if (expr.parent.kind === 269 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } // Array literal assignment - array destructuring pattern - ts.Debug.assert(expr.parent.kind === 181 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.parent.kind === 182 /* ArrayLiteralExpression */); // [{ property1: p1, property2 }] = elems; var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType; @@ -50891,7 +51124,7 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - var isPropertyName_1 = node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node; + var isPropertyName_1 = node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.name === node; return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } @@ -50948,7 +51181,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 272 /* SourceFile */) { + if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 273 /* 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. @@ -51003,7 +51236,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 211 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 212 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -51044,16 +51277,16 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 242 /* ImportEqualsDeclaration */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return node.expression && node.expression.kind === 71 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -51063,7 +51296,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 272 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 273 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -51143,15 +51376,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 271 /* EnumMember */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 272 /* EnumMember */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 271 /* EnumMember */) { + if (node.kind === 272 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -51318,7 +51551,7 @@ var ts; // populate reverse mapping: file path -> type reference directive that was resolved to this file fileToDirective = ts.createMap(); resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { - if (!resolvedDirective) { + if (!resolvedDirective || !resolvedDirective.resolvedFileName) { return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); @@ -51377,18 +51610,22 @@ var ts; }, getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; } }; + function isInHeritageClause(node) { + return node.parent && node.parent.kind === 206 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 267 /* HeritageClause */; + } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { // program does not have any files with type reference directives - bail out if (!fileToDirective) { return undefined; } - // property access can only be used as values + // property access can only be used as values, or types when within an expression with type arguments inside a heritage clause // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries - var meaning = (node.kind === 183 /* PropertyAccessExpression */) || (node.kind === 71 /* Identifier */ && isInTypeQuery(node)) - ? 67216319 /* Value */ | 1048576 /* ExportValue */ - : 67901928 /* Type */ | 1920 /* Namespace */; + var meaning = 67901928 /* Type */ | 1920 /* Namespace */; + if ((node.kind === 71 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 184 /* PropertyAccessExpression */ && !isInHeritageClause(node))) { + meaning = 67216319 /* Value */ | 1048576 /* ExportValue */; + } var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; } @@ -51437,7 +51674,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 272 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 273 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -51452,12 +51689,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 237 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 238 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 272 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 273 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -51635,7 +51872,7 @@ var ts; } switch (modifier.kind) { case 76 /* ConstKeyword */: - if (node.kind !== 236 /* EnumDeclaration */ && node.parent.kind === 233 /* ClassDeclaration */) { + if (node.kind !== 237 /* EnumDeclaration */ && node.parent.kind === 234 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(76 /* ConstKeyword */)); } break; @@ -51655,7 +51892,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + else if (node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -51678,7 +51915,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + else if (node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 148 /* Parameter */) { @@ -51714,7 +51951,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 148 /* Parameter */) { @@ -51723,8 +51960,8 @@ var ts; flags |= 1 /* Export */; break; case 79 /* DefaultKeyword */: - var container = node.parent.kind === 272 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 237 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 273 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 238 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } flags |= 512 /* Default */; @@ -51736,13 +51973,13 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 148 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 2097152 /* Ambient */) && node.parent.kind === 238 /* ModuleBlock */) { + else if ((node.parent.flags & 2097152 /* Ambient */) && node.parent.kind === 239 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -51752,14 +51989,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 233 /* ClassDeclaration */) { + if (node.kind !== 234 /* ClassDeclaration */) { if (node.kind !== 153 /* MethodDeclaration */ && node.kind !== 151 /* PropertyDeclaration */ && node.kind !== 155 /* GetAccessor */ && node.kind !== 156 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 233 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) { + if (!(node.parent.kind === 234 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -51801,7 +52038,7 @@ var ts; } return; } - else if ((node.kind === 242 /* ImportDeclaration */ || node.kind === 241 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 243 /* ImportDeclaration */ || node.kind === 242 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 148 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { @@ -51835,29 +52072,29 @@ var ts; case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 159 /* IndexSignature */: - case 237 /* ModuleDeclaration */: - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 238 /* ModuleDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 148 /* Parameter */: return false; default: - if (node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + if (node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { return false; } switch (node.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return nodeHasAnyModifiersExcept(node, 120 /* AsyncKeyword */); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return nodeHasAnyModifiersExcept(node, 117 /* AbstractKeyword */); - case 234 /* InterfaceDeclaration */: - case 212 /* VariableStatement */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 213 /* VariableStatement */: + case 236 /* TypeAliasDeclaration */: return true; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 76 /* ConstKeyword */); default: ts.Debug.fail(); @@ -51871,18 +52108,17 @@ var ts; function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 153 /* MethodDeclaration */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } - function checkGrammarForDisallowedTrailingComma(list) { + function checkGrammarForDisallowedTrailingComma(list, diag) { + if (diag === void 0) { diag = ts.Diagnostics.Trailing_comma_not_allowed; } if (list && list.hasTrailingComma) { - var start = list.end - ",".length; - var end = list.end; - return grammarErrorAtPos(list[0], start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); + return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag); } } function checkGrammarTypeParameterList(typeParameters, file) { @@ -51901,6 +52137,9 @@ var ts; if (i !== (parameterCount - 1)) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); } + if (!(parameter.flags & 2097152 /* Ambient */)) { // Allow `...foo,` in ambient declarations; see GH#23070 + checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + } if (ts.isBindingPattern(parameter.name)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } @@ -51971,7 +52210,7 @@ var ts; if (type.flags & 2 /* String */ || type.flags & 4 /* Number */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type))); } - if (allTypesAssignableToKind(type, 32 /* StringLiteral */, /*strict*/ true)) { + if (type.flags & 131072 /* Union */ && allTypesAssignableToKind(type, 32 /* StringLiteral */, /*strict*/ true)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead); } return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); @@ -52000,7 +52239,7 @@ var ts; if (args) { for (var _i = 0, args_5 = args; _i < args_5.length; _i++) { var arg = args_5[_i]; - if (arg.kind === 204 /* OmittedExpression */) { + if (arg.kind === 205 /* OmittedExpression */) { return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -52080,14 +52319,14 @@ var ts; return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 198 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 26 /* CommaToken */) { + if (computedPropertyName.expression.kind === 199 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 26 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 232 /* FunctionDeclaration */ || - node.kind === 190 /* FunctionExpression */ || + ts.Debug.assert(node.kind === 233 /* FunctionDeclaration */ || + node.kind === 191 /* FunctionExpression */ || node.kind === 153 /* MethodDeclaration */); if (node.flags & 2097152 /* Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); @@ -52113,7 +52352,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 270 /* SpreadAssignment */) { + if (prop.kind === 271 /* SpreadAssignment */) { continue; } var name = prop.name; @@ -52121,7 +52360,7 @@ var ts; // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 269 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 270 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -52145,8 +52384,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 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8 /* NumericLiteral */) { @@ -52196,7 +52435,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 262 /* JsxSpreadAttribute */) { + if (attr.kind === 263 /* JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -52206,7 +52445,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 263 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 264 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -52215,12 +52454,12 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 220 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 221 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) { return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); } } - if (forInOrOfStatement.initializer.kind === 231 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 232 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -52235,20 +52474,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 219 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 220 /* 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 === 219 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 220 /* 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 === 219 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 220 /* 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); @@ -52316,7 +52555,7 @@ var ts; } var parent = ts.walkUpParenthesizedTypes(node.parent); switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: var decl = parent; if (decl.name.kind !== 71 /* Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -52354,7 +52593,7 @@ var ts; return true; } if (node.kind === 153 /* MethodDeclaration */) { - if (node.parent.kind === 182 /* ObjectLiteralExpression */) { + if (node.parent.kind === 183 /* 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 === 120 /* AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -52383,7 +52622,7 @@ var ts; 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 === 234 /* InterfaceDeclaration */) { + else if (node.parent.kind === 235 /* 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 === 165 /* TypeLiteral */) { @@ -52397,11 +52636,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 226 /* LabeledStatement */: + case 227 /* 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 === 221 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 222 /* 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); @@ -52409,8 +52648,8 @@ var ts; return false; } break; - case 225 /* SwitchStatement */: - if (node.kind === 222 /* BreakStatement */ && !node.label) { + case 226 /* SwitchStatement */: + if (node.kind === 223 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -52425,13 +52664,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 222 /* BreakStatement */ + var message = node.kind === 223 /* 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 === 222 /* BreakStatement */ + var message = node.kind === 223 /* 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); @@ -52443,7 +52682,8 @@ var ts; if (node !== ts.last(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 179 /* ArrayBindingPattern */ || node.name.kind === 178 /* ObjectBindingPattern */) { + checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + if (node.name.kind === 180 /* ArrayBindingPattern */ || node.name.kind === 179 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.propertyName) { @@ -52457,11 +52697,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ || - expr.kind === 196 /* PrefixUnaryExpression */ && expr.operator === 38 /* MinusToken */ && + expr.kind === 197 /* PrefixUnaryExpression */ && expr.operator === 38 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 219 /* ForInStatement */ && node.parent.parent.kind !== 220 /* ForOfStatement */) { + if (node.parent.parent.kind !== 220 /* ForInStatement */ && node.parent.parent.kind !== 221 /* ForOfStatement */) { if (node.flags & 2097152 /* Ambient */) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -52490,7 +52730,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 212 /* VariableStatement */ || !node.type || node.initializer || node.flags & 2097152 /* Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 213 /* VariableStatement */ || !node.type || node.initializer || node.flags & 2097152 /* Ambient */)) { return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); } if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && @@ -52549,15 +52789,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 215 /* IfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 224 /* WithStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 216 /* IfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: return false; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -52623,7 +52863,7 @@ var ts; return true; } } - else if (node.parent.kind === 234 /* InterfaceDeclaration */) { + else if (node.parent.kind === 235 /* 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; } @@ -52660,13 +52900,13 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 234 /* InterfaceDeclaration */ || - node.kind === 235 /* TypeAliasDeclaration */ || - node.kind === 242 /* ImportDeclaration */ || - node.kind === 241 /* ImportEqualsDeclaration */ || - node.kind === 248 /* ExportDeclaration */ || - node.kind === 247 /* ExportAssignment */ || - node.kind === 240 /* NamespaceExportDeclaration */ || + if (node.kind === 235 /* InterfaceDeclaration */ || + node.kind === 236 /* TypeAliasDeclaration */ || + node.kind === 243 /* ImportDeclaration */ || + node.kind === 242 /* ImportEqualsDeclaration */ || + node.kind === 249 /* ExportDeclaration */ || + node.kind === 248 /* ExportAssignment */ || + node.kind === 241 /* NamespaceExportDeclaration */ || ts.hasModifier(node, 2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } @@ -52675,7 +52915,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 === 212 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 213 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -52701,7 +52941,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 === 211 /* Block */ || node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + if (node.parent.kind === 212 /* Block */ || node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -52725,7 +52965,7 @@ var ts; else if (ts.isChildOfNodeWithKind(node, 177 /* LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 271 /* EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 272 /* EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -52777,8 +53017,8 @@ var ts; /** 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 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -52786,14 +53026,14 @@ var ts; } function isSomeImportDeclaration(decl) { switch (decl.kind) { - case 243 /* ImportClause */: // For default import - case 241 /* ImportEqualsDeclaration */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: // For rename import `x as y` + case 244 /* ImportClause */: // For default import + case 242 /* ImportEqualsDeclaration */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: // For rename import `x as y` return true; case 71 /* Identifier */: // For regular import, `decl` is an Identifier under the ImportSpecifier. - return decl.parent.kind === 246 /* ImportSpecifier */; + return decl.parent.kind === 247 /* ImportSpecifier */; default: return false; } @@ -52804,7 +53044,7 @@ var ts; JsxNames.JSX = "JSX"; JsxNames.IntrinsicElements = "IntrinsicElements"; JsxNames.ElementClass = "ElementClass"; - JsxNames.ElementAttributesPropertyNameContainer = "ElementAttributesProperty"; + JsxNames.ElementAttributesPropertyNameContainer = "ElementAttributesProperty"; // TODO: Deprecate and remove support JsxNames.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute"; JsxNames.Element = "Element"; JsxNames.IntrinsicAttributes = "IntrinsicAttributes"; @@ -52960,12 +53200,19 @@ var ts; /** Create a unique name based on the supplied text. */ function createOptimisticUniqueName(text) { var name = createIdentifier(text); - name.autoGenerateFlags = 5 /* OptimisticUnique */; + name.autoGenerateFlags = 3 /* Unique */ | 32 /* Optimistic */; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createOptimisticUniqueName = createOptimisticUniqueName; + /** Create a unique name based on the supplied text. This does not consider names injected by the transformer. */ + function createFileLevelUniqueName(text) { + var name = createOptimisticUniqueName(text); + name.autoGenerateFlags |= 64 /* FileLevel */; + return name; + } + ts.createFileLevelUniqueName = createFileLevelUniqueName; function getGeneratedNameForNode(node, shouldSkipNameGenerationScope) { var name = createIdentifier(""); name.autoGenerateFlags = 4 /* Node */; @@ -53064,7 +53311,7 @@ var ts; ts.updateQualifiedName = updateQualifiedName; function parenthesizeForComputedName(expression) { return (ts.isBinaryExpression(expression) && expression.operatorToken.kind === 26 /* CommaToken */) || - expression.kind === 296 /* CommaListExpression */ ? + expression.kind === 297 /* CommaListExpression */ ? createParen(expression) : expression; } @@ -53492,6 +53739,24 @@ var ts; : node; } ts.updateInferTypeNode = updateInferTypeNode; + function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) { + var node = createSynthesizedNode(178 /* ImportType */); + node.argument = argument; + node.qualifier = qualifier; + node.typeArguments = asNodeArray(typeArguments); + node.isTypeOf = isTypeOf; + return node; + } + ts.createImportTypeNode = createImportTypeNode; + function updateImportTypeNode(node, argument, qualifier, typeArguments, isTypeOf) { + return node.argument !== argument + || node.qualifier !== qualifier + || node.typeArguments !== typeArguments + || node.isTypeOf !== isTypeOf + ? updateNode(createImportTypeNode(argument, qualifier, typeArguments, isTypeOf), node) + : node; + } + ts.updateImportTypeNode = updateImportTypeNode; function createParenthesizedType(type) { var node = createSynthesizedNode(172 /* ParenthesizedType */); node.type = type; @@ -53565,7 +53830,7 @@ var ts; ts.updateLiteralTypeNode = updateLiteralTypeNode; // Binding Patterns function createObjectBindingPattern(elements) { - var node = createSynthesizedNode(178 /* ObjectBindingPattern */); + var node = createSynthesizedNode(179 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); return node; } @@ -53577,7 +53842,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements) { - var node = createSynthesizedNode(179 /* ArrayBindingPattern */); + var node = createSynthesizedNode(180 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); return node; } @@ -53589,7 +53854,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createSynthesizedNode(180 /* BindingElement */); + var node = createSynthesizedNode(181 /* BindingElement */); node.dotDotDotToken = dotDotDotToken; node.propertyName = asName(propertyName); node.name = asName(name); @@ -53608,7 +53873,7 @@ var ts; ts.updateBindingElement = updateBindingElement; // Expression function createArrayLiteral(elements, multiLine) { - var node = createSynthesizedNode(181 /* ArrayLiteralExpression */); + var node = createSynthesizedNode(182 /* ArrayLiteralExpression */); node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) node.multiLine = true; @@ -53622,7 +53887,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, multiLine) { - var node = createSynthesizedNode(182 /* ObjectLiteralExpression */); + var node = createSynthesizedNode(183 /* ObjectLiteralExpression */); node.properties = createNodeArray(properties); if (multiLine) node.multiLine = true; @@ -53636,7 +53901,7 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name) { - var node = createSynthesizedNode(183 /* PropertyAccessExpression */); + var node = createSynthesizedNode(184 /* PropertyAccessExpression */); node.expression = ts.parenthesizeForAccess(expression); node.name = asName(name); setEmitFlags(node, 131072 /* NoIndentation */); @@ -53653,7 +53918,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index) { - var node = createSynthesizedNode(184 /* ElementAccessExpression */); + var node = createSynthesizedNode(185 /* ElementAccessExpression */); node.expression = ts.parenthesizeForAccess(expression); node.argumentExpression = asExpression(index); return node; @@ -53667,7 +53932,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(185 /* CallExpression */); + var node = createSynthesizedNode(186 /* CallExpression */); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); @@ -53683,7 +53948,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(186 /* NewExpression */); + var node = createSynthesizedNode(187 /* NewExpression */); node.expression = ts.parenthesizeForNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -53699,7 +53964,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, template) { - var node = createSynthesizedNode(187 /* TaggedTemplateExpression */); + var node = createSynthesizedNode(188 /* TaggedTemplateExpression */); node.tag = ts.parenthesizeForAccess(tag); node.template = template; return node; @@ -53713,7 +53978,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createTypeAssertion(type, expression) { - var node = createSynthesizedNode(188 /* TypeAssertionExpression */); + var node = createSynthesizedNode(189 /* TypeAssertionExpression */); node.type = type; node.expression = ts.parenthesizePrefixOperand(expression); return node; @@ -53727,7 +53992,7 @@ var ts; } ts.updateTypeAssertion = updateTypeAssertion; function createParen(expression) { - var node = createSynthesizedNode(189 /* ParenthesizedExpression */); + var node = createSynthesizedNode(190 /* ParenthesizedExpression */); node.expression = expression; return node; } @@ -53739,7 +54004,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(190 /* FunctionExpression */); + var node = createSynthesizedNode(191 /* FunctionExpression */); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -53763,7 +54028,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createSynthesizedNode(191 /* ArrowFunction */); + var node = createSynthesizedNode(192 /* ArrowFunction */); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); @@ -53797,7 +54062,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression) { - var node = createSynthesizedNode(192 /* DeleteExpression */); + var node = createSynthesizedNode(193 /* DeleteExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -53809,7 +54074,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression) { - var node = createSynthesizedNode(193 /* TypeOfExpression */); + var node = createSynthesizedNode(194 /* TypeOfExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -53821,7 +54086,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression) { - var node = createSynthesizedNode(194 /* VoidExpression */); + var node = createSynthesizedNode(195 /* VoidExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -53833,7 +54098,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression) { - var node = createSynthesizedNode(195 /* AwaitExpression */); + var node = createSynthesizedNode(196 /* AwaitExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -53845,7 +54110,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand) { - var node = createSynthesizedNode(196 /* PrefixUnaryExpression */); + var node = createSynthesizedNode(197 /* PrefixUnaryExpression */); node.operator = operator; node.operand = ts.parenthesizePrefixOperand(operand); return node; @@ -53858,7 +54123,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator) { - var node = createSynthesizedNode(197 /* PostfixUnaryExpression */); + var node = createSynthesizedNode(198 /* PostfixUnaryExpression */); node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -53871,7 +54136,7 @@ var ts; } ts.updatePostfix = updatePostfix; function createBinary(left, operator, right) { - var node = createSynthesizedNode(198 /* BinaryExpression */); + var node = createSynthesizedNode(199 /* BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); @@ -53888,7 +54153,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { - var node = createSynthesizedNode(199 /* ConditionalExpression */); + var node = createSynthesizedNode(200 /* ConditionalExpression */); node.condition = ts.parenthesizeForConditionalHead(condition); node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(55 /* QuestionToken */); node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); @@ -53918,7 +54183,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans) { - var node = createSynthesizedNode(200 /* TemplateExpression */); + var node = createSynthesizedNode(201 /* TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -53956,7 +54221,7 @@ var ts; } ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral; function createYield(asteriskTokenOrExpression, expression) { - var node = createSynthesizedNode(201 /* YieldExpression */); + var node = createSynthesizedNode(202 /* YieldExpression */); node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 39 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined; node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 39 /* AsteriskToken */ ? asteriskTokenOrExpression : expression; return node; @@ -53970,7 +54235,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression) { - var node = createSynthesizedNode(202 /* SpreadElement */); + var node = createSynthesizedNode(203 /* SpreadElement */); node.expression = ts.parenthesizeExpressionForList(expression); return node; } @@ -53982,7 +54247,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(203 /* ClassExpression */); + var node = createSynthesizedNode(204 /* ClassExpression */); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -54003,11 +54268,11 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression() { - return createSynthesizedNode(204 /* OmittedExpression */); + return createSynthesizedNode(205 /* OmittedExpression */); } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression) { - var node = createSynthesizedNode(205 /* ExpressionWithTypeArguments */); + var node = createSynthesizedNode(206 /* ExpressionWithTypeArguments */); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); return node; @@ -54021,7 +54286,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createAsExpression(expression, type) { - var node = createSynthesizedNode(206 /* AsExpression */); + var node = createSynthesizedNode(207 /* AsExpression */); node.expression = expression; node.type = type; return node; @@ -54035,7 +54300,7 @@ var ts; } ts.updateAsExpression = updateAsExpression; function createNonNullExpression(expression) { - var node = createSynthesizedNode(207 /* NonNullExpression */); + var node = createSynthesizedNode(208 /* NonNullExpression */); node.expression = ts.parenthesizeForAccess(expression); return node; } @@ -54047,7 +54312,7 @@ var ts; } ts.updateNonNullExpression = updateNonNullExpression; function createMetaProperty(keywordToken, name) { - var node = createSynthesizedNode(208 /* MetaProperty */); + var node = createSynthesizedNode(209 /* MetaProperty */); node.keywordToken = keywordToken; node.name = name; return node; @@ -54061,7 +54326,7 @@ var ts; ts.updateMetaProperty = updateMetaProperty; // Misc function createTemplateSpan(expression, literal) { - var node = createSynthesizedNode(209 /* TemplateSpan */); + var node = createSynthesizedNode(210 /* TemplateSpan */); node.expression = expression; node.literal = literal; return node; @@ -54075,12 +54340,12 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createSemicolonClassElement() { - return createSynthesizedNode(210 /* SemicolonClassElement */); + return createSynthesizedNode(211 /* SemicolonClassElement */); } ts.createSemicolonClassElement = createSemicolonClassElement; // Element function createBlock(statements, multiLine) { - var block = createSynthesizedNode(211 /* Block */); + var block = createSynthesizedNode(212 /* Block */); block.statements = createNodeArray(statements); if (multiLine) block.multiLine = multiLine; @@ -54094,7 +54359,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList) { - var node = createSynthesizedNode(212 /* VariableStatement */); + var node = createSynthesizedNode(213 /* VariableStatement */); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -54109,11 +54374,11 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createEmptyStatement() { - return createSynthesizedNode(213 /* EmptyStatement */); + return createSynthesizedNode(214 /* EmptyStatement */); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression) { - var node = createSynthesizedNode(214 /* ExpressionStatement */); + var node = createSynthesizedNode(215 /* ExpressionStatement */); node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -54125,7 +54390,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement) { - var node = createSynthesizedNode(215 /* IfStatement */); + var node = createSynthesizedNode(216 /* IfStatement */); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -54141,7 +54406,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression) { - var node = createSynthesizedNode(216 /* DoStatement */); + var node = createSynthesizedNode(217 /* DoStatement */); node.statement = statement; node.expression = expression; return node; @@ -54155,7 +54420,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement) { - var node = createSynthesizedNode(217 /* WhileStatement */); + var node = createSynthesizedNode(218 /* WhileStatement */); node.expression = expression; node.statement = statement; return node; @@ -54169,7 +54434,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement) { - var node = createSynthesizedNode(218 /* ForStatement */); + var node = createSynthesizedNode(219 /* ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -54187,7 +54452,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement) { - var node = createSynthesizedNode(219 /* ForInStatement */); + var node = createSynthesizedNode(220 /* ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -54203,7 +54468,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(awaitModifier, initializer, expression, statement) { - var node = createSynthesizedNode(220 /* ForOfStatement */); + var node = createSynthesizedNode(221 /* ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; @@ -54221,7 +54486,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label) { - var node = createSynthesizedNode(221 /* ContinueStatement */); + var node = createSynthesizedNode(222 /* ContinueStatement */); node.label = asName(label); return node; } @@ -54233,7 +54498,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label) { - var node = createSynthesizedNode(222 /* BreakStatement */); + var node = createSynthesizedNode(223 /* BreakStatement */); node.label = asName(label); return node; } @@ -54245,7 +54510,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression) { - var node = createSynthesizedNode(223 /* ReturnStatement */); + var node = createSynthesizedNode(224 /* ReturnStatement */); node.expression = expression; return node; } @@ -54257,7 +54522,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement) { - var node = createSynthesizedNode(224 /* WithStatement */); + var node = createSynthesizedNode(225 /* WithStatement */); node.expression = expression; node.statement = statement; return node; @@ -54271,7 +54536,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock) { - var node = createSynthesizedNode(225 /* SwitchStatement */); + var node = createSynthesizedNode(226 /* SwitchStatement */); node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -54285,7 +54550,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement) { - var node = createSynthesizedNode(226 /* LabeledStatement */); + var node = createSynthesizedNode(227 /* LabeledStatement */); node.label = asName(label); node.statement = statement; return node; @@ -54299,7 +54564,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression) { - var node = createSynthesizedNode(227 /* ThrowStatement */); + var node = createSynthesizedNode(228 /* ThrowStatement */); node.expression = expression; return node; } @@ -54311,7 +54576,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock) { - var node = createSynthesizedNode(228 /* TryStatement */); + var node = createSynthesizedNode(229 /* TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -54327,11 +54592,11 @@ var ts; } ts.updateTry = updateTry; function createDebuggerStatement() { - return createSynthesizedNode(229 /* DebuggerStatement */); + return createSynthesizedNode(230 /* DebuggerStatement */); } ts.createDebuggerStatement = createDebuggerStatement; function createVariableDeclaration(name, type, initializer) { - var node = createSynthesizedNode(230 /* VariableDeclaration */); + var node = createSynthesizedNode(231 /* VariableDeclaration */); node.name = asName(name); node.type = type; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -54347,7 +54612,7 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createVariableDeclarationList(declarations, flags) { - var node = createSynthesizedNode(231 /* VariableDeclarationList */); + var node = createSynthesizedNode(232 /* VariableDeclarationList */); node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); return node; @@ -54360,7 +54625,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(232 /* FunctionDeclaration */); + var node = createSynthesizedNode(233 /* FunctionDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; @@ -54386,7 +54651,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(233 /* ClassDeclaration */); + var node = createSynthesizedNode(234 /* ClassDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -54408,7 +54673,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(234 /* InterfaceDeclaration */); + var node = createSynthesizedNode(235 /* InterfaceDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -54430,7 +54695,7 @@ var ts; } ts.updateInterfaceDeclaration = updateInterfaceDeclaration; function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) { - var node = createSynthesizedNode(235 /* TypeAliasDeclaration */); + var node = createSynthesizedNode(236 /* TypeAliasDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -54450,7 +54715,7 @@ var ts; } ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration; function createEnumDeclaration(decorators, modifiers, name, members) { - var node = createSynthesizedNode(236 /* EnumDeclaration */); + var node = createSynthesizedNode(237 /* EnumDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -54468,7 +54733,7 @@ var ts; } ts.updateEnumDeclaration = updateEnumDeclaration; function createModuleDeclaration(decorators, modifiers, name, body, flags) { - var node = createSynthesizedNode(237 /* ModuleDeclaration */); + var node = createSynthesizedNode(238 /* ModuleDeclaration */); node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 512 /* GlobalAugmentation */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -54487,7 +54752,7 @@ var ts; } ts.updateModuleDeclaration = updateModuleDeclaration; function createModuleBlock(statements) { - var node = createSynthesizedNode(238 /* ModuleBlock */); + var node = createSynthesizedNode(239 /* ModuleBlock */); node.statements = createNodeArray(statements); return node; } @@ -54499,7 +54764,7 @@ var ts; } ts.updateModuleBlock = updateModuleBlock; function createCaseBlock(clauses) { - var node = createSynthesizedNode(239 /* CaseBlock */); + var node = createSynthesizedNode(240 /* CaseBlock */); node.clauses = createNodeArray(clauses); return node; } @@ -54511,7 +54776,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createNamespaceExportDeclaration(name) { - var node = createSynthesizedNode(240 /* NamespaceExportDeclaration */); + var node = createSynthesizedNode(241 /* NamespaceExportDeclaration */); node.name = asName(name); return node; } @@ -54523,7 +54788,7 @@ var ts; } ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration; function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { - var node = createSynthesizedNode(241 /* ImportEqualsDeclaration */); + var node = createSynthesizedNode(242 /* ImportEqualsDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -54541,7 +54806,7 @@ var ts; } ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { - var node = createSynthesizedNode(242 /* ImportDeclaration */); + var node = createSynthesizedNode(243 /* ImportDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; @@ -54559,7 +54824,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings) { - var node = createSynthesizedNode(243 /* ImportClause */); + var node = createSynthesizedNode(244 /* ImportClause */); node.name = name; node.namedBindings = namedBindings; return node; @@ -54573,7 +54838,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name) { - var node = createSynthesizedNode(244 /* NamespaceImport */); + var node = createSynthesizedNode(245 /* NamespaceImport */); node.name = name; return node; } @@ -54585,7 +54850,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements) { - var node = createSynthesizedNode(245 /* NamedImports */); + var node = createSynthesizedNode(246 /* NamedImports */); node.elements = createNodeArray(elements); return node; } @@ -54597,7 +54862,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name) { - var node = createSynthesizedNode(246 /* ImportSpecifier */); + var node = createSynthesizedNode(247 /* ImportSpecifier */); node.propertyName = propertyName; node.name = name; return node; @@ -54611,7 +54876,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression) { - var node = createSynthesizedNode(247 /* ExportAssignment */); + var node = createSynthesizedNode(248 /* ExportAssignment */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; @@ -54628,7 +54893,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { - var node = createSynthesizedNode(248 /* ExportDeclaration */); + var node = createSynthesizedNode(249 /* ExportDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; @@ -54646,7 +54911,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements) { - var node = createSynthesizedNode(249 /* NamedExports */); + var node = createSynthesizedNode(250 /* NamedExports */); node.elements = createNodeArray(elements); return node; } @@ -54658,7 +54923,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(propertyName, name) { - var node = createSynthesizedNode(250 /* ExportSpecifier */); + var node = createSynthesizedNode(251 /* ExportSpecifier */); node.propertyName = asName(propertyName); node.name = asName(name); return node; @@ -54673,7 +54938,7 @@ var ts; ts.updateExportSpecifier = updateExportSpecifier; // Module references function createExternalModuleReference(expression) { - var node = createSynthesizedNode(252 /* ExternalModuleReference */); + var node = createSynthesizedNode(253 /* ExternalModuleReference */); node.expression = expression; return node; } @@ -54686,7 +54951,7 @@ var ts; ts.updateExternalModuleReference = updateExternalModuleReference; // JSX function createJsxElement(openingElement, children, closingElement) { - var node = createSynthesizedNode(253 /* JsxElement */); + var node = createSynthesizedNode(254 /* JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -54702,7 +54967,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(254 /* JsxSelfClosingElement */); + var node = createSynthesizedNode(255 /* JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = typeArguments && createNodeArray(typeArguments); node.attributes = attributes; @@ -54718,7 +54983,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(255 /* JsxOpeningElement */); + var node = createSynthesizedNode(256 /* JsxOpeningElement */); node.tagName = tagName; node.typeArguments = typeArguments && createNodeArray(typeArguments); node.attributes = attributes; @@ -54734,7 +54999,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName) { - var node = createSynthesizedNode(256 /* JsxClosingElement */); + var node = createSynthesizedNode(257 /* JsxClosingElement */); node.tagName = tagName; return node; } @@ -54746,7 +55011,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxFragment(openingFragment, children, closingFragment) { - var node = createSynthesizedNode(257 /* JsxFragment */); + var node = createSynthesizedNode(258 /* JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -54762,7 +55027,7 @@ var ts; } ts.updateJsxFragment = updateJsxFragment; function createJsxAttribute(name, initializer) { - var node = createSynthesizedNode(260 /* JsxAttribute */); + var node = createSynthesizedNode(261 /* JsxAttribute */); node.name = name; node.initializer = initializer; return node; @@ -54776,7 +55041,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(261 /* JsxAttributes */); + var node = createSynthesizedNode(262 /* JsxAttributes */); node.properties = createNodeArray(properties); return node; } @@ -54788,7 +55053,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(262 /* JsxSpreadAttribute */); + var node = createSynthesizedNode(263 /* JsxSpreadAttribute */); node.expression = expression; return node; } @@ -54800,7 +55065,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(263 /* JsxExpression */); + var node = createSynthesizedNode(264 /* JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -54814,7 +55079,7 @@ var ts; ts.updateJsxExpression = updateJsxExpression; // Clauses function createCaseClause(expression, statements) { - var node = createSynthesizedNode(264 /* CaseClause */); + var node = createSynthesizedNode(265 /* CaseClause */); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -54828,7 +55093,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(265 /* DefaultClause */); + var node = createSynthesizedNode(266 /* DefaultClause */); node.statements = createNodeArray(statements); return node; } @@ -54840,7 +55105,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(266 /* HeritageClause */); + var node = createSynthesizedNode(267 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); return node; @@ -54853,7 +55118,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(267 /* CatchClause */); + var node = createSynthesizedNode(268 /* CatchClause */); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -54868,7 +55133,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(268 /* PropertyAssignment */); + var node = createSynthesizedNode(269 /* PropertyAssignment */); node.name = asName(name); node.questionToken = undefined; node.initializer = ts.parenthesizeExpressionForList(initializer); @@ -54883,7 +55148,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(269 /* ShorthandPropertyAssignment */); + var node = createSynthesizedNode(270 /* ShorthandPropertyAssignment */); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -54897,7 +55162,7 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(270 /* SpreadAssignment */); + var node = createSynthesizedNode(271 /* SpreadAssignment */); node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; return node; } @@ -54910,7 +55175,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; // Enum function createEnumMember(name, initializer) { - var node = createSynthesizedNode(271 /* EnumMember */); + var node = createSynthesizedNode(272 /* EnumMember */); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -54924,12 +55189,13 @@ var ts; } ts.updateEnumMember = updateEnumMember; // Top-level nodes - function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences) { + function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib) { if (node.statements !== statements || (isDeclarationFile !== undefined && node.isDeclarationFile !== isDeclarationFile) || (referencedFiles !== undefined && node.referencedFiles !== referencedFiles) || - (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences)) { - var updated = createSynthesizedNode(272 /* SourceFile */); + (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) || + (hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) { + var updated = createSynthesizedNode(273 /* SourceFile */); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -54939,6 +55205,7 @@ var ts; updated.isDeclarationFile = isDeclarationFile === undefined ? node.isDeclarationFile : isDeclarationFile; updated.referencedFiles = referencedFiles === undefined ? node.referencedFiles : referencedFiles; updated.typeReferenceDirectives = typeReferences === undefined ? node.typeReferenceDirectives : typeReferences; + updated.hasNoDefaultLib = hasNoDefaultLib === undefined ? node.hasNoDefaultLib : hasNoDefaultLib; if (node.amdDependencies !== undefined) updated.amdDependencies = node.amdDependencies; if (node.moduleName !== undefined) @@ -54947,8 +55214,6 @@ var ts; updated.languageVariant = node.languageVariant; if (node.renamedDependencies !== undefined) updated.renamedDependencies = node.renamedDependencies; - if (node.hasNoDefaultLib !== undefined) - updated.hasNoDefaultLib = node.hasNoDefaultLib; if (node.languageVersion !== undefined) updated.languageVersion = node.languageVersion; if (node.scriptKind !== undefined) @@ -55011,7 +55276,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createSynthesizedNode(294 /* NotEmittedStatement */); + var node = createSynthesizedNode(295 /* NotEmittedStatement */); node.original = original; setTextRange(node, original); return node; @@ -55023,7 +55288,7 @@ var ts; */ /* @internal */ function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(298 /* EndOfDeclarationMarker */); + var node = createSynthesizedNode(299 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -55035,7 +55300,7 @@ var ts; */ /* @internal */ function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(297 /* MergeDeclarationMarker */); + var node = createSynthesizedNode(298 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -55050,7 +55315,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(295 /* PartiallyEmittedExpression */); + var node = createSynthesizedNode(296 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; setTextRange(node, original); @@ -55066,7 +55331,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 296 /* CommaListExpression */) { + if (node.kind === 297 /* CommaListExpression */) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26 /* CommaToken */) { @@ -55076,7 +55341,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(296 /* CommaListExpression */); + var node = createSynthesizedNode(297 /* CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -55088,7 +55353,7 @@ var ts; } ts.updateCommaList = updateCommaList; function createBundle(sourceFiles) { - var node = ts.createNode(273 /* Bundle */); + var node = ts.createNode(274 /* Bundle */); node.sourceFiles = sourceFiles; return node; } @@ -55224,7 +55489,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 === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -55726,7 +55991,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 226 /* LabeledStatement */ + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 227 /* LabeledStatement */ ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -55744,13 +56009,13 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return false; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -55776,7 +56041,7 @@ var ts; } else { switch (callee.kind) { - case 183 /* PropertyAccessExpression */: { + case 184 /* PropertyAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a.b()` target is `(_a = a).b` and thisArg is `_a` thisArg = ts.createTempVariable(recordTempVariable); @@ -55789,7 +56054,7 @@ var ts; } break; } - case 184 /* ElementAccessExpression */: { + case 185 /* ElementAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a` thisArg = ts.createTempVariable(recordTempVariable); @@ -55849,9 +56114,9 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); case 153 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); @@ -56177,7 +56442,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 === 189 /* ParenthesizedExpression */) { + if (skipped.kind === 190 /* ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -56211,8 +56476,8 @@ 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(198 /* BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(198 /* BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(199 /* BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(199 /* BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { @@ -56221,7 +56486,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ - && operand.kind === 201 /* YieldExpression */) { + && operand.kind === 202 /* YieldExpression */) { return false; } return true; @@ -56309,7 +56574,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 198 /* BinaryExpression */ && node.operatorToken.kind === 37 /* PlusToken */) { + if (node.kind === 199 /* BinaryExpression */ && node.operatorToken.kind === 37 /* PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -56324,7 +56589,7 @@ var ts; return 0 /* Unknown */; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(199 /* ConditionalExpression */, 55 /* QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(200 /* ConditionalExpression */, 55 /* QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { @@ -56338,8 +56603,8 @@ var ts; // so in case when comma expression is introduced as a part of previous transformations // if should be wrapped in parens since comma operator has the lowest precedence var emittedExpression = ts.skipPartiallyEmittedExpressions(e); - return emittedExpression.kind === 198 /* BinaryExpression */ && emittedExpression.operatorToken.kind === 26 /* CommaToken */ || - emittedExpression.kind === 296 /* CommaListExpression */ + return emittedExpression.kind === 199 /* BinaryExpression */ && emittedExpression.operatorToken.kind === 26 /* CommaToken */ || + emittedExpression.kind === 297 /* CommaListExpression */ ? ts.createParen(e) : e; } @@ -56357,9 +56622,9 @@ var ts; */ function parenthesizeDefaultExpression(e) { var check = ts.skipPartiallyEmittedExpressions(e); - return (check.kind === 203 /* ClassExpression */ || - check.kind === 190 /* FunctionExpression */ || - check.kind === 296 /* CommaListExpression */ || + return (check.kind === 204 /* ClassExpression */ || + check.kind === 191 /* FunctionExpression */ || + check.kind === 297 /* CommaListExpression */ || ts.isBinaryExpression(check) && check.operatorToken.kind === 26 /* CommaToken */) ? ts.createParen(e) : e; @@ -56374,9 +56639,9 @@ var ts; function parenthesizeForNew(expression) { var leftmostExpr = getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: return ts.createParen(expression); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return !leftmostExpr.arguments ? ts.createParen(expression) : expression; @@ -56399,7 +56664,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 186 /* NewExpression */ || emittedExpression.arguments)) { + && (emittedExpression.kind !== 187 /* NewExpression */ || emittedExpression.arguments)) { return expression; } return ts.setTextRange(ts.createParen(expression), expression); @@ -56437,7 +56702,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(198 /* BinaryExpression */, 26 /* CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(199 /* BinaryExpression */, 26 /* CommaToken */); return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(ts.createParen(expression), expression); @@ -56448,14 +56713,14 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 190 /* FunctionExpression */ || kind === 191 /* ArrowFunction */) { + if (kind === 191 /* FunctionExpression */ || kind === 192 /* ArrowFunction */) { var mutableCall = ts.getMutableClone(emittedExpression); mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreateOuterExpressions(expression, mutableCall, 4 /* PartiallyEmittedExpressions */); } } var leftmostExpressionKind = getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 182 /* ObjectLiteralExpression */ || leftmostExpressionKind === 190 /* FunctionExpression */) { + if (leftmostExpressionKind === 183 /* ObjectLiteralExpression */ || leftmostExpressionKind === 191 /* FunctionExpression */) { return ts.setTextRange(ts.createParen(expression), expression); } return expression; @@ -56505,25 +56770,25 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: node = node.operand; continue; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: node = node.left; continue; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: node = node.condition; continue; - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 184 /* ElementAccessExpression */: - case 183 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 184 /* PropertyAccessExpression */: node = node.expression; continue; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -56531,7 +56796,7 @@ var ts; } } function parenthesizeConciseBody(body) { - if (!ts.isBlock(body) && getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 182 /* ObjectLiteralExpression */) { + if (!ts.isBlock(body) && getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 183 /* ObjectLiteralExpression */) { return ts.setTextRange(ts.createParen(body), body); } return body; @@ -56547,13 +56812,13 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 7 /* All */; } switch (node.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return (kinds & 1 /* Parentheses */) !== 0; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: - case 207 /* NonNullExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: + case 208 /* NonNullExpression */: return (kinds & 2 /* Assertions */) !== 0; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0; } return false; @@ -56578,7 +56843,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipAssertions(node) { - while (ts.isAssertionExpression(node) || node.kind === 207 /* NonNullExpression */) { + while (ts.isAssertionExpression(node) || node.kind === 208 /* NonNullExpression */) { node = node.expression; } return node; @@ -56586,11 +56851,11 @@ var ts; ts.skipAssertions = skipAssertions; function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 189 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression); - case 188 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 206 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); - case 207 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); - case 295 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 190 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression); + case 189 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 207 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); + case 208 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); + case 296 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -56608,7 +56873,7 @@ var ts; * the containing expression is created/updated. */ function isIgnorableParen(node) { - return node.kind === 189 /* ParenthesizedExpression */ + return node.kind === 190 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node) && ts.nodeIsSynthesized(ts.getSourceMapRange(node)) && ts.nodeIsSynthesized(ts.getCommentRange(node)) @@ -56673,10 +56938,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 242 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 243 /* ImportDeclaration */ && node.importClause) { return ts.getGeneratedNameForNode(node); } - if (node.kind === 248 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 249 /* ExportDeclaration */ && node.moduleSpecifier) { return ts.getGeneratedNameForNode(node); } return undefined; @@ -56794,7 +57059,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -56806,11 +57071,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -56843,11 +57108,11 @@ var ts; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { case 148 /* Parameter */: - case 180 /* BindingElement */: + case 181 /* BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 202 /* SpreadElement */: - case 270 /* SpreadAssignment */: + case 203 /* SpreadElement */: + case 271 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -56859,7 +57124,7 @@ var ts; */ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 180 /* BindingElement */: + case 181 /* BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -56871,7 +57136,7 @@ var ts; : propertyName; } break; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -56883,7 +57148,7 @@ var ts; : propertyName; } break; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -56901,13 +57166,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: - case 181 /* ArrayLiteralExpression */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: + case 182 /* ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -56947,11 +57212,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 179 /* ArrayBindingPattern */: - case 181 /* ArrayLiteralExpression */: + case 180 /* ArrayBindingPattern */: + case 182 /* ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 178 /* ObjectBindingPattern */: - case 182 /* ObjectLiteralExpression */: + case 179 /* ObjectBindingPattern */: + case 183 /* ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -57179,6 +57444,8 @@ var ts; return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode)); case 171 /* InferType */: return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + case 178 /* ImportType */: + return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); case 172 /* ParenthesizedType */: return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode)); case 174 /* TypeOperator */: @@ -57190,195 +57457,195 @@ var ts; case 177 /* LiteralType */: return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); // Binding patterns - case 178 /* ObjectBindingPattern */: + case 179 /* ObjectBindingPattern */: return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 179 /* ArrayBindingPattern */: + case 180 /* ArrayBindingPattern */: return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); // Expression - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context)); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken)); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression)); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 206 /* AsExpression */: + case 207 /* AsExpression */: return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier)); // Misc - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); // Element - case 211 /* Block */: + case 212 /* Block */: return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 245 /* NamedImports */: + case 246 /* NamedImports */: return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 249 /* NamedExports */: + case 250 /* NamedExports */: return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 250 /* ExportSpecifier */: + case 251 /* ExportSpecifier */: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); // Module references - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); // JSX - case 253 /* JsxElement */: + case 254 /* JsxElement */: return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); - case 255 /* JsxOpeningElement */: + case 256 /* JsxOpeningElement */: return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 264 /* CaseClause */: + case 265 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Enum - case 271 /* EnumMember */: + case 272 /* EnumMember */: return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); // Top-level nodes - case 272 /* SourceFile */: + case 273 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: // No need to visit nodes with no children. @@ -57430,11 +57697,11 @@ var ts; var result = initial; switch (node.kind) { // Leaf nodes - case 210 /* SemicolonClassElement */: - case 213 /* EmptyStatement */: - case 204 /* OmittedExpression */: - case 229 /* DebuggerStatement */: - case 294 /* NotEmittedStatement */: + case 211 /* SemicolonClassElement */: + case 214 /* EmptyStatement */: + case 205 /* OmittedExpression */: + case 230 /* DebuggerStatement */: + case 295 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names @@ -57501,49 +57768,49 @@ var ts; result = reduceNode(node.body, cbNode, result); break; // Binding patterns - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: result = reduceNodes(node.elements, cbNodes, result); break; - case 180 /* BindingElement */: + case 181 /* BindingElement */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Expression - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: result = reduceNodes(node.elements, cbNodes, result); break; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: result = reduceNodes(node.properties, cbNodes, result); break; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 185 /* CallExpression */: + case 186 /* CallExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 186 /* NewExpression */: + case 187 /* NewExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: result = reduceNode(node.type, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -57551,123 +57818,123 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 189 /* ParenthesizedExpression */: - case 192 /* DeleteExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 195 /* AwaitExpression */: - case 201 /* YieldExpression */: - case 202 /* SpreadElement */: - case 207 /* NonNullExpression */: + case 190 /* ParenthesizedExpression */: + case 193 /* DeleteExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 196 /* AwaitExpression */: + case 202 /* YieldExpression */: + case 203 /* SpreadElement */: + case 208 /* NonNullExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: result = reduceNode(node.operand, cbNode, result); break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 206 /* AsExpression */: + case 207 /* AsExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.type, cbNode, result); break; // Misc - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; // Element - case 211 /* Block */: + case 212 /* Block */: result = reduceNodes(node.statements, cbNodes, result); break; - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 215 /* IfStatement */: + case 216 /* IfStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 216 /* DoStatement */: + case 217 /* DoStatement */: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 217 /* WhileStatement */: - case 224 /* WithStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 218 /* ForStatement */: + case 219 /* ForStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 223 /* ReturnStatement */: - case 227 /* ThrowStatement */: + case 224 /* ReturnStatement */: + case 228 /* ThrowStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 228 /* TryStatement */: + case 229 /* TryStatement */: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: result = reduceNodes(node.declarations, cbNodes, result); break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -57676,7 +57943,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -57684,139 +57951,139 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.members, cbNodes, result); break; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: result = reduceNodes(node.statements, cbNodes, result); break; - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: result = reduceNodes(node.clauses, cbNodes, result); break; - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.moduleReference, cbNode, result); break; - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 243 /* ImportClause */: + case 244 /* ImportClause */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: result = reduceNode(node.name, cbNode, result); break; - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: result = reduceNodes(node.elements, cbNodes, result); break; - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; // Module references - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: result = reduceNode(node.expression, cbNode, result); break; // JSX - case 253 /* JsxElement */: + case 254 /* JsxElement */: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: result = reduceNode(node.openingFragment, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingFragment, cbNode, result); break; - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: result = reduceNodes(node.properties, cbNodes, result); break; - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 264 /* CaseClause */: + case 265 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // falls through - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 267 /* CatchClause */: + case 268 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Enum - case 271 /* EnumMember */: + case 272 /* EnumMember */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Top-level nodes - case 272 /* SourceFile */: + case 273 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -57889,7 +58156,7 @@ var ts; function aggregateTransformFlagsForSubtree(node) { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 205 /* ExpressionWithTypeArguments */)) { + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 206 /* ExpressionWithTypeArguments */)) { return 0 /* None */; } // Aggregate the transform flags of each child. @@ -58022,21 +58289,21 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" // import { x, y } from "mod" externalImports.push(node); - hasImportStarOrImportDefault = getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); + hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); break; - case 241 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 252 /* ExternalModuleReference */) { + case 242 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 253 /* ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -58066,13 +58333,13 @@ var ts; } } break; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: if (ts.hasModifier(node, 1 /* Export */)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -58080,7 +58347,7 @@ var ts; } } break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default function() { } @@ -58100,7 +58367,7 @@ var ts; } } break; - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default class { } @@ -58174,6 +58441,26 @@ var ts; ts.isIdentifier(expression); } ts.isSimpleCopiableExpression = isSimpleCopiableExpression; + /** + * @param input Template string input strings + * @param args Names which need to be made file-level unique + */ + function helperString(input) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return function (uniqueName) { + var result = ""; + for (var i = 0; i < args.length; i++) { + result += input[i]; + result += uniqueName(args[i]); + } + result += input[input.length - 1]; + return result; + }; + } + ts.helperString = helperString; })(ts || (ts = {})); /// /// @@ -58700,8 +58987,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(184 /* ElementAccessExpression */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(185 /* ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -58770,15 +59057,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 272 /* SourceFile */: - case 239 /* CaseBlock */: - case 238 /* ModuleBlock */: - case 211 /* Block */: + case 273 /* SourceFile */: + case 240 /* CaseBlock */: + case 239 /* ModuleBlock */: + case 212 /* Block */: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 233 /* ClassDeclaration */: - case 232 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: + case 233 /* FunctionDeclaration */: if (ts.hasModifier(node, 2 /* Ambient */)) { break; } @@ -58790,7 +59077,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 === 233 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */)); + ts.Debug.assert(node.kind === 234 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */)); } break; } @@ -58834,10 +59121,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 247 /* ExportAssignment */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 248 /* ExportAssignment */: + case 249 /* ExportDeclaration */: return visitEllidableStatement(node); default: return visitorWorker(node); @@ -58858,13 +59145,13 @@ var ts; return node; } switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -58884,11 +59171,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 248 /* ExportDeclaration */ || - node.kind === 242 /* ImportDeclaration */ || - node.kind === 243 /* ImportClause */ || - (node.kind === 241 /* ImportEqualsDeclaration */ && - node.moduleReference.kind === 252 /* ExternalModuleReference */)) { + if (node.kind === 249 /* ExportDeclaration */ || + node.kind === 243 /* ImportDeclaration */ || + node.kind === 244 /* ImportClause */ || + (node.kind === 242 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 253 /* ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -58930,7 +59217,7 @@ var ts; case 153 /* MethodDeclaration */: // Fallback to the default visit behavior. return visitorWorker(node); - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: return node; default: return ts.Debug.failBadSyntaxKind(node); @@ -58999,22 +59286,22 @@ var ts; // TypeScript index signatures are elided. case 149 /* Decorator */: // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return undefined; case 151 /* PropertyDeclaration */: // TypeScript property declarations are elided. However their names are still visited, and can potentially be retained if they could have sideeffects return visitPropertyDeclaration(node); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; case 154 /* Constructor */: return visitConstructor(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return ts.createNotEmittedStatement(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: // This is a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -59025,7 +59312,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: // This is a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -59036,13 +59323,13 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); case 153 /* MethodDeclaration */: @@ -59055,13 +59342,13 @@ var ts; case 156 /* SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); case 148 /* Parameter */: @@ -59074,33 +59361,33 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return visitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return visitNewExpression(node); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); default: @@ -59581,7 +59868,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 214 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 215 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -60095,8 +60382,8 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: @@ -60118,8 +60405,8 @@ var ts; return serializeTypeNode(node.type); case 156 /* SetAccessor */: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: case 153 /* MethodDeclaration */: return ts.createIdentifier("Function"); default: @@ -60928,12 +61215,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentScope.kind === 272 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); + ], currentScope.kind === 273 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 236 /* EnumDeclaration */) { + if (node.kind === 237 /* EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -61052,7 +61339,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 238 /* ModuleBlock */) { + if (body.kind === 239 /* ModuleBlock */) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -61098,13 +61385,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 (body.kind !== 238 /* ModuleBlock */) { + if (body.kind !== 239 /* ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 237 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 238 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -61145,7 +61432,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 244 /* NamespaceImport */) { + if (node.kind === 245 /* NamespaceImport */) { // Elide a namespace import if it is not referenced. return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } @@ -61377,16 +61664,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(71 /* Identifier */); - context.enableSubstitution(269 /* ShorthandPropertyAssignment */); + context.enableSubstitution(270 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(237 /* ModuleDeclaration */); + context.enableEmitNotification(238 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 237 /* ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 238 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 236 /* EnumDeclaration */; + return ts.getOriginalNode(node).kind === 237 /* EnumDeclaration */; } /** * Hook for node emit. @@ -61447,9 +61734,9 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return substituteExpressionIdentifier(node); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -61487,9 +61774,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 !== 272 /* SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 237 /* ModuleDeclaration */) || - (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 236 /* EnumDeclaration */); + if (container && container.kind !== 273 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 238 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 237 /* EnumDeclaration */); if (substitute) { return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), /*location*/ node); @@ -61626,15 +61913,15 @@ var ts; case 120 /* AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return visitAwaitExpression(node); case 153 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return visitArrowFunction(node); default: return ts.visitEachChild(node, visitor, context); @@ -61643,27 +61930,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatementInAsyncBody(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatementInAsyncBody(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClauseInAsyncBody(node); - case 211 /* Block */: - case 225 /* SwitchStatement */: - case 239 /* CaseBlock */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: - case 228 /* TryStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 215 /* IfStatement */: - case 224 /* WithStatement */: - case 226 /* LabeledStatement */: + case 212 /* Block */: + case 226 /* SwitchStatement */: + case 240 /* CaseBlock */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: + case 229 /* TryStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 216 /* IfStatement */: + case 225 /* WithStatement */: + case 227 /* LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -61863,7 +62150,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 191 /* ArrowFunction */; + var isArrowFunction = node.kind === 192 /* ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* 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 @@ -61936,11 +62223,11 @@ var ts; enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(185 /* CallExpression */); - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(184 /* ElementAccessExpression */); + context.enableSubstitution(186 /* CallExpression */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(185 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(233 /* ClassDeclaration */); + context.enableEmitNotification(234 /* ClassDeclaration */); context.enableEmitNotification(153 /* MethodDeclaration */); context.enableEmitNotification(155 /* GetAccessor */); context.enableEmitNotification(156 /* SetAccessor */); @@ -61984,11 +62271,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return substituteCallExpression(node); } return node; @@ -62020,7 +62307,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 233 /* ClassDeclaration */ + return kind === 234 /* ClassDeclaration */ || kind === 154 /* Constructor */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ @@ -62028,11 +62315,11 @@ var ts; } function createSuperAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) { - return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createFileLevelUniqueName("_super"), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } else { - return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), + return ts.setTextRange(ts.createCall(ts.createFileLevelUniqueName("_super"), /*typeArguments*/ undefined, [argumentExpression]), location); } } @@ -62065,12 +62352,12 @@ var ts; ts.asyncSuperHelper = { name: "typescript:async-super", scoped: true, - text: "\n const _super = name => super[name];" + text: ts.helperString(__makeTemplateObject(["\n const ", " = name => super[name];"], ["\n const ", " = name => super[name];"]), "_super") }; ts.advancedAsyncSuperHelper = { name: "typescript:advanced-async-super", scoped: true, - text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" + text: ts.helperString(__makeTemplateObject(["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"], ["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"]), "_super") }; })(ts || (ts = {})); /// @@ -62122,23 +62409,23 @@ var ts; return node; } switch (node.kind) { - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return visitAwaitExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitYieldExpression(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node, noDestructuringValue); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return visitVoidExpression(node); case 154 /* Constructor */: return visitConstructorDeclaration(node); @@ -62148,19 +62435,19 @@ var ts; return visitGetAccessorDeclaration(node); case 156 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return visitArrowFunction(node); case 148 /* Parameter */: return visitParameter(node); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return visitExpressionStatement(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -62183,7 +62470,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 220 /* ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 221 /* ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node); @@ -62195,7 +62482,7 @@ var ts; var objects = []; for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { var e = elements_4[_i]; - if (e.kind === 270 /* SpreadAssignment */) { + if (e.kind === 271 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -62204,7 +62491,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 268 /* PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 269 /* PropertyAssignment */ ? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -62222,7 +62509,7 @@ var ts; // If the first element is a spread element, then the first argument to __assign is {}: // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 182 /* ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 183 /* ObjectLiteralExpression */) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -62301,6 +62588,11 @@ var ts; bodyLocation = node.statement; statementsLocation = node.statement.statements; } + else if (node.statement) { + ts.append(statements, node.statement); + bodyLocation = node.statement; + statementsLocation = node.statement; + } return ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer) ], 1 /* Let */), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), @@ -62530,11 +62822,11 @@ var ts; enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(185 /* CallExpression */); - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(184 /* ElementAccessExpression */); + context.enableSubstitution(186 /* CallExpression */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(185 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(233 /* ClassDeclaration */); + context.enableEmitNotification(234 /* ClassDeclaration */); context.enableEmitNotification(153 /* MethodDeclaration */); context.enableEmitNotification(155 /* GetAccessor */); context.enableEmitNotification(156 /* SetAccessor */); @@ -62578,11 +62870,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return substituteCallExpression(node); } return node; @@ -62614,7 +62906,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 233 /* ClassDeclaration */ + return kind === 234 /* ClassDeclaration */ || kind === 154 /* Constructor */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ @@ -62730,13 +63022,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 253 /* JsxElement */: + case 254 /* JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -62746,13 +63038,13 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return visitJsxExpression(node); - case 253 /* JsxElement */: + case 254 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -62825,7 +63117,7 @@ var ts; literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile); return ts.setTextRange(literal, node); } - else if (node.kind === 263 /* JsxExpression */) { + else if (node.kind === 264 /* JsxExpression */) { if (node.expression === undefined) { return ts.createTrue(); } @@ -62919,7 +63211,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 253 /* JsxElement */) { + if (node.kind === 254 /* JsxElement */) { return getTagName(node.openingElement); } else { @@ -63227,7 +63519,7 @@ var ts; return node; } switch (node.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -63463,13 +63755,13 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ - && node.kind === 223 /* ReturnStatement */ + && node.kind === 224 /* ReturnStatement */ && !node.expression; } function shouldVisitNode(node) { return (node.transformFlags & 128 /* ContainsES2015 */) !== 0 || convertedLoopState !== undefined - || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 211 /* Block */))) + || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 212 /* Block */))) || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)) || (ts.getEmitFlags(node) & 33554432 /* TypeScriptClassWrapper */) !== 0; } @@ -63497,63 +63789,63 @@ var ts; switch (node.kind) { case 115 /* StaticKeyword */: return undefined; // elide static keyword - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return visitClassDeclaration(node); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return visitClassExpression(node); case 148 /* Parameter */: return visitParameter(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return visitArrowFunction(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitVariableDeclaration(node); case 71 /* Identifier */: return visitIdentifier(node); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitSwitchStatement(node); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return visitCaseBlock(node); - case 211 /* Block */: + case 212 /* Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: return visitBreakOrContinueStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return visitExpressionStatement(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClause(node); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); case 146 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return visitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return visitNewExpression(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node, /*needsDestructuringValue*/ true); case 13 /* NoSubstitutionTemplateLiteral */: case 14 /* TemplateHead */: @@ -63564,28 +63856,28 @@ var ts; return visitStringLiteral(node); case 8 /* NumericLiteral */: return visitNumericLiteral(node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return visitTemplateExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitYieldExpression(node); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return visitSpreadElement(node); case 97 /* SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 99 /* ThisKeyword */: return visitThisKeyword(node); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return visitMetaProperty(node); case 153 /* MethodDeclaration */: return visitMethodDeclaration(node); case 155 /* GetAccessor */: case 156 /* SetAccessor */: return visitAccessorDeclaration(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); @@ -63624,7 +63916,7 @@ var ts; return updated; } function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + return ts.setOriginalNode(ts.createReturn(ts.createFileLevelUniqueName("_this")), node); } function visitReturnStatement(node) { if (convertedLoopState) { @@ -63672,13 +63964,13 @@ 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 === 222 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var jump = node.kind === 223 /* BreakStatement */ ? 2 /* Break */ : 4 /* 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; if (!node.label) { - if (node.kind === 222 /* BreakStatement */) { + if (node.kind === 223 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } @@ -63689,7 +63981,7 @@ var ts; } } else { - if (node.kind === 222 /* BreakStatement */) { + if (node.kind === 223 /* BreakStatement */) { labelMarker = "break-" + node.label.escapedText; setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(node.label), labelMarker); } @@ -63811,7 +64103,7 @@ var ts; /*modifiers*/ undefined, /*asteriskToken*/ undefined, /*name*/ undefined, - /*typeParameters*/ undefined, extendsClauseElement ? [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "_super")] : [], + /*typeParameters*/ undefined, extendsClauseElement ? [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, ts.createFileLevelUniqueName("_super"))] : [], /*type*/ undefined, transformClassBody(node, extendsClauseElement)); // To preserve the behavior of the old emitter, we explicitly indent // the body of the function here if it was requested in an earlier @@ -63967,7 +64259,7 @@ var ts; if (isDerivedClass && superCaptureStatus !== 2 /* ReplaceWithReturn */ && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { - statements.push(ts.createReturn(ts.createIdentifier("_this"))); + statements.push(ts.createReturn(ts.createFileLevelUniqueName("_this"))); } ts.addRange(statements, endLexicalEnvironment()); if (constructor) { @@ -63989,11 +64281,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 223 /* ReturnStatement */) { + if (statement.kind === 224 /* ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 215 /* IfStatement */) { + else if (statement.kind === 216 /* IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -64001,7 +64293,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 211 /* Block */) { + else if (statement.kind === 212 /* Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -64059,7 +64351,7 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 214 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { + if (firstStatement.kind === 215 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } @@ -64069,8 +64361,8 @@ var ts; && statementOffset === ctorStatements.length - 1 && !(ctor.transformFlags & (16384 /* ContainsLexicalThis */ | 32768 /* ContainsCapturedLexicalThis */))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 198 /* BinaryExpression */ - || superCallExpression.left.kind !== 185 /* CallExpression */) { + if (superCallExpression.kind !== 199 /* BinaryExpression */ + || superCallExpression.left.kind !== 186 /* CallExpression */) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } // Shift comments from the original super call to the return statement. @@ -64090,7 +64382,7 @@ var ts; return ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */); } function createDefaultSuperCallOrThis() { - return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createFileLevelUniqueName("_super"), ts.createNull()), ts.createFunctionApply(ts.createFileLevelUniqueName("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } /** * Visits a parameter declaration. @@ -64267,7 +64559,7 @@ var ts; * @param node A node. */ function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 191 /* ArrowFunction */) { + if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 192 /* ArrowFunction */) { captureThisForNode(statements, node, ts.createThis()); } } @@ -64275,7 +64567,7 @@ var ts; enableSubstitutionsForCapturedThis(); var captureThisStatement = ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("_this", + ts.createVariableDeclaration(ts.createFileLevelUniqueName("_this"), /*type*/ undefined, initializer) ])); ts.setEmitFlags(captureThisStatement, 1536 /* NoComments */ | 1048576 /* CustomPrologue */); @@ -64287,7 +64579,7 @@ var ts; if (hierarchyFacts & 16384 /* NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return statements; case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: @@ -64301,8 +64593,8 @@ var ts; // should be relatively safe to use. newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"); break; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* 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 = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 93 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); @@ -64312,7 +64604,7 @@ var ts; } var captureNewTargetStatement = ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("_newTarget", + ts.createVariableDeclaration(ts.createFileLevelUniqueName("_newTarget"), /*type*/ undefined, newTarget) ])); if (copyOnWrite) { @@ -64333,7 +64625,7 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; case 153 /* MethodDeclaration */: @@ -64538,7 +64830,7 @@ var ts; : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 232 /* FunctionDeclaration */ || node.kind === 190 /* FunctionExpression */)) { + if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 233 /* FunctionDeclaration */ || node.kind === 191 /* FunctionExpression */)) { name = ts.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); @@ -64586,7 +64878,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 191 /* ArrowFunction */); + ts.Debug.assert(node.kind === 192 /* 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 @@ -64653,9 +64945,9 @@ var ts; function visitExpressionStatement(node) { // If we are here it is most likely because our expression is a destructuring assignment. switch (node.expression.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } return ts.visitEachChild(node, visitor, context); @@ -64674,9 +64966,9 @@ var ts; // expression. If we are in a state where we do not need the destructuring value, // we pass that information along to the children that care about it. switch (node.expression.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } } @@ -64878,14 +65170,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -65142,11 +65434,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 231 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 232 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -65436,10 +65728,10 @@ var ts; case 153 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -65766,7 +66058,7 @@ var ts; ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var initializer = ts.createLogicalOr(resultingCall, actualThis); resultingCall = assignToCapturedThis - ? ts.createAssignment(ts.createIdentifier("_this"), initializer) + ? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer) : initializer; } return ts.setOriginalNode(resultingCall, node); @@ -65826,7 +66118,7 @@ var ts; else { if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 181 /* ArrayLiteralExpression */ + return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 182 /* ArrayLiteralExpression */ ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -66037,8 +66329,8 @@ var ts; function visitSuperKeyword(isExpressionOfCall) { return hierarchyFacts & 8 /* NonStaticClassElement */ && !isExpressionOfCall - ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") - : ts.createIdentifier("_super"); + ? ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), "prototype") + : ts.createFileLevelUniqueName("_super"); } function visitMetaProperty(node) { if (node.keywordToken === 94 /* NewKeyword */ && node.name.escapedText === "target") { @@ -66048,7 +66340,7 @@ var ts; else { hierarchyFacts |= 16384 /* NewTarget */; } - return ts.createIdentifier("_newTarget"); + return ts.createFileLevelUniqueName("_newTarget"); } return node; } @@ -66093,9 +66385,9 @@ var ts; context.enableEmitNotification(153 /* MethodDeclaration */); context.enableEmitNotification(155 /* GetAccessor */); context.enableEmitNotification(156 /* SetAccessor */); - context.enableEmitNotification(191 /* ArrowFunction */); - context.enableEmitNotification(190 /* FunctionExpression */); - context.enableEmitNotification(232 /* FunctionDeclaration */); + context.enableEmitNotification(192 /* ArrowFunction */); + context.enableEmitNotification(191 /* FunctionExpression */); + context.enableEmitNotification(233 /* FunctionDeclaration */); } } /** @@ -66137,10 +66429,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 180 /* BindingElement */: - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 230 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 231 /* VariableDeclaration */: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -66205,7 +66497,7 @@ var ts; function substituteThisKeyword(node) { if (enabledSubstitutions & 1 /* CapturedThis */ && hierarchyFacts & 16 /* CapturesThis */) { - return ts.setTextRange(ts.createIdentifier("_this"), node); + return ts.setTextRange(ts.createFileLevelUniqueName("_this"), node); } return node; } @@ -66222,11 +66514,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 214 /* ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 215 /* ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 185 /* CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 186 /* CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -66234,7 +66526,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 202 /* SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 203 /* SpreadElement */) { return false; } var expression = callArgument.expression; @@ -66247,7 +66539,7 @@ var ts; return ts.createCall(ts.getHelperName("__extends"), /*typeArguments*/ undefined, [ name, - ts.createIdentifier("_super") + ts.createFileLevelUniqueName("_super") ]); } function createTemplateObjectHelper(context, cooked, raw) { @@ -66539,13 +66831,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 216 /* DoStatement */: + case 217 /* DoStatement */: return visitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return visitWhileStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -66558,24 +66850,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); case 155 /* GetAccessor */: case 156 /* SetAccessor */: return visitAccessorDeclaration(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return visitBreakStatement(node); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return visitContinueStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 16777216 /* ContainsYield */) { @@ -66596,21 +66888,21 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return visitConditionalExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitYieldExpression(node); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return visitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -66623,9 +66915,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -66852,7 +67144,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: // [source] // a.b = yield; // @@ -66864,7 +67156,7 @@ var ts; // _a.b = %sent%; target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: // [source] // a[b] = yield; // @@ -67240,35 +67532,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 211 /* Block */: + case 212 /* Block */: return transformAndEmitBlock(node); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return transformAndEmitIfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return transformAndEmitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return transformAndEmitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return transformAndEmitWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -67698,7 +67990,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 265 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 266 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -67711,7 +68003,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 264 /* CaseClause */) { + if (clause.kind === 265 /* CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -68935,15 +69227,15 @@ var ts; if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(255 /* JsxOpeningElement */); - context.enableEmitNotification(256 /* JsxClosingElement */); - context.enableEmitNotification(254 /* JsxSelfClosingElement */); + context.enableEmitNotification(256 /* JsxOpeningElement */); + context.enableEmitNotification(257 /* JsxClosingElement */); + context.enableEmitNotification(255 /* JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(268 /* PropertyAssignment */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(269 /* PropertyAssignment */); return transformSourceFile; /** * Transforms an ES5 source file to ES3. @@ -68962,9 +69254,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 255 /* JsxOpeningElement */: - case 256 /* JsxClosingElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 257 /* JsxClosingElement */: + case 255 /* JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -69054,11 +69346,11 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(71 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(198 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(196 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(197 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(269 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(272 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(199 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(197 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(198 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(270 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(273 /* 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. @@ -69380,23 +69672,23 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return visitExportDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return visitClassDeclaration(node); - case 297 /* MergeDeclarationMarker */: + case 298 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 298 /* EndOfDeclarationMarker */: + case 299 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -69845,7 +70137,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 212 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 213 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -69900,10 +70192,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 245 /* NamedImports */: + case 246 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -70102,7 +70394,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -70166,10 +70458,10 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return substituteExpressionIdentifier(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return substituteBinaryExpression(node); - case 197 /* PostfixUnaryExpression */: - case 196 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -70190,7 +70482,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 272 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 273 /* SourceFile */) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), /*location*/ node); } @@ -70265,7 +70557,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 197 /* PostfixUnaryExpression */ + var expression = node.kind === 198 /* PostfixUnaryExpression */ ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 43 /* PlusPlusToken */ ? 59 /* PlusEqualsToken */ : 60 /* MinusEqualsToken */), ts.createLiteral(1)), /*location*/ node) : node; @@ -70344,11 +70636,11 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(71 /* Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(269 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(198 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(196 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(197 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(272 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(270 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(199 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(197 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(198 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableEmitNotification(273 /* 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. @@ -70569,7 +70861,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 248 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 249 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -70594,7 +70886,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 248 /* ExportDeclaration */) { + if (externalImport.kind !== 249 /* ExportDeclaration */) { continue; } if (!externalImport.exportClause) { @@ -70672,19 +70964,19 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -70734,15 +71026,15 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: // ExportDeclarations are elided as they are handled via // `appendExportsOfDeclaration`. return undefined; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -70918,7 +71210,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 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 272 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 273 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -70982,7 +71274,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 === 212 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 213 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -71013,6 +71305,12 @@ var ts; delete deferredExports[id]; return ts.append(statements, node); } + else { + var original = ts.getOriginalNode(node); + if (ts.isModuleOrEnumDeclaration(original)) { + return ts.append(appendExportsOfDeclaration(statements, original), node); + } + } return node; } /** @@ -71038,10 +71336,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 245 /* NamedImports */: + case 246 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -71221,43 +71519,43 @@ var ts; */ function nestedElementVisitor(node) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return visitClassDeclaration(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return visitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return visitWhileStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return visitWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitSwitchStatement(node); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return visitCaseBlock(node); - case 264 /* CaseClause */: + case 265 /* CaseClause */: return visitCaseClause(node); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return visitDefaultClause(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return visitTryStatement(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClause(node); - case 211 /* Block */: + case 212 /* Block */: return visitBlock(node); - case 297 /* MergeDeclarationMarker */: + case 298 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 298 /* EndOfDeclarationMarker */: + case 299 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -71443,7 +71741,7 @@ var ts; */ function destructuringAndImportCallVisitor(node) { if (node.transformFlags & 1024 /* DestructuringAssignment */ - && node.kind === 198 /* BinaryExpression */) { + && node.kind === 199 /* BinaryExpression */) { return visitDestructuringAssignment(node); } else if (ts.isImportCall(node)) { @@ -71508,7 +71806,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 272 /* SourceFile */; + return container !== undefined && container.kind === 273 /* SourceFile */; } else { return false; @@ -71541,7 +71839,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -71589,7 +71887,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -71625,10 +71923,10 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return substituteExpressionIdentifier(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return substituteBinaryExpression(node); - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -71721,14 +72019,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 197 /* PostfixUnaryExpression */ + var expression = node.kind === 198 /* PostfixUnaryExpression */ ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 197 /* PostfixUnaryExpression */) { + if (node.kind === 198 /* PostfixUnaryExpression */) { expression = node.operator === 43 /* PlusPlusToken */ ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -71750,7 +72048,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 272 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 273 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -71791,7 +72089,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(272 /* SourceFile */); + context.enableEmitNotification(273 /* SourceFile */); context.enableSubstitution(71 /* Identifier */); var currentSourceFile; return transformSourceFile; @@ -71820,10 +72118,10 @@ var ts; } function visitor(node) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // Elide `import=` as it is not legal with --module ES6 return undefined; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); } return node; @@ -71930,7 +72228,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 === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -71959,7 +72257,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 === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -72006,7 +72304,7 @@ var ts; ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */) { + if (node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -72025,7 +72323,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 === 233 /* ClassDeclaration */ || node.kind === 148 /* Parameter */) { + else if (node.parent.kind === 234 /* ClassDeclaration */ || node.kind === 148 /* Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -72116,7 +72414,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 === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* 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 : @@ -72130,7 +72428,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -72186,7 +72484,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 === 233 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 234 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* 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 : @@ -72199,7 +72497,7 @@ 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 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 162 /* FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -72214,10 +72512,10 @@ 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 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 158 /* ConstructSignature */: @@ -72231,17 +72529,17 @@ var ts; if (ts.hasModifier(node.parent, 32 /* Static */)) { 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 === 233 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 234 /* 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 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -72256,7 +72554,7 @@ var ts; function getHeritageClauseVisibilityError() { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 233 /* ClassDeclaration */) { + if (node.parent.parent.kind === 234 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = node.parent.token === 108 /* ImplementsKeyword */ ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -72395,15 +72693,17 @@ var ts; } } function transformRoot(node) { - if (node.kind === 272 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) { + if (node.kind === 273 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) { return node; } - if (node.kind === 273 /* Bundle */) { + if (node.kind === 274 /* Bundle */) { isBundledEmit = true; var refs_1 = ts.createMap(); + var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) return; // Omit declaration files from bundle results, too + hasNoDefaultLib_1 = hasNoDefaultLib_1 || sourceFile.hasNoDefaultLib; currentSourceFile = sourceFile; enclosingDeclaration = sourceFile; possibleImports = undefined; @@ -72415,15 +72715,16 @@ 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_5 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements_5)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ []); + var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements_5)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false); return newFile; } needsDeclare = true; var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - return ts.updateSourceFileNode(sourceFile, updated, /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ []); + return ts.updateSourceFileNode(sourceFile, updated, /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false); })); bundle.syntheticFileReferences = []; bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences(); + bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, /*forceDtsPaths*/ true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); refs_1.forEach(referenceVisitor_1); @@ -72447,15 +72748,29 @@ var ts; refs.forEach(referenceVisitor); var statements = ts.visitNodes(node.statements, visitDeclarationStatements); var combinedStatements = ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements)), node.statements); + var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax); if (ts.isExternalModule(node) && !resultHasExternalModuleIndicator) { combinedStatements = ts.setTextRange(ts.createNodeArray(combinedStatements.concat([ts.createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createNamedExports([]), /*moduleSpecifier*/ undefined)])), combinedStatements); } - var updated = ts.updateSourceFileNode(node, combinedStatements, /*isDeclarationFile*/ true, references, getFileReferencesForUsedTypeReferences()); + var updated = ts.updateSourceFileNode(node, combinedStatements, /*isDeclarationFile*/ true, references, getFileReferencesForUsedTypeReferences(), node.hasNoDefaultLib); return updated; function getFileReferencesForUsedTypeReferences() { - return necessaryTypeRefernces ? ts.map(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : []; + return necessaryTypeRefernces ? ts.mapDefined(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : []; } function getFileReferenceForTypeName(typeName) { + // Elide type references for which we have imports + for (var _i = 0, emittedImports_1 = emittedImports; _i < emittedImports_1.length; _i++) { + var importStatement = emittedImports_1[_i]; + if (ts.isImportEqualsDeclaration(importStatement) && ts.isExternalModuleReference(importStatement.moduleReference)) { + var expr = importStatement.moduleReference.expression; + if (ts.isStringLiteralLike(expr) && expr.text === typeName) { + return undefined; + } + } + else if (ts.isImportDeclaration(importStatement) && ts.isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) { + return undefined; + } + } return { fileName: typeName, pos: -1, end: -1 }; } function mapReferencesIntoArray(references, outputFilePath) { @@ -72497,7 +72812,7 @@ var ts; return name; } else { - if (name.kind === 179 /* ArrayBindingPattern */) { + if (name.kind === 180 /* ArrayBindingPattern */) { return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -72505,7 +72820,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 204 /* OmittedExpression */) { + if (elem.kind === 205 /* OmittedExpression */) { return elem; } return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined); @@ -72563,7 +72878,7 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */) { + if (node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } if (node.kind === 148 /* Parameter */ @@ -72585,20 +72900,20 @@ var ts; function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 237 /* ModuleDeclaration */: - case 234 /* InterfaceDeclaration */: - case 233 /* ClassDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: + case 233 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 235 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return !getBindingNameVisible(node); - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: return false; } return false; @@ -72652,7 +72967,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return; - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 237 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 238 /* ModuleDeclaration */ && parent.kind !== 178 /* ImportType */); if (input.kind === 9 /* StringLiteral */ && isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); if (newName) { @@ -72664,7 +72979,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 252 /* ExternalModuleReference */) { + if (decl.moduleReference.kind === 253 /* ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return ts.updateImportEqualsDeclaration(decl, @@ -72691,7 +73006,7 @@ var ts; return visibleDefaultBinding && ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier)); } - if (decl.importClause.namedBindings.kind === 244 /* NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 245 /* NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined; @@ -72727,7 +73042,7 @@ var ts; continue; } // Eagerly transform import equals - if they're not visible, we'll get nothing, if they are, we'll immediately add them since it's complete - if (i.kind === 241 /* ImportEqualsDeclaration */) { + if (i.kind === 242 /* ImportEqualsDeclaration */) { var result_3 = transformImportEqualsDeclaration(i); importDeclarationMap.set("" + ts.getNodeId(i), result_3); continue; @@ -72786,7 +73101,7 @@ var ts; if (ts.hasModifier(input, 8 /* Private */)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) return; // Elide all but the first overload - return cleanup(ts.createProperty(/*decorators*/ undefined, input.modifiers, input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined)); + return cleanup(ts.createProperty(/*decorators*/ undefined, ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined)); } } var canProdiceDiagnostic = ts.canProduceDiagnostics(input); @@ -72797,14 +73112,14 @@ var ts; checkEntityNameVisibility(input.exprName, enclosingDeclaration); } var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 165 /* TypeLiteral */ || input.kind === 176 /* MappedType */) && input.parent.kind !== 235 /* TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 165 /* TypeLiteral */ || input.kind === 176 /* MappedType */) && input.parent.kind !== 236 /* TypeAliasDeclaration */); if (shouldEnterSuppressNewDiagnosticsContextContext) { // We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do. suppressNewDiagnosticContexts = true; } if (isProcessedComponent(input)) { switch (input.kind) { - case 205 /* ExpressionWithTypeArguments */: { + case 206 /* ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } @@ -72856,7 +73171,7 @@ var ts; return cleanup(ts.updateIndexSignature(input, /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(119 /* AnyKeyword */))); } - case 230 /* VariableDeclaration */: { + case 231 /* VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -72888,6 +73203,11 @@ var ts; case 163 /* ConstructorType */: { return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } + case 178 /* ImportType */: { + if (!ts.isLiteralImportTypeNode(input)) + return cleanup(input); + return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); + } default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]); } } @@ -72922,7 +73242,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 248 /* ExportDeclaration */: { + case 249 /* ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -72930,7 +73250,7 @@ var ts; // Rewrite external module names if necessary return ts.updateExportDeclaration(input, /*decorators*/ undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier)); } - case 247 /* ExportAssignment */: { + case 248 /* ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -72949,8 +73269,8 @@ var ts; return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)]; } } - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: { + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: { // Different parts of the import may be marked visible at different times (via visibility checking), so we defer our first look until later // to reduce the likelihood we need to rewrite it possibleImports = possibleImports || []; @@ -72976,27 +73296,27 @@ var ts; } var oldPossibleImports; switch (input.kind) { - case 235 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all + case 236 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all return cleanup(ts.updateTypeAliasDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 234 /* InterfaceDeclaration */: { + case 235 /* InterfaceDeclaration */: { return cleanup(ts.updateInterfaceDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 232 /* FunctionDeclaration */: { + case 233 /* FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type return cleanup(ts.updateFunctionDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), /*body*/ undefined)); } - case 237 /* ModuleDeclaration */: { + case 238 /* ModuleDeclaration */: { previousNeedsDeclare = needsDeclare; needsDeclare = false; oldPossibleImports = possibleImports; possibleImports = undefined; var inner = input.body; - if (inner && inner.kind === 238 /* ModuleBlock */) { + if (inner && inner.kind === 239 /* ModuleBlock */) { var statements = ts.visitNodes(inner.statements, visitDeclarationStatements); var body = ts.updateModuleBlock(inner, filterCandidateImports(statements)); needsDeclare = previousNeedsDeclare; @@ -73012,7 +73332,7 @@ var ts; /*decorators*/ undefined, mods, input.name, ts.visitNode(inner, visitDeclarationStatements))); } } - case 233 /* ClassDeclaration */: { + case 234 /* ClassDeclaration */: { var modifiers = ts.createNodeArray(ensureModifiers(input)); var typeParameters = ensureTypeParams(input, input.typeParameters); var ctor = ts.getFirstConstructorWithBody(input); @@ -73082,7 +73402,7 @@ var ts; /*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 212 /* VariableStatement */: { + case 213 /* VariableStatement */: { if (!ts.forEach(input.declarationList.declarations, getBindingNameVisible)) return; var nodes = ts.visitNodes(input.declarationList.declarations, visitDeclarationSubtree); @@ -73090,7 +73410,7 @@ var ts; return; return cleanup(ts.updateVariableStatement(input, ts.createNodeArray(ensureModifiers(input)), ts.updateVariableDeclarationList(input.declarationList, nodes))); } - case 236 /* EnumDeclaration */: { + case 237 /* EnumDeclaration */: { return cleanup(ts.updateEnumDeclaration(input, /*decorators*/ undefined, ts.createNodeArray(ensureModifiers(input)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -73106,7 +73426,7 @@ var ts; if (isEnclosingDeclaration(input)) { enclosingDeclaration = previousEnclosingDeclaration; } - if (input.kind === 237 /* ModuleDeclaration */) { + if (input.kind === 238 /* ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; possibleImports = ts.concatenate(oldPossibleImports, possibleImports); } @@ -73129,7 +73449,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 204 /* OmittedExpression */) { + if (e.kind === 205 /* OmittedExpression */) { return; } if (e.name) { @@ -73183,7 +73503,7 @@ var ts; function ensureModifierFlags(node) { var mask = 3071 /* All */ ^ (4 /* Public */ | 256 /* Async */); // No async modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */; - var parentIsFile = node.parent.kind === 272 /* SourceFile */; + var parentIsFile = node.parent.kind === 273 /* SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= ((isBundledEmit && parentIsFile ? 0 : 1 /* Export */) | 512 /* Default */ | 2 /* Ambient */); additions = 0 /* None */; @@ -73231,7 +73551,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 234 /* InterfaceDeclaration */) { + if (node.kind === 235 /* InterfaceDeclaration */) { return true; } return false; @@ -73260,7 +73580,7 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 148 /* Parameter */: @@ -73270,17 +73590,17 @@ var ts; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 237 /* ModuleDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 234 /* InterfaceDeclaration */: - case 233 /* ClassDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: - case 212 /* VariableStatement */: - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: + case 233 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 235 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: + case 213 /* VariableStatement */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: return true; } return false; @@ -73297,13 +73617,14 @@ var ts; case 152 /* MethodSignature */: case 157 /* CallSignature */: case 159 /* IndexSignature */: - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 147 /* TypeParameter */: - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: case 161 /* TypeReference */: case 170 /* ConditionalType */: case 162 /* FunctionType */: case 163 /* ConstructorType */: + case 178 /* ImportType */: return true; } return false; @@ -73393,7 +73714,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(299 /* Count */); + var enabledSyntaxKindFeatures = new Array(300 /* Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -73739,7 +74060,7 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (sourceFileOrBundle.kind === 272 /* SourceFile */) { // emitting single module file + if (sourceFileOrBundle.kind === 273 /* SourceFile */) { // emitting single module file // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); @@ -73889,7 +74210,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 294 /* NotEmittedStatement */ + if (node.kind !== 295 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -73906,7 +74227,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 294 /* NotEmittedStatement */ + if (node.kind !== 295 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -74083,7 +74404,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 294 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 295 /* NotEmittedStatement */; // We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation. // It is expensive to walk entire tree just to set one kind of node to have no comments. var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 10 /* JsxText */; @@ -74104,7 +74425,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 === 231 /* VariableDeclarationList */) { + if (node.kind === 232 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -74448,7 +74769,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 273 /* Bundle */) { + if (sourceFile.kind === 274 /* Bundle */) { var jsFilePath = options.outFile || options.out; var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); var declarationFilePath = (forceDtsPaths || options.declaration) ? ts.removeFileExtension(jsFilePath) + ".d.ts" /* Dts */ : undefined; @@ -74490,7 +74811,6 @@ var ts; // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); - var moduleKind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); @@ -74503,9 +74823,6 @@ var ts; mapRoot: compilerOptions.mapRoot, extendedDiagnostics: compilerOptions.extendedDiagnostics, }); - var currentSourceFile; - var bundledHelpers; - var isOwnFileEmit; var emitSkipped = false; // Emit each output file ts.performance.mark("beforePrint"); @@ -74546,7 +74863,7 @@ var ts; // Transform the source files var transform = ts.transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, /*allowDtsFiles*/ false); // Create a printer to print the nodes - var printer = createPrinter(compilerOptions, { + var printer = createPrinter(__assign({}, compilerOptions, { noEmitHelpers: compilerOptions.noEmitHelpers }), { // resolver hooks hasGlobalName: resolver.hasGlobalName, // transform hooks @@ -74557,7 +74874,6 @@ var ts; onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, onEmitSourceMapOfPosition: sourceMap.emitPos, // emitter hooks - onEmitHelpers: emitHelpers, onSetSourceFile: setSourceFile, }); printSourceFileOrBundle(jsFilePath, sourceMapFilePath, ts.isSourceFile(sourceFileOrBundle) ? transform.transformed[0] : ts.createBundle(transform.transformed), printer, sourceMap); @@ -74579,7 +74895,7 @@ var ts; emitterDiagnostics.add(diagnostic); } } - var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: true }), { + var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: true, noEmitHelpers: true }), { // resolver hooks hasGlobalName: resolver.hasGlobalName, // sourcemap hooks @@ -74599,17 +74915,14 @@ var ts; declarationTransform.dispose(); } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapRecorder) { - var bundle = sourceFileOrBundle.kind === 273 /* Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 272 /* SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 274 /* Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 273 /* SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; mapRecorder.initialize(jsFilePath, sourceMapFilePath || "", sourceFileOrBundle, sourceMapDataList); if (bundle) { - bundledHelpers = ts.createMap(); - isOwnFileEmit = false; printer.writeBundle(bundle, writer); } else { - isOwnFileEmit = true; printer.writeFile(sourceFile, writer); } writer.writeLine(); @@ -74626,66 +74939,19 @@ var ts; // Reset state mapRecorder.reset(); writer.clear(); - currentSourceFile = undefined; - bundledHelpers = undefined; - isOwnFileEmit = false; } function setSourceFile(node) { - currentSourceFile = node; sourceMap.setSourceFile(node); } function setSourceFileForDeclarationSourceMaps(node) { - currentSourceFile = node; declarationSourceMap.setSourceFile(node); } - function emitHelpers(node, writeLines) { - var helpersEmitted = false; - var bundle = node.kind === 273 /* Bundle */ ? node : undefined; - if (bundle && moduleKind === ts.ModuleKind.None) { - return; - } - var numNodes = bundle ? bundle.sourceFiles.length : 1; - for (var i = 0; i < numNodes; i++) { - var currentNode = bundle ? bundle.sourceFiles[i] : node; - var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; - var shouldSkip = compilerOptions.noEmitHelpers || ts.getExternalHelpersModuleName(sourceFile) !== undefined; - var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; - var helpers = ts.getEmitHelpers(currentNode); - if (helpers) { - for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { - var helper = _b[_a]; - if (!helper.scoped) { - // Skip the helper if it can be skipped and the noEmitHelpers compiler - // option is set, or if it can be imported and the importHelpers compiler - // option is set. - if (shouldSkip) - continue; - // Skip the helper if it can be bundled but hasn't already been emitted and we - // are emitting a bundled module. - if (shouldBundle) { - if (bundledHelpers.get(helper.name)) { - continue; - } - bundledHelpers.set(helper.name, true); - } - } - else if (bundle) { - // Skip the helper if it is scoped and we are emitting bundled helpers - continue; - } - writeLines(helper.text); - helpersEmitted = true; - } - } - } - return helpersEmitted; - } } ts.emitFiles = emitFiles; function createPrinter(printerOptions, handlers) { if (printerOptions === void 0) { printerOptions = {}; } if (handlers === void 0) { handlers = {}; } - var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onEmitHelpers = handlers.onEmitHelpers, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; + var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; var newLine = ts.getNewLineCharacter(printerOptions); var comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition); var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition; @@ -74708,6 +74974,9 @@ var ts; writeSemicolon = deferWriteSemicolon; } var syntheticParent = { pos: -1, end: -1 }; + var moduleKind = ts.getEmitModuleKind(printerOptions); + var bundledHelpers = ts.createMap(); + var isOwnFileEmit; reset(); return { // public API @@ -74734,8 +75003,8 @@ var ts; break; } switch (node.kind) { - case 272 /* SourceFile */: return printFile(node); - case 273 /* Bundle */: return printBundle(node); + case 273 /* SourceFile */: return printFile(node); + case 274 /* Bundle */: return printBundle(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -74770,11 +75039,12 @@ var ts; writer = previousWriter; } function writeBundle(bundle, output) { + isOwnFileEmit = false; var previousWriter = writer; setWriter(output); emitShebangIfNeeded(bundle); emitPrologueDirectivesIfNeeded(bundle); - emitHelpersIndirect(bundle); + emitHelpers(bundle); emitSyntheticTripleSlashReferencesIfNeeded(bundle); for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) { var sourceFile = _b[_a]; @@ -74784,6 +75054,7 @@ var ts; writer = previousWriter; } function writeFile(sourceFile, output) { + isOwnFileEmit = true; var previousWriter = writer; setWriter(output); emitShebangIfNeeded(sourceFile); @@ -74890,7 +75161,7 @@ var ts; writeSpace(); writeKeyword("in"); writeSpace(); - emit(node.constraint); + emitIfPresent(node.constraint); } function pipelineEmitUnspecified(node) { var kind = node.kind; @@ -74950,7 +75221,7 @@ var ts; return emitTypeReference(node); case 162 /* FunctionType */: return emitFunctionType(node); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return emitJSDocFunctionType(node); case 163 /* ConstructorType */: return emitConstructorType(node); @@ -74972,7 +75243,7 @@ var ts; return emitInferType(node); case 172 /* ParenthesizedType */: return emitParenthesizedType(node); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); case 173 /* ThisType */: return emitThisType(); @@ -74984,154 +75255,156 @@ var ts; return emitMappedType(node); case 177 /* LiteralType */: return emitLiteralType(node); - case 275 /* JSDocAllType */: + case 178 /* ImportType */: + return emitImportTypeNode(node); + case 276 /* JSDocAllType */: write("*"); return; - case 276 /* JSDocUnknownType */: + case 277 /* JSDocUnknownType */: write("?"); return; - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return emitJSDocNullableType(node); - case 278 /* JSDocNonNullableType */: + case 279 /* JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return emitJSDocOptionalType(node); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return emitJSDocVariadicType(node); // Binding patterns - case 178 /* ObjectBindingPattern */: + case 179 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 179 /* ArrayBindingPattern */: + case 180 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return emitBindingElement(node); // Misc - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return emitTemplateSpan(node); - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 211 /* Block */: + case 212 /* Block */: return emitBlock(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return emitVariableStatement(node); - case 213 /* EmptyStatement */: + case 214 /* EmptyStatement */: return emitEmptyStatement(); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return emitExpressionStatement(node); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return emitIfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return emitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return emitWhileStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return emitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return emitForInStatement(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return emitForOfStatement(node); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return emitContinueStatement(node); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return emitBreakStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return emitReturnStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return emitWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return emitSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return emitLabeledStatement(node); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return emitThrowStatement(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return emitTryStatement(node); - case 229 /* DebuggerStatement */: + case 230 /* DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return emitClassDeclaration(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return emitModuleBlock(node); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return emitCaseBlock(node); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return emitImportDeclaration(node); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return emitImportClause(node); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return emitNamespaceImport(node); - case 245 /* NamedImports */: + case 246 /* NamedImports */: return emitNamedImports(node); - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return emitImportSpecifier(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return emitExportAssignment(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return emitExportDeclaration(node); - case 249 /* NamedExports */: + case 250 /* NamedExports */: return emitNamedExports(node); - case 250 /* ExportSpecifier */: + case 251 /* ExportSpecifier */: return emitExportSpecifier(node); - case 251 /* MissingDeclaration */: + case 252 /* MissingDeclaration */: return; // Module references - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 10 /* JsxText */: return emitJsxText(node); - case 255 /* JsxOpeningElement */: - case 258 /* JsxOpeningFragment */: + case 256 /* JsxOpeningElement */: + case 259 /* JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 256 /* JsxClosingElement */: - case 259 /* JsxClosingFragment */: + case 257 /* JsxClosingElement */: + case 260 /* JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return emitJsxAttribute(node); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return emitJsxAttributes(node); - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 264 /* CaseClause */: + case 265 /* CaseClause */: return emitCaseClause(node); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return emitDefaultClause(node); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return emitHeritageClause(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 271 /* EnumMember */: + case 272 /* EnumMember */: return emitEnumMember(node); // JSDoc nodes (ignored) // Transformation nodes (ignored) @@ -75169,81 +75442,123 @@ var ts; writeTokenNode(node, writeKeyword); return; // Expressions - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return emitElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return emitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return emitNewExpression(node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return emitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return emitArrowFunction(node); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return emitDeleteExpression(node); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return emitVoidExpression(node); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return emitAwaitExpression(node); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return emitBinaryExpression(node); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return emitConditionalExpression(node); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return emitTemplateExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return emitYieldExpression(node); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return emitSpreadExpression(node); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return emitClassExpression(node); - case 204 /* OmittedExpression */: + case 205 /* OmittedExpression */: return; - case 206 /* AsExpression */: + case 207 /* AsExpression */: return emitAsExpression(node); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return emitNonNullExpression(node); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return emitMetaProperty(node); // JSX - case 253 /* JsxElement */: + case 254 /* JsxElement */: return emitJsxElement(node); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return emitJsxFragment(node); // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return emitCommaList(node); } } function trySubstituteNode(hint, node) { return node && substituteNode && substituteNode(hint, node) || node; } - function emitHelpersIndirect(node) { - if (onEmitHelpers) { - onEmitHelpers(node, writeLines); + function emitHelpers(node) { + var helpersEmitted = false; + var bundle = node.kind === 274 /* Bundle */ ? node : undefined; + if (bundle && moduleKind === ts.ModuleKind.None) { + return; } + var numNodes = bundle ? bundle.sourceFiles.length : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? bundle.sourceFiles[i] : node; + var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; + var shouldSkip = printerOptions.noEmitHelpers || ts.getExternalHelpersModuleName(sourceFile) !== undefined; + var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; + var helpers = ts.getEmitHelpers(currentNode); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + // Skip the helper if it can be skipped and the noEmitHelpers compiler + // option is set, or if it can be imported and the importHelpers compiler + // option is set. + if (shouldSkip) + continue; + // Skip the helper if it can be bundled but hasn't already been emitted and we + // are emitting a bundled module. + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } + else if (bundle) { + // Skip the helper if it is scoped and we are emitting bundled helpers + continue; + } + if (typeof helper.text === "string") { + writeLines(helper.text); + } + else { + writeLines(helper.text(makeFileLevelOptmiisticUniqueName)); + } + helpersEmitted = true; + } + } + } + return helpersEmitted; } // // Literals/Pseudo-literals @@ -75324,8 +75639,8 @@ var ts; emitNodeWithWriter(node.name, writeParameter); } emitIfPresent(node.questionToken); - if (node.parent && node.parent.kind === 280 /* JSDocFunctionType */ && !node.name) { - emit(node.type); + if (node.parent && node.parent.kind === 281 /* JSDocFunctionType */ && !node.name) { + emitIfPresent(node.type); } else { emitTypeAnnotation(node.type); @@ -75437,13 +75752,13 @@ var ts; writeSpace(); writePunctuation("=>"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); } function emitJSDocFunctionType(node) { write("function"); emitParameters(node, node.parameters); write(":"); - emit(node.type); + emitIfPresent(node.type); } function emitJSDocNullableType(node) { write("?"); @@ -75465,7 +75780,7 @@ var ts; writeSpace(); writePunctuation("=>"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); } function emitTypeQuery(node) { writeKeyword("typeof"); @@ -75565,7 +75880,7 @@ var ts; } writePunctuation(":"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); writeSemicolon(); if (emitFlags & 1 /* SingleLine */) { writeSpace(); @@ -75579,6 +75894,21 @@ var ts; function emitLiteralType(node) { emitExpression(node.literal); } + function emitImportTypeNode(node) { + if (node.isTypeOf) { + writeKeyword("typeof"); + writeSpace(); + } + writeKeyword("import"); + writePunctuation("("); + emit(node.argument); + writePunctuation(")"); + if (node.qualifier) { + writePunctuation("."); + emit(node.qualifier); + } + emitTypeArguments(node, node.typeArguments); + } // // Binding patterns // @@ -75754,7 +76084,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 === 196 /* PrefixUnaryExpression */ + return operand.kind === 197 /* PrefixUnaryExpression */ && ((node.operator === 37 /* PlusToken */ && (operand.operator === 37 /* PlusToken */ || operand.operator === 43 /* PlusPlusToken */)) || (node.operator === 38 /* MinusToken */ && (operand.operator === 38 /* MinusToken */ || operand.operator === 44 /* MinusMinusToken */))); } @@ -75798,7 +76128,7 @@ var ts; } function emitYieldExpression(node) { emitTokenWithComment(116 /* YieldKeyword */, node.pos, writeKeyword, node); - emit(node.asteriskToken); + emitIfPresent(node.asteriskToken); emitExpressionWithLeadingSpace(node.expression); } function emitSpreadExpression(node) { @@ -75871,7 +76201,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node); emitTokenWithComment(82 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 215 /* IfStatement */) { + if (node.elseStatement.kind === 216 /* IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -75942,7 +76272,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 231 /* VariableDeclarationList */) { + if (node.kind === 232 /* VariableDeclarationList */) { emit(node); } else { @@ -76153,7 +76483,7 @@ var ts; // Emit all the prologue directives (like "use strict"). var statementOffset = emitPrologueDirectives(body.statements, /*startWithNewLine*/ true); var pos = writer.getTextPos(); - emitHelpersIndirect(body); + emitHelpers(body); if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) { decreaseIndent(); emitList(body, body.statements, 384 /* SingleLineFunctionBodyStatements */); @@ -76234,7 +76564,7 @@ var ts; var body = node.body; if (!body) return writeSemicolon(); - while (body.kind === 237 /* ModuleDeclaration */) { + while (body.kind === 238 /* ModuleDeclaration */) { writePunctuation("."); emit(body.name); body = body.body; @@ -76285,12 +76615,12 @@ var ts; writeSemicolon(); } function emitImportClause(node) { - emit(node.name); + emitIfPresent(node.name); if (node.name && node.namedBindings) { emitTokenWithComment(26 /* CommaToken */, node.name.end, writePunctuation, node); writeSpace(); } - emit(node.namedBindings); + emitIfPresent(node.namedBindings); } function emitNamespaceImport(node) { var asPos = emitTokenWithComment(39 /* AsteriskToken */, node.pos, writePunctuation, node); @@ -76556,20 +76886,40 @@ var ts; emitSourceFileWorker(node); } function emitSyntheticTripleSlashReferencesIfNeeded(node) { - emitTripleSlashDirectives(node.syntheticFileReferences || [], node.syntheticTypeReferences || []); + emitTripleSlashDirectives(node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || []); } function emitTripleSlashDirectivesIfNeeded(node) { if (node.isDeclarationFile) - emitTripleSlashDirectives(node.referencedFiles, node.typeReferenceDirectives); + emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives); } - function emitTripleSlashDirectives(files, types) { - for (var _a = 0, files_1 = files; _a < files_1.length; _a++) { - var directive = files_1[_a]; + function emitTripleSlashDirectives(hasNoDefaultLib, files, types) { + if (hasNoDefaultLib) { + write("/// "); + writeLine(); + } + if (currentSourceFile && currentSourceFile.moduleName) { + write("/// "); + writeLine(); + } + if (currentSourceFile && currentSourceFile.amdDependencies) { + for (var _a = 0, _b = currentSourceFile.amdDependencies; _a < _b.length; _a++) { + var dep = _b[_a]; + if (dep.name) { + write("/// "); + } + else { + write("/// "); + } + writeLine(); + } + } + for (var _c = 0, files_1 = files; _c < files_1.length; _c++) { + var directive = files_1[_c]; write("/// "); writeLine(); } - for (var _b = 0, types_18 = types; _b < types_18.length; _b++) { - var directive = types_18[_b]; + for (var _d = 0, types_18 = types; _d < types_18.length; _d++) { + var directive = types_18[_d]; write("/// "); writeLine(); } @@ -76577,7 +76927,7 @@ var ts; function emitSourceFileWorker(node) { var statements = node.statements; pushNameGenerationScope(node); - emitHelpersIndirect(node); + emitHelpers(node); var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); }); emitTripleSlashDirectivesIfNeeded(node); emitList(node, statements, 1 /* MultiLine */, index === -1 ? statements.length : index); @@ -77133,7 +77483,7 @@ var ts; && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 189 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 190 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -77229,11 +77579,16 @@ var ts; * or within the NameGenerator. */ function isUniqueName(name) { - return !(hasGlobalName && hasGlobalName(name)) - && !currentSourceFile.identifiers.has(name) + return isFileLevelUniqueName(name) && !generatedNames.has(name) && !(reservedNames && reservedNames.has(name)); } + /** + * Returns a value indicating whether a name is unique globally or within the current file. + */ + function isFileLevelUniqueName(name) { + return ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName); + } /** * Returns a value indicating whether a name is unique within a container. */ @@ -77289,9 +77644,10 @@ 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, optimistic) { + function makeUniqueName(baseName, checkFn, optimistic) { + if (checkFn === void 0) { checkFn = isUniqueName; } if (optimistic) { - if (isUniqueName(baseName)) { + if (checkFn(baseName)) { generatedNames.set(baseName, true); return baseName; } @@ -77303,13 +77659,16 @@ var ts; var i = 1; while (true) { var generatedName = baseName + i; - if (isUniqueName(generatedName)) { + if (checkFn(generatedName)) { generatedNames.set(generatedName, true); return generatedName; } i++; } } + function makeFileLevelOptmiisticUniqueName(name) { + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. */ @@ -77352,17 +77711,17 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return makeUniqueName(getTextOfNode(node)); - case 237 /* ModuleDeclaration */: - case 236 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: - case 247 /* ExportAssignment */: + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: + case 248 /* ExportAssignment */: return generateNameForExportDefault(); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return generateNameForClassExpression(); case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: @@ -77382,9 +77741,7 @@ var ts; case 2 /* Loop */: return makeTempVariableName(268435456 /* _i */, !!(name.autoGenerateFlags & 16 /* ReservedInNestedScopes */)); case 3 /* Unique */: - return makeUniqueName(ts.idText(name)); - case 5 /* OptimisticUnique */: - return makeUniqueName(ts.idText(name), /*optimistic*/ true); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 64 /* FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 32 /* Optimistic */)); } ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } @@ -77601,7 +77958,7 @@ var ts; } ts.createCompilerHost = createCompilerHost; function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { - var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + var diagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(cancellationToken), program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (program.getCompilerOptions().declaration) { ts.addRange(diagnostics, program.getDeclarationDiagnostics(sourceFile, cancellationToken)); } @@ -77810,6 +78167,12 @@ var ts; } } ts.isProgramUptoDate = isProgramUptoDate; + function getConfigFileParsingDiagnostics(configFileParseResult) { + return configFileParseResult.options.configFile ? + configFileParseResult.options.configFile.parseDiagnostics.concat(configFileParseResult.errors) : + configFileParseResult.errors; + } + ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics; /** * Determined if source file needs to be re-created even if its text hasn't changed */ @@ -77838,9 +78201,10 @@ var ts; * @param options - The compiler options which should be used. * @param host - The host interacts with the underlying file system. * @param oldProgram - Reuses an old program structure. + * @param configFileParsingDiagnostics - error during config file parsing * @returns A 'Program' object. */ - function createProgram(rootNames, options, host, oldProgram) { + function createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics) { var program; var files = []; var commonSourceDirectory; @@ -77881,7 +78245,7 @@ var ts; var resolveModuleNamesWorker; var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; if (host.resolveModuleNames) { - resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(checkAllDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { + resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. if (!resolved || resolved.extension !== undefined) { return resolved; @@ -77894,15 +78258,15 @@ var ts; else { moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; - resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(checkAllDefined(moduleNames), containingFile, loader_1); }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; if (host.resolveTypeReferenceDirectives) { - resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(checkAllDefined(typeDirectiveNames), containingFile); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile); }; } else { var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; - resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(checkAllDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; } // Map from a stringified PackageId to the source file with that id. // Only one source file may have a given packageId. Others become redirects (see createRedirectSourceFile). @@ -77939,8 +78303,9 @@ var ts; if (!skipDefaultLib) { // If '--lib' is not specified, include default library file according to '--target' // otherwise, using options specified in '--lib' instead of '--target' default library file - if (!options.lib) { - processRootFile(getDefaultLibraryFileName(), /*isDefaultLib*/ true); + var defaultLibraryFileName = getDefaultLibraryFileName(); + if (!options.lib && defaultLibraryFileName) { + processRootFile(defaultLibraryFileName, /*isDefaultLib*/ true); } else { ts.forEach(options.lib, function (libFileName) { @@ -77996,7 +78361,8 @@ var ts; getSourceFileFromReference: getSourceFileFromReference, sourceFileToPackageName: sourceFileToPackageName, redirectTargetsSet: redirectTargetsSet, - isEmittedFile: isEmittedFile + isEmittedFile: isEmittedFile, + getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics }; verifyCompilerOptions(); ts.performance.mark("afterProgram"); @@ -78583,10 +78949,10 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: - case 230 /* VariableDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: + case 231 /* VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -78594,41 +78960,41 @@ var ts; } } switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 108 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file)); return; - case 206 /* AsExpression */: + case 207 /* AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } var prevParent = parent; @@ -78641,25 +79007,25 @@ 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_to_remove_this_warning)); } switch (parent.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } // falls through - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 212 /* VariableStatement */); + return checkModifiers(nodes, parent.kind === 213 /* VariableStatement */); } break; case 151 /* PropertyDeclaration */: @@ -78681,11 +79047,11 @@ var ts; return; } break; - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 205 /* ExpressionWithTypeArguments */: - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 206 /* ExpressionWithTypeArguments */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); @@ -78772,6 +79138,9 @@ var ts; function getGlobalDiagnostics() { return ts.sortAndDeduplicateDiagnostics(getDiagnosticsProducingTypeChecker().getGlobalDiagnostics().slice()); } + function getConfigFileParsingDiagnostics() { + return configFileParsingDiagnostics || ts.emptyArray; + } function processRootFile(fileName, isDefaultLib) { processSourceFile(ts.normalizePath(fileName), isDefaultLib, /*packageId*/ undefined); } @@ -78867,9 +79236,18 @@ var ts; else if (ts.isImportCall(node) && node.arguments.length === 1 && ts.isStringLiteralLike(node.arguments[0])) { imports = ts.append(imports, node.arguments[0]); } - else { - ts.forEachChild(node, collectDynamicImportOrRequireCalls); + else if (ts.isLiteralImportTypeNode(node)) { + imports = ts.append(imports, node.argument.literal); } + else { + collectDynamicImportOrRequireCallsForEachChild(node); + if (ts.hasJSDocNodes(node)) { + ts.forEach(node.jsDoc, collectDynamicImportOrRequireCallsForEachChild); + } + } + } + function collectDynamicImportOrRequireCallsForEachChild(node) { + ts.forEachChild(node, collectDynamicImportOrRequireCalls); } } /** This should have similar behavior to 'processSourceFile' without diagnostics or mutation. */ @@ -79521,10 +79899,6 @@ var ts; } } ts.getResolutionDiagnostic = getResolutionDiagnostic; - function checkAllDefined(names) { - ts.Debug.assert(names.every(function (name) { return name !== undefined; }), "A name is undefined.", function () { return JSON.stringify(names); }); - return names; - } function getModuleNames(_a) { var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations; var res = imports.map(function (i) { return i.text; }); @@ -79790,35 +80164,35 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 148 /* Parameter */: - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 267 /* CatchClause */: - case 260 /* JsxAttribute */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 268 /* CatchClause */: + case 261 /* JsxAttribute */: return 1 /* Value */; case 147 /* TypeParameter */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: case 165 /* TypeLiteral */: return 2 /* Type */; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */; - case 271 /* EnumMember */: - case 233 /* ClassDeclaration */: + case 272 /* EnumMember */: + case 234 /* ClassDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -79828,26 +80202,26 @@ var ts; else { return 4 /* Namespace */; } - case 236 /* EnumDeclaration */: - case 245 /* NamedImports */: - case 246 /* ImportSpecifier */: - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: - case 247 /* ExportAssignment */: - case 248 /* ExportDeclaration */: + case 237 /* EnumDeclaration */: + case 246 /* NamedImports */: + case 247 /* ImportSpecifier */: + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 248 /* ExportAssignment */: + case 249 /* ExportDeclaration */: return 7 /* All */; // An external module can be a Value - case 272 /* SourceFile */: + case 273 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 7 /* All */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { return 1 /* Value */; } - else if (node.parent.kind === 247 /* ExportAssignment */) { + else if (node.parent.kind === 248 /* ExportAssignment */) { return 7 /* All */; } else if (isInRightSideOfInternalImportEqualsDeclaration(node)) { @@ -79876,7 +80250,7 @@ var ts; // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace var name = node.kind === 145 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 241 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; + return name && name.parent.kind === 242 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { while (node.parent.kind === 145 /* QualifiedName */) { @@ -79902,16 +80276,16 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 183 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 183 /* PropertyAccessExpression */) { + if (root.parent.kind === 184 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 184 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 205 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 266 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 206 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 267 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 233 /* ClassDeclaration */ && root.parent.parent.token === 108 /* ImplementsKeyword */) || - (decl.kind === 234 /* InterfaceDeclaration */ && root.parent.parent.token === 85 /* ExtendsKeyword */); + return (decl.kind === 234 /* ClassDeclaration */ && root.parent.parent.token === 108 /* ImplementsKeyword */) || + (decl.kind === 235 /* InterfaceDeclaration */ && root.parent.parent.token === 85 /* ExtendsKeyword */); } return false; } @@ -79928,17 +80302,17 @@ var ts; switch (node.parent.kind) { case 161 /* TypeReference */: return true; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent); } return false; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 185 /* CallExpression */); + return isCallOrNewExpressionTarget(node, 186 /* CallExpression */); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 186 /* NewExpression */); + return isCallOrNewExpressionTarget(node, 187 /* NewExpression */); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -79951,7 +80325,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 226 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 227 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -79976,11 +80350,11 @@ var ts; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 237 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 238 /* ModuleDeclaration */ && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -79992,15 +80366,15 @@ var ts; switch (node.parent.kind) { case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 268 /* PropertyAssignment */: - case 271 /* EnumMember */: + case 269 /* PropertyAssignment */: + case 272 /* EnumMember */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return node.parent.argumentExpression === node; case 146 /* ComputedPropertyName */: return true; @@ -80015,7 +80389,7 @@ var ts; } ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; function getContainerNode(node) { - if (node.kind === 291 /* JSDocTypedefTag */) { + if (node.kind === 292 /* JSDocTypedefTag */) { // This doesn't just apply to the node immediately under the comment, but to everything in its parent's scope. // node.parent = the JSDoc comment, node.parent.parent = the node having the comment. // Then we get parent again in the loop. @@ -80027,17 +80401,17 @@ var ts; return undefined; } switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 237 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: return node; } } @@ -80045,23 +80419,23 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return "module" /* moduleElement */; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return "class" /* classElement */; - case 234 /* InterfaceDeclaration */: return "interface" /* interfaceElement */; - case 235 /* TypeAliasDeclaration */: return "type" /* typeElement */; - case 236 /* EnumDeclaration */: return "enum" /* enumElement */; - case 230 /* VariableDeclaration */: + case 235 /* InterfaceDeclaration */: return "interface" /* interfaceElement */; + case 236 /* TypeAliasDeclaration */: return "type" /* typeElement */; + case 237 /* EnumDeclaration */: return "enum" /* enumElement */; + case 231 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return "function" /* functionElement */; case 155 /* GetAccessor */: return "getter" /* memberGetAccessorElement */; case 156 /* SetAccessor */: return "setter" /* memberSetAccessorElement */; @@ -80076,17 +80450,17 @@ var ts; case 157 /* CallSignature */: return "call" /* callSignatureElement */; case 154 /* Constructor */: return "constructor" /* constructorImplementationElement */; case 147 /* TypeParameter */: return "type parameter" /* typeParameterElement */; - case 271 /* EnumMember */: return "enum member" /* enumMemberElement */; + case 272 /* EnumMember */: return "enum member" /* enumMemberElement */; case 148 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */; - case 241 /* ImportEqualsDeclaration */: - case 246 /* ImportSpecifier */: - case 243 /* ImportClause */: - case 250 /* ExportSpecifier */: - case 244 /* NamespaceImport */: + case 242 /* ImportEqualsDeclaration */: + case 247 /* ImportSpecifier */: + case 244 /* ImportClause */: + case 251 /* ExportSpecifier */: + case 245 /* NamespaceImport */: return "alias" /* alias */; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return "type" /* typeElement */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var kind = ts.getSpecialPropertyAssignmentKind(node); var right = node.right; switch (kind) { @@ -80178,27 +80552,27 @@ var ts; return false; } switch (n.kind) { - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 182 /* ObjectLiteralExpression */: - case 178 /* ObjectBindingPattern */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 183 /* ObjectLiteralExpression */: + case 179 /* ObjectBindingPattern */: case 165 /* TypeLiteral */: - case 211 /* Block */: - case 238 /* ModuleBlock */: - case 239 /* CaseBlock */: - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 212 /* Block */: + case 239 /* ModuleBlock */: + case 240 /* CaseBlock */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return nodeEndsWith(n, 18 /* CloseBraceToken */, sourceFile); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 186 /* NewExpression */: + case 187 /* NewExpression */: if (!n.arguments) { return true; } // falls through - case 185 /* CallExpression */: - case 189 /* ParenthesizedExpression */: + case 186 /* CallExpression */: + case 190 /* ParenthesizedExpression */: case 172 /* ParenthesizedType */: return nodeEndsWith(n, 20 /* CloseParenToken */, sourceFile); case 162 /* FunctionType */: @@ -80207,13 +80581,13 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 158 /* ConstructSignature */: case 157 /* CallSignature */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -80223,19 +80597,19 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 20 /* CloseParenToken */, sourceFile); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 215 /* IfStatement */: + case 216 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 25 /* SemicolonToken */, sourceFile); - case 181 /* ArrayLiteralExpression */: - case 179 /* ArrayBindingPattern */: - case 184 /* ElementAccessExpression */: + case 182 /* ArrayLiteralExpression */: + case 180 /* ArrayBindingPattern */: + case 185 /* ElementAccessExpression */: case 146 /* ComputedPropertyName */: case 167 /* TupleType */: return nodeEndsWith(n, 22 /* CloseBracketToken */, sourceFile); @@ -80244,44 +80618,44 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 22 /* CloseBracketToken */, sourceFile); - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 217 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 218 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 216 /* DoStatement */: + case 217 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 106 /* WhileKeyword */, sourceFile) ? nodeEndsWith(n, 20 /* CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); case 164 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 193 /* TypeOfExpression */: - case 192 /* DeleteExpression */: - case 194 /* VoidExpression */: - case 201 /* YieldExpression */: - case 202 /* SpreadElement */: + case 194 /* TypeOfExpression */: + case 193 /* DeleteExpression */: + case 195 /* VoidExpression */: + case 202 /* YieldExpression */: + case 203 /* SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 248 /* ExportDeclaration */: - case 242 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -80478,7 +80852,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 272 /* SourceFile */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 273 /* SourceFile */ || 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. @@ -80550,17 +80924,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 263 /* JsxExpression */) { + if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 264 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 263 /* JsxExpression */) { + if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 264 /* JsxExpression */) { return true; } //
|
- if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 256 /* JsxClosingElement */) { + if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 257 /* JsxClosingElement */) { return true; } return false; @@ -80717,10 +81091,10 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 161 /* TypeReference */ || node.kind === 185 /* CallExpression */) { + if (node.kind === 161 /* TypeReference */ || node.kind === 186 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 233 /* ClassDeclaration */ || node.kind === 234 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 234 /* ClassDeclaration */ || node.kind === 235 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -80772,18 +81146,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 181 /* ArrayLiteralExpression */ || - node.kind === 182 /* ObjectLiteralExpression */) { + if (node.kind === 182 /* ArrayLiteralExpression */ || + node.kind === 183 /* ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 198 /* BinaryExpression */ && + if (node.parent.kind === 199 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 58 /* EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 220 /* ForOfStatement */ && + if (node.parent.kind === 221 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -80791,7 +81165,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 268 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 269 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -80878,6 +81252,17 @@ var ts; return result; } ts.repeatString = repeatString; + function skipConstraint(type) { + return type.isTypeParameter() ? type.getConstraint() : type; + } + ts.skipConstraint = skipConstraint; + function getNameFromPropertyName(name) { + return name.kind === 146 /* ComputedPropertyName */ + // treat computed property names where expression is string/numeric literal as just string/numeric literal + ? ts.isStringOrNumericLiteral(name.expression) ? name.expression.text : undefined + : ts.getTextOfIdentifierOrLiteral(name); + } + ts.getNameFromPropertyName = getNameFromPropertyName; })(ts || (ts = {})); // Display-part writer helpers /* @internal */ @@ -81076,7 +81461,7 @@ var ts; ts.signatureToDisplayParts = signatureToDisplayParts; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 246 /* ImportSpecifier */ || location.parent.kind === 250 /* ExportSpecifier */) && + (location.parent.kind === 247 /* ImportSpecifier */ || location.parent.kind === 251 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -81256,114 +81641,114 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return spanInVariableDeclaration(node); case 148 /* Parameter */: return spanInParameterDeclaration(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 154 /* Constructor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 211 /* Block */: + case 212 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return spanInBlock(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return spanInBlock(node.block); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 216 /* DoStatement */: + case 217 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 229 /* DebuggerStatement */: + case 230 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 215 /* IfStatement */: + case 216 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return spanInForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 228 /* TryStatement */: + case 229 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } // falls through - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 180 /* BindingElement */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 181 /* BindingElement */: // span on complete node return textSpan(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: // span in statement return spanInNode(node.statement); case 149 /* Decorator */: return spanInNodeArray(node.parent.decorators); - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: return undefined; // Tokens: case 25 /* SemicolonToken */: @@ -81406,13 +81791,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 === 71 /* Identifier */ || - node.kind === 202 /* SpreadElement */ || - node.kind === 268 /* PropertyAssignment */ || - node.kind === 269 /* ShorthandPropertyAssignment */) && + node.kind === 203 /* SpreadElement */ || + node.kind === 269 /* PropertyAssignment */ || + node.kind === 270 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 198 /* BinaryExpression */) { + if (node.kind === 199 /* 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 @@ -81434,22 +81819,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (node.parent.kind) { - case 216 /* DoStatement */: + case 217 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); case 149 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 218 /* ForStatement */: - case 220 /* ForOfStatement */: + case 219 /* ForStatement */: + case 221 /* ForOfStatement */: return textSpan(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (node.parent.operatorToken.kind === 26 /* CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -81458,20 +81843,20 @@ var ts; } } switch (node.parent.kind) { - case 268 /* PropertyAssignment */: + case 269 /* 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 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; @@ -81480,7 +81865,7 @@ var ts; } break; } - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -81510,7 +81895,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 219 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 220 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern, set breakpoint in binding pattern @@ -81521,7 +81906,7 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1 /* Export */) || - variableDeclaration.parent.parent.kind === 220 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 221 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -81562,7 +81947,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1 /* Export */) || - (functionDeclaration.parent.kind === 233 /* ClassDeclaration */ && functionDeclaration.kind !== 154 /* Constructor */); + (functionDeclaration.parent.kind === 234 /* ClassDeclaration */ && functionDeclaration.kind !== 154 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -81585,26 +81970,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // falls through // Set on parent if on same line otherwise on first statement - case 217 /* WhileStatement */: - case 215 /* IfStatement */: - case 219 /* ForInStatement */: + case 218 /* WhileStatement */: + case 216 /* IfStatement */: + case 220 /* 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 218 /* ForStatement */: - case 220 /* ForOfStatement */: + case 219 /* ForStatement */: + case 221 /* 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 === 231 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 232 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -81629,21 +82014,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 204 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 205 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 180 /* BindingElement */) { + if (bindingPattern.parent.kind === 181 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 179 /* ArrayBindingPattern */ && node.kind !== 178 /* ObjectBindingPattern */); - var elements = node.kind === 181 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 204 /* OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 180 /* ArrayBindingPattern */ && node.kind !== 179 /* ObjectBindingPattern */); + var elements = node.kind === 182 /* ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 205 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -81651,18 +82036,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 === 198 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 199 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -81670,25 +82055,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } // falls through - case 236 /* EnumDeclaration */: - case 233 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 211 /* Block */: + case 212 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 267 /* CatchClause */: + case 268 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -81696,7 +82081,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 178 /* ObjectBindingPattern */: + case 179 /* 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); @@ -81712,7 +82097,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 179 /* ArrayBindingPattern */: + case 180 /* 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); @@ -81727,12 +82112,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 216 /* DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 185 /* CallExpression */ || - node.parent.kind === 186 /* NewExpression */) { + if (node.parent.kind === 217 /* DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 186 /* CallExpression */ || + node.parent.kind === 187 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 189 /* ParenthesizedExpression */) { + if (node.parent.kind === 190 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -81741,21 +82126,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 154 /* Constructor */: - case 217 /* WhileStatement */: - case 216 /* DoStatement */: - case 218 /* ForStatement */: - case 220 /* ForOfStatement */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 189 /* ParenthesizedExpression */: + case 218 /* WhileStatement */: + case 217 /* DoStatement */: + case 219 /* ForStatement */: + case 221 /* ForOfStatement */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 190 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -81765,20 +82150,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 268 /* PropertyAssignment */ || + node.parent.kind === 269 /* PropertyAssignment */ || node.parent.kind === 148 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 188 /* TypeAssertionExpression */) { + if (node.parent.kind === 189 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 216 /* DoStatement */) { + if (node.parent.kind === 217 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -81786,7 +82171,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 220 /* ForOfStatement */) { + if (node.parent.kind === 221 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -82226,10 +82611,10 @@ 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 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 232 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 233 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -82440,16 +82825,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param" pos = tag.tagName.end; switch (tag.kind) { - case 287 /* JSDocParameterTag */: + case 288 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 290 /* JSDocTemplateTag */: + case 291 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 289 /* JSDocTypeTag */: + case 290 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 288 /* JSDocReturnTag */: + case 289 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -82536,22 +82921,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 255 /* JsxOpeningElement */: + case 256 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -82579,17 +82964,17 @@ var ts; if (token) { if (tokenKind === 58 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 230 /* VariableDeclaration */ || + if (token.parent.kind === 231 /* VariableDeclaration */ || token.parent.kind === 151 /* PropertyDeclaration */ || token.parent.kind === 148 /* Parameter */ || - token.parent.kind === 260 /* JsxAttribute */) { + token.parent.kind === 261 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 198 /* BinaryExpression */ || - token.parent.kind === 196 /* PrefixUnaryExpression */ || - token.parent.kind === 197 /* PostfixUnaryExpression */ || - token.parent.kind === 199 /* ConditionalExpression */) { + if (token.parent.kind === 199 /* BinaryExpression */ || + token.parent.kind === 197 /* PrefixUnaryExpression */ || + token.parent.kind === 198 /* PostfixUnaryExpression */ || + token.parent.kind === 200 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -82599,7 +82984,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 260 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 261 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 12 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -82615,7 +83000,7 @@ var ts; else if (tokenKind === 71 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } @@ -82625,17 +83010,17 @@ var ts; return 15 /* typeParameterName */; } return; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } @@ -83151,7 +83536,9 @@ var ts; GlobalsSearch[GlobalsSearch["Success"] = 1] = "Success"; GlobalsSearch[GlobalsSearch["Fail"] = 2] = "Fail"; })(GlobalsSearch || (GlobalsSearch = {})); - function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position, allSourceFiles, preferences) { + function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences) { + var typeChecker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); if (ts.isInReferenceComment(sourceFile, position)) { var entries = Completions.PathCompletions.getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); return entries && convertPathCompletions(entries); @@ -83166,7 +83553,7 @@ var ts; && (contextToken.kind === 72 /* BreakKeyword */ || contextToken.kind === 77 /* ContinueKeyword */ || contextToken.kind === 71 /* Identifier */)) { return getLabelCompletionAtPosition(contextToken.parent); } - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, preferences, compilerOptions.target); + var completionData = getCompletionData(program, log, sourceFile, position, preferences); if (!completionData) { return undefined; } @@ -83200,7 +83587,7 @@ var ts; } case 2 /* Types */: { var entries = completion.types.map(function (type) { return ({ name: type.value, kindModifiers: "" /* none */, kind: "type" /* typeElement */, sortText: "0" }); }); - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, entries: entries }; } default: return ts.Debug.assertNever(completion); @@ -83291,24 +83678,24 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var insertText; var replacementSpan; - if (preferences.includeCompletionsWithInsertText) { - if (origin && origin.type === "this-type") { - insertText = needsConvertPropertyAccess ? "this[" + quote(name, preferences) + "]" : "this." + name; - } - else if (needsConvertPropertyAccess) { - insertText = "[" + quote(name, preferences) + "]"; - var dot = ts.findChildOfKind(propertyAccessToConvert, 23 /* DotToken */, sourceFile); - // If the text after the '.' starts with this name, write over it. Else, add new text. - var end = ts.startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; - replacementSpan = ts.createTextSpanFromBounds(dot.getStart(sourceFile), end); - } - if (isJsxInitializer) { - if (insertText === undefined) - insertText = name; - insertText = "{" + insertText + "}"; - if (typeof isJsxInitializer !== "boolean") { - replacementSpan = ts.createTextSpanFromNode(isJsxInitializer, sourceFile); - } + if (origin && origin.type === "this-type") { + insertText = needsConvertPropertyAccess ? "this[" + quote(name, preferences) + "]" : "this." + name; + } + // We should only have needsConvertPropertyAccess if there's a property access to convert. But see #21790. + // Somehow there was a global with a non-identifier name. Hopefully someone will complain about getting a "foo bar" global completion and provide a repro. + else if ((origin && origin.type === "symbol-member" || needsConvertPropertyAccess) && propertyAccessToConvert) { + insertText = needsConvertPropertyAccess ? "[" + quote(name, preferences) + "]" : "[" + name + "]"; + var dot = ts.findChildOfKind(propertyAccessToConvert, 23 /* DotToken */, sourceFile); + // If the text after the '.' starts with this name, write over it. Else, add new text. + var end = ts.startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; + replacementSpan = ts.createTextSpanFromBounds(dot.getStart(sourceFile), end); + } + if (isJsxInitializer) { + if (insertText === undefined) + insertText = name; + insertText = "{" + insertText + "}"; + if (typeof isJsxInitializer !== "boolean") { + replacementSpan = ts.createTextSpanFromNode(isJsxInitializer, sourceFile); } } if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) { @@ -83423,7 +83810,7 @@ var ts; case 177 /* LiteralType */: switch (node.parent.parent.kind) { case 161 /* TypeReference */: - return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(node.parent), typeChecker) }; + return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(node.parent), typeChecker), isNewIdentifier: false }; case 175 /* IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { @@ -83432,10 +83819,12 @@ var ts; // } // let x: Foo["/*completion position*/"] return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(node.parent.parent.objectType)); + case 178 /* ImportType */: + return { kind: 0 /* Paths */, paths: Completions.PathCompletions.getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) }; default: return undefined; } - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: if (ts.isObjectLiteralExpression(node.parent.parent) && node.parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -83452,7 +83841,7 @@ var ts; return stringLiteralCompletionsFromProperties(typeChecker.getContextualType(node.parent.parent)); } return fromContextualType(); - case 184 /* ElementAccessExpression */: { + case 185 /* ElementAccessExpression */: { var _a = node.parent, expression = _a.expression, argumentExpression = _a.argumentExpression; if (node === argumentExpression) { // Get all names of properties on the expression @@ -83465,25 +83854,19 @@ var ts; } return undefined; } - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: if (!ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false) && !ts.isImportCall(node.parent)) { - var argumentInfo_1 = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - if (argumentInfo_1) { - var candidates = []; - typeChecker.getResolvedSignature(argumentInfo_1.invocation, candidates, argumentInfo_1.argumentCount); - var uniques_1 = ts.createMap(); - return { kind: 2 /* Types */, types: ts.flatMap(candidates, function (candidate) { return getStringLiteralTypes(typeChecker.getParameterType(candidate, argumentInfo_1.argumentIndex), typeChecker, uniques_1); }) }; - } - return fromContextualType(); + return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo, typeChecker) : fromContextualType(); } // falls through (is `require("")` or `import("")`) - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: - case 252 /* ExternalModuleReference */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 253 /* 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*/"); @@ -83497,26 +83880,40 @@ var ts; function fromContextualType() { // Get completion for string literal from string literal type // i.e. var x: "hi" | "hello" = "/*completion position*/" - return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker), typeChecker) }; + return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker), typeChecker), isNewIdentifier: false }; } } + function getStringLiteralCompletionsFromSignature(argumentInfo, checker) { + var isNewIdentifier = false; + var uniques = ts.createMap(); + var candidates = []; + checker.getResolvedSignature(argumentInfo.invocation, candidates, argumentInfo.argumentCount); + var types = ts.flatMap(candidates, function (candidate) { + if (!candidate.hasRestParameter && argumentInfo.argumentCount > candidate.parameters.length) + return; + var type = checker.getParameterType(candidate, argumentInfo.argumentIndex); + isNewIdentifier = isNewIdentifier || !!(type.flags & 2 /* String */); + return getStringLiteralTypes(type, checker, uniques); + }); + return { kind: 2 /* Types */, types: types, isNewIdentifier: isNewIdentifier }; + } function stringLiteralCompletionsFromProperties(type) { return type && { kind: 1 /* Properties */, symbols: type.getApparentProperties(), hasIndexSignature: hasIndexSignature(type) }; } function getStringLiteralTypes(type, typeChecker, uniques) { if (uniques === void 0) { uniques = ts.createMap(); } - if (type && type.flags & 32768 /* TypeParameter */) { - type = type.getConstraint(); - } - return type && type.flags & 131072 /* Union */ + if (!type) + return ts.emptyArray; + type = ts.skipConstraint(type); + return type.isUnion() ? ts.flatMap(type.types, function (t) { return getStringLiteralTypes(t, typeChecker, uniques); }) - : type && type.flags & 32 /* StringLiteral */ && !(type.flags & 256 /* EnumLiteral */) && ts.addToSeen(uniques, type.value) + : type.isStringLiteral() && !(type.flags & 256 /* EnumLiteral */) && ts.addToSeen(uniques, type.value) ? [type] : ts.emptyArray; } - function getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, _a, allSourceFiles) { + function getSymbolCompletionFromEntryId(program, log, sourceFile, position, _a) { var name = _a.name, source = _a.source; - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }, compilerOptions.target); + var completionData = getCompletionData(program, log, sourceFile, position, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }); if (!completionData) { return { type: "none" }; } @@ -83530,7 +83927,7 @@ var ts; // completion entry. return ts.firstDefined(symbols, function (symbol) { var origin = symbolToOriginInfoMap[ts.getSymbolId(symbol)]; - var info = getCompletionEntryDisplayNameForSymbol(symbol, compilerOptions.target, origin, completionKind); + var info = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, origin, completionKind); return info && info.name === name && getSourceFromOrigin(origin) === source ? { type: "symbol", symbol: symbol, location: location, symbolToOriginInfoMap: symbolToOriginInfoMap, previousToken: previousToken, isJsxInitializer: isJsxInitializer } : undefined; }) || { type: "none" }; } @@ -83541,8 +83938,9 @@ var ts; || ts.codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) : symbol.name; } - function getCompletionEntryDetails(program, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, formatContext, getCanonicalFileName, preferences) { + function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, getCanonicalFileName, preferences) { var typeChecker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); var name = entryId.name; var contextToken = ts.findPrecedingToken(position, sourceFile); if (ts.isInString(sourceFile, position, contextToken)) { @@ -83552,7 +83950,7 @@ var ts; return stringLiteralCompletions && stringLiteralCompletionDetails(name, contextToken, stringLiteralCompletions, sourceFile, typeChecker); } // Compute all the completion symbols again. - var symbolCompletion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); + var symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); switch (symbolCompletion.type) { case "request": { var request = symbolCompletion.request; @@ -83569,7 +83967,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, symbolToOriginInfoMap = symbolCompletion.symbolToOriginInfoMap, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, program, typeChecker, host, compilerOptions, sourceFile, previousToken, formatContext, getCanonicalFileName, allSourceFiles, preferences), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, program, typeChecker, host, compilerOptions, sourceFile, previousToken, formatContext, getCanonicalFileName, program.getSourceFiles(), preferences), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, codeActions, sourceDisplay); } case "none": @@ -83611,8 +84009,8 @@ var ts; var _a = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, getSymbolName(symbol, symbolOriginInfo, compilerOptions.target), host, program, checker, compilerOptions, allSourceFiles, formatContext, getCanonicalFileName, previousToken, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } - function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles) { - var completion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); + function getCompletionEntrySymbol(program, log, sourceFile, position, entryId) { + var completion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); return completion.type === "symbol" ? completion.symbol : undefined; } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; @@ -83647,11 +84045,11 @@ var ts; return getContextualTypeFromParent(currentToken, checker); case 58 /* EqualsToken */: switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return checker.getContextualType(parent.initializer); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -83661,7 +84059,7 @@ var ts; case 73 /* CaseKeyword */: return getSwitchedType(ts.cast(parent, ts.isCaseClause), checker); case 17 /* OpenBraceToken */: - return ts.isJsxExpression(parent) && parent.parent.kind !== 253 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined; + return ts.isJsxExpression(parent) && parent.parent.kind !== 254 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined; default: var argInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(currentToken, position, sourceFile); return argInfo @@ -83676,15 +84074,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 186 /* NewExpression */: + case 187 /* NewExpression */: return checker.getContextualType(parent); - case 198 /* BinaryExpression */: { + case 199 /* 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 264 /* CaseClause */: + case 265 /* CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -83700,9 +84098,10 @@ var ts; return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); } function isModuleSymbol(symbol) { - return symbol.declarations.some(function (d) { return d.kind === 272 /* SourceFile */; }); + return symbol.declarations.some(function (d) { return d.kind === 273 /* SourceFile */; }); } - function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, preferences, target) { + function getCompletionData(program, log, sourceFile, position, preferences) { + var typeChecker = program.getTypeChecker(); var start = ts.timestamp(); var currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false); // TODO: GH#15853 // We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.) @@ -83751,11 +84150,11 @@ var ts; if (tag.tagName.pos <= position && position <= tag.tagName.end) { return { kind: 1 /* JsDocTagName */ }; } - if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 274 /* JSDocTypeExpression */) { + if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 275 /* JSDocTypeExpression */) { currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ true); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 292 /* JSDocPropertyTag */ || + (currentToken.parent.kind !== 293 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression); @@ -83805,13 +84204,16 @@ var ts; if (contextToken.kind === 23 /* DotToken */) { isRightOfDot = true; switch (parent.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; break; case 145 /* QualifiedName */: node = parent.left; break; + case 178 /* ImportType */: + node = parent; + break; default: // There is nothing that precedes the dot, so this likely just a stray character // or leading into a '...' token. Just bail out instead. @@ -83822,7 +84224,7 @@ var ts; // // 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 === 183 /* PropertyAccessExpression */) { + if (parent && parent.kind === 184 /* PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -83830,39 +84232,39 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 29 /* GreaterThanToken */: - if (currentToken.parent.kind === 253 /* JsxElement */ || currentToken.parent.kind === 255 /* JsxOpeningElement */) { + if (currentToken.parent.kind === 254 /* JsxElement */ || currentToken.parent.kind === 256 /* JsxOpeningElement */) { location = currentToken; } break; case 41 /* SlashToken */: - if (currentToken.parent.kind === 254 /* JsxSelfClosingElement */) { + if (currentToken.parent.kind === 255 /* JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: if (contextToken.kind === 41 /* SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (!(parent.left.flags & 32768 /* ThisNodeHasError */)) { // It has a left-hand side, so we're not in an opening JSX tag. break; } // falls through - case 254 /* JsxSelfClosingElement */: - case 253 /* JsxElement */: - case 255 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 254 /* JsxElement */: + case 256 /* JsxOpeningElement */: if (contextToken.kind === 27 /* LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: switch (previousToken.kind) { case 58 /* EqualsToken */: isJsxInitializer = true; @@ -83916,11 +84318,11 @@ var ts; return { kind: 0 /* Data */, symbols: symbols, completionKind: completionKind, isInSnippetScope: isInSnippetScope, propertyAccessToConvert: propertyAccessToConvert, isNewIdentifierLocation: isNewIdentifierLocation, location: location, keywordFilters: keywordFilters, symbolToOriginInfoMap: symbolToOriginInfoMap, recommendedCompletion: recommendedCompletion, previousToken: previousToken, isJsxInitializer: isJsxInitializer }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 287 /* JSDocParameterTag */: - case 292 /* JSDocPropertyTag */: - case 288 /* JSDocReturnTag */: - case 289 /* JSDocTypeTag */: - case 291 /* JSDocTypedefTag */: + case 288 /* JSDocParameterTag */: + case 293 /* JSDocPropertyTag */: + case 289 /* JSDocReturnTag */: + case 290 /* JSDocTypeTag */: + case 292 /* JSDocTypedefTag */: return true; } } @@ -83928,17 +84330,18 @@ var ts; // Right of dot member completion list completionKind = 2 /* PropertyAccess */; // Since this is qualified name check its a type node location - var isTypeLocation = insideJsDocTagTypeExpression || ts.isPartOfTypeNode(node.parent); + var isImportType = ts.isLiteralImportTypeNode(node); + var isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !node.isTypeOf) || ts.isPartOfTypeNode(node.parent); var isRhsOfImportDeclaration = ts.isInRightSideOfInternalImportEqualsDeclaration(node); var allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile)); - if (ts.isEntityName(node)) { + if (ts.isEntityName(node) || isImportType) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { symbol = ts.skipAlias(symbol, typeChecker); if (symbol.flags & (1536 /* Module */ | 384 /* Enum */)) { // Extract module or enum members var exportedSymbols = ts.Debug.assertEachDefined(typeChecker.getExportsOfModule(symbol), "getExportsOfModule() should all be defined"); - var isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess((node.parent), symbol.name); }; + var isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess(isImportType ? node : (node.parent), symbol.name); }; var isValidTypeAccess_1 = function (symbol) { return symbolCanBeReferencedAtTypeLocation(symbol); }; var isValidAccess = allowTypeOrValue ? // Any kind is allowed when dotting off namespace in internal import equals declaration @@ -83951,7 +84354,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.some(function (d) { return d.kind !== 272 /* SourceFile */ && d.kind !== 237 /* ModuleDeclaration */ && d.kind !== 236 /* EnumDeclaration */; })) { + if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 273 /* SourceFile */ && d.kind !== 238 /* ModuleDeclaration */ && d.kind !== 237 /* EnumDeclaration */; })) { addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node)); } return; @@ -83975,12 +84378,31 @@ var ts; else { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; - if (typeChecker.isValidPropertyAccessForCompletions((node.parent), type, symbol)) { - symbols.push(symbol); + if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 178 /* ImportType */ ? node : node.parent, type, symbol)) { + addPropertySymbol(symbol); } } } } + function addPropertySymbol(symbol) { + // If this is e.g. [Symbol.iterator], add a completion for `Symbol`. + var symbolSymbol = ts.firstDefined(symbol.declarations, function (decl) { + var name = ts.getNameOfDeclaration(decl); + var leftName = name.kind === 146 /* ComputedPropertyName */ ? getLeftMostName(name.expression) : undefined; + return leftName && typeChecker.getSymbolAtLocation(leftName); + }); + if (symbolSymbol) { + symbols.push(symbolSymbol); + symbolToOriginInfoMap[ts.getSymbolId(symbolSymbol)] = { type: "symbol-member" }; + } + else { + symbols.push(symbol); + } + } + /** Given 'a.b.c', returns 'a'. */ + function getLeftMostName(e) { + return ts.isIdentifier(e) ? e : ts.isPropertyAccessExpression(e) ? getLeftMostName(e.expression) : undefined; + } function tryGetGlobalSymbols() { var result = tryGetObjectLikeCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() @@ -84055,7 +84477,7 @@ var ts; var symbolMeanings = 67901928 /* Type */ | 67216319 /* Value */ | 1920 /* Namespace */ | 2097152 /* Alias */; symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined"); // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 272 /* SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 273 /* SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode); if (thisType) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker, /*isForAccess*/ true); _i < _a.length; _i++) { @@ -84065,18 +84487,38 @@ var ts; } } } - // Don't suggest import completions for a commonjs-only module - if (preferences.includeCompletionsForModuleExports && !(sourceFile.commonJsModuleIndicator && !sourceFile.externalModuleIndicator)) { - getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", target); + if (shouldOfferImportCompletions()) { + getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", program.getCompilerOptions().target); } filterGlobalCompletion(symbols); } + function shouldOfferImportCompletions() { + // If not already a module, must have modules enabled and not currently be in a commonjs module. (TODO: import completions for commonjs) + if (!preferences.includeCompletionsForModuleExports) + return false; + // If already using ES6 modules, OK to continue using them. + if (sourceFile.externalModuleIndicator) + return true; + // If already using commonjs, don't introduce ES6. + if (sourceFile.commonJsModuleIndicator) + return false; + // If some file is using ES6 modules, assume that it's OK to add more. + if (program.getSourceFiles().some(function (s) { return !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!s.externalModuleIndicator; })) { + return true; + } + // For JS, stay on the safe side. + if (ts.isSourceFileJavaScript(sourceFile)) + return false; + // If module transpilation is enabled or we're targeting es6 or above, or not emitting, OK. + var compilerOptions = program.getCompilerOptions(); + return !!compilerOptions.module || compilerOptions.target >= 2 /* ES2015 */ || !!compilerOptions.noEmit; + } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 272 /* SourceFile */: - case 200 /* TemplateExpression */: - case 263 /* JsxExpression */: - case 211 /* Block */: + case 273 /* SourceFile */: + case 201 /* TemplateExpression */: + case 264 /* JsxExpression */: + case 212 /* Block */: return true; default: return ts.isStatement(scopeNode); @@ -84123,12 +84565,12 @@ var ts; return parentKind === 151 /* PropertyDeclaration */ || parentKind === 150 /* PropertySignature */ || parentKind === 148 /* Parameter */ || - parentKind === 230 /* VariableDeclaration */ || + parentKind === 231 /* VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 58 /* EqualsToken */: - return parentKind === 235 /* TypeAliasDeclaration */; + return parentKind === 236 /* TypeAliasDeclaration */; case 118 /* AsKeyword */: - return parentKind === 206 /* AsExpression */; + return parentKind === 207 /* AsExpression */; } } return false; @@ -84149,7 +84591,7 @@ var ts; } function getSymbolsFromOtherSourceFileExports(symbols, tokenText, target) { var tokenTextLowerCase = tokenText.toLowerCase(); - ts.codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, allSourceFiles, function (moduleSymbol) { + ts.codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, program.getSourceFiles(), function (moduleSymbol) { for (var _i = 0, _a = typeChecker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) { var symbol = _a[_i]; // Don't add a completion for a re-export, only for the original. @@ -84220,11 +84662,11 @@ var ts; return true; } if (contextToken.kind === 29 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 255 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 256 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 256 /* JsxClosingElement */ || contextToken.parent.kind === 254 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 253 /* JsxElement */; + if (contextToken.parent.kind === 257 /* JsxClosingElement */ || contextToken.parent.kind === 255 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 254 /* JsxElement */; } } return false; @@ -84234,36 +84676,36 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 26 /* CommaToken */: - return containingNodeKind === 185 /* CallExpression */ // func( a, | + return containingNodeKind === 186 /* CallExpression */ // func( a, | || containingNodeKind === 154 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 186 /* NewExpression */ // new C(a, | - || containingNodeKind === 181 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 198 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 187 /* NewExpression */ // new C(a, | + || containingNodeKind === 182 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 199 /* BinaryExpression */ // const x = (a, | || containingNodeKind === 162 /* FunctionType */; // var x: (s: string, list| case 19 /* OpenParenToken */: - return containingNodeKind === 185 /* CallExpression */ // func( | + return containingNodeKind === 186 /* CallExpression */ // func( | || containingNodeKind === 154 /* Constructor */ // constructor( | - || containingNodeKind === 186 /* NewExpression */ // new C(a| - || containingNodeKind === 189 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 187 /* NewExpression */ // new C(a| + || containingNodeKind === 190 /* ParenthesizedExpression */ // const x = (a| || containingNodeKind === 172 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 21 /* OpenBracketToken */: - return containingNodeKind === 181 /* ArrayLiteralExpression */ // [ | + return containingNodeKind === 182 /* ArrayLiteralExpression */ // [ | || containingNodeKind === 159 /* IndexSignature */ // [ | : string ] || containingNodeKind === 146 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 129 /* ModuleKeyword */: // module | case 130 /* NamespaceKeyword */: // namespace | return true; case 23 /* DotToken */: - return containingNodeKind === 237 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 238 /* ModuleDeclaration */; // module A.| case 17 /* OpenBraceToken */: - return containingNodeKind === 233 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 234 /* ClassDeclaration */; // class A{ | case 58 /* EqualsToken */: - return containingNodeKind === 230 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 198 /* BinaryExpression */; // x = a| + return containingNodeKind === 231 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 199 /* BinaryExpression */; // x = a| case 14 /* TemplateHead */: - return containingNodeKind === 200 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 201 /* TemplateExpression */; // `aa ${| case 15 /* TemplateMiddle */: - return containingNodeKind === 209 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 210 /* TemplateSpan */; // `aa ${10} dd ${| case 114 /* PublicKeyword */: case 112 /* PrivateKeyword */: case 113 /* ProtectedKeyword */: @@ -84313,7 +84755,7 @@ var ts; completionKind = 0 /* ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 182 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 183 /* ObjectLiteralExpression */) { var typeForObject = typeChecker.getContextualType(objectLikeContainer); if (!typeForObject) return 2 /* Fail */; @@ -84322,7 +84764,7 @@ var ts; existingMembers = objectLikeContainer.properties; } else { - ts.Debug.assert(objectLikeContainer.kind === 178 /* ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 179 /* ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -84333,7 +84775,7 @@ 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.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 220 /* ForOfStatement */; + var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 221 /* ForOfStatement */; if (!canGetType && rootDeclaration.kind === 148 /* Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); @@ -84378,9 +84820,9 @@ var ts; return undefined; // cursor is in an import clause // try to show exported member for imported module - var declarationKind = namedImportsOrExports.kind === 245 /* NamedImports */ ? - 242 /* ImportDeclaration */ : - 248 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 246 /* NamedImports */ ? + 243 /* ImportDeclaration */ : + 249 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -84465,8 +84907,8 @@ var ts; case 17 /* OpenBraceToken */: // import { | case 26 /* CommaToken */: // import { a as 0, | switch (contextToken.parent.kind) { - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return contextToken.parent; } } @@ -84517,14 +84959,14 @@ var ts; case 28 /* LessThanSlashToken */: case 41 /* SlashToken */: case 71 /* Identifier */: - case 183 /* PropertyAccessExpression */: - case 261 /* JsxAttributes */: - case 260 /* JsxAttribute */: - case 262 /* JsxSpreadAttribute */: - if (parent && (parent.kind === 254 /* JsxSelfClosingElement */ || parent.kind === 255 /* JsxOpeningElement */)) { + case 184 /* PropertyAccessExpression */: + case 262 /* JsxAttributes */: + case 261 /* JsxAttribute */: + case 263 /* JsxSpreadAttribute */: + if (parent && (parent.kind === 255 /* JsxSelfClosingElement */ || parent.kind === 256 /* JsxOpeningElement */)) { return parent; } - else if (parent.kind === 260 /* JsxAttribute */) { + else if (parent.kind === 261 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -84536,7 +84978,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent && ((parent.kind === 260 /* JsxAttribute */) || (parent.kind === 262 /* JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 261 /* JsxAttribute */) || (parent.kind === 263 /* JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -84546,8 +84988,8 @@ var ts; break; case 18 /* CloseBraceToken */: if (parent && - parent.kind === 263 /* JsxExpression */ && - parent.parent && parent.parent.kind === 260 /* JsxAttribute */) { + parent.kind === 264 /* JsxExpression */ && + parent.parent && parent.parent.kind === 261 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -84555,7 +84997,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 262 /* JsxSpreadAttribute */) { + if (parent && parent.kind === 263 /* JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -84574,50 +85016,50 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 26 /* CommaToken */: - return containingNodeKind === 230 /* VariableDeclaration */ || - containingNodeKind === 231 /* VariableDeclarationList */ || - containingNodeKind === 212 /* VariableStatement */ || - containingNodeKind === 236 /* EnumDeclaration */ || // enum a { foo, | + return containingNodeKind === 231 /* VariableDeclaration */ || + containingNodeKind === 232 /* VariableDeclarationList */ || + containingNodeKind === 213 /* VariableStatement */ || + containingNodeKind === 237 /* EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 234 /* InterfaceDeclaration */ || // interface A= contextToken.pos); case 23 /* DotToken */: - return containingNodeKind === 179 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 180 /* ArrayBindingPattern */; // var [.| case 56 /* ColonToken */: - return containingNodeKind === 180 /* BindingElement */; // var {x :html| + return containingNodeKind === 181 /* BindingElement */; // var {x :html| case 21 /* OpenBracketToken */: - return containingNodeKind === 179 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 180 /* ArrayBindingPattern */; // var [x| case 19 /* OpenParenToken */: - return containingNodeKind === 267 /* CatchClause */ || + return containingNodeKind === 268 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 17 /* OpenBraceToken */: - return containingNodeKind === 236 /* EnumDeclaration */; // enum a { | + return containingNodeKind === 237 /* EnumDeclaration */; // enum a { | case 27 /* LessThanToken */: - return containingNodeKind === 233 /* ClassDeclaration */ || // class A< | - containingNodeKind === 203 /* ClassExpression */ || // var C = class D< | - containingNodeKind === 234 /* InterfaceDeclaration */ || // interface A< | - containingNodeKind === 235 /* TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 234 /* ClassDeclaration */ || // class A< | + containingNodeKind === 204 /* ClassExpression */ || // var C = class D< | + containingNodeKind === 235 /* InterfaceDeclaration */ || // interface A< | + containingNodeKind === 236 /* TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 115 /* StaticKeyword */: return containingNodeKind === 151 /* PropertyDeclaration */ && !ts.isClassLike(contextToken.parent.parent); case 24 /* DotDotDotToken */: return containingNodeKind === 148 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 179 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 180 /* ArrayBindingPattern */); // var [...z| case 114 /* PublicKeyword */: case 112 /* PrivateKeyword */: case 113 /* ProtectedKeyword */: return containingNodeKind === 148 /* Parameter */ && !ts.isConstructorDeclaration(contextToken.parent.parent); case 118 /* AsKeyword */: - return containingNodeKind === 246 /* ImportSpecifier */ || - containingNodeKind === 250 /* ExportSpecifier */ || - containingNodeKind === 244 /* NamespaceImport */; + return containingNodeKind === 247 /* ImportSpecifier */ || + containingNodeKind === 251 /* ExportSpecifier */ || + containingNodeKind === 245 /* NamespaceImport */; case 125 /* GetKeyword */: case 136 /* SetKeyword */: if (isFromObjectTypeDeclaration(contextToken)) { @@ -84723,9 +85165,9 @@ 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 !== 268 /* PropertyAssignment */ && - m.kind !== 269 /* ShorthandPropertyAssignment */ && - m.kind !== 180 /* BindingElement */ && + if (m.kind !== 269 /* PropertyAssignment */ && + m.kind !== 270 /* ShorthandPropertyAssignment */ && + m.kind !== 181 /* BindingElement */ && m.kind !== 153 /* MethodDeclaration */ && m.kind !== 155 /* GetAccessor */ && m.kind !== 156 /* SetAccessor */) { @@ -84736,7 +85178,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 180 /* BindingElement */ && m.propertyName) { + if (m.kind === 181 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 71 /* Identifier */) { existingName = m.propertyName.escapedText; @@ -84806,7 +85248,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 260 /* JsxAttribute */) { + if (attr.kind === 261 /* JsxAttribute */) { seenNames.set(attr.name.escapedText, true); } } @@ -84836,7 +85278,7 @@ var ts; // TODO: GH#18169 return { name: JSON.stringify(name), needsConvertPropertyAccess: false }; case 2 /* PropertyAccess */: - case 1 /* Global */: + case 1 /* Global */: // For a 'this.' completion it will be in a global context, but may have a non-identifier name. // Don't add a completion for a name starting with a space. See https://github.com/Microsoft/TypeScript/pull/20547 return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true }; case 5 /* None */: @@ -84946,12 +85388,11 @@ var ts; * excludes array-like types or callable/constructable types. */ function getPropertiesForCompletion(type, checker, isForAccess) { - if (!(type.flags & 131072 /* Union */)) { + if (!(type.isUnion())) { return ts.Debug.assertEachDefined(type.getApparentProperties(), "getApparentProperties() should all be defined"); } - var types = type.types; // If we're providing completions for an object literal, skip primitive, array-like, or callable types since those shouldn't be implemented by object literals. - var filteredTypes = isForAccess ? types : types.filter(function (memberType) { + var filteredTypes = isForAccess ? type.types : type.types.filter(function (memberType) { return !(memberType.flags & 16382 /* Primitive */ || checker.isArrayLikeType(memberType) || ts.typeHasCallOrConstructSignatures(memberType, checker)); }); return ts.Debug.assertEachDefined(checker.getAllPossiblePropertiesOfTypes(filteredTypes), "getAllPossiblePropertiesOfTypes() should all be defined"); @@ -84963,7 +85404,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) { // class c { method() { } | method2() { } } switch (location.kind) { - case 293 /* SyntaxList */: + case 294 /* SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -85112,7 +85553,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 272 /* SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 273 /* SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -85144,16 +85585,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 225 /* SwitchStatement */: - if (statement.kind === 221 /* ContinueStatement */) { + case 226 /* SwitchStatement */: + if (statement.kind === 222 /* ContinueStatement */) { return false; } // falls through - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 217 /* WhileStatement */: - case 216 /* DoStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 218 /* WhileStatement */: + case 217 /* DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -85176,11 +85617,11 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 238 /* ModuleBlock */: - case 272 /* SourceFile */: - case 211 /* Block */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 239 /* ModuleBlock */: + case 273 /* SourceFile */: + case 212 /* Block */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */ && ts.isClassDeclaration(declaration)) { return declaration.members.concat([declaration]); @@ -85190,11 +85631,11 @@ var ts; } case 154 /* Constructor */: case 153 /* MethodDeclaration */: - case 232 /* FunctionDeclaration */: { + case 233 /* FunctionDeclaration */: { return container.parameters.concat((ts.isClassLike(container.parent) ? container.parent.members : [])); } - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: 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. @@ -85227,7 +85668,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 88 /* ForKeyword */, 106 /* WhileKeyword */, 81 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 216 /* DoStatement */) { + if (loopNode.kind === 217 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 106 /* WhileKeyword */)) { @@ -85247,13 +85688,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -85555,10 +85996,10 @@ var ts; } cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportEquals */ && parent.kind === 230 /* VariableDeclaration */) { + if (exportKind === 2 /* ExportEquals */ && parent.kind === 231 /* VariableDeclaration */) { var name = parent.name; if (name.kind === 71 /* Identifier */) { directImports.push(name); @@ -85569,12 +86010,12 @@ var ts; addIndirectUser(direct.getSourceFile()); } break; - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */)); break; - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 244 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 245 /* NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name); } else if (ts.isDefaultImport(direct)) { @@ -85588,7 +86029,7 @@ var ts; directImports.push(direct); } break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); @@ -85609,7 +86050,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 272 /* SourceFile */ || sourceFileLike.kind === 237 /* ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 273 /* SourceFile */ || sourceFileLike.kind === 238 /* ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUsers(sourceFileLike); } @@ -85664,7 +86105,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 241 /* ImportEqualsDeclaration */) { + if (decl.kind === 242 /* ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -85678,7 +86119,7 @@ var ts; if (decl.moduleSpecifier.kind !== 9 /* StringLiteral */) { return; } - if (decl.kind === 248 /* ExportDeclaration */) { + if (decl.kind === 249 /* ExportDeclaration */) { searchForNamedImport(decl.exportClause); return; } @@ -85687,7 +86128,7 @@ var ts; return; } var namedBindings = importClause.namedBindings; - if (namedBindings && namedBindings.kind === 244 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 245 /* NamespaceImport */) { handleNamespaceImportLike(namedBindings.name); return; } @@ -85739,7 +86180,7 @@ var ts; } } else { - var localSymbol = element.kind === 250 /* ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 251 /* 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); @@ -85755,7 +86196,7 @@ var ts; function findNamespaceReExports(sourceFileLike, name, checker) { var namespaceImportSymbol = checker.getSymbolAtLocation(name); return forEachPossibleImportOrExportStatement(sourceFileLike, function (statement) { - if (statement.kind !== 248 /* ExportDeclaration */) + if (statement.kind !== 249 /* ExportDeclaration */) return; var _a = statement, exportClause = _a.exportClause, moduleSpecifier = _a.moduleSpecifier; if (moduleSpecifier || !exportClause) @@ -85774,7 +86215,7 @@ var ts; for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { var referencingFile = sourceFiles_4[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if (searchSourceFile.kind === 272 /* SourceFile */) { + if (searchSourceFile.kind === 273 /* SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -85821,7 +86262,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 === 272 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 273 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -85836,20 +86277,18 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 248 /* ExportDeclaration */: - case 242 /* ImportDeclaration */: { + case 249 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: { var decl = statement; - if (decl.moduleSpecifier && decl.moduleSpecifier.kind === 9 /* StringLiteral */) { + if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 241 /* ImportEqualsDeclaration */: { + case 242 /* ImportEqualsDeclaration */: { var decl = statement; - var moduleReference = decl.moduleReference; - if (moduleReference.kind === 252 /* ExternalModuleReference */ && - moduleReference.expression.kind === 9 /* StringLiteral */) { - action(decl, moduleReference.expression); + if (isExternalModuleImportEquals(decl)) { + action(decl, decl.moduleReference.expression); } break; } @@ -85869,7 +86308,7 @@ var ts; function getExport() { var parent = node.parent; if (symbol.exportSymbol) { - if (parent.kind === 183 /* PropertyAccessExpression */) { + if (parent.kind === 184 /* 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 symbol.declarations.some(function (d) { return d === parent; }) && ts.isBinaryExpression(parent.parent) @@ -85985,10 +86424,10 @@ var ts; // 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. function getExportNode(parent, node) { - if (parent.kind === 230 /* VariableDeclaration */) { + if (parent.kind === 231 /* VariableDeclaration */) { var p = parent; return p.name !== node ? undefined : - p.parent.kind === 267 /* CatchClause */ ? undefined : p.parent.parent.kind === 212 /* VariableStatement */ ? p.parent.parent : undefined; + p.parent.kind === 268 /* CatchClause */ ? undefined : p.parent.parent.kind === 213 /* VariableStatement */ ? p.parent.parent : undefined; } else { return parent; @@ -85997,15 +86436,15 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent) ? { isNamedImport: false } : undefined; - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return parent.propertyName ? undefined : { isNamedImport: true }; - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: ts.Debug.assert(parent.name === node); return { isNamedImport: false }; default: @@ -86047,22 +86486,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 185 /* CallExpression */) { + if (node.kind === 186 /* CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 272 /* SourceFile */) { + if (parent.kind === 273 /* SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 238 /* ModuleBlock */); + ts.Debug.assert(parent.kind === 239 /* ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */; + return node.kind === 238 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */; } - function isExternalModuleImportEquals(_a) { - var moduleReference = _a.moduleReference; - return moduleReference.kind === 252 /* ExternalModuleReference */ && moduleReference.expression.kind === 9 /* StringLiteral */; + function isExternalModuleImportEquals(eq) { + return eq.moduleReference.kind === 253 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 9 /* StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -86096,13 +86534,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* 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 === 269 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 270 /* ShorthandPropertyAssignment */) { var result_5 = []; FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_5.push(nodeEntry(node)); }); return result_5; @@ -86204,13 +86642,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 182 /* ObjectLiteralExpression */) { + else if (node.kind === 183 /* ObjectLiteralExpression */) { return { kind: "interface" /* interfaceElement */, displayParts: [ts.punctuationPart(19 /* OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(20 /* CloseParenToken */)] }; } - else if (node.kind === 203 /* ClassExpression */) { + else if (node.kind === 204 /* ClassExpression */) { return { kind: "local class" /* localClassElement */, displayParts: [ts.punctuationPart(19 /* OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(20 /* CloseParenToken */)] @@ -86289,12 +86727,12 @@ var ts; return false; } switch (node.parent.kind) { - case 237 /* ModuleDeclaration */: - case 252 /* ExternalModuleReference */: - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 238 /* ModuleDeclaration */: + case 253 /* ExternalModuleReference */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return true; - case 185 /* CallExpression */: + case 186 /* CallExpression */: return ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false) || ts.isImportCall(node.parent); default: return false; @@ -86317,10 +86755,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 272 /* SourceFile */: + case 273 /* 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 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: references.push({ type: "node", node: decl.name }); break; default: @@ -86411,7 +86849,7 @@ var ts; return ts.firstDefined(symbol.declarations, function (decl) { if (!decl.parent) { // Assertions for GH#21814. We should be handling SourceFile symbols in `getReferencedSymbolsForModule` instead of getting here. - ts.Debug.assert(decl.kind === 272 /* SourceFile */); + ts.Debug.assert(decl.kind === 273 /* SourceFile */); ts.Debug.fail("Unexpected symbol at " + ts.Debug.showSyntaxKind(node) + ": " + ts.Debug.showSymbol(symbol)); } return ts.isTypeLiteralNode(decl.parent) && ts.isUnionTypeNode(decl.parent.parent) @@ -86577,9 +87015,9 @@ var ts; checker.getPropertySymbolOfDestructuringAssignment(location); } function getObjectBindingElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 180 /* BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 181 /* BindingElement */); if (bindingElement && - bindingElement.parent.kind === 178 /* ObjectBindingPattern */ && + bindingElement.parent.kind === 179 /* ObjectBindingPattern */ && !bindingElement.propertyName) { return bindingElement; } @@ -86609,7 +87047,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 === 190 /* FunctionExpression */ || valueDeclaration.kind === 203 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 191 /* FunctionExpression */ || valueDeclaration.kind === 204 /* ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -86619,7 +87057,7 @@ var ts; if (flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasModifier(d, 8 /* Private */); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 233 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 234 /* ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -86648,7 +87086,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 272 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 273 /* 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; @@ -87010,7 +87448,7 @@ var ts; if (refNode.kind !== 71 /* Identifier */) { return; } - if (refNode.parent.kind === 269 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 270 /* ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -87029,7 +87467,7 @@ var ts; } else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { var body = parent.body; - if (body.kind === 211 /* Block */) { + if (body.kind === 212 /* Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { addReference(returnStatement.expression); @@ -87052,7 +87490,7 @@ var ts; if (componentType.symbol && componentType.symbol.getFlags() & (32 /* Class */ | 64 /* Interface */)) { result.push(componentType.symbol); } - if (componentType.getFlags() & 393216 /* UnionOrIntersection */) { + if (componentType.isUnionOrIntersection()) { getSymbolsForClassAndInterfaceComponents(componentType, result); } } @@ -87070,12 +87508,12 @@ var ts; } function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { - if (node.kind === 205 /* ExpressionWithTypeArguments */ - && node.parent.kind === 266 /* HeritageClause */ + if (node.kind === 206 /* ExpressionWithTypeArguments */ + && node.parent.kind === 267 /* HeritageClause */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } - else if (node.kind === 71 /* Identifier */ || node.kind === 183 /* PropertyAccessExpression */) { + else if (node.kind === 71 /* Identifier */ || node.kind === 184 /* PropertyAccessExpression */) { return getContainingClassIfInHeritageClause(node.parent); } } @@ -87086,13 +87524,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 191 /* ArrowFunction */: - case 190 /* FunctionExpression */: - case 182 /* ObjectLiteralExpression */: - case 203 /* ClassExpression */: - case 181 /* ArrayLiteralExpression */: + case 192 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 183 /* ObjectLiteralExpression */: + case 204 /* ClassExpression */: + case 182 /* ArrayLiteralExpression */: return true; default: return false; @@ -87191,13 +87629,13 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // falls through - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* 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. @@ -87205,11 +87643,11 @@ var ts; return undefined; } var references = []; - for (var _i = 0, _a = searchSpaceNode.kind === 272 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()]; _i < _a.length; _i++) { + for (var _i = 0, _a = searchSpaceNode.kind === 273 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()]; _i < _a.length; _i++) { var sourceFile = _a[_i]; cancellationToken.throwIfCancellationRequested(); var positions = getPossibleSymbolReferencePositions(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode); - getThisReferencesInFile(sourceFile, searchSpaceNode.kind === 272 /* SourceFile */ ? sourceFile : searchSpaceNode, positions, staticFlag, references); + getThisReferencesInFile(sourceFile, searchSpaceNode.kind === 273 /* SourceFile */ ? sourceFile : searchSpaceNode, positions, staticFlag, references); } return [{ definition: { type: "this", node: thisOrSuperKeyword }, @@ -87224,8 +87662,8 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(FindAllReferences.nodeEntry(node)); } @@ -87236,16 +87674,16 @@ var ts; result.push(FindAllReferences.nodeEntry(node)); } break; - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { result.push(FindAllReferences.nodeEntry(node)); } break; - case 272 /* SourceFile */: - if (container.kind === 272 /* SourceFile */ && !ts.isExternalModule(container)) { + case 273 /* SourceFile */: + if (container.kind === 273 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(FindAllReferences.nodeEntry(node)); } break; @@ -87275,7 +87713,7 @@ var ts; // If the location is name of property symbol from object literal destructuring pattern // Search the property symbol // for ( { property: p2 } of elems) { } - if (containingObjectLiteralElement.kind !== 269 /* ShorthandPropertyAssignment */) { + if (containingObjectLiteralElement.kind !== 270 /* ShorthandPropertyAssignment */) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); if (propertySymbol) { result.push(propertySymbol); @@ -87326,7 +87764,7 @@ var ts; result.push(rootSymbol); // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, result, /*previousIterationSymbolsCache*/ ts.createSymbolTable(), checker); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, result); } } } @@ -87344,36 +87782,31 @@ var ts; * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. * The value of previousIterationSymbol is undefined when the function is first called. */ - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, checker) { - // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited - // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. - // For example: - // interface C extends C { - // /*findRef*/propName: string; - // } - // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, - // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, - // the function will add any found symbol of the property-name, then its sub-routine will call - // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already - // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. - if (!symbol || previousIterationSymbolsCache.has(symbol.escapedName)) { - return; - } - if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + function getPropertySymbolsFromBaseTypes(symbol, propertyName, checker, result) { + if (result === void 0) { result = []; } + var seen = ts.createMap(); + recur(symbol); + return result; + function recur(symbol) { + // Use `addToSeen` to ensure we don't infinitely recurse in this situation: + // interface C extends C { + // /*findRef*/propName: string; + // } + if (!(symbol.flags & (32 /* Class */ | 64 /* Interface */)) || !ts.addToSeen(seen, ts.getSymbolId(symbol))) + return; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; for (var _b = 0, _c = ts.getAllSuperTypeNodes(declaration); _b < _c.length; _b++) { var typeReference = _c[_b]; var type = checker.getTypeAtLocation(typeReference); - if (!type) + if (!(type && type.symbol)) continue; var propertySymbol = checker.getPropertyOfType(type, propertyName); if (propertySymbol) { result.push.apply(result, checker.getRootSymbols(propertySymbol)); } // Visit the typeReference as well to see if it directly or indirectly use that property - previousIterationSymbolsCache.set(symbol.escapedName, symbol); - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, checker); + recur(type.symbol); } } } @@ -87437,32 +87870,19 @@ var ts; if (search.parents && !ts.some(search.parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker); })) { return undefined; } - var result = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, result, /*previousIterationSymbolsCache*/ ts.createSymbolTable(), checker); - return result.some(search.includes) ? rootSymbol : undefined; + return getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker).some(search.includes) ? rootSymbol : undefined; } return undefined; }); } } - function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 146 /* ComputedPropertyName */) { - var nameExpression = node.name.expression; - // treat computed property names where expression is string/numeric literal as just string/numeric literal - if (ts.isStringOrNumericLiteral(nameExpression)) { - return nameExpression.text; - } - return undefined; - } - return ts.getTextOfIdentifierOrLiteral(node.name); - } /** Gets all symbols for one property. Does not get symbols for every property. */ function getPropertySymbolsFromContextualType(node, checker) { var contextualType = checker.getContextualType(node.parent); - var name = getNameFromObjectLiteralElement(node); + var name = ts.getNameFromPropertyName(node.name); var symbol = contextualType && name && contextualType.getProperty(name); return symbol ? [symbol] : - contextualType && contextualType.flags & 131072 /* Union */ ? ts.mapDefined(contextualType.types, function (t) { return t.getProperty(name); }) : ts.emptyArray; + contextualType && contextualType.isUnion() ? ts.mapDefined(contextualType.types, function (t) { return t.getProperty(name); }) : ts.emptyArray; } /** * Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations @@ -87535,19 +87955,12 @@ var ts; */ function getParentSymbolsOfPropertyAccess(location, symbol, checker) { var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(location); - if (!propertyAccessExpression) { - return undefined; - } - var localParentType = checker.getTypeAtLocation(propertyAccessExpression.expression); - if (!localParentType) { - return undefined; - } - if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== symbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 393216 /* UnionOrIntersection */) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } + var localParentType = propertyAccessExpression && checker.getTypeAtLocation(propertyAccessExpression.expression); + return localParentType && localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== symbol.parent + ? [localParentType.symbol] + : localParentType && localParentType.isUnionOrIntersection() + ? getSymbolsForClassAndInterfaceComponents(localParentType) + : undefined; } })(Core = FindAllReferences.Core || (FindAllReferences.Core = {})); })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); @@ -87597,7 +88010,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 === 269 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 270 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -87673,7 +88086,7 @@ var ts; if (!type) { return undefined; } - if (type.flags & 131072 /* Union */ && !(type.flags & 16 /* Enum */)) { + if (type.isUnion() && !(type.flags & 16 /* Enum */)) { return ts.flatMap(type.types, function (t) { return t.symbol && getDefinitionFromSymbol(typeChecker, t.symbol, node); }); } return type.symbol && getDefinitionFromSymbol(typeChecker, type.symbol, node); @@ -87707,11 +88120,11 @@ var ts; return true; } switch (declaration.kind) { - case 243 /* ImportClause */: - case 241 /* ImportEqualsDeclaration */: + case 244 /* ImportClause */: + case 242 /* ImportEqualsDeclaration */: return true; - case 246 /* ImportSpecifier */: - return declaration.parent.kind === 245 /* NamedImports */; + case 247 /* ImportSpecifier */: + return declaration.parent.kind === 246 /* NamedImports */; default: return false; } @@ -87746,7 +88159,7 @@ var ts; switch (node.kind) { case 154 /* Constructor */: case 158 /* ConstructSignature */: - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: return true; @@ -87898,9 +88311,9 @@ var ts; JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 292 /* JSDocPropertyTag */: + case 293 /* JSDocPropertyTag */: return [declaration]; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return [declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -87921,15 +88334,15 @@ var ts; function getCommentText(tag) { var comment = tag.comment; switch (tag.kind) { - case 285 /* JSDocAugmentsTag */: + case 286 /* JSDocAugmentsTag */: return withNode(tag.class); - case 290 /* JSDocTemplateTag */: + case 291 /* JSDocTemplateTag */: return withList(tag.typeParameters); - case 289 /* JSDocTypeTag */: + case 290 /* JSDocTypeTag */: return withNode(tag.typeExpression); - case 291 /* JSDocTypedefTag */: - case 292 /* JSDocPropertyTag */: - case 287 /* JSDocParameterTag */: + case 292 /* JSDocTypedefTag */: + case 293 /* JSDocPropertyTag */: + case 288 /* JSDocParameterTag */: var name = tag.name; return name ? withNode(name) : comment; default: @@ -88112,20 +88525,20 @@ var ts; function getCommentOwnerInfo(tokenAtPos) { for (var commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: case 152 /* MethodSignature */: var parameters = commentOwner.parameters; return { commentOwner: commentOwner, parameters: parameters }; - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: case 150 /* PropertySignature */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 235 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 236 /* TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 212 /* VariableStatement */: { + case 213 /* VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; var parameters_1 = varDeclarations.length === 1 && varDeclarations[0].initializer @@ -88133,14 +88546,14 @@ var ts; : undefined; return { commentOwner: commentOwner, parameters: parameters_1 }; } - case 272 /* SourceFile */: + case 273 /* SourceFile */: return undefined; - case 237 /* ModuleDeclaration */: + case 238 /* 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 === 237 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 198 /* BinaryExpression */: { + return commentOwner.parent.kind === 238 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 199 /* BinaryExpression */: { var be = commentOwner; if (ts.getSpecialPropertyAssignmentKind(be) === 0 /* None */) { return undefined; @@ -88160,14 +88573,14 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 189 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 190 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return rightHandSide.parameters; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; if (member.kind === 154 /* Constructor */) { @@ -88566,16 +88979,14 @@ var ts; continue; } } - var matchKind = bestMatchKind(containerMatches); - var isCaseSensitive = allMatchesAreCaseSensitive(containerMatches); - rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: isCaseSensitive, declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: Math.min.apply(Math, matches.map(function (m) { return m.kind; })), isCaseSensitive: matches.every(function (m) { return m.isCaseSensitive; }), declaration: declaration }); } } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 243 /* ImportClause */: - case 246 /* ImportSpecifier */: - case 241 /* ImportEqualsDeclaration */: + case 244 /* ImportClause */: + case 247 /* ImportSpecifier */: + case 242 /* ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -88583,17 +88994,6 @@ var ts; return true; } } - function allMatchesAreCaseSensitive(matches) { - ts.Debug.assert(matches.length > 0); - // This is a case sensitive match, only if all the submatches were case sensitive. - for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { - var match = matches_1[_i]; - if (!match.isCaseSensitive) { - return false; - } - } - return true; - } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); if (name && ts.isPropertyNameLiteral(name)) { @@ -88632,10 +89032,8 @@ 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.kind === 146 /* ComputedPropertyName */) { - if (!tryAddComputedPropertyName(name.expression, containers, /*includeLastPortion*/ false)) { - return undefined; - } + if (name.kind === 146 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers, /*includeLastPortion*/ false)) { + return undefined; } // Now, walk up our containers, adding all their names to the container array. declaration = ts.getContainerNode(declaration); @@ -88647,18 +89045,6 @@ var ts; } return containers; } - function bestMatchKind(matches) { - ts.Debug.assert(matches.length > 0); - var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) { - var match = matches_2[_i]; - var kind = match.kind; - if (kind < bestMatchKind) { - bestMatchKind = kind; - } - } - return bestMatchKind; - } function compareNavigateToItems(i1, i2) { // TODO(cyrusn): get the gamut of comparisons that VS already uses here. return ts.compareValues(i1.matchKind, i2.matchKind) @@ -88839,7 +89225,7 @@ var ts; addLeafNode(node); } break; - case 243 /* ImportClause */: + case 244 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -88851,7 +89237,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 244 /* NamespaceImport */) { + if (namedBindings.kind === 245 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -88862,8 +89248,8 @@ var ts; } } break; - case 180 /* BindingElement */: - case 230 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 231 /* VariableDeclaration */: var _d = node, name = _d.name, initializer = _d.initializer; if (ts.isBindingPattern(name)) { addChildrenRecursively(name); @@ -88884,12 +89270,12 @@ var ts; addNodeWithRecursiveChild(node, initializer); } break; - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -88899,9 +89285,9 @@ var ts; } endNode(); break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -88909,18 +89295,18 @@ var ts; } endNode(); break; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 250 /* ExportSpecifier */: - case 241 /* ImportEqualsDeclaration */: + case 251 /* ExportSpecifier */: + case 242 /* ImportEqualsDeclaration */: case 159 /* IndexSignature */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: addLeafNode(node); break; - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var special = ts.getSpecialPropertyAssignmentKind(node); switch (special) { case 1 /* ExportsProperty */: @@ -88942,7 +89328,7 @@ var ts; if (ts.hasJSDocNodes(node)) { ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 291 /* JSDocTypedefTag */) { + if (tag.kind === 292 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -89004,7 +89390,7 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: return ts.hasModifier(a, 32 /* Static */) === ts.hasModifier(b, 32 /* Static */); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return areSameModule(a, b); default: return true; @@ -89013,7 +89399,7 @@ var ts; // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes. // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { - return a.body.kind === b.body.kind && (a.body.kind !== 237 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 238 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -89043,7 +89429,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 237 /* ModuleDeclaration */) { + if (node.kind === 238 /* ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -89051,18 +89437,18 @@ var ts; return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); } switch (node.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 203 /* ClassExpression */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 204 /* ClassExpression */: return getFunctionOrClassName(node); - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 237 /* ModuleDeclaration */) { + if (node.kind === 238 /* ModuleDeclaration */) { return getModuleName(node); } var name = ts.getNameOfDeclaration(node); @@ -89073,16 +89459,16 @@ var ts; } } switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; } @@ -89098,7 +89484,7 @@ var ts; return "()"; case 159 /* IndexSignature */: return "[]"; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -89110,7 +89496,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 212 /* VariableStatement */) { + if (parentNode && parentNode.kind === 213 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 71 /* Identifier */) { @@ -89139,24 +89525,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 236 /* EnumDeclaration */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 272 /* SourceFile */: - case 235 /* TypeAliasDeclaration */: - case 291 /* JSDocTypedefTag */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 237 /* EnumDeclaration */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 273 /* SourceFile */: + case 236 /* TypeAliasDeclaration */: + case 292 /* JSDocTypedefTag */: return true; case 154 /* Constructor */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return hasSomeImportantChild(item); - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -89166,8 +89552,8 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 238 /* ModuleBlock */: - case 272 /* SourceFile */: + case 239 /* ModuleBlock */: + case 273 /* SourceFile */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: return true; @@ -89178,7 +89564,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 230 /* VariableDeclaration */ && childKind !== 180 /* BindingElement */; + return childKind !== 231 /* VariableDeclaration */ && childKind !== 181 /* BindingElement */; }); } } @@ -89234,7 +89620,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 237 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 238 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -89245,16 +89631,16 @@ var ts; * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again. */ function getInteriorModule(decl) { - return decl.body.kind === 237 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 238 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { return !member.name || member.name.kind === 146 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 272 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 273 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 230 /* VariableDeclaration */) { + if (node.parent && node.parent.kind === 231 /* VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -89264,16 +89650,16 @@ var ts; return ts.declarationNameToString(node.name); } // See if it is a var initializer. If so, use the var name. - else if (node.parent.kind === 230 /* VariableDeclaration */) { + else if (node.parent.kind === 231 /* VariableDeclaration */) { return ts.declarationNameToString(node.parent.name); } // See if it is of the form " = function(){...}". If so, use the text from the left-hand side. - else if (node.parent.kind === 198 /* BinaryExpression */ && + else if (node.parent.kind === 199 /* BinaryExpression */ && node.parent.operatorToken.kind === 58 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } // See if it is a property assignment, and if so use the property name - else if (node.parent.kind === 268 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 269 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } // Default exports are named "default" @@ -89286,9 +89672,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 191 /* ArrowFunction */: - case 190 /* FunctionExpression */: - case 203 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 204 /* ClassExpression */: return true; default: return false; @@ -89625,24 +90011,24 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 211 /* Block */: + case 212 /* Block */: if (ts.isFunctionBlock(n)) { - return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 191 /* ArrowFunction */); + return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 192 /* ArrowFunction */); } // Check if the block is standalone, or 'attached' to some parent statement. // 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 216 /* DoStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 218 /* ForStatement */: - case 215 /* IfStatement */: - case 217 /* WhileStatement */: - case 224 /* WithStatement */: - case 267 /* CatchClause */: + case 217 /* DoStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 219 /* ForStatement */: + case 216 /* IfStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: + case 268 /* CatchClause */: return spanForNode(n.parent); - case 228 /* TryStatement */: + case 229 /* TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -89657,16 +90043,16 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile)); } - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return spanForNode(n.parent); - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 239 /* CaseBlock */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 240 /* CaseBlock */: return spanForNode(n); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 21 /* OpenBracketToken */); } function spanForObjectOrArrayLiteral(node, open) { @@ -89709,12 +90095,10 @@ var ts; PatternMatchKind[PatternMatchKind["substring"] = 2] = "substring"; PatternMatchKind[PatternMatchKind["camelCase"] = 3] = "camelCase"; })(PatternMatchKind = ts.PatternMatchKind || (ts.PatternMatchKind = {})); - function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) { + function createPatternMatch(kind, isCaseSensitive) { return { kind: kind, - punctuationStripped: punctuationStripped, - isCaseSensitive: isCaseSensitive, - camelCaseWeight: camelCaseWeight + isCaseSensitive: isCaseSensitive }; } function createPatternMatcher(pattern) { @@ -89727,304 +90111,237 @@ var ts; var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { - getMatches: getMatches, - getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern, + getMatches: function (containers, candidate) { return skipMatch(candidate) ? undefined : getMatches(containers, candidate, dotSeparatedSegments, stringToWordSpans); }, + getMatchesForLastSegmentOfPattern: function (candidate) { return skipMatch(candidate) ? undefined : matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments), stringToWordSpans); }, patternContainsDots: dotSeparatedSegments.length > 1 }; // Quick checks so we can bail out when asked to match a candidate. function skipMatch(candidate) { return invalidPattern || !candidate; } - function getMatchesForLastSegmentOfPattern(candidate) { - if (skipMatch(candidate)) { - return undefined; - } - return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); - } - function getMatches(candidateContainers, candidate) { - if (skipMatch(candidate)) { - return undefined; - } - // First, check that the last part of the dot separated pattern matches the name of the - // candidate. If not, then there's no point in proceeding and doing the more - // expensive work. - var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); - if (!candidateMatch) { - return undefined; - } - candidateContainers = candidateContainers || []; - // -1 because the last part was checked against the name, and only the rest - // of the parts are checked against the container. - if (dotSeparatedSegments.length - 1 > candidateContainers.length) { - // There weren't enough container parts to match against the pattern parts. - // So this definitely doesn't match. - return undefined; - } - // So far so good. Now break up the container for the candidate and check if all - // the dotted parts match up correctly. - var totalMatch = candidateMatch; - for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { - var segment = dotSeparatedSegments[i]; - var containerName = candidateContainers[j]; - var containerMatch = matchSegment(containerName, segment); - if (!containerMatch) { - // This container didn't match the pattern piece. So there's no match at all. - return undefined; - } - ts.addRange(totalMatch, containerMatch); - } - // Success, this symbol's full name matched against the dotted name the user was asking - // about. - return totalMatch; - } - function getWordSpans(word) { - var spans = stringToWordSpans.get(word); - if (!spans) { - stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); - } - return spans; - } - function matchTextChunk(candidate, chunk, punctuationStripped) { - var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); - if (index === 0) { - if (chunk.text.length === candidate.length) { - // a) Check if the part matches the candidate entirely, in an case insensitive or - // sensitive manner. If it does, return that there was an exact match. - return createPatternMatch(PatternMatchKind.exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text); - } - else { - // b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive - // manner. If it does, return that there was a prefix match. - return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text)); - } - } - var isLowercase = chunk.isLowerCase; - if (isLowercase) { - if (index > 0) { - // c) If the part is entirely lowercase, then check if it is contained anywhere in the - // candidate in a case insensitive manner. If so, return that there was a substring - // match. - // - // Note: We only have a substring match if the lowercase part is prefix match of some - // word part. That way we don't match something like 'Class' when the user types 'a'. - // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). - var wordSpans = getWordSpans(candidate); - for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { - var span = wordSpans_1[_i]; - if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, - /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); - } - } - } - } - else { - // d) If the part was not entirely lowercase, then check if it is contained in the - // candidate in a case *sensitive* manner. If so, return that there was a substring - // match. - if (candidate.indexOf(chunk.text) > 0) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ true); - } - } - if (!isLowercase) { - // e) If the part was not entirely lowercase, then attempt a camel cased match as well. - if (chunk.characterSpans.length > 0) { - var candidateParts = getWordSpans(candidate); - var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); - if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); - } - camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true); - if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); - } - } - } - if (isLowercase) { - // f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? - // We could check every character boundary start of the candidate for the pattern. However, that's - // an m * n operation in the wost case. Instead, find the first instance of the pattern - // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to - // filter the list based on a substring that starts on a capital letter and also with a lowercase one. - // (Pattern: fogbar, Candidate: quuxfogbarFogBar). - if (chunk.text.length < candidate.length) { - if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ false); - } - } - } + } + ts.createPatternMatcher = createPatternMatcher; + function getMatches(candidateContainers, candidate, dotSeparatedSegments, stringToWordSpans) { + // First, check that the last part of the dot separated pattern matches the name of the + // candidate. If not, then there's no point in proceeding and doing the more + // expensive work. + var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments), stringToWordSpans); + if (!candidateMatch) { return undefined; } - function containsSpaceOrAsterisk(text) { - for (var i = 0; i < text.length; i++) { - var ch = text.charCodeAt(i); - if (ch === 32 /* space */ || ch === 42 /* asterisk */) { - return true; - } - } - return false; + candidateContainers = candidateContainers || []; + // -1 because the last part was checked against the name, and only the rest + // of the parts are checked against the container. + if (dotSeparatedSegments.length - 1 > candidateContainers.length) { + // There weren't enough container parts to match against the pattern parts. + // So this definitely doesn't match. + return undefined; } - function matchSegment(candidate, segment) { - // First check if the segment matches as is. This is also useful if the segment contains - // characters we would normally strip when splitting into parts that we also may want to - // match in the candidate. For example if the segment is "@int" and the candidate is - // "@int", then that will show up as an exact match here. - // - // Note: if the segment contains a space or an asterisk then we must assume that it's a - // multi-word segment. - if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { - var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); - if (match) { - return [match]; - } + // So far so good. Now break up the container for the candidate and check if all + // the dotted parts match up correctly. + var totalMatch = candidateMatch; + for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { + var segment = dotSeparatedSegments[i]; + var containerName = candidateContainers[j]; + var containerMatch = matchSegment(containerName, segment, stringToWordSpans); + if (!containerMatch) { + // This container didn't match the pattern piece. So there's no match at all. + return undefined; } - // The logic for pattern matching is now as follows: - // - // 1) Break the segment passed in into words. Breaking is rather simple and a - // good way to think about it that if gives you all the individual alphanumeric words - // of the pattern. - // - // 2) For each word try to match the word against the candidate value. - // - // 3) Matching is as follows: - // - // a) Check if the word matches the candidate entirely, in an case insensitive or - // sensitive manner. If it does, return that there was an exact match. - // - // b) Check if the word is a prefix of the candidate, in a case insensitive or - // sensitive manner. If it does, return that there was a prefix match. - // - // c) If the word is entirely lowercase, then check if it is contained anywhere in the - // candidate in a case insensitive manner. If so, return that there was a substring - // match. - // - // Note: We only have a substring match if the lowercase part is prefix match of - // some word part. That way we don't match something like 'Class' when the user - // types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with - // 'a'). - // - // d) If the word was not entirely lowercase, then check if it is contained in the - // candidate in a case *sensitive* manner. If so, return that there was a substring - // match. - // - // e) If the word was not entirely lowercase, then attempt a camel cased match as - // well. - // - // f) The word is all lower case. Is it a case insensitive substring of the candidate starting - // on a part boundary of the candidate? - // - // Only if all words have some sort of match is the pattern considered matched. - var subWordTextChunks = segment.subWordTextChunks; - var matches; - for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { - var subWordTextChunk = subWordTextChunks_1[_i]; - // Try to match the candidate with this word - var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); - if (!result) { - return undefined; - } - matches = matches || []; - matches.push(result); - } - return matches; + ts.addRange(totalMatch, containerMatch); } - function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { - var patternPartStart = patternSpan ? patternSpan.start : 0; - var patternPartLength = patternSpan ? patternSpan.length : pattern.length; - if (patternPartLength > candidateSpan.length) { - // Pattern part is longer than the candidate part. There can never be a match. - return false; - } - if (ignoreCase) { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (toLowerCase(ch1) !== toLowerCase(ch2)) { - return false; - } - } - } - else { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (ch1 !== ch2) { - return false; - } - } - } - return true; + // Success, this symbol's full name matched against the dotted name the user was asking + // about. + return totalMatch; + } + function getWordSpans(word, stringToWordSpans) { + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { - var chunkCharacterSpans = chunk.characterSpans; - // Note: we may have more pattern parts than candidate parts. This is because multiple - // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". - // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U - // and I will both match in UI. - var currentCandidate = 0; - var currentChunkSpan = 0; - var firstMatch; - var contiguous; - while (true) { - // Let's consider our termination cases - if (currentChunkSpan === chunkCharacterSpans.length) { - // We did match! We shall assign a weight to this - var weight = 0; - // Was this contiguous? - if (contiguous) { - weight += 1; - } - // Did we start at the beginning of the candidate? - if (firstMatch === 0) { - weight += 2; - } - return weight; + return spans; + } + function matchTextChunk(candidate, chunk, stringToWordSpans) { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + // a) Check if the word is a prefix of the candidate, in a case insensitive or + // sensitive manner. If it does, return that there was an exact match if the word and candidate are the same length, else a prefix match. + return createPatternMatch(chunk.text.length === candidate.length ? PatternMatchKind.exact : PatternMatchKind.prefix, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text)); + } + if (chunk.isLowerCase) { + if (index === -1) + return undefined; + // b) If the part is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of some + // word part. That way we don't match something like 'Class' when the user types 'a'. + // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). + var wordSpans = getWordSpans(candidate, stringToWordSpans); + for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { + var span = wordSpans_1[_i]; + if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { + return createPatternMatch(PatternMatchKind.substring, /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); } - else if (currentCandidate === candidateParts.length) { - // No match, since we still have more of the pattern to hit - return undefined; + } + // c) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? + // We could check every character boundary start of the candidate for the pattern. However, that's + // an m * n operation in the wost case. Instead, find the first instance of the pattern + // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to + // filter the list based on a substring that starts on a capital letter and also with a lowercase one. + // (Pattern: fogbar, Candidate: quuxfogbarFogBar). + if (chunk.text.length < candidate.length && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(PatternMatchKind.substring, /*isCaseSensitive:*/ false); + } + } + else { + // d) If the part was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(PatternMatchKind.substring, /*isCaseSensitive:*/ true); + } + // e) If the part was not entirely lowercase, then attempt a camel cased match as well. + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate, stringToWordSpans); + var isCaseSensitive = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false) ? true + : tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true) ? false : undefined; + if (isCaseSensitive !== undefined) { + return createPatternMatch(PatternMatchKind.camelCase, isCaseSensitive); } - var candidatePart = candidateParts[currentCandidate]; - var gotOneMatchThisCandidate = false; - // Consider the case of matching SiUI against SimpleUIElement. The candidate parts - // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' - // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to - // still keep matching pattern parts against that candidate part. - for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { - var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; - if (gotOneMatchThisCandidate) { - // We've already gotten one pattern part match in this candidate. We will - // only continue trying to consumer pattern parts if the last part and this - // part are both upper case. - if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || - !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { - break; - } - } - if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { - break; - } - gotOneMatchThisCandidate = true; - firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; - // If we were contiguous, then keep that value. If we weren't, then keep that - // value. If we don't know, then set the value to 'true' as an initial match is - // obviously contiguous. - contiguous = contiguous === undefined ? true : contiguous; - candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); - } - // Check if we matched anything at all. If we didn't, then we need to unset the - // contiguous bit if we currently had it set. - // If we haven't set the bit yet, then that means we haven't matched anything so - // far, and we don't want to change that. - if (!gotOneMatchThisCandidate && contiguous !== undefined) { - contiguous = false; - } - // Move onto the next candidate. - currentCandidate++; } } } - ts.createPatternMatcher = createPatternMatcher; + function matchSegment(candidate, segment, stringToWordSpans) { + // First check if the segment matches as is. This is also useful if the segment contains + // characters we would normally strip when splitting into parts that we also may want to + // match in the candidate. For example if the segment is "@int" and the candidate is + // "@int", then that will show up as an exact match here. + // + // Note: if the segment contains a space or an asterisk then we must assume that it's a + // multi-word segment. + if (every(segment.totalTextChunk.text, function (ch) { return ch !== 32 /* space */ && ch !== 42 /* asterisk */; })) { + var match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans); + if (match) { + return [match]; + } + } + // The logic for pattern matching is now as follows: + // + // 1) Break the segment passed in into words. Breaking is rather simple and a + // good way to think about it that if gives you all the individual alphanumeric words + // of the pattern. + // + // 2) For each word try to match the word against the candidate value. + // + // 3) Matching is as follows: + // + // a) Check if the word is a prefix of the candidate, in a case insensitive or + // sensitive manner. If it does, return that there was an exact match if the word and candidate are the same length, else a prefix match. + // + // If the word is entirely lowercase: + // b) Then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of + // some word part. That way we don't match something like 'Class' when the user + // types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with + // 'a'). + // + // c) The word is all lower case. Is it a case insensitive substring of the candidate starting + // on a part boundary of the candidate? + // + // Else: + // d) If the word was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + // + // e) If the word was not entirely lowercase, then attempt a camel cased match as + // well. + // + // Only if all words have some sort of match is the pattern considered matched. + var subWordTextChunks = segment.subWordTextChunks; + var matches; + for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { + var subWordTextChunk = subWordTextChunks_1[_i]; + // Try to match the candidate with this word + var result = matchTextChunk(candidate, subWordTextChunk, stringToWordSpans); + if (!result) { + return undefined; + } + matches = matches || []; + matches.push(result); + } + return matches; + } + function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { + if (patternSpan === void 0) { patternSpan = { start: 0, length: pattern.length }; } + return patternSpan.length <= candidateSpan.length // If pattern part is longer than the candidate part there can never be a match. + && everyInRange(0, patternSpan.length, function (i) { return equalChars(pattern.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase); }); + } + function equalChars(ch1, ch2, ignoreCase) { + return ignoreCase ? toLowerCase(ch1) === toLowerCase(ch2) : ch1 === ch2; + } + function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { + var chunkCharacterSpans = chunk.characterSpans; + // Note: we may have more pattern parts than candidate parts. This is because multiple + // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". + // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U + // and I will both match in UI. + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch; + var contiguous; + while (true) { + // Let's consider our termination cases + if (currentChunkSpan === chunkCharacterSpans.length) { + return true; + } + else if (currentCandidate === candidateParts.length) { + // No match, since we still have more of the pattern to hit + return false; + } + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + // Consider the case of matching SiUI against SimpleUIElement. The candidate parts + // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' + // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to + // still keep matching pattern parts against that candidate part. + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + if (gotOneMatchThisCandidate) { + // We've already gotten one pattern part match in this candidate. We will + // only continue trying to consumer pattern parts if the last part and this + // part are both upper case. + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + gotOneMatchThisCandidate = true; + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + // If we were contiguous, then keep that value. If we weren't, then keep that + // value. If we don't know, then set the value to 'true' as an initial match is + // obviously contiguous. + contiguous = contiguous === undefined ? true : contiguous; + candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + // Check if we matched anything at all. If we didn't, then we need to unset the + // contiguous bit if we currently had it set. + // If we haven't set the bit yet, then that means we haven't matched anything so + // far, and we don't want to change that. + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + // Move onto the next candidate. + currentCandidate++; + } + } function createSegment(text) { return { totalTextChunk: createTextChunk(text), @@ -90064,24 +90381,18 @@ var ts; // Assumes 'value' is already lowercase. function indexOfIgnoringCase(str, value) { var n = str.length - value.length; - for (var i = 0; i <= n; i++) { - if (startsWithIgnoringCase(str, value, i)) { - return i; + var _loop_10 = function (start) { + if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) { + return { value: start }; } + }; + for (var start = 0; start <= n; start++) { + var state_3 = _loop_10(start); + if (typeof state_3 === "object") + return state_3.value; } return -1; } - // Assumes 'value' is already lowercase. - function startsWithIgnoringCase(str, value, start) { - for (var i = 0; i < value.length; i++) { - var ch1 = toLowerCase(str.charCodeAt(i + start)); - var ch2 = value.charCodeAt(i); - if (ch1 !== ch2) { - return false; - } - } - return true; - } function toLowerCase(ch) { // Fast convert for the ascii range. if (ch >= 65 /* A */ && ch <= 90 /* Z */) { @@ -90149,7 +90460,7 @@ var ts; var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); - var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + var hasTransitionFromUpperToLower = word && transitionFromUpperToLower(identifier, i, wordStart); if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit !== currentIsDigit || @@ -90196,46 +90507,28 @@ var ts; return false; } function isAllPunctuation(identifier, start, end) { - for (var i = start; i < end; i++) { - var ch = identifier.charCodeAt(i); - // We don't consider _ or $ as punctuation as there may be things with that name. - if (!charIsPunctuation(ch) || ch === 95 /* _ */ || ch === 36 /* $ */) { - return false; - } - } - return true; + return every(identifier, function (ch) { return charIsPunctuation(ch) && ch !== 95 /* _ */; }, start, end); } - function transitionFromUpperToLower(identifier, word, index, wordStart) { - if (word) { - // Cases this supports: - // 1) IDisposable -> I, Disposable - // 2) UIElement -> UI, Element - // 3) HTMLDocument -> HTML, Document - // - // etc. - if (index !== wordStart && - index + 1 < identifier.length) { - var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); - if (currentIsUpper && nextIsLower) { - // We have a transition from an upper to a lower letter here. But we only - // want to break if all the letters that preceded are uppercase. i.e. if we - // have "Foo" we don't want to break that into "F, oo". But if we have - // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, - // Foo". i.e. the last uppercase letter belongs to the lowercase letters - // that follows. Note: this will make the following not split properly: - // "HELLOthere". However, these sorts of names do not show up in .Net - // programs. - for (var i = wordStart; i < index; i++) { - if (!isUpperCaseLetter(identifier.charCodeAt(i))) { - return false; - } - } - return true; - } - } - } - return false; + function transitionFromUpperToLower(identifier, index, wordStart) { + // Cases this supports: + // 1) IDisposable -> I, Disposable + // 2) UIElement -> UI, Element + // 3) HTMLDocument -> HTML, Document + // + // etc. + // We have a transition from an upper to a lower letter here. But we only + // want to break if all the letters that preceded are uppercase. i.e. if we + // have "Foo" we don't want to break that into "F, oo". But if we have + // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, + // Foo". i.e. the last uppercase letter belongs to the lowercase letters + // that follows. Note: this will make the following not split properly: + // "HELLOthere". However, these sorts of names do not show up in .Net + // programs. + return index !== wordStart + && index + 1 < identifier.length + && isUpperCaseLetter(identifier.charCodeAt(index)) + && isLowerCaseLetter(identifier.charCodeAt(index + 1)) + && every(identifier, isUpperCaseLetter, wordStart, index); } function transitionFromLowerToUpper(identifier, word, index) { var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); @@ -90253,10 +90546,20 @@ var ts; // on characters would be: A M // // We break the search string on characters. But we break the symbol name on words. - var transition = word - ? (currentIsUpper && !lastIsUpper) - : currentIsUpper; - return transition; + return currentIsUpper && (!word || !lastIsUpper); + } + function everyInRange(start, end, pred) { + for (var i = start; i < end; i++) { + if (!pred(i)) { + return false; + } + } + return true; + } + function every(s, pred, start, end) { + if (start === void 0) { start = 0; } + if (end === void 0) { end = s.length; } + return everyInRange(start, end, function (i) { return pred(s.charCodeAt(i), i); }); } })(ts || (ts = {})); var ts; @@ -90725,7 +91028,7 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 185 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 186 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -90807,25 +91110,25 @@ var ts; var argumentsSpan = getApplicableSpanForArguments(list, sourceFile); return { kind: kind, invocation: invocation, argumentsSpan: argumentsSpan, argumentIndex: argumentIndex, argumentCount: argumentCount }; } - else if (node.kind === 13 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 187 /* TaggedTemplateExpression */) { + else if (node.kind === 13 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 188 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile); } } - else if (node.kind === 14 /* TemplateHead */ && node.parent.parent.kind === 187 /* TaggedTemplateExpression */) { + else if (node.kind === 14 /* TemplateHead */ && node.parent.parent.kind === 188 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 200 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 201 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 209 /* TemplateSpan */ && node.parent.parent.parent.kind === 187 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 210 /* TemplateSpan */ && node.parent.parent.parent.kind === 188 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 200 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 201 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 16 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -90960,7 +91263,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 === 200 /* TemplateExpression */) { + if (template.kind === 201 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -90969,7 +91272,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 272 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 273 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -91103,8 +91406,8 @@ var ts; var isJsFile = ts.isSourceFileJavaScript(sourceFile); function check(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: if (isJsFile) { var symbol = node.symbol; if (symbol.members && (symbol.members.size > 0)) { @@ -91138,12 +91441,12 @@ var ts; ts.computeSuggestionDiagnostics = computeSuggestionDiagnostics; function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings.kind === 244 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings.kind === 245 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -91163,7 +91466,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* Class */) { - return ts.getDeclarationOfKind(symbol, 203 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 204 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; } if (flags & 384 /* Enum */) @@ -91243,11 +91546,11 @@ var ts; // If we requested completions after `x.` at the top-level, we may be at a source file location. switch (location.parent && location.parent.kind) { // If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'. - case 255 /* JsxOpeningElement */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: return location.kind === 71 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return "JSX attribute" /* jsxAttribute */; default: return "property" /* memberVariableElement */; @@ -91286,7 +91589,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location); - if (location.parent && location.parent.kind === 183 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 184 /* 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)) { @@ -91307,7 +91610,7 @@ var ts; if (callExpressionLike) { var candidateSignatures = []; signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); - var useConstructSignatures = callExpressionLike.kind === 186 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 97 /* SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 187 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 97 /* SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -91344,7 +91647,7 @@ var ts; // If it is call or construct signature of lambda's write type name displayParts.push(ts.punctuationPart(56 /* ColonToken */)); displayParts.push(ts.spacePart()); - if (!(type.flags & 65536 /* Object */ && type.objectFlags & 16 /* Anonymous */) && type.symbol) { + if (!(ts.getObjectFlags(type) & 16 /* Anonymous */) && type.symbol) { ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 4 /* AllowAnyNodeKind */ | 1 /* WriteTypeParametersOrArguments */)); displayParts.push(ts.lineBreakPart()); } @@ -91394,7 +91697,7 @@ var ts; } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 203 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 204 /* 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 @@ -91438,7 +91741,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 237 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 238 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 71 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 130 /* NamespaceKeyword */ : 129 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -91475,7 +91778,7 @@ var ts; } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 235 /* TypeAliasDeclaration */) { + else if (declaration.kind === 236 /* TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path @@ -91492,7 +91795,7 @@ var ts; symbolKind = "enum member" /* enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 271 /* EnumMember */) { + if (declaration.kind === 272 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -91521,12 +91824,12 @@ var ts; } } switch (symbol.declarations[0].kind) { - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(84 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(130 /* NamespaceKeyword */)); break; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: displayParts.push(ts.keywordPart(84 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 58 /* EqualsToken */ : 79 /* DefaultKeyword */)); @@ -91537,7 +91840,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 241 /* ImportEqualsDeclaration */) { + if (declaration.kind === 242 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -91615,10 +91918,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 && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 272 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 273 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 198 /* BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 199 /* BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -91723,16 +92026,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 190 /* FunctionExpression */) { + if (declaration.kind === 191 /* FunctionExpression */) { return true; } - if (declaration.kind !== 230 /* VariableDeclaration */ && declaration.kind !== 232 /* FunctionDeclaration */) { + if (declaration.kind !== 231 /* VariableDeclaration */ && declaration.kind !== 233 /* 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 === 272 /* SourceFile */ || parent.kind === 238 /* ModuleBlock */) { + if (parent.kind === 273 /* SourceFile */ || parent.kind === 239 /* ModuleBlock */) { return false; } } @@ -91844,7 +92147,7 @@ var ts; return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.cloneCompilerOptions(options); - var _loop_10 = function (opt) { + var _loop_11 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -91863,7 +92166,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_10(opt); + _loop_11(opt); } return options; } @@ -92042,10 +92345,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 260 /* JsxAttribute */: - case 255 /* JsxOpeningElement */: - case 256 /* JsxClosingElement */: - case 254 /* JsxSelfClosingElement */: + case 261 /* JsxAttribute */: + case 256 /* JsxOpeningElement */: + case 257 /* JsxClosingElement */: + case 255 /* 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 === 71 /* Identifier */; } @@ -92376,7 +92679,7 @@ var ts; rule("NoSpaceBetweenCloseParenAndAngularBracket", 20 /* CloseParenToken */, 27 /* LessThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), rule("NoSpaceAfterOpenAngularBracket", 27 /* LessThanToken */, anyToken, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), rule("NoSpaceBeforeCloseAngularBracket", anyToken, 29 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), - rule("NoSpaceAfterCloseAngularBracket", 29 /* GreaterThanToken */, [19 /* OpenParenToken */, 21 /* OpenBracketToken */, 29 /* GreaterThanToken */, 26 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), + rule("NoSpaceAfterCloseAngularBracket", 29 /* GreaterThanToken */, [19 /* OpenParenToken */, 21 /* OpenBracketToken */, 29 /* GreaterThanToken */, 26 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/], 8 /* Delete */), // decorators rule("SpaceBeforeAt", [20 /* CloseParenToken */, 71 /* Identifier */], 57 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */), rule("NoSpaceAfterAt", 57 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */), @@ -92525,44 +92828,44 @@ var ts; return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 218 /* ForStatement */; + return context.contextNode.kind === 219 /* ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 198 /* BinaryExpression */: - case 199 /* ConditionalExpression */: + case 199 /* BinaryExpression */: + case 200 /* ConditionalExpression */: case 170 /* ConditionalType */: - case 206 /* AsExpression */: - case 250 /* ExportSpecifier */: - case 246 /* ImportSpecifier */: + case 207 /* AsExpression */: + case 251 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: case 160 /* TypePredicate */: case 168 /* UnionType */: case 169 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 180 /* BindingElement */: + case 181 /* BindingElement */: // equals in type X = ... - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: // equal in p = 0; case 148 /* Parameter */: - case 271 /* EnumMember */: + case 272 /* EnumMember */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return context.currentTokenSpan.kind === 58 /* EqualsToken */ || context.nextTokenSpan.kind === 58 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: // "in" keyword in [P in keyof T]: T[P] case 147 /* TypeParameter */: return context.currentTokenSpan.kind === 92 /* InKeyword */ || context.nextTokenSpan.kind === 92 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return context.currentTokenSpan.kind === 144 /* OfKeyword */ || context.nextTokenSpan.kind === 144 /* OfKeyword */; } return false; @@ -92578,18 +92881,18 @@ var ts; return contextKind === 151 /* PropertyDeclaration */ || contextKind === 150 /* PropertySignature */ || contextKind === 148 /* Parameter */ || - contextKind === 230 /* VariableDeclaration */ || + contextKind === 231 /* VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 199 /* ConditionalExpression */ || + return context.contextNode.kind === 200 /* ConditionalExpression */ || context.contextNode.kind === 170 /* ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 178 /* ObjectBindingPattern */ || + return context.contextNode.kind === 179 /* ObjectBindingPattern */ || context.contextNode.kind === 176 /* MappedType */ || isSingleLineBlockContext(context); } @@ -92616,17 +92919,17 @@ var ts; return true; } switch (node.kind) { - case 211 /* Block */: - case 239 /* CaseBlock */: - case 182 /* ObjectLiteralExpression */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 240 /* CaseBlock */: + case 183 /* ObjectLiteralExpression */: + case 239 /* ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: @@ -92634,52 +92937,55 @@ var ts; case 156 /* SetAccessor */: // case SyntaxKind.MethodSignature: case 157 /* CallSignature */: - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: case 154 /* Constructor */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 234 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 235 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; } + function isNotFunctionDeclContext(context) { + return !isFunctionDeclContext(context); + } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 232 /* FunctionDeclaration */ || context.contextNode.kind === 190 /* FunctionExpression */; + return context.contextNode.kind === 233 /* FunctionDeclaration */ || context.contextNode.kind === 191 /* FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: case 165 /* TypeLiteral */: - case 237 /* ModuleDeclaration */: - case 248 /* ExportDeclaration */: - case 249 /* NamedExports */: - case 242 /* ImportDeclaration */: - case 245 /* NamedImports */: + case 238 /* ModuleDeclaration */: + case 249 /* ExportDeclaration */: + case 250 /* NamedExports */: + case 243 /* ImportDeclaration */: + case 246 /* NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 233 /* ClassDeclaration */: - case 237 /* ModuleDeclaration */: - case 236 /* EnumDeclaration */: - case 267 /* CatchClause */: - case 238 /* ModuleBlock */: - case 225 /* SwitchStatement */: + case 234 /* ClassDeclaration */: + case 238 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: + case 268 /* CatchClause */: + case 239 /* ModuleBlock */: + case 226 /* SwitchStatement */: return true; - case 211 /* Block */: { + case 212 /* 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 !== 191 /* ArrowFunction */ && blockParent.kind !== 190 /* FunctionExpression */) { + if (!blockParent || blockParent.kind !== 192 /* ArrowFunction */ && blockParent.kind !== 191 /* FunctionExpression */) { return true; } } @@ -92688,31 +92994,31 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 215 /* IfStatement */: - case 225 /* SwitchStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 217 /* WhileStatement */: - case 228 /* TryStatement */: - case 216 /* DoStatement */: - case 224 /* WithStatement */: + case 216 /* IfStatement */: + case 226 /* SwitchStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 218 /* WhileStatement */: + case 229 /* TryStatement */: + case 217 /* DoStatement */: + case 225 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 267 /* CatchClause */: + case 268 /* CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 182 /* ObjectLiteralExpression */; + return context.contextNode.kind === 183 /* ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 185 /* CallExpression */; + return context.contextNode.kind === 186 /* CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 186 /* NewExpression */; + return context.contextNode.kind === 187 /* NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -92724,25 +93030,25 @@ var ts; return context.nextTokenSpan.kind !== 22 /* CloseBracketToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 191 /* ArrowFunction */; + return context.contextNode.kind === 192 /* ArrowFunction */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 253 /* JsxElement */ && context.contextNode.kind !== 257 /* JsxFragment */; + return context.contextNode.kind !== 254 /* JsxElement */ && context.contextNode.kind !== 258 /* JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 263 /* JsxExpression */ || context.contextNode.kind === 262 /* JsxSpreadAttribute */; + return context.contextNode.kind === 264 /* JsxExpression */ || context.contextNode.kind === 263 /* JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 260 /* JsxAttribute */; + return context.nextTokenParent.kind === 261 /* JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 260 /* JsxAttribute */; + return context.contextNode.kind === 261 /* JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 254 /* JsxSelfClosingElement */; + return context.contextNode.kind === 255 /* JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -92760,14 +93066,14 @@ var ts; return node.kind === 149 /* Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 231 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 232 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 237 /* ModuleDeclaration */; + return context.contextNode.kind === 238 /* ModuleDeclaration */; } function isObjectTypeContext(context) { return context.contextNode.kind === 165 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; @@ -92781,21 +93087,21 @@ var ts; } switch (parent.kind) { case 161 /* TypeReference */: - case 188 /* TypeAssertionExpression */: - case 235 /* TypeAliasDeclaration */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 189 /* TypeAssertionExpression */: + case 236 /* TypeAliasDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 205 /* ExpressionWithTypeArguments */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 206 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -92806,16 +93112,16 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 188 /* TypeAssertionExpression */; + return context.contextNode.kind === 189 /* TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 105 /* VoidKeyword */ && context.currentTokenParent.kind === 194 /* VoidExpression */; + return context.currentTokenSpan.kind === 105 /* VoidKeyword */ && context.currentTokenParent.kind === 195 /* VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 201 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 202 /* YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 207 /* NonNullExpression */; + return context.contextNode.kind === 208 /* NonNullExpression */; } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -93054,17 +93360,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 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 238 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 272 /* SourceFile */: - case 211 /* Block */: - case 238 /* ModuleBlock */: + return body && body.kind === 239 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 273 /* SourceFile */: + case 212 /* Block */: + case 239 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -93168,7 +93474,7 @@ var ts; if (previousLine !== -1 /* Unknown */ && line !== previousLine) { break; } - if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) { + if (formatting.SmartIndenter.shouldIndentChildNode(options, n, child, sourceFile)) { return options.indentSize; } previousLine = line; @@ -93255,7 +93561,7 @@ var ts; return -1 /* Unknown */; } function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { - var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0; + var delta = formatting.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; if (effectiveParentStartLine === startLine) { // if node is located on the same line with the parent // - inherit indentation from the parent @@ -93287,10 +93593,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 233 /* ClassDeclaration */: return 75 /* ClassKeyword */; - case 234 /* InterfaceDeclaration */: return 109 /* InterfaceKeyword */; - case 232 /* FunctionDeclaration */: return 89 /* FunctionKeyword */; - case 236 /* EnumDeclaration */: return 236 /* EnumDeclaration */; + case 234 /* ClassDeclaration */: return 75 /* ClassKeyword */; + case 235 /* InterfaceDeclaration */: return 109 /* InterfaceKeyword */; + case 233 /* FunctionDeclaration */: return 89 /* FunctionKeyword */; + case 237 /* EnumDeclaration */: return 237 /* EnumDeclaration */; case 155 /* GetAccessor */: return 125 /* GetKeyword */; case 156 /* SetAccessor */: return 136 /* SetKeyword */; case 153 /* MethodDeclaration */: @@ -93324,9 +93630,9 @@ var ts; getIndentation: function () { return indentation; }, getDelta: getDelta, recomputeIndentation: function (lineAdded) { - if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(options, node.parent, node, sourceFile)) { indentation += lineAdded ? options.indentSize : -options.indentSize; - delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0; + delta = formatting.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; } } }; @@ -93344,9 +93650,9 @@ var ts; case 41 /* SlashToken */: case 29 /* GreaterThanToken */: switch (container.kind) { - case 255 /* JsxOpeningElement */: - case 256 /* JsxClosingElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 257 /* JsxClosingElement */: + case 255 /* JsxSelfClosingElement */: return false; } break; @@ -93364,7 +93670,7 @@ var ts; } function getDelta(child) { // Delta value should be zero when the node explicitly prevents indentation of the child node - return formatting.SmartIndenter.nodeWillIndentChild(node, child, /*indentByDefault*/ true) ? delta : 0; + return formatting.SmartIndenter.nodeWillIndentChild(options, node, child, sourceFile, /*indentByDefault*/ true) ? delta : 0; } } function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { @@ -93452,7 +93758,7 @@ var ts; indentMultilineCommentOrJsxText(range, childIndentation.indentation, /*firstLineIsIndented*/ true, /*indentFinalLine*/ false); } childContextNode = node; - if (isFirstListItem && parent.kind === 181 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent.kind === 182 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -93864,11 +94170,11 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 154 /* Constructor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (node.typeParameters === list) { return 27 /* LessThanToken */; } @@ -93876,8 +94182,8 @@ var ts; return 19 /* OpenParenToken */; } break; - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: if (node.typeArguments === list) { return 27 /* LessThanToken */; } @@ -94002,7 +94308,7 @@ var ts; if (options.indentStyle === ts.IndentStyle.Block) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 26 /* CommaToken */ && precedingToken.parent.kind !== 198 /* BinaryExpression */) { + if (precedingToken.kind === 26 /* CommaToken */ && precedingToken.parent.kind !== 199 /* 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 /* Unknown */) { @@ -94047,7 +94353,7 @@ var ts; var previous; var current = precedingToken; while (current) { - if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous, /*isNextChild*/ true)) { + if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(options, current, previous, sourceFile, /*isNextChild*/ true)) { var currentStart = getStartLineAndCharacterForNode(current, sourceFile); var nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile); var indentationDelta = nextTokenKind !== 0 /* Unknown */ @@ -94113,7 +94419,7 @@ var ts; } } // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line - if (shouldIndentChildNode(parent, current, isNextChild) && !parentAndChildShareLine) { + if (shouldIndentChildNode(options, parent, current, sourceFile, isNextChild) && !parentAndChildShareLine) { indentationDelta += options.indentSize; } // In our AST, a call argument's `parent` is the call-expression, not the argument list. @@ -94158,7 +94464,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 === 272 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 273 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -94206,7 +94512,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 215 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 216 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 82 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -94223,13 +94529,13 @@ var ts; switch (node.parent.kind) { case 161 /* TypeReference */: return getListIfStartEndIsInListRange(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd()); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return node.parent.properties; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return node.parent.elements; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 157 /* CallSignature */: @@ -94240,18 +94546,18 @@ var ts; return getListIfStartEndIsInListRange(node.parent.typeParameters, start, node.getEnd()) || getListIfStartEndIsInListRange(node.parent.parameters, start, node.getEnd()); } - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return getListIfStartEndIsInListRange(node.parent.typeParameters, node.getStart(sourceFile), node.getEnd()); - case 186 /* NewExpression */: - case 185 /* CallExpression */: { + case 187 /* NewExpression */: + case 186 /* CallExpression */: { var start = node.getStart(sourceFile); return getListIfStartEndIsInListRange(node.parent.typeArguments, start, node.getEnd()) || getListIfStartEndIsInListRange(node.parent.arguments, start, node.getEnd()); } - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return getListIfStartEndIsInListRange(node.parent.declarations, node.getStart(sourceFile), node.getEnd()); - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return getListIfStartEndIsInListRange(node.parent.elements, node.getStart(sourceFile), node.getEnd()); } } @@ -94291,10 +94597,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: node = node.expression; break; default: @@ -94358,37 +94664,37 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 214 /* ExpressionStatement */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 181 /* ArrayLiteralExpression */: - case 211 /* Block */: - case 238 /* ModuleBlock */: - case 182 /* ObjectLiteralExpression */: + case 215 /* ExpressionStatement */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 182 /* ArrayLiteralExpression */: + case 212 /* Block */: + case 239 /* ModuleBlock */: + case 183 /* ObjectLiteralExpression */: case 165 /* TypeLiteral */: case 176 /* MappedType */: case 167 /* TupleType */: - case 239 /* CaseBlock */: - case 265 /* DefaultClause */: - case 264 /* CaseClause */: - case 189 /* ParenthesizedExpression */: - case 183 /* PropertyAccessExpression */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 212 /* VariableStatement */: - case 230 /* VariableDeclaration */: - case 247 /* ExportAssignment */: - case 223 /* ReturnStatement */: - case 199 /* ConditionalExpression */: - case 179 /* ArrayBindingPattern */: - case 178 /* ObjectBindingPattern */: - case 255 /* JsxOpeningElement */: - case 258 /* JsxOpeningFragment */: - case 254 /* JsxSelfClosingElement */: - case 263 /* JsxExpression */: + case 240 /* CaseBlock */: + case 266 /* DefaultClause */: + case 265 /* CaseClause */: + case 190 /* ParenthesizedExpression */: + case 184 /* PropertyAccessExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 213 /* VariableStatement */: + case 231 /* VariableDeclaration */: + case 248 /* ExportAssignment */: + case 224 /* ReturnStatement */: + case 200 /* ConditionalExpression */: + case 180 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 256 /* JsxOpeningElement */: + case 259 /* JsxOpeningFragment */: + case 255 /* JsxSelfClosingElement */: + case 264 /* JsxExpression */: case 152 /* MethodSignature */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: @@ -94396,44 +94702,51 @@ var ts; case 162 /* FunctionType */: case 163 /* ConstructorType */: case 172 /* ParenthesizedType */: - case 187 /* TaggedTemplateExpression */: - case 195 /* AwaitExpression */: - case 249 /* NamedExports */: - case 245 /* NamedImports */: - case 250 /* ExportSpecifier */: - case 246 /* ImportSpecifier */: - case 268 /* PropertyAssignment */: + case 188 /* TaggedTemplateExpression */: + case 196 /* AwaitExpression */: + case 250 /* NamedExports */: + case 246 /* NamedImports */: + case 251 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 269 /* PropertyAssignment */: case 151 /* PropertyDeclaration */: return true; } return false; } - function nodeWillIndentChild(parent, child, indentByDefault) { + function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 218 /* ForStatement */: - case 215 /* IfStatement */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 231 /* VariableDeclaration */: + case 269 /* PropertyAssignment */: + case 183 /* ObjectLiteralExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 183 /* ObjectLiteralExpression */) { + return rangeIsOnOneLine(sourceFile, child); + } + break; + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 219 /* ForStatement */: + case 216 /* IfStatement */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - return childKind !== 211 /* Block */; - case 248 /* ExportDeclaration */: - return childKind !== 249 /* NamedExports */; - case 242 /* ImportDeclaration */: - return childKind !== 243 /* ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 245 /* NamedImports */); - case 253 /* JsxElement */: - return childKind !== 256 /* JsxClosingElement */; - case 257 /* JsxFragment */: - return childKind !== 259 /* JsxClosingFragment */; + return childKind !== 212 /* Block */; + case 249 /* ExportDeclaration */: + return childKind !== 250 /* NamedExports */; + case 243 /* ImportDeclaration */: + return childKind !== 244 /* ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 246 /* NamedImports */); + case 254 /* JsxElement */: + return childKind !== 257 /* JsxClosingElement */; + case 258 /* JsxFragment */: + return childKind !== 260 /* JsxClosingFragment */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -94441,17 +94754,17 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 223 /* ReturnStatement */: - case 227 /* ThrowStatement */: { - if (parent.kind !== 211 /* Block */) { + case 224 /* ReturnStatement */: + case 228 /* ThrowStatement */: { + if (parent.kind !== 212 /* Block */) { return true; } var grandParent = parent.parent; // In a function, we may want to write inner functions after this. - return !(grandParent && grandParent.kind === 190 /* FunctionExpression */ || grandParent.kind === 232 /* FunctionDeclaration */); + return !(grandParent && grandParent.kind === 191 /* FunctionExpression */ || grandParent.kind === 233 /* FunctionDeclaration */); } - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: return true; default: return false; @@ -94461,12 +94774,18 @@ var ts; * True when the parent node should indent the given child by an explicit rule. * @param isNextChild If true, we are judging indent of a hypothetical child *after* this one, not the current child. */ - function shouldIndentChildNode(parent, child, isNextChild) { + function shouldIndentChildNode(settings, parent, child, sourceFile, isNextChild) { if (isNextChild === void 0) { isNextChild = false; } - return (nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, /*indentByDefault*/ false)) + return (nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(settings, parent, child, sourceFile, /*indentByDefault*/ false)) && !(isNextChild && child && isControlFlowEndingStatement(child.kind, parent)); } SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; + function rangeIsOnOneLine(sourceFile, range) { + var rangeStart = ts.skipTrivia(sourceFile.text, range.pos); + var startLine = sourceFile.getLineAndCharacterOfPosition(rangeStart).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(range.end).line; + return startLine === endLine; + } })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -94574,7 +94893,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 === 26 /* CommaToken */ || (candidate.kind === 25 /* SemicolonToken */ && node.parent.kind === 182 /* ObjectLiteralExpression */)); + return candidate && node.parent && (candidate.kind === 26 /* CommaToken */ || (candidate.kind === 25 /* SemicolonToken */ && node.parent.kind === 183 /* ObjectLiteralExpression */)); } function spaces(count) { var s = ""; @@ -94731,12 +95050,21 @@ var ts; this.changes.push({ kind: ChangeKind.Text, sourceFile: sourceFile, range: { pos: pos, end: pos }, text: text }); }; /** Prefer this over replacing a node with another that has a type annotation, as it avoids reformatting the other parts of the node. */ - ChangeTracker.prototype.insertTypeAnnotation = function (sourceFile, node, type) { - var end = (ts.isFunctionLike(node) - // If no `)`, is an arrow function `x => x`, so use the end of the first parameter - ? ts.findChildOfKind(node, 20 /* CloseParenToken */, sourceFile) || ts.first(node.parameters) - : node.kind !== 230 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name).end; - this.insertNodeAt(sourceFile, end, type, { prefix: ": " }); + ChangeTracker.prototype.tryInsertTypeAnnotation = function (sourceFile, node, type) { + var endNode; + if (ts.isFunctionLike(node)) { + endNode = ts.findChildOfKind(node, 20 /* CloseParenToken */, sourceFile); + if (!endNode) { + if (!ts.isArrowFunction(node)) + return; // Function missing parentheses, give up + // If no `)`, is an arrow function `x => x`, so use the end of the first parameter + endNode = ts.first(node.parameters); + } + } + else { + endNode = node.kind !== 231 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name; + } + this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); }; ChangeTracker.prototype.insertTypeParameters = function (sourceFile, node, typeParameters) { // If no `(`, is an arrow function `x => x`, so use the pos of the first parameter @@ -94946,7 +95274,7 @@ var ts; var _this = this; this.nodesInsertedAtClassStarts.forEach(function (_a) { var sourceFile = _a.sourceFile, cls = _a.cls, members = _a.members; - var newCls = cls.kind === 233 /* ClassDeclaration */ + var newCls = cls.kind === 234 /* ClassDeclaration */ ? ts.updateClassDeclaration(cls, cls.decorators, cls.modifiers, cls.name, cls.typeParameters, cls.heritageClauses, members) : ts.updateClassExpression(cls, cls.modifiers, cls.name, cls.typeParameters, cls.heritageClauses, members); _this.replaceNode(sourceFile, cls, newCls); @@ -94972,14 +95300,14 @@ var ts; var sourceFile = changesInFile[0].sourceFile; // order changes by start position var normalized = ts.stableSort(changesInFile, function (a, b) { return a.range.pos - b.range.pos; }); - var _loop_11 = function (i) { + var _loop_12 = function (i) { ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () { return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range); }); }; // verify that change intervals do not overlap, except possibly at end points. for (var i = 0; i < normalized.length - 1; i++) { - _loop_11(i); + _loop_12(i); } var textChanges = normalized.map(function (c) { return ts.createTextChange(ts.createTextSpanFromRange(c.range), computeNewText(c, sourceFile, newLineCharacter, formatContext, validate)); @@ -95015,7 +95343,7 @@ var ts; ? indentation : ts.formatting.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix === newLineCharacter || ts.getLineStartPositionForPosition(pos, sourceFile) === pos); if (delta === undefined) { - delta = ts.formatting.SmartIndenter.shouldIndentChildNode(nodeIn) ? (formatOptions.indentSize || 0) : 0; + delta = ts.formatting.SmartIndenter.shouldIndentChildNode(formatContext.options, nodeIn) ? (formatOptions.indentSize || 0) : 0; } var file = { text: text, getLineAndCharacterOfPosition: function (pos) { return ts.getLineAndCharacterOfPosition(this, pos); } }; var changes = ts.formatting.formatNodeGivenIndentation(node, file, sourceFile.languageVariant, initialIndentation, delta, formatContext); @@ -95436,7 +95764,7 @@ var ts; if (!param.type) { var paramType = ts.getJSDocType(param); if (paramType) - changes.insertTypeAnnotation(sourceFile, param, transformJSDocType(paramType)); + changes.tryInsertTypeAnnotation(sourceFile, param, transformJSDocType(paramType)); } } if (needParens) @@ -95444,35 +95772,35 @@ var ts; if (!decl.type) { var returnType = ts.getJSDocReturnType(decl); if (returnType) - changes.insertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType)); + changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType)); } } else { var jsdocType = ts.Debug.assertDefined(ts.getJSDocType(decl)); // If not defined, shouldn't have been an error to fix ts.Debug.assert(!decl.type); // If defined, shouldn't have been an error to fix. - changes.insertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType)); + changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType)); } } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 230 /* VariableDeclaration */ || + node.kind === 231 /* VariableDeclaration */ || node.kind === 150 /* PropertySignature */ || node.kind === 151 /* PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 275 /* JSDocAllType */: - case 276 /* JSDocUnknownType */: + case 276 /* JSDocAllType */: + case 277 /* JSDocUnknownType */: return ts.createTypeReferenceNode("any", ts.emptyArray); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return transformJSDocOptionalType(node); - case 278 /* JSDocNonNullableType */: + case 279 /* JSDocNonNullableType */: return transformJSDocType(node.type); - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return transformJSDocNullableType(node); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return transformJSDocVariadicType(node); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return transformJSDocFunctionType(node); case 161 /* TypeReference */: return transformJSDocTypeReference(node); @@ -95496,7 +95824,7 @@ var ts; } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 281 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + var isRest = node.type.kind === 282 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.createToken(24 /* DotDotDotToken */) : node.dotDotDotToken; return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -95572,12 +95900,12 @@ var ts; var precedingNode; var newClassDeclaration; switch (ctorDeclaration.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: precedingNode = ctorDeclaration; deleteNode(ctorDeclaration); newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration); break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: precedingNode = ctorDeclaration.parent.parent; if (ctorDeclaration.parent.declarations.length === 1) { deleteNode(precedingNode); @@ -95637,8 +95965,8 @@ var ts; return ts.isFunctionLike(source); } function createClassElement(symbol, modifiers) { - // both properties and methods are bound as property symbols - if (!(symbol.flags & 4 /* Property */)) { + // Right now the only thing we can convert are function expressions, which are marked as methods + if (!(symbol.flags & 8192 /* Method */)) { return; } var memberDeclaration = symbol.valueDeclaration; @@ -95647,7 +95975,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 === 214 /* ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 215 /* ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; deleteNode(nodeToDelete); if (!assignmentBinaryExpression.right) { @@ -95655,7 +95983,7 @@ var ts; /*type*/ undefined, /*initializer*/ undefined); } switch (assignmentBinaryExpression.right.kind) { - case 190 /* FunctionExpression */: { + case 191 /* FunctionExpression */: { var functionExpression = assignmentBinaryExpression.right; var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 120 /* AsyncKeyword */)); var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined, @@ -95663,12 +95991,12 @@ var ts; copyComments(assignmentBinaryExpression, method, sourceFile); return method; } - case 191 /* ArrowFunction */: { + case 192 /* ArrowFunction */: { var arrowFunction = assignmentBinaryExpression.right; var arrowFunctionBody = arrowFunction.body; var bodyBlock = void 0; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 211 /* Block */) { + if (arrowFunctionBody.kind === 212 /* Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] @@ -95696,7 +96024,7 @@ var ts; } function createClassFromVariableDeclaration(node) { var initializer = node.initializer; - if (!initializer || initializer.kind !== 190 /* FunctionExpression */) { + if (!initializer || initializer.kind !== 191 /* FunctionExpression */) { return undefined; } if (node.name.kind !== 71 /* Identifier */) { @@ -95775,10 +96103,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier)); break; - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.createPropertyAccess(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -95831,20 +96159,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports) { switch (statement.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target); return false; - case 214 /* ExpressionStatement */: { + case 215 /* ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 185 /* CallExpression */: { + case 186 /* CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0])); } return false; } - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var _a = expression, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return operatorToken.kind === 58 /* EqualsToken */ && convertAssignment(sourceFile, checker, statement, left, right, changes, exports); } @@ -95886,8 +96214,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers) { switch (name.kind) { - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: { + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return [ @@ -95937,10 +96265,10 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. - case 269 /* ShorthandPropertyAssignment */: - case 270 /* SpreadAssignment */: + case 270 /* ShorthandPropertyAssignment */: + case 271 /* SpreadAssignment */: return undefined; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals(prop.name.text, prop.initializer); case 153 /* MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(84 /* ExportKeyword */)], prop); @@ -95971,18 +96299,18 @@ var ts; function convertModuleExportsToExportDefault(exported, checker) { var modifiers = [ts.createToken(84 /* ExportKeyword */), ts.createToken(79 /* DefaultKeyword */)]; switch (exported.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: { + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: { // `module.exports = function f() {}` --> `export default function f() {}` var fn = exported; return [[functionExpressionToDeclaration(fn.name && fn.name.text, modifiers, fn)], true]; } - case 203 /* ClassExpression */: { + case 204 /* ClassExpression */: { // `module.exports = class C {}` --> `export default class C {}` var cls = exported; return [[classExpressionToDeclaration(cls.name && cls.name.text, modifiers, cls)], true]; } - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (ts.isRequireCall(exported, /*checkArgumentIsStringLiteralLike*/ true)) { return convertReExportAll(exported.arguments[0], checker); } @@ -96013,7 +96341,7 @@ var ts; function convertExportsDotXEquals(name, exported) { var modifiers = [ts.createToken(84 /* ExportKeyword */)]; switch (exported.kind) { - case 190 /* FunctionExpression */: { + case 191 /* FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -96021,10 +96349,10 @@ var ts; } } // falls through - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported); default: @@ -96042,7 +96370,7 @@ var ts; */ function convertSingleImport(file, name, moduleSpecifier, changes, checker, identifiers, target) { switch (name.kind) { - case 178 /* ObjectBindingPattern */: { + case 179 /* 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 @@ -96053,7 +96381,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 179 /* ArrayBindingPattern */: { + case 180 /* ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -96132,9 +96460,9 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return parent.name !== node; - case 180 /* BindingElement */: + case 181 /* BindingElement */: return parent.propertyName !== node; default: return true; @@ -96330,40 +96658,19 @@ var ts; if (!ts.isIdentifier(token)) { return undefined; } - var classAndMakeStatic = getClassAndMakeStatic(token, checker); - if (!classAndMakeStatic) { - return undefined; - } - var classDeclaration = classAndMakeStatic.classDeclaration, makeStatic = classAndMakeStatic.makeStatic; - var classDeclarationSourceFile = classDeclaration.getSourceFile(); - var inJs = ts.isInJavaScriptFile(classDeclarationSourceFile); - var call = ts.tryCast(token.parent.parent, ts.isCallExpression); - return { token: token, classDeclaration: classDeclaration, makeStatic: makeStatic, classDeclarationSourceFile: classDeclarationSourceFile, inJs: inJs, call: call }; - } - function getClassAndMakeStatic(token, checker) { var parent = token.parent; - if (!ts.isPropertyAccessExpression(parent)) { + if (!ts.isPropertyAccessExpression(parent)) return undefined; - } - if (parent.expression.kind === 99 /* ThisKeyword */) { - var containingClassMemberDeclaration = ts.getThisContainer(token, /*includeArrowFunctions*/ false); - if (!ts.isClassElement(containingClassMemberDeclaration)) { - return undefined; - } - var classDeclaration = containingClassMemberDeclaration.parent; - // Property accesses on `this` in a static method are accesses of a static member. - return ts.isClassLike(classDeclaration) ? { classDeclaration: classDeclaration, makeStatic: ts.hasModifier(containingClassMemberDeclaration, 32 /* Static */) } : undefined; - } - else { - var leftExpressionType = checker.getTypeAtLocation(parent.expression); - var symbol = leftExpressionType.symbol; - if (!(symbol && leftExpressionType.flags & 65536 /* Object */ && symbol.flags & 32 /* Class */)) { - return undefined; - } - var classDeclaration = ts.cast(ts.first(symbol.declarations), ts.isClassLike); - // The expression is a class symbol but the type is not the instance-side. - return { classDeclaration: classDeclaration, makeStatic: leftExpressionType !== checker.getDeclaredTypeOfSymbol(symbol) }; - } + var leftExpressionType = ts.skipConstraint(checker.getTypeAtLocation(parent.expression)); + var symbol = leftExpressionType.symbol; + var classDeclaration = symbol && symbol.declarations && ts.find(symbol.declarations, ts.isClassLike); + if (!classDeclaration) + return undefined; + var makeStatic = leftExpressionType.target !== checker.getDeclaredTypeOfSymbol(symbol); + var classDeclarationSourceFile = classDeclaration.getSourceFile(); + var inJs = ts.isSourceFileJavaScript(classDeclarationSourceFile); + var call = ts.tryCast(parent.parent, ts.isCallExpression); + return { token: token, classDeclaration: classDeclaration, makeStatic: makeStatic, classDeclarationSourceFile: classDeclarationSourceFile, inJs: inJs, call: call }; } function getActionsForAddMissingMemberInJavaScriptFile(context, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingMemberInJs(t, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic); }); @@ -96372,7 +96679,7 @@ var ts; } function addMissingMemberInJs(changeTracker, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) { if (makeStatic) { - if (classDeclaration.kind === 203 /* ClassExpression */) { + if (classDeclaration.kind === 204 /* ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -96398,7 +96705,7 @@ var ts; } function getTypeNode(checker, classDeclaration, token) { var typeNode; - if (token.parent.parent.kind === 198 /* BinaryExpression */) { + if (token.parent.parent.kind === 199 /* 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))); @@ -96453,36 +96760,48 @@ var ts; var errorCodes = [ ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, + ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2.code, ]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile; - var info = getInfo(sourceFile, context.span.start, context.program.getTypeChecker()); + var info = getInfo(sourceFile, context.span.start, context); if (!info) return undefined; var node = info.node, suggestion = info.suggestion; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestion); }); + var target = context.host.getCompilationSettings().target; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestion, target); }); return [codefix.createCodeFixAction(changes, [ts.Diagnostics.Change_spelling_to_0, suggestion], fixId, ts.Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start, context.program.getTypeChecker()); + var info = getInfo(diag.file, diag.start, context); + var target = context.host.getCompilationSettings().target; if (info) - doChange(changes, context.sourceFile, info.node, info.suggestion); + doChange(changes, context.sourceFile, info.node, info.suggestion, target); }); }, }); - function getInfo(sourceFile, pos, checker) { + function getInfo(sourceFile, pos, context) { // This is the identifier of the misspelled word. eg: // this.speling = 1; // ^^^^^^^ var node = ts.getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false); // TODO: GH#15852 + var checker = context.program.getTypeChecker(); var suggestion; if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) { ts.Debug.assert(node.kind === 71 /* Identifier */); var containingType = checker.getTypeAtLocation(node.parent.expression); suggestion = checker.getSuggestionForNonexistentProperty(node, containingType); } + else if (ts.isImportSpecifier(node.parent) && node.parent.name === node) { + ts.Debug.assert(node.kind === 71 /* Identifier */); + var importDeclaration = ts.findAncestor(node, ts.isImportDeclaration); + var resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration); + if (resolvedSourceFile && resolvedSourceFile.symbol) { + suggestion = checker.getSuggestionForNonexistentModule(node, resolvedSourceFile.symbol); + } + } else { var meaning = ts.getMeaningFromLocation(node); var name = ts.getTextOfNode(node); @@ -96491,8 +96810,13 @@ var ts; } return suggestion === undefined ? undefined : { node: node, suggestion: suggestion }; } - function doChange(changes, sourceFile, node, suggestion) { - changes.replaceNode(sourceFile, node, ts.createIdentifier(suggestion)); + function doChange(changes, sourceFile, node, suggestion, target) { + if (!ts.isIdentifierText(suggestion, target) && ts.isPropertyAccessExpression(node.parent)) { + changes.replaceNode(sourceFile, node.parent, ts.createElementAccess(node.parent.expression, ts.createLiteral(suggestion))); + } + else { + changes.replaceNode(sourceFile, node, ts.createIdentifier(suggestion)); + } } function convertSemanticMeaningToSymbolFlags(meaning) { var flags = 0; @@ -96507,6 +96831,14 @@ var ts; } return flags; } + function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) { + if (!importDeclaration || !ts.isStringLiteralLike(importDeclaration.moduleSpecifier)) + return undefined; + var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text); + if (!resolvedModule) + return undefined; + return context.program.getSourceFile(resolvedModule.resolvedFileName); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -96847,11 +97179,11 @@ var ts; switch (token.parent.kind) { case 148 /* Parameter */: return true; - case 230 /* VariableDeclaration */: { + case 231 /* VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 220 /* ForOfStatement */: - case 219 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 220 /* ForInStatement */: return true; } } @@ -96864,7 +97196,7 @@ var ts; tryDeleteIdentifier(changes, sourceFile, token); break; case 151 /* PropertyDeclaration */: - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: changes.deleteNode(sourceFile, token.parent); break; default: @@ -96882,7 +97214,7 @@ var ts; function tryDeleteIdentifier(changes, sourceFile, identifier) { var parent = identifier.parent; switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: tryDeleteVariableDeclaration(changes, sourceFile, parent); break; case 147 /* TypeParameter */: @@ -96921,11 +97253,11 @@ var ts; } break; // handle case where 'import a = A;' - case 241 /* ImportEqualsDeclaration */: - var importEquals = ts.getAncestor(identifier, 241 /* ImportEqualsDeclaration */); + case 242 /* ImportEqualsDeclaration */: + var importEquals = ts.getAncestor(identifier, 242 /* ImportEqualsDeclaration */); changes.deleteNode(sourceFile, importEquals); break; - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: var namedImports = parent.parent; if (namedImports.elements.length === 1) { tryDeleteNamedImportBinding(changes, sourceFile, namedImports); @@ -96935,10 +97267,10 @@ var ts; changes.deleteNodeInList(sourceFile, parent); } break; - case 243 /* ImportClause */: // this covers both 'import |d|' and 'import |d,| *' + case 244 /* ImportClause */: // this covers both 'import |d|' and 'import |d,| *' var importClause = parent; if (!importClause.namedBindings) { // |import d from './file'| - changes.deleteNode(sourceFile, ts.getAncestor(importClause, 242 /* ImportDeclaration */)); + changes.deleteNode(sourceFile, ts.getAncestor(importClause, 243 /* ImportDeclaration */)); } else { // import |d,| * as ns from './file' @@ -96954,7 +97286,7 @@ var ts; } } break; - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: tryDeleteNamedImportBinding(changes, sourceFile, parent); break; default: @@ -96976,14 +97308,14 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(namedBindings, 242 /* ImportDeclaration */); + var importDecl = ts.getAncestor(namedBindings, 243 /* ImportDeclaration */); changes.deleteNode(sourceFile, importDecl); } } // token.parent is a variableDeclaration function tryDeleteVariableDeclaration(changes, sourceFile, varDecl) { switch (varDecl.parent.parent.kind) { - case 218 /* ForStatement */: { + case 219 /* ForStatement */: { var forStatement = varDecl.parent.parent; var forInitializer = forStatement.initializer; if (forInitializer.declarations.length === 1) { @@ -96994,14 +97326,14 @@ var ts; } break; } - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: var forOfStatement = varDecl.parent.parent; - ts.Debug.assert(forOfStatement.initializer.kind === 231 /* VariableDeclarationList */); + ts.Debug.assert(forOfStatement.initializer.kind === 232 /* VariableDeclarationList */); var forOfInitializer = forOfStatement.initializer; changes.replaceNode(sourceFile, forOfInitializer.declarations[0], ts.createObjectLiteral()); break; - case 219 /* ForInStatement */: - case 228 /* TryStatement */: + case 220 /* ForInStatement */: + case 229 /* TryStatement */: break; default: var variableStatement = varDecl.parent.parent; @@ -97034,7 +97366,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 === 277 /* JSDocNullableType */) { + if (typeNode.kind === 278 /* 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, 4096 /* Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -97054,7 +97386,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 277 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 4096 /* Undefined */) : type; + var fixedType = typeNode.kind === 278 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 4096 /* Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -97071,10 +97403,10 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 206 /* AsExpression */: + case 207 /* AsExpression */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 155 /* GetAccessor */: case 159 /* IndexSignature */: case 176 /* MappedType */: @@ -97084,9 +97416,9 @@ var ts; case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 156 /* SetAccessor */: - case 235 /* TypeAliasDeclaration */: - case 188 /* TypeAssertionExpression */: - case 230 /* VariableDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 189 /* TypeAssertionExpression */: + case 231 /* VariableDeclaration */: return true; default: return false; @@ -97143,11 +97475,11 @@ var ts; case 153 /* MethodDeclaration */: insertBefore = containingFunction.name; break; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 89 /* FunctionKeyword */, sourceFile); break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: insertBefore = ts.findChildOfKind(containingFunction, 19 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters); break; default: @@ -97268,9 +97600,9 @@ var ts; return useExistingImportActions.concat(getCodeActionsForAddImport(exportInfos, context, existingImports)); } function getNamespaceImportName(declaration) { - if (declaration.kind === 242 /* ImportDeclaration */) { + if (declaration.kind === 243 /* ImportDeclaration */) { var namedBindings = declaration.importClause && ts.isImportClause(declaration.importClause) && declaration.importClause.namedBindings; - return namedBindings && namedBindings.kind === 244 /* NamespaceImport */ ? namedBindings.name : undefined; + return namedBindings && namedBindings.kind === 245 /* NamespaceImport */ ? namedBindings.name : undefined; } else { return declaration.name; @@ -97286,7 +97618,7 @@ var ts; if (!cached) { cached = cachedImportDeclarations[moduleSymbolId] = ts.mapDefined(imports, function (moduleSpecifier) { var i = ts.importFromModuleSpecifier(moduleSpecifier); - return (i.kind === 242 /* ImportDeclaration */ || i.kind === 241 /* ImportEqualsDeclaration */) + return (i.kind === 243 /* ImportDeclaration */ || i.kind === 242 /* ImportEqualsDeclaration */) && checker.getSymbolAtLocation(moduleSpecifier) === moduleSymbol ? { declaration: i, importKind: importKind } : undefined; }); } @@ -97619,7 +97951,7 @@ var ts; function getCodeActionsForAddImport(exportInfos, ctx, existingImports) { var fromExistingImport = ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind; - if (declaration.kind === 242 /* ImportDeclaration */ && declaration.importClause) { + if (declaration.kind === 243 /* ImportDeclaration */ && declaration.importClause) { var changes = tryUpdateExistingImport(ctx, ts.isImportClause(declaration.importClause) && declaration.importClause || undefined, importKind); if (changes) { var moduleSpecifierWithoutQuotes = ts.stripQuotes(declaration.moduleSpecifier.getText()); @@ -97638,9 +97970,9 @@ var ts; } function newImportInfoFromExistingSpecifier(_a) { var declaration = _a.declaration, importKind = _a.importKind; - var expression = declaration.kind === 242 /* ImportDeclaration */ + var expression = declaration.kind === 243 /* ImportDeclaration */ ? declaration.moduleSpecifier - : declaration.moduleReference.kind === 252 /* ExternalModuleReference */ + : declaration.moduleReference.kind === 253 /* ExternalModuleReference */ ? declaration.moduleReference.expression : undefined; return expression && ts.isStringLiteral(expression) ? { moduleSpecifier: expression.text, importKind: importKind } : undefined; @@ -97648,7 +97980,7 @@ var ts; function tryUpdateExistingImport(context, importClause, importKind) { var symbolName = context.symbolName, sourceFile = context.sourceFile; var name = importClause.name; - var namedBindings = (importClause.kind !== 241 /* ImportEqualsDeclaration */ && importClause).namedBindings; + var namedBindings = (importClause.kind !== 242 /* ImportEqualsDeclaration */ && importClause).namedBindings; switch (importKind) { case 1 /* Default */: return name ? undefined : ChangeTracker.with(context, function (t) { @@ -97656,11 +97988,11 @@ var ts; }); case 0 /* Named */: { var newImportSpecifier_1 = ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(symbolName)); - if (namedBindings && namedBindings.kind === 245 /* NamedImports */ && namedBindings.elements.length !== 0) { + if (namedBindings && namedBindings.kind === 246 /* NamedImports */ && namedBindings.elements.length !== 0) { // There are already named imports; add another. return ChangeTracker.with(context, function (t) { return t.insertNodeInListAfter(sourceFile, namedBindings.elements[namedBindings.elements.length - 1], newImportSpecifier_1); }); } - if (!namedBindings || namedBindings.kind === 245 /* NamedImports */ && namedBindings.elements.length === 0) { + if (!namedBindings || namedBindings.kind === 246 /* NamedImports */ && namedBindings.elements.length === 0) { return ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, importClause, ts.createImportClause(name, ts.createNamedImports([newImportSpecifier_1]))); }); @@ -97711,7 +98043,7 @@ var ts; // The error wasn't for the symbolAtLocation, it was for the JSX tag itself, which needs access to e.g. `React`. var parent = token.parent; var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(parent); - if ((ts.isJsxOpeningLikeElement && parent.tagName === token) || parent.kind === 258 /* JsxOpeningFragment */) { + if ((ts.isJsxOpeningLikeElement && parent.tagName === token) || parent.kind === 259 /* JsxOpeningFragment */) { umdSymbol = checker.resolveName(checker.getJsxNamespace(parent), isNodeOpeningLikeElement ? parent.tagName : parent, 67216319 /* Value */, /*excludeGlobals*/ false); } } @@ -98223,11 +98555,11 @@ var ts; } function isApplicableFunctionForInference(declaration) { switch (declaration.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: return true; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return !!declaration.name; } return false; @@ -98259,7 +98591,7 @@ var ts; function annotate(changes, sourceFile, declaration, type, program) { var typeNode = type && getTypeNodeIfAccessible(type, declaration, program.getTypeChecker()); if (typeNode) - changes.insertTypeAnnotation(sourceFile, declaration, typeNode); + changes.tryInsertTypeAnnotation(sourceFile, declaration, typeNode); } function getTypeNodeIfAccessible(type, enclosingScope, checker) { var typeIsAccessible = true; @@ -98286,8 +98618,8 @@ var ts; function inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) { switch (containingFunction.kind) { case 154 /* Constructor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: var isConstructor = containingFunction.kind === 154 /* Constructor */; var searchToken = isConstructor ? @@ -98355,21 +98687,21 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: usageContext.isNumber = true; break; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpressionContext(node.parent, usageContext); break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext); break; - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext); break; - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpressionContext(node.parent, checker, usageContext); } @@ -98377,10 +98709,10 @@ var ts; inferTypeFromContextualType(node, checker, usageContext); } break; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: inferTypeFromPropertyAccessExpressionContext(node.parent, checker, usageContext); break; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext); break; default: @@ -98482,7 +98814,7 @@ var ts; // LogicalOperator case 54 /* BarBarToken */: if (node === parent.left && - (node.parent.parent.kind === 230 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 231 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usageContext, checker.getTypeAtLocation(parent.right)); @@ -98510,7 +98842,7 @@ var ts; } } inferTypeFromContext(parent, checker, callContext.returnType); - if (parent.kind === 185 /* CallExpression */) { + if (parent.kind === 186 /* CallExpression */) { (usageContext.callContexts || (usageContext.callContexts = [])).push(callContext); } else { @@ -98692,7 +99024,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 185 /* CallExpression */ : 186 /* NewExpression */; + var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 186 /* CallExpression */ : 187 /* NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false), function (a) { return a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length); }); if (!node) { return []; @@ -98807,13 +99139,13 @@ var ts; else if (type.flags & 8 /* Boolean */) { return ts.createFalse(); } - else if (type.flags & 224 /* Literal */) { + else if (type.isLiteral()) { return ts.createLiteral(type.value); } - else if (type.flags & 131072 /* Union */) { + else if (type.isUnion()) { return ts.firstDefined(type.types, function (t) { return getDefaultValueFromType(checker, t); }); } - else if (ts.getObjectFlags(type) & 1 /* Class */) { + else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); if (!classDeclaration || ts.hasModifier(classDeclaration, 128 /* Abstract */)) return undefined; @@ -99201,7 +99533,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 230 /* VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 231 /* VariableDeclaration */) ? node.parent.parent : node; if (ts.hasModifier(declaringNode, 1 /* Export */)) { (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; @@ -99210,13 +99542,13 @@ var ts; } // Some things can't be extracted in certain situations switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; case 97 /* 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 === 185 /* CallExpression */) { + if (node.parent.kind === 186 /* CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -99231,8 +99563,8 @@ var ts; } if (!node || ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node)) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); @@ -99244,20 +99576,20 @@ var ts; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 215 /* IfStatement */: + case 216 /* IfStatement */: permittedJumps = 0 /* None */; break; - case 228 /* TryStatement */: + case 229 /* TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* None */; break; - case 211 /* Block */: - if (node.parent && node.parent.kind === 228 /* TryStatement */ && node.parent.finallyBlock === node) { + case 212 /* Block */: + if (node.parent && node.parent.kind === 229 /* TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* Return */; } break; - case 264 /* CaseClause */: + case 265 /* CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* Break */; break; @@ -99273,7 +99605,7 @@ var ts; case 99 /* ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; break; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); @@ -99281,8 +99613,8 @@ var ts; seenLabels.pop(); break; } - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: { var label = node.label; if (label) { @@ -99292,20 +99624,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 222 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { + if (!(permittedJumps & (node.kind === 223 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: if (permittedJumps & 4 /* Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -99370,7 +99702,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 272 /* SourceFile */) { + if (current.kind === 273 /* SourceFile */) { return scopes; } } @@ -99462,12 +99794,12 @@ var ts; switch (scope.kind) { case 154 /* Constructor */: return "constructor"; - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: return scope.name ? "function '" + scope.name.text + "'" : "anonymous function"; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return "arrow function"; case 153 /* MethodDeclaration */: return "method '" + scope.name.getText(); @@ -99480,12 +99812,12 @@ var ts; } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 233 /* ClassDeclaration */ + return scope.kind === 234 /* ClassDeclaration */ ? scope.name ? "class '" + scope.name.text + "'" : "anonymous class declaration" : scope.name ? "class expression '" + scope.name.text + "'" : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 238 /* ModuleBlock */ + return scope.kind === 239 /* ModuleBlock */ ? "namespace '" + scope.parent.name.getText() + "'" : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */; } @@ -99770,7 +100102,7 @@ var ts; var localReference = ts.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 214 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 215 /* 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.createVariableStatement( @@ -99789,7 +100121,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 214 /* ExpressionStatement */) { + if (node.parent.kind === 215 /* ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.deleteNode(context.file, node.parent, ts.textChanges.useNonAdjustedPositions); } @@ -99906,7 +100238,7 @@ var ts; return { body: ts.createBlock(statements, /*multiLine*/ true), returnValueProperty: undefined }; } function visitor(node) { - if (!ignoreReturns && node.kind === 223 /* ReturnStatement */ && hasWritesOrVariableDeclarations) { + if (!ignoreReturns && node.kind === 224 /* ReturnStatement */ && hasWritesOrVariableDeclarations) { var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); if (node.expression) { if (!returnValueProperty) { @@ -100086,7 +100418,7 @@ var ts; var scope = scopes_1[_i]; usagesPerScope.push({ usages: ts.createMap(), typeParameterUsages: ts.createMap(), substitutions: ts.createMap() }); substitutionsPerScope.push(ts.createMap()); - functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 232 /* FunctionDeclaration */ + functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 233 /* FunctionDeclaration */ ? [ts.createDiagnosticForNode(scope, Messages.cannotExtractToOtherFunctionLike)] : []); var constantErrors = []; @@ -100149,7 +100481,7 @@ var ts; : ts.getEnclosingBlockScopeContainer(scopes[0]); ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations); } - var _loop_12 = function (i) { + var _loop_13 = function (i) { var scopeUsages = usagesPerScope[i]; // Special case: in the innermost scope, all usages are available. // (The computed value reflects the value at the top-level of the scope, but the @@ -100189,7 +100521,7 @@ var ts; } }; for (var i = 0; i < scopes.length; i++) { - _loop_12(i); + _loop_13(i); } return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations }; function hasTypeParameters(node) { @@ -100213,7 +100545,7 @@ var ts; var visitedTypes = symbolWalker.walkType(type).visitedTypes; for (var _i = 0, visitedTypes_1 = visitedTypes; _i < visitedTypes_1.length; _i++) { var visitedType = visitedTypes_1[_i]; - if (visitedType.flags & 32768 /* TypeParameter */) { + if (visitedType.isTypeParameter()) { allTypeParameterUsages.set(visitedType.id.toString(), visitedType); } } @@ -100425,30 +100757,30 @@ var ts; */ function isExtractableExpression(node) { switch (node.parent.kind) { - case 271 /* EnumMember */: + case 272 /* EnumMember */: return false; } switch (node.kind) { case 9 /* StringLiteral */: - return node.parent.kind !== 242 /* ImportDeclaration */ && - node.parent.kind !== 246 /* ImportSpecifier */; - case 202 /* SpreadElement */: - case 178 /* ObjectBindingPattern */: - case 180 /* BindingElement */: + return node.parent.kind !== 243 /* ImportDeclaration */ && + node.parent.kind !== 247 /* ImportSpecifier */; + case 203 /* SpreadElement */: + case 179 /* ObjectBindingPattern */: + case 181 /* BindingElement */: return false; case 71 /* Identifier */: - return node.parent.kind !== 180 /* BindingElement */ && - node.parent.kind !== 246 /* ImportSpecifier */ && - node.parent.kind !== 250 /* ExportSpecifier */; + return node.parent.kind !== 181 /* BindingElement */ && + node.parent.kind !== 247 /* ImportSpecifier */ && + node.parent.kind !== 251 /* ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 211 /* Block */: - case 272 /* SourceFile */: - case 238 /* ModuleBlock */: - case 264 /* CaseClause */: + case 212 /* Block */: + case 273 /* SourceFile */: + case 239 /* ModuleBlock */: + case 265 /* CaseClause */: return true; default: return false; @@ -100813,7 +101145,7 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 274 /* FirstJSDocNode */ || kid.kind > 292 /* LastJSDocNode */; }); + var child = ts.find(children, function (kid) { return kid.kind < 275 /* FirstJSDocNode */ || kid.kind > 293 /* LastJSDocNode */; }); return child.kind < 145 /* FirstNode */ ? child : child.getFirstToken(sourceFile); @@ -100883,7 +101215,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(293 /* SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(294 /* SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -100978,28 +101310,9 @@ var ts; return this.declarations; }; SymbolObject.prototype.getDocumentationComment = function (checker) { - if (this.documentationComment === undefined) { - if (this.declarations) { - this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations(this.declarations); - if (this.documentationComment.length === 0 || this.declarations.some(hasJSDocInheritDocTag)) { - if (checker) { - for (var _i = 0, _a = this.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - var inheritedDocs = findInheritedJSDocComments(declaration, this.getName(), checker); - if (inheritedDocs.length > 0) { - if (this.documentationComment.length > 0) { - inheritedDocs.push(ts.lineBreakPart()); - } - this.documentationComment = ts.concatenate(inheritedDocs, this.documentationComment); - break; - } - } - } - } - } - else { - this.documentationComment = []; - } + if (!this.documentationComment) { + this.documentationComment = ts.emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs + this.documentationComment = getDocumentationComment(this.declarations, checker); } return this.documentationComment; }; @@ -101068,9 +101381,7 @@ var ts; return this.checker.getIndexTypeOfType(this, 1 /* Number */); }; TypeObject.prototype.getBaseTypes = function () { - return this.flags & 65536 /* Object */ && this.objectFlags & (1 /* Class */ | 2 /* Interface */) - ? this.checker.getBaseTypes(this) - : undefined; + return this.isClassOrInterface() ? this.checker.getBaseTypes(this) : undefined; }; TypeObject.prototype.getNonNullableType = function () { return this.checker.getNonNullableType(this); @@ -101081,6 +101392,33 @@ var ts; TypeObject.prototype.getDefault = function () { return this.checker.getDefaultFromTypeParameter(this); }; + TypeObject.prototype.isUnion = function () { + return !!(this.flags & 131072 /* Union */); + }; + TypeObject.prototype.isIntersection = function () { + return !!(this.flags & 262144 /* Intersection */); + }; + TypeObject.prototype.isUnionOrIntersection = function () { + return !!(this.flags & 393216 /* UnionOrIntersection */); + }; + TypeObject.prototype.isLiteral = function () { + return !!(this.flags & 224 /* Literal */); + }; + TypeObject.prototype.isStringLiteral = function () { + return !!(this.flags & 32 /* StringLiteral */); + }; + TypeObject.prototype.isNumberLiteral = function () { + return !!(this.flags & 64 /* NumberLiteral */); + }; + TypeObject.prototype.isTypeParameter = function () { + return !!(this.flags & 32768 /* TypeParameter */); + }; + TypeObject.prototype.isClassOrInterface = function () { + return !!(ts.getObjectFlags(this) & 3 /* ClassOrInterface */); + }; + TypeObject.prototype.isClass = function () { + return !!(ts.getObjectFlags(this) & 1 /* Class */); + }; return TypeObject; }()); var SignatureObject = /** @class */ (function () { @@ -101100,22 +101438,7 @@ var ts; return this.checker.getReturnTypeOfSignature(this); }; SignatureObject.prototype.getDocumentationComment = function () { - if (this.documentationComment === undefined) { - if (this.declaration) { - this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations([this.declaration]); - if (this.documentationComment.length === 0 || hasJSDocInheritDocTag(this.declaration)) { - var inheritedDocs = findInheritedJSDocComments(this.declaration, this.declaration.symbol.getName(), this.checker); - if (this.documentationComment.length > 0) { - inheritedDocs.push(ts.lineBreakPart()); - } - this.documentationComment = ts.concatenate(inheritedDocs, this.documentationComment); - } - } - else { - this.documentationComment = []; - } - } - return this.documentationComment; + return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker)); }; SignatureObject.prototype.getJsDocTags = function () { if (this.jsDocTags === undefined) { @@ -101133,6 +101456,21 @@ var ts; function hasJSDocInheritDocTag(node) { return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; }); } + function getDocumentationComment(declarations, checker) { + if (!declarations) + return ts.emptyArray; + var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations); + if (doc.length === 0 || declarations.some(hasJSDocInheritDocTag)) { + for (var _i = 0, declarations_13 = declarations; _i < declarations_13.length; _i++) { + var declaration = declarations_13[_i]; + var inheritedDocs = findInheritedJSDocComments(declaration, declaration.symbol.name, checker); + // TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs + if (inheritedDocs) + doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc); + } + } + return doc; + } /** * Attempts to find JSDoc comments for possibly-inherited properties. Checks superclasses then traverses * implemented interfaces until a symbol is found with the same name and with documentation. @@ -101142,22 +101480,11 @@ var ts; * @returns A filled array of documentation comments if any were found, otherwise an empty array. */ function findInheritedJSDocComments(declaration, propertyName, typeChecker) { - var foundDocs = false; - return ts.flatMap(declaration.parent ? ts.getAllSuperTypeNodes(declaration.parent) : ts.emptyArray, function (superTypeNode) { - if (foundDocs) { - return ts.emptyArray; - } + return ts.firstDefined(declaration.parent ? ts.getAllSuperTypeNodes(declaration.parent) : ts.emptyArray, function (superTypeNode) { var superType = typeChecker.getTypeAtLocation(superTypeNode); - if (!superType) { - return ts.emptyArray; - } - var baseProperty = typeChecker.getPropertyOfType(superType, propertyName); - if (!baseProperty) { - return ts.emptyArray; - } - var inheritedDocs = baseProperty.getDocumentationComment(typeChecker); - foundDocs = inheritedDocs.length > 0; - return inheritedDocs; + var baseProperty = superType && typeChecker.getPropertyOfType(superType, propertyName); + var inheritedDocs = baseProperty && baseProperty.getDocumentationComment(typeChecker); + return inheritedDocs && inheritedDocs.length ? inheritedDocs : undefined; }); } var SourceFileObject = /** @class */ (function (_super) { @@ -101216,13 +101543,13 @@ var ts; } function getDeclarationName(declaration) { var name = ts.getNameOfDeclaration(declaration); - return name && (ts.isPropertyNameLiteral(name) ? ts.getTextOfIdentifierOrLiteral(name) : - name.kind === 146 /* ComputedPropertyName */ && ts.isPropertyAccessExpression(name.expression) ? name.expression.name.text : undefined); + return name && (ts.isComputedPropertyName(name) && ts.isPropertyAccessExpression(name.expression) ? name.expression.name.text + : ts.isPropertyName(name) ? ts.getNameFromPropertyName(name) : undefined); } function visit(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: var functionDeclaration = node; @@ -101244,17 +101571,17 @@ var ts; } ts.forEachChild(node, visit); break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: - case 237 /* ModuleDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 250 /* ExportSpecifier */: - case 246 /* ImportSpecifier */: - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 251 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 165 /* TypeLiteral */: @@ -101267,8 +101594,8 @@ var ts; break; } // falls through - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: { + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -101279,19 +101606,19 @@ var ts; } } // falls through - case 271 /* EnumMember */: + case 272 /* EnumMember */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: addDeclaration(node); break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -101303,7 +101630,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 244 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 245 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -101312,7 +101639,7 @@ var ts; } } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (ts.getSpecialPropertyAssignmentKind(node) !== 0 /* None */) { addDeclaration(node); } @@ -101847,16 +102174,16 @@ var ts; // Convert from deprecated options names to new names var fullPreferences = __assign({}, ts.identity(options), { includeCompletionsForModuleExports: options.includeCompletionsForModuleExports || options.includeExternalModuleExports, includeCompletionsWithInsertText: options.includeCompletionsWithInsertText || options.includeInsertTextCompletions }); synchronizeHostData(); - return ts.Completions.getCompletionsAtPosition(host, program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, program.getSourceFiles(), fullPreferences); + return ts.Completions.getCompletionsAtPosition(host, program, log, getValidSourceFile(fileName), position, fullPreferences); } function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences) { if (preferences === void 0) { preferences = ts.defaultPreferences; } synchronizeHostData(); - return ts.Completions.getCompletionEntryDetails(program, log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, formattingOptions && ts.formatting.getFormatContext(formattingOptions), getCanonicalFileName, preferences); + return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, formattingOptions && ts.formatting.getFormatContext(formattingOptions), getCanonicalFileName, preferences); } function getCompletionEntrySymbol(fileName, position, name, source) { synchronizeHostData(); - return ts.Completions.getCompletionEntrySymbol(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles()); + return ts.Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name: name, source: source }); } function getQuickInfoAtPosition(fileName, position) { synchronizeHostData(); @@ -101877,7 +102204,7 @@ var ts; return undefined; } // falls through - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 145 /* QualifiedName */: case 99 /* ThisKeyword */: case 173 /* ThisType */: @@ -101917,7 +102244,8 @@ var ts; } return checker.getSymbolAtLocation(node); } - var sourceMapCommentRegExp = /^\/\/[@#] sourceMappingURL=(.+)$/gm; + // Sometimes tools can sometimes see the following line as a source mapping url comment, so we mangle it a bit (the [M]) + var sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)$/gm; var base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/; function scanForSourcemapURL(fileName) { var mappedFile = sourcemappedFileCache.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); @@ -102144,7 +102472,7 @@ var ts; return; } switch (node.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 145 /* QualifiedName */: case 9 /* StringLiteral */: case 86 /* FalseKeyword */: @@ -102169,7 +102497,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 === 237 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 238 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -102599,7 +102927,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 252 /* ExternalModuleReference */ || + node.parent.kind === 253 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -102617,7 +102945,7 @@ var ts; // falls through case 71 /* Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 182 /* ObjectLiteralExpression */ || node.parent.parent.kind === 261 /* JsxAttributes */) && + (node.parent.parent.kind === 183 /* ObjectLiteralExpression */ || node.parent.parent.kind === 262 /* JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -102656,7 +102984,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 184 /* ElementAccessExpression */ && + node.parent.kind === 185 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -108342,7 +108670,7 @@ var ts; // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ var searchPaths = [ts.combinePaths(this.projectService.getExecutingFilePath(), "../../..")].concat(this.projectService.pluginProbeLocations); if (this.projectService.globalPlugins) { - var _loop_13 = function (globalPluginName) { + var _loop_14 = function (globalPluginName) { // Skip empty names from odd commandline parses if (!globalPluginName) return "continue"; @@ -108357,7 +108685,7 @@ var ts; // Enable global plugins with synthetic configuration entries for (var _i = 0, _a = this.projectService.globalPlugins; _i < _a.length; _i++) { var globalPluginName = _a[_i]; - _loop_13(globalPluginName); + _loop_14(globalPluginName); } } }; @@ -110042,7 +110370,7 @@ var ts; return projects; function combineProjects(toAddInfo) { if (toAddInfo !== info) { - var _loop_14 = function (project) { + var _loop_15 = function (project) { // Add the projects only if they can use symLink targets and not already in the list if (project.languageServiceEnabled && !project.getCompilerOptions().preserveSymlinks && @@ -110058,7 +110386,7 @@ var ts; }; for (var _i = 0, _a = toAddInfo.containingProjects; _i < _a.length; _i++) { var project = _a[_i]; - _loop_14(project); + _loop_15(project); } } } @@ -110375,13 +110703,13 @@ var ts; this.printProjects(); }; ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { - var _loop_15 = function (proj) { + var _loop_16 = function (proj) { var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); }; for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { var proj = currentProjects_1[_i]; - _loop_15(proj); + _loop_16(proj); } }; /* @internal */ @@ -110490,7 +110818,7 @@ var ts; var excludeRules = []; var normalizedNames = rootFiles.map(function (f) { return ts.normalizeSlashes(f.fileName); }); var excludedFiles = []; - var _loop_16 = function (name) { + var _loop_17 = function (name) { var rule = this_2.safelist[name]; for (var _i = 0, normalizedNames_1 = normalizedNames; _i < normalizedNames_1.length; _i++) { var root = normalizedNames_1[_i]; @@ -110508,7 +110836,7 @@ var ts; } } if (rule.exclude) { - var _loop_17 = function (exclude) { + var _loop_18 = function (exclude) { var processedRule = root.replace(rule.match, function () { var groups = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -110535,7 +110863,7 @@ var ts; }; for (var _c = 0, _d = rule.exclude; _c < _d.length; _c++) { var exclude = _d[_c]; - _loop_17(exclude); + _loop_18(exclude); } } else { @@ -110551,11 +110879,11 @@ var ts; var this_2 = this; for (var _i = 0, _a = Object.keys(this.safelist); _i < _a.length; _i++) { var name = _a[_i]; - _loop_16(name); + _loop_17(name); } var excludeRegexes = excludeRules.map(function (e) { return new RegExp(e, "i"); }); var filesToKeep = []; - var _loop_18 = function (i) { + var _loop_19 = function (i) { if (excludeRegexes.some(function (re) { return re.test(normalizedNames[i]); })) { excludedFiles.push(normalizedNames[i]); } @@ -110593,7 +110921,7 @@ var ts; }; var this_3 = this; for (var i = 0; i < proj.rootFiles.length; i++) { - _loop_18(i); + _loop_19(i); } proj.rootFiles = filesToKeep; return excludedFiles; diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 94dcc50dc28..99804672930 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -240,128 +240,129 @@ declare namespace ts { IndexedAccessType = 175, MappedType = 176, LiteralType = 177, - ObjectBindingPattern = 178, - ArrayBindingPattern = 179, - BindingElement = 180, - ArrayLiteralExpression = 181, - ObjectLiteralExpression = 182, - PropertyAccessExpression = 183, - ElementAccessExpression = 184, - CallExpression = 185, - NewExpression = 186, - TaggedTemplateExpression = 187, - TypeAssertionExpression = 188, - ParenthesizedExpression = 189, - FunctionExpression = 190, - ArrowFunction = 191, - DeleteExpression = 192, - TypeOfExpression = 193, - VoidExpression = 194, - AwaitExpression = 195, - PrefixUnaryExpression = 196, - PostfixUnaryExpression = 197, - BinaryExpression = 198, - ConditionalExpression = 199, - TemplateExpression = 200, - YieldExpression = 201, - SpreadElement = 202, - ClassExpression = 203, - OmittedExpression = 204, - ExpressionWithTypeArguments = 205, - AsExpression = 206, - NonNullExpression = 207, - MetaProperty = 208, - TemplateSpan = 209, - SemicolonClassElement = 210, - Block = 211, - VariableStatement = 212, - EmptyStatement = 213, - ExpressionStatement = 214, - IfStatement = 215, - DoStatement = 216, - WhileStatement = 217, - ForStatement = 218, - ForInStatement = 219, - ForOfStatement = 220, - ContinueStatement = 221, - BreakStatement = 222, - ReturnStatement = 223, - WithStatement = 224, - SwitchStatement = 225, - LabeledStatement = 226, - ThrowStatement = 227, - TryStatement = 228, - DebuggerStatement = 229, - VariableDeclaration = 230, - VariableDeclarationList = 231, - FunctionDeclaration = 232, - ClassDeclaration = 233, - InterfaceDeclaration = 234, - TypeAliasDeclaration = 235, - EnumDeclaration = 236, - ModuleDeclaration = 237, - ModuleBlock = 238, - CaseBlock = 239, - NamespaceExportDeclaration = 240, - ImportEqualsDeclaration = 241, - ImportDeclaration = 242, - ImportClause = 243, - NamespaceImport = 244, - NamedImports = 245, - ImportSpecifier = 246, - ExportAssignment = 247, - ExportDeclaration = 248, - NamedExports = 249, - ExportSpecifier = 250, - MissingDeclaration = 251, - ExternalModuleReference = 252, - JsxElement = 253, - JsxSelfClosingElement = 254, - JsxOpeningElement = 255, - JsxClosingElement = 256, - JsxFragment = 257, - JsxOpeningFragment = 258, - JsxClosingFragment = 259, - JsxAttribute = 260, - JsxAttributes = 261, - JsxSpreadAttribute = 262, - JsxExpression = 263, - CaseClause = 264, - DefaultClause = 265, - HeritageClause = 266, - CatchClause = 267, - PropertyAssignment = 268, - ShorthandPropertyAssignment = 269, - SpreadAssignment = 270, - EnumMember = 271, - SourceFile = 272, - Bundle = 273, - JSDocTypeExpression = 274, - JSDocAllType = 275, - JSDocUnknownType = 276, - JSDocNullableType = 277, - JSDocNonNullableType = 278, - JSDocOptionalType = 279, - JSDocFunctionType = 280, - JSDocVariadicType = 281, - JSDocComment = 282, - JSDocTypeLiteral = 283, - JSDocTag = 284, - JSDocAugmentsTag = 285, - JSDocClassTag = 286, - JSDocParameterTag = 287, - JSDocReturnTag = 288, - JSDocTypeTag = 289, - JSDocTemplateTag = 290, - JSDocTypedefTag = 291, - JSDocPropertyTag = 292, - SyntaxList = 293, - NotEmittedStatement = 294, - PartiallyEmittedExpression = 295, - CommaListExpression = 296, - MergeDeclarationMarker = 297, - EndOfDeclarationMarker = 298, - Count = 299, + ImportType = 178, + ObjectBindingPattern = 179, + ArrayBindingPattern = 180, + BindingElement = 181, + ArrayLiteralExpression = 182, + ObjectLiteralExpression = 183, + PropertyAccessExpression = 184, + ElementAccessExpression = 185, + CallExpression = 186, + NewExpression = 187, + TaggedTemplateExpression = 188, + TypeAssertionExpression = 189, + ParenthesizedExpression = 190, + FunctionExpression = 191, + ArrowFunction = 192, + DeleteExpression = 193, + TypeOfExpression = 194, + VoidExpression = 195, + AwaitExpression = 196, + PrefixUnaryExpression = 197, + PostfixUnaryExpression = 198, + BinaryExpression = 199, + ConditionalExpression = 200, + TemplateExpression = 201, + YieldExpression = 202, + SpreadElement = 203, + ClassExpression = 204, + OmittedExpression = 205, + ExpressionWithTypeArguments = 206, + AsExpression = 207, + NonNullExpression = 208, + MetaProperty = 209, + TemplateSpan = 210, + SemicolonClassElement = 211, + Block = 212, + VariableStatement = 213, + EmptyStatement = 214, + ExpressionStatement = 215, + IfStatement = 216, + DoStatement = 217, + WhileStatement = 218, + ForStatement = 219, + ForInStatement = 220, + ForOfStatement = 221, + ContinueStatement = 222, + BreakStatement = 223, + ReturnStatement = 224, + WithStatement = 225, + SwitchStatement = 226, + LabeledStatement = 227, + ThrowStatement = 228, + TryStatement = 229, + DebuggerStatement = 230, + VariableDeclaration = 231, + VariableDeclarationList = 232, + FunctionDeclaration = 233, + ClassDeclaration = 234, + InterfaceDeclaration = 235, + TypeAliasDeclaration = 236, + EnumDeclaration = 237, + ModuleDeclaration = 238, + ModuleBlock = 239, + CaseBlock = 240, + NamespaceExportDeclaration = 241, + ImportEqualsDeclaration = 242, + ImportDeclaration = 243, + ImportClause = 244, + NamespaceImport = 245, + NamedImports = 246, + ImportSpecifier = 247, + ExportAssignment = 248, + ExportDeclaration = 249, + NamedExports = 250, + ExportSpecifier = 251, + MissingDeclaration = 252, + ExternalModuleReference = 253, + JsxElement = 254, + JsxSelfClosingElement = 255, + JsxOpeningElement = 256, + JsxClosingElement = 257, + JsxFragment = 258, + JsxOpeningFragment = 259, + JsxClosingFragment = 260, + JsxAttribute = 261, + JsxAttributes = 262, + JsxSpreadAttribute = 263, + JsxExpression = 264, + CaseClause = 265, + DefaultClause = 266, + HeritageClause = 267, + CatchClause = 268, + PropertyAssignment = 269, + ShorthandPropertyAssignment = 270, + SpreadAssignment = 271, + EnumMember = 272, + SourceFile = 273, + Bundle = 274, + JSDocTypeExpression = 275, + JSDocAllType = 276, + JSDocUnknownType = 277, + JSDocNullableType = 278, + JSDocNonNullableType = 279, + JSDocOptionalType = 280, + JSDocFunctionType = 281, + JSDocVariadicType = 282, + JSDocComment = 283, + JSDocTypeLiteral = 284, + JSDocTag = 285, + JSDocAugmentsTag = 286, + JSDocClassTag = 287, + JSDocParameterTag = 288, + JSDocReturnTag = 289, + JSDocTypeTag = 290, + JSDocTemplateTag = 291, + JSDocTypedefTag = 292, + JSDocPropertyTag = 293, + SyntaxList = 294, + NotEmittedStatement = 295, + PartiallyEmittedExpression = 296, + CommaListExpression = 297, + MergeDeclarationMarker = 298, + EndOfDeclarationMarker = 299, + Count = 300, FirstAssignment = 58, LastAssignment = 70, FirstCompoundAssignment = 59, @@ -373,7 +374,7 @@ declare namespace ts { FirstFutureReservedWord = 108, LastFutureReservedWord = 116, FirstTypeNode = 160, - LastTypeNode = 177, + LastTypeNode = 178, FirstPunctuation = 17, LastPunctuation = 70, FirstToken = 0, @@ -387,10 +388,10 @@ declare namespace ts { FirstBinaryOperator = 27, LastBinaryOperator = 70, FirstNode = 145, - FirstJSDocNode = 274, - LastJSDocNode = 292, - FirstJSDocTagNode = 284, - LastJSDocTagNode = 292 + FirstJSDocNode = 275, + LastJSDocNode = 293, + FirstJSDocTagNode = 285, + LastJSDocTagNode = 293 } enum NodeFlags { None = 0, @@ -697,6 +698,12 @@ declare namespace ts { interface KeywordTypeNode extends TypeNode { kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.VoidKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.NullKeyword | SyntaxKind.NeverKeyword; } + interface ImportTypeNode extends NodeWithTypeArguments { + kind: SyntaxKind.ImportType; + isTypeOf?: boolean; + argument: TypeNode; + qualifier?: EntityName; + } interface ThisTypeNode extends TypeNode { kind: SyntaxKind.ThisType; } @@ -707,11 +714,13 @@ declare namespace ts { interface ConstructorTypeNode extends TypeNode, SignatureDeclarationBase { kind: SyntaxKind.ConstructorType; } + interface NodeWithTypeArguments extends TypeNode { + typeArguments?: NodeArray; + } type TypeReferenceType = TypeReferenceNode | ExpressionWithTypeArguments; - interface TypeReferenceNode extends TypeNode { + interface TypeReferenceNode extends NodeWithTypeArguments { kind: SyntaxKind.TypeReference; typeName: EntityName; - typeArguments?: NodeArray; } interface TypePredicateNode extends TypeNode { kind: SyntaxKind.TypePredicate; @@ -1027,11 +1036,10 @@ declare namespace ts { interface ImportCall extends CallExpression { expression: ImportExpression; } - interface ExpressionWithTypeArguments extends TypeNode { + interface ExpressionWithTypeArguments extends NodeWithTypeArguments { kind: SyntaxKind.ExpressionWithTypeArguments; parent?: HeritageClause; expression: LeftHandSideExpression; - typeArguments?: NodeArray; } interface NewExpression extends PrimaryExpression, Declaration { kind: SyntaxKind.NewExpression; @@ -1689,6 +1697,7 @@ declare namespace ts { getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + getConfigFileParsingDiagnostics(): ReadonlyArray; /** * Gets a type checker that can be used to semantically analyze source files in the program. */ @@ -1812,7 +1821,7 @@ declare namespace ts { isArgumentsSymbol(symbol: Symbol): boolean; isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; - isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean; /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; @@ -1824,6 +1833,7 @@ declare namespace ts { getApparentType(type: Type): Type; getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined; getSuggestionForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): string | undefined; + getSuggestionForNonexistentModule(node: Identifier, target: Symbol): string | undefined; getBaseConstraintOfType(type: Type): Type | undefined; getDefaultFromTypeParameter(type: Type): Type | undefined; } @@ -2583,9 +2593,10 @@ declare namespace ts { interface EmitHelper { readonly name: string; readonly scoped: boolean; - readonly text: string; + readonly text: string | ((node: EmitHelperUniqueNameCallback) => string); readonly priority?: number; } + type EmitHelperUniqueNameCallback = (name: string) => string; enum EmitHint { SourceFile = 0, Expression = 1, @@ -2757,6 +2768,7 @@ declare namespace ts { removeComments?: boolean; newLine?: NewLineKind; omitTrailingSemicolon?: boolean; + noEmitHelpers?: boolean; } /** @deprecated See comment on SymbolWriter */ interface SymbolTracker { @@ -3396,6 +3408,8 @@ declare namespace ts { function createUniqueName(text: string): Identifier; /** Create a unique name based on the supplied text. */ function createOptimisticUniqueName(text: string): Identifier; + /** Create a unique name based on the supplied text. This does not consider names injected by the transformer. */ + function createFileLevelUniqueName(text: string): Identifier; /** Create a unique name generated for a node. */ function getGeneratedNameForNode(node: Node): Identifier; function createToken(token: TKind): Token; @@ -3430,9 +3444,9 @@ declare namespace ts { function updateGetAccessor(node: GetAccessorDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: PropertyName, parameters: ReadonlyArray, type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; function createSetAccessor(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: string | PropertyName, parameters: ReadonlyArray, body: Block | undefined): SetAccessorDeclaration; function updateSetAccessor(node: SetAccessorDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: PropertyName, parameters: ReadonlyArray, body: Block | undefined): SetAccessorDeclaration; - function createCallSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration; + function createCallSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): CallSignatureDeclaration; function updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; - function createConstructSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; + function createConstructSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function createIndexSignature(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; function updateIndexSignature(node: IndexSignatureDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; @@ -3441,9 +3455,9 @@ declare namespace ts { function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; function createTypeReferenceNode(typeName: string | EntityName, typeArguments: ReadonlyArray | undefined): TypeReferenceNode; function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray | undefined): TypeReferenceNode; - function createFunctionTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): FunctionTypeNode; + function createFunctionTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): FunctionTypeNode; function updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): FunctionTypeNode; - function createConstructorTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructorTypeNode; + function createConstructorTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): ConstructorTypeNode; function updateConstructorTypeNode(node: ConstructorTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructorTypeNode; function createTypeQueryNode(exprName: EntityName): TypeQueryNode; function updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName): TypeQueryNode; @@ -3453,15 +3467,17 @@ declare namespace ts { function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; function createTupleTypeNode(elementTypes: ReadonlyArray): TupleTypeNode; function updateTypleTypeNode(node: TupleTypeNode, elementTypes: ReadonlyArray): TupleTypeNode; - function createUnionTypeNode(types: TypeNode[]): UnionTypeNode; + function createUnionTypeNode(types: ReadonlyArray): UnionTypeNode; function updateUnionTypeNode(node: UnionTypeNode, types: NodeArray): UnionTypeNode; - function createIntersectionTypeNode(types: TypeNode[]): IntersectionTypeNode; + function createIntersectionTypeNode(types: ReadonlyArray): IntersectionTypeNode; function updateIntersectionTypeNode(node: IntersectionTypeNode, types: NodeArray): IntersectionTypeNode; function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: ReadonlyArray): UnionOrIntersectionTypeNode; function createConditionalTypeNode(checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; function updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; function createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; function updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; + function createImportTypeNode(argument: TypeNode, qualifier?: EntityName, typeArguments?: ReadonlyArray, isTypeOf?: boolean): ImportTypeNode; + function updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, qualifier?: EntityName, typeArguments?: ReadonlyArray, isTypeOf?: boolean): ImportTypeNode; function createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; function createThisTypeNode(): ThisTypeNode; @@ -3660,7 +3676,7 @@ declare namespace ts { function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment; function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember; function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember; - function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"]): SourceFile; + function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean): SourceFile; /** * Creates a shallow, memberwise clone of a node for mutation. */ @@ -3686,10 +3702,10 @@ declare namespace ts { function updateCommaList(node: CommaListExpression, elements: ReadonlyArray): CommaListExpression; function createBundle(sourceFiles: ReadonlyArray): Bundle; function updateBundle(node: Bundle, sourceFiles: ReadonlyArray): Bundle; - function createImmediatelyInvokedFunctionExpression(statements: Statement[]): CallExpression; - function createImmediatelyInvokedFunctionExpression(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; - function createImmediatelyInvokedArrowFunction(statements: Statement[]): CallExpression; - function createImmediatelyInvokedArrowFunction(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; + function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray): CallExpression; + function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; + function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray): CallExpression; + function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; function createComma(left: Expression, right: Expression): Expression; function createLessThan(left: Expression, right: Expression): Expression; function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment; @@ -3877,6 +3893,7 @@ declare namespace ts { function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string; function formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; + function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): ReadonlyArray; /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' * that represent a compilation unit. @@ -3888,9 +3905,10 @@ declare namespace ts { * @param options - The compiler options which should be used. * @param host - The host interacts with the underlying file system. * @param oldProgram - Reuses an old program structure. + * @param configFileParsingDiagnostics - error during config file parsing * @returns A 'Program' object. */ - function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; + function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray): Program; } declare namespace ts { interface EmitOutput { @@ -3951,6 +3969,10 @@ declare namespace ts { * Get the diagnostics that dont belong to any file */ getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + /** + * Get the diagnostics from config file parsing + */ + getConfigFileParsingDiagnostics(): ReadonlyArray; /** * Get the syntax diagnostics, for all source files if source file is not supplied */ @@ -4010,24 +4032,25 @@ declare namespace ts { /** * Create the builder to manage semantic diagnostics and cache them */ - function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram): SemanticDiagnosticsBuilderProgram; - function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram): SemanticDiagnosticsBuilderProgram; + function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram; + function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram; /** * Create the builder that can handle the changes in program and iterate through changed files * to emit the those files and manage semantic diagnostics cache as well */ - function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram): EmitAndSemanticDiagnosticsBuilderProgram; - function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram): EmitAndSemanticDiagnosticsBuilderProgram; + function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram; + function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram; /** * Creates a builder thats just abstraction over program and can be used with watch */ - function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram): BuilderProgram; - function createAbstractBuilder(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: BuilderProgram): BuilderProgram; + function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; + function createAbstractBuilder(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; } declare namespace ts { type DiagnosticReporter = (diagnostic: Diagnostic) => void; type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void; - type CreateProgram = (rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: T) => T; + /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */ + type CreateProgram = (rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: ReadonlyArray) => T; interface WatchCompilerHost { /** * Used to create the program when need for program creation or recreation detected @@ -4091,10 +4114,6 @@ declare namespace ts { * Reports config file diagnostics */ interface ConfigFileDiagnosticsReporter { - /** - * Reports the diagnostics in reading/writing or parsing of the config file - */ - onConfigFileDiagnostic: DiagnosticReporter; /** * Reports unrecoverable error when parsing config file */ @@ -4241,6 +4260,15 @@ declare namespace ts { getNonNullableType(): Type; getConstraint(): Type | undefined; getDefault(): Type | undefined; + isUnion(): this is UnionType; + isIntersection(): this is IntersectionType; + isUnionOrIntersection(): this is UnionOrIntersectionType; + isLiteral(): this is LiteralType; + isStringLiteral(): this is StringLiteralType; + isNumberLiteral(): this is NumberLiteralType; + isTypeParameter(): this is TypeParameter; + isClassOrInterface(): this is InterfaceType; + isClass(): this is InterfaceType; } interface Signature { getDeclaration(): SignatureDeclaration; @@ -4655,6 +4683,7 @@ declare namespace ts { placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; insertSpaceBeforeTypeAnnotation?: boolean; + indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean; } interface DefinitionInfo { fileName: string; diff --git a/lib/typescript.js b/lib/typescript.js index 06d660a8873..b343a3c3135 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -22,6 +22,10 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { } return t; }; +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || @@ -239,144 +243,145 @@ var ts; SyntaxKind[SyntaxKind["IndexedAccessType"] = 175] = "IndexedAccessType"; SyntaxKind[SyntaxKind["MappedType"] = 176] = "MappedType"; SyntaxKind[SyntaxKind["LiteralType"] = 177] = "LiteralType"; + SyntaxKind[SyntaxKind["ImportType"] = 178] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 178] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 179] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 180] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 179] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 180] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 181] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 181] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 182] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 183] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 184] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 185] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 186] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 187] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 188] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 189] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 190] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 191] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 192] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 193] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 194] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 195] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 196] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 197] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 198] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 199] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 200] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 201] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 202] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 203] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 204] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 205] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 206] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 207] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 208] = "MetaProperty"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 182] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 183] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 184] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 185] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 186] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 187] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 188] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 189] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 190] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 191] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 192] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 193] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 194] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 195] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 196] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 197] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 198] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 199] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 200] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 201] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 202] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 203] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 204] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 205] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 206] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 207] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 208] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 209] = "MetaProperty"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 209] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 210] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 210] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 211] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 211] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 212] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 213] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 214] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 215] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 216] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 217] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 218] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 219] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 220] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 221] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 222] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 223] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 224] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 225] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 226] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 227] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 228] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 229] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 230] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 231] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 232] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 233] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 234] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 235] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 236] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 237] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 238] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 239] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 240] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 241] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 242] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 243] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 244] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 245] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 246] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 247] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 248] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 249] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 250] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 251] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 212] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 213] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 214] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 215] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 216] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 217] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 218] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 219] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 220] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 221] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 222] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 223] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 224] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 225] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 226] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 227] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 228] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 229] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 230] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 231] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 232] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 233] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 234] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 235] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 236] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 237] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 238] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 239] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 240] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 241] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 242] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 243] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 244] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 245] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 246] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 247] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 248] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 249] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 250] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 251] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 252] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 252] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 253] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 253] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 254] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 255] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 256] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 257] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 258] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 259] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 260] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 261] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 262] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 263] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 254] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 255] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 256] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 257] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 258] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 259] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 260] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 261] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 262] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 263] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 264] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 264] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 265] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 266] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 267] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 265] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 266] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 267] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 268] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 268] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 269] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 270] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 269] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 270] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 271] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 271] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 272] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 272] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 273] = "Bundle"; + SyntaxKind[SyntaxKind["SourceFile"] = 273] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 274] = "Bundle"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 274] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 275] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 275] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 276] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 276] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 277] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 278] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 279] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 280] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 281] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 282] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 283] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocTag"] = 284] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 285] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 286] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 287] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 288] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 289] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 290] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 291] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 292] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 277] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 278] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 279] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 280] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 281] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 282] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 283] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 284] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocTag"] = 285] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 286] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 287] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 288] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 289] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 290] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 291] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 292] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 293] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 294] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 296] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 297] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 298] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 295] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 296] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 297] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 298] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 299] = "EndOfDeclarationMarker"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 299] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 300] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment"; @@ -389,7 +394,7 @@ var ts; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 108] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 116] = "LastFutureReservedWord"; SyntaxKind[SyntaxKind["FirstTypeNode"] = 160] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 177] = "LastTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 178] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 17] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 70] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; @@ -403,10 +408,10 @@ var ts; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 27] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 145] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 274] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 292] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 284] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 275] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 293] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 285] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 293] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword"; /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 144] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); @@ -501,11 +506,12 @@ var ts; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Loop"] = 2] = "Loop"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Unique"] = 3] = "Unique"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Node"] = 4] = "Node"; - GeneratedIdentifierFlags[GeneratedIdentifierFlags["OptimisticUnique"] = 5] = "OptimisticUnique"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["KindMask"] = 7] = "KindMask"; // Flags GeneratedIdentifierFlags[GeneratedIdentifierFlags["SkipNameGenerationScope"] = 8] = "SkipNameGenerationScope"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["ReservedInNestedScopes"] = 16] = "ReservedInNestedScopes"; + GeneratedIdentifierFlags[GeneratedIdentifierFlags["Optimistic"] = 32] = "Optimistic"; + GeneratedIdentifierFlags[GeneratedIdentifierFlags["FileLevel"] = 64] = "FileLevel"; })(GeneratedIdentifierFlags = ts.GeneratedIdentifierFlags || (ts.GeneratedIdentifierFlags = {})); /* @internal */ var TokenFlags; @@ -3028,7 +3034,7 @@ var ts; ts.compose = compose; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (_match, index) { return Debug.assertDefined(args[+index + baseIndex]); }); } ts.formatStringFromArgs = formatStringFromArgs; function getLocaleSpecificMessage(message) { @@ -4801,13 +4807,18 @@ var ts; */ function watchChildDirectories(parentDir, existingChildWatches, callback) { var newChildWatches; - ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? host.getAccessileSortedChildDirectories(parentDir) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(ts.getNormalizedAbsolutePath(child, parentDir), childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); + ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? ts.mapDefined(host.getAccessibleSortedChildDirectories(parentDir), function (child) { + var childFullName = ts.getNormalizedAbsolutePath(child, parentDir); + // Filter our the symbolic link directories since those arent included in recursive watch + // which is same behaviour when recursive: true is passed to fs.watch + return host.filePathComparer(childFullName, host.realpath(childFullName)) === 0 /* EqualTo */ ? childFullName : undefined; + }) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); return newChildWatches || ts.emptyArray; /** * Create new childDirectoryWatcher and add it to the new ChildDirectoryWatcher list */ function createAndAddChildDirectoryWatcher(childName) { - var result = createDirectoryWatcher(ts.getNormalizedAbsolutePath(childName, parentDir), callback); + var result = createDirectoryWatcher(childName, callback); addChildDirectoryWatcher(result); } /** @@ -4916,14 +4927,7 @@ var ts; exit: function (exitCode) { process.exit(exitCode); }, - realpath: function (path) { - try { - return _fs.realpathSync(path); - } - catch (_a) { - return path; - } - }, + realpath: realpath, debugMode: ts.some(process.execArgv, function (arg) { return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg); }), tryEnableSourceMapsForHost: function () { try { @@ -5009,8 +5013,9 @@ var ts; var watchDirectoryRecursively = createRecursiveDirectoryWatcher({ filePathComparer: useCaseSensitiveFileNames ? ts.compareStringsCaseSensitive : ts.compareStringsCaseInsensitive, directoryExists: directoryExists, - getAccessileSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, - watchDirectory: watchDirectory + getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, + watchDirectory: watchDirectory, + realpath: realpath }); return function (directoryName, callback, recursive) { if (recursive) { @@ -5312,6 +5317,14 @@ var ts; function getDirectories(path) { return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); }); } + function realpath(path) { + try { + return _fs.realpathSync(path); + } + catch (_a) { + return path; + } + } function getModifiedTime(path) { try { return _fs.statSync(path).mtime; @@ -5428,6 +5441,7 @@ var ts; Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), Unexpected_token: diag(1012, ts.DiagnosticCategory.Error, "Unexpected_token_1012", "Unexpected token."), + A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma: diag(1013, ts.DiagnosticCategory.Error, "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013", "A rest parameter or binding pattern may not have a trailing comma."), A_rest_parameter_must_be_last_in_a_parameter_list: diag(1014, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."), Parameter_cannot_have_question_mark_and_initializer: diag(1015, ts.DiagnosticCategory.Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."), A_required_parameter_cannot_follow_an_optional_parameter: diag(1016, ts.DiagnosticCategory.Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."), @@ -5659,6 +5673,9 @@ var ts; An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead: diag(1336, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead_1336", "An index signature parameter type cannot be a type alias. Consider writing '[{0}: {1}]: {2}' instead."), An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead: diag(1337, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead_1337", "An index signature parameter type cannot be a union type. Consider using a mapped object type instead."), infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."), + Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."), + Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340", "Module '{0}' does not refer to a type, but is used as a type here."), + Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."), Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."), Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."), @@ -5764,7 +5781,7 @@ var ts; The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."), The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: diag(2405, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."), The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: diag(2406, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."), - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter."), + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."), Setters_cannot_return_a_value: diag(2408, ts.DiagnosticCategory.Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."), Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: diag(2409, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."), The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: diag(2410, ts.DiagnosticCategory.Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."), @@ -5838,7 +5855,7 @@ var ts; The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: diag(2483, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."), Export_declaration_conflicts_with_exported_declaration_of_0: diag(2484, ts.DiagnosticCategory.Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."), The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: diag(2487, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."), - Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type must have a '[Symbol.iterator]()' method that returns an iterator."), + Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."), An_iterator_must_have_a_next_method: diag(2489, ts.DiagnosticCategory.Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."), The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: diag(2490, ts.DiagnosticCategory.Error, "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the 'next()' method of an iterator must have a 'value' property."), The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: diag(2491, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."), @@ -5854,7 +5871,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: diag(2501, ts.DiagnosticCategory.Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."), _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: diag(2502, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."), Cannot_find_namespace_0: diag(2503, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."), - Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), + Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), A_generator_cannot_have_a_void_type_annotation: diag(2505, ts.DiagnosticCategory.Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."), _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: diag(2506, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."), Type_0_is_not_a_constructor_function_type: diag(2507, ts.DiagnosticCategory.Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."), @@ -5918,6 +5935,8 @@ var ts; Property_0_is_used_before_being_assigned: diag(2565, ts.DiagnosticCategory.Error, "Property_0_is_used_before_being_assigned_2565", "Property '{0}' is used before being assigned."), A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."), Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."), + Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2568, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568", "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), + Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."), The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."), JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."), @@ -8485,7 +8504,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 272 /* SourceFile */) { + while (node && node.kind !== 273 /* SourceFile */) { node = node.parent; } return node; @@ -8493,11 +8512,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 211 /* Block */: - case 239 /* CaseBlock */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 212 /* Block */: + case 240 /* CaseBlock */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: return true; } return false; @@ -8541,6 +8560,14 @@ var ts; } } ts.getEndLinePosition = getEndLinePosition; + /** + * Returns a value indicating whether a name is unique globally or within the current file + */ + function isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) { + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name); + } + ts.isFileLevelUniqueName = isFileLevelUniqueName; // Returns true if this node is missing from the actual source code. A 'missing' node is different // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes // in the tree), it is definitely missing. However, a node may be defined, but still be @@ -8606,7 +8633,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 === 293 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 294 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -8720,7 +8747,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 230 /* VariableDeclaration */ && node.parent.kind === 267 /* CatchClause */; + return node.kind === 231 /* VariableDeclaration */ && node.parent.kind === 268 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -8742,11 +8769,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 === 237 /* ModuleDeclaration */ && (!node.body); + return node && node.kind === 238 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 272 /* SourceFile */ || - node.kind === 237 /* ModuleDeclaration */ || + return node.kind === 273 /* SourceFile */ || + node.kind === 238 /* ModuleDeclaration */ || ts.isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -8763,9 +8790,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 272 /* SourceFile */: + case 273 /* SourceFile */: return ts.isExternalModule(node.parent); - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -8777,22 +8804,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 272 /* SourceFile */: - case 239 /* CaseBlock */: - case 267 /* CatchClause */: - case 237 /* ModuleDeclaration */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 273 /* SourceFile */: + case 240 /* CaseBlock */: + case 268 /* CatchClause */: + case 238 /* ModuleDeclaration */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: case 154 /* Constructor */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; - case 211 /* Block */: + case 212 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return parentNode && !ts.isFunctionLike(parentNode); @@ -8808,19 +8835,19 @@ var ts; case 159 /* IndexSignature */: case 162 /* FunctionType */: case 163 /* ConstructorType */: - case 280 /* JSDocFunctionType */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 290 /* JSDocTemplateTag */: - case 232 /* FunctionDeclaration */: + case 281 /* JSDocFunctionType */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 291 /* JSDocTemplateTag */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; default: ts.assertTypeIsNever(node); @@ -8830,8 +8857,8 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isAnyImportSyntax(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: return true; default: return false; @@ -8885,7 +8912,7 @@ var ts; return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); case 145 /* QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -8932,7 +8959,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 211 /* Block */) { + if (node.body && node.body.kind === 212 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -8946,7 +8973,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* 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 @@ -8955,23 +8982,23 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: errorNode = node.name; break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -9000,7 +9027,7 @@ var ts; } ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isConstEnumDeclaration(node) { - return node.kind === 236 /* EnumDeclaration */ && isConst(node); + return node.kind === 237 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -9013,15 +9040,21 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 185 /* CallExpression */ && n.expression.kind === 97 /* SuperKeyword */; + return n.kind === 186 /* CallExpression */ && n.expression.kind === 97 /* SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 185 /* CallExpression */ && n.expression.kind === 91 /* ImportKeyword */; + return n.kind === 186 /* CallExpression */ && n.expression.kind === 91 /* ImportKeyword */; } ts.isImportCall = isImportCall; + function isLiteralImportTypeNode(n) { + return n.kind === 178 /* ImportType */ && + n.argument.kind === 177 /* LiteralType */ && + ts.isStringLiteral(n.argument.literal); + } + ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 214 /* ExpressionStatement */ + return node.kind === 215 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -9032,9 +9065,9 @@ var ts; function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 148 /* Parameter */ || node.kind === 147 /* TypeParameter */ || - node.kind === 190 /* FunctionExpression */ || - node.kind === 191 /* ArrowFunction */ || - node.kind === 189 /* ParenthesizedExpression */) ? + node.kind === 191 /* FunctionExpression */ || + node.kind === 192 /* ArrowFunction */ || + node.kind === 190 /* ParenthesizedExpression */) ? 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 '/**/' @@ -9050,7 +9083,7 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (160 /* FirstTypeNode */ <= node.kind && node.kind <= 177 /* LastTypeNode */) { + if (160 /* FirstTypeNode */ <= node.kind && node.kind <= 178 /* LastTypeNode */) { return true; } switch (node.kind) { @@ -9063,8 +9096,8 @@ var ts; case 131 /* NeverKeyword */: return true; case 105 /* VoidKeyword */: - return node.parent.kind !== 194 /* VoidExpression */; - case 205 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 195 /* VoidExpression */; + case 206 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 147 /* TypeParameter */: return node.parent.kind === 176 /* MappedType */ || node.parent.kind === 171 /* InferType */; @@ -9075,41 +9108,44 @@ var ts; if (node.parent.kind === 145 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 184 /* 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 === 71 /* Identifier */ || node.kind === 145 /* QualifiedName */ || node.kind === 183 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 71 /* Identifier */ || node.kind === 145 /* QualifiedName */ || node.kind === 184 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through case 145 /* QualifiedName */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 99 /* ThisKeyword */: var parent = node.parent; if (parent.kind === 164 /* TypeQuery */) { return false; } + if (parent.kind === 178 /* ImportType */) { + return !parent.isTypeOf; + } // Do not recursively call isPartOfTypeNode on the parent. In the example: // // let a: A.B.C; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (160 /* FirstTypeNode */ <= parent.kind && parent.kind <= 177 /* LastTypeNode */) { + if (160 /* FirstTypeNode */ <= parent.kind && parent.kind <= 178 /* LastTypeNode */) { return true; } switch (parent.kind) { - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 147 /* TypeParameter */: return node === parent.constraint; case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 148 /* Parameter */: - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return node === parent.type; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 154 /* Constructor */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: @@ -9120,12 +9156,12 @@ var ts; case 158 /* ConstructSignature */: case 159 /* IndexSignature */: return node === parent.type; - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return node === parent.type; - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: return ts.contains(parent.typeArguments, node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -9149,23 +9185,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitor(node); - case 239 /* CaseBlock */: - case 211 /* Block */: - case 215 /* IfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 224 /* WithStatement */: - case 225 /* SwitchStatement */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: - case 226 /* LabeledStatement */: - case 228 /* TryStatement */: - case 267 /* CatchClause */: + case 240 /* CaseBlock */: + case 212 /* Block */: + case 216 /* IfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 225 /* WithStatement */: + case 226 /* SwitchStatement */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: + case 227 /* LabeledStatement */: + case 229 /* TryStatement */: + case 268 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -9175,19 +9211,19 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 236 /* EnumDeclaration */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 237 /* EnumDeclaration */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. @@ -9230,12 +9266,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 234 /* InterfaceDeclaration */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: case 165 /* TypeLiteral */: return node.members; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return node.properties; } } @@ -9243,14 +9279,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 180 /* BindingElement */: - case 271 /* EnumMember */: + case 181 /* BindingElement */: + case 272 /* EnumMember */: case 148 /* Parameter */: - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 269 /* ShorthandPropertyAssignment */: - case 230 /* VariableDeclaration */: + case 270 /* ShorthandPropertyAssignment */: + case 231 /* VariableDeclaration */: return true; } } @@ -9262,8 +9298,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 231 /* VariableDeclarationList */ - && node.parent.parent.kind === 212 /* VariableStatement */; + return node.parent.kind === 232 /* VariableDeclarationList */ + && node.parent.parent.kind === 213 /* VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isValidESSymbolDeclaration(node) { @@ -9279,8 +9315,8 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return true; } return false; @@ -9291,7 +9327,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 226 /* LabeledStatement */) { + if (node.statement.kind !== 227 /* LabeledStatement */) { return node.statement; } node = node.statement; @@ -9299,17 +9335,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 211 /* Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 212 /* Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 153 /* MethodDeclaration */ && node.parent.kind === 182 /* ObjectLiteralExpression */; + return node && node.kind === 153 /* MethodDeclaration */ && node.parent.kind === 183 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { return node.kind === 153 /* MethodDeclaration */ && - (node.parent.kind === 182 /* ObjectLiteralExpression */ || - node.parent.kind === 203 /* ClassExpression */); + (node.parent.kind === 183 /* ObjectLiteralExpression */ || + node.parent.kind === 204 /* ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -9322,7 +9358,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 268 /* PropertyAssignment */) { + if (property.kind === 269 /* PropertyAssignment */) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -9372,14 +9408,14 @@ var ts; node = node.parent; } break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 237 /* ModuleDeclaration */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 238 /* ModuleDeclaration */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 153 /* MethodDeclaration */: @@ -9390,8 +9426,8 @@ var ts; case 157 /* CallSignature */: case 158 /* ConstructSignature */: case 159 /* IndexSignature */: - case 236 /* EnumDeclaration */: - case 272 /* SourceFile */: + case 237 /* EnumDeclaration */: + case 273 /* SourceFile */: return node; } } @@ -9402,8 +9438,8 @@ var ts; if (container) { switch (container.kind) { case 154 /* Constructor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return container; } } @@ -9428,9 +9464,9 @@ var ts; case 146 /* ComputedPropertyName */: node = node.parent; break; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: if (!stopOnFunctions) { continue; } @@ -9461,14 +9497,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 190 /* FunctionExpression */ || func.kind === 191 /* ArrowFunction */) { + if (func.kind === 191 /* FunctionExpression */ || func.kind === 192 /* ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 189 /* ParenthesizedExpression */) { + while (parent.kind === 190 /* ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 185 /* CallExpression */ && parent.expression === prev) { + if (parent.kind === 186 /* CallExpression */ && parent.expression === prev) { return parent; } } @@ -9479,7 +9515,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 183 /* PropertyAccessExpression */ || kind === 184 /* ElementAccessExpression */) + return (kind === 184 /* PropertyAccessExpression */ || kind === 185 /* ElementAccessExpression */) && node.expression.kind === 97 /* SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -9488,7 +9524,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 183 /* PropertyAccessExpression */ || kind === 184 /* ElementAccessExpression */) + return (kind === 184 /* PropertyAccessExpression */ || kind === 185 /* ElementAccessExpression */) && node.expression.kind === 99 /* ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -9496,7 +9532,7 @@ var ts; switch (node.kind) { case 161 /* TypeReference */: return node.typeName; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; @@ -9509,10 +9545,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return node.tag; - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -9521,25 +9557,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node, parent, grandparent) { switch (node.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: // classes are valid targets return true; case 151 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 233 /* ClassDeclaration */; + return parent.kind === 234 /* ClassDeclaration */; case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 153 /* 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 === 233 /* ClassDeclaration */; + && parent.kind === 234 /* ClassDeclaration */; case 148 /* 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 === 154 /* Constructor */ || parent.kind === 153 /* MethodDeclaration */ || parent.kind === 156 /* SetAccessor */) - && grandparent.kind === 233 /* ClassDeclaration */; + && grandparent.kind === 234 /* ClassDeclaration */; } return false; } @@ -9555,7 +9591,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return ts.forEach(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); case 153 /* MethodDeclaration */: case 156 /* SetAccessor */: @@ -9565,9 +9601,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 255 /* JsxOpeningElement */ || - parent.kind === 254 /* JsxSelfClosingElement */ || - parent.kind === 256 /* JsxClosingElement */) { + if (parent.kind === 256 /* JsxOpeningElement */ || + parent.kind === 255 /* JsxSelfClosingElement */ || + parent.kind === 257 /* JsxClosingElement */) { return parent.tagName === node; } return false; @@ -9580,37 +9616,37 @@ var ts; case 101 /* TrueKeyword */: case 86 /* FalseKeyword */: case 12 /* RegularExpressionLiteral */: - case 181 /* ArrayLiteralExpression */: - case 182 /* ObjectLiteralExpression */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 187 /* TaggedTemplateExpression */: - case 206 /* AsExpression */: - case 188 /* TypeAssertionExpression */: - case 207 /* NonNullExpression */: - case 189 /* ParenthesizedExpression */: - case 190 /* FunctionExpression */: - case 203 /* ClassExpression */: - case 191 /* ArrowFunction */: - case 194 /* VoidExpression */: - case 192 /* DeleteExpression */: - case 193 /* TypeOfExpression */: - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: - case 198 /* BinaryExpression */: - case 199 /* ConditionalExpression */: - case 202 /* SpreadElement */: - case 200 /* TemplateExpression */: + case 182 /* ArrayLiteralExpression */: + case 183 /* ObjectLiteralExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 188 /* TaggedTemplateExpression */: + case 207 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 208 /* NonNullExpression */: + case 190 /* ParenthesizedExpression */: + case 191 /* FunctionExpression */: + case 204 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 195 /* VoidExpression */: + case 193 /* DeleteExpression */: + case 194 /* TypeOfExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 199 /* BinaryExpression */: + case 200 /* ConditionalExpression */: + case 203 /* SpreadElement */: + case 201 /* TemplateExpression */: case 13 /* NoSubstitutionTemplateLiteral */: - case 204 /* OmittedExpression */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 257 /* JsxFragment */: - case 201 /* YieldExpression */: - case 195 /* AwaitExpression */: - case 208 /* MetaProperty */: + case 205 /* OmittedExpression */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 258 /* JsxFragment */: + case 202 /* YieldExpression */: + case 196 /* AwaitExpression */: + case 209 /* MetaProperty */: return true; case 145 /* QualifiedName */: while (node.parent.kind === 145 /* QualifiedName */) { @@ -9634,47 +9670,47 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 271 /* EnumMember */: - case 268 /* PropertyAssignment */: - case 180 /* BindingElement */: + case 272 /* EnumMember */: + case 269 /* PropertyAssignment */: + case 181 /* BindingElement */: return parent.initializer === node; - case 214 /* ExpressionStatement */: - case 215 /* IfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 223 /* ReturnStatement */: - case 224 /* WithStatement */: - case 225 /* SwitchStatement */: - case 264 /* CaseClause */: - case 227 /* ThrowStatement */: + case 215 /* ExpressionStatement */: + case 216 /* IfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 224 /* ReturnStatement */: + case 225 /* WithStatement */: + case 226 /* SwitchStatement */: + case 265 /* CaseClause */: + case 228 /* ThrowStatement */: return parent.expression === node; - case 218 /* ForStatement */: + case 219 /* ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 231 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 232 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 231 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 232 /* VariableDeclarationList */) || forInStatement.expression === node; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: return node === parent.expression; - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return node === parent.expression; case 146 /* ComputedPropertyName */: return node === parent.expression; case 149 /* Decorator */: - case 263 /* JsxExpression */: - case 262 /* JsxSpreadAttribute */: - case 270 /* SpreadAssignment */: + case 264 /* JsxExpression */: + case 263 /* JsxSpreadAttribute */: + case 271 /* SpreadAssignment */: return true; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: return isExpressionNode(parent); @@ -9682,7 +9718,7 @@ var ts; } ts.isInExpressionContext = isInExpressionContext; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 252 /* ExternalModuleReference */; + return node.kind === 242 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 253 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -9691,7 +9727,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 252 /* ExternalModuleReference */; + return node.kind === 242 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 253 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -9719,7 +9755,7 @@ var ts; } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) { - if (callExpression.kind !== 185 /* CallExpression */) { + if (callExpression.kind !== 186 /* CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -9790,9 +9826,11 @@ var ts; function getJavascriptInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 190 /* FunctionExpression */ || e.kind === 191 /* ArrowFunction */ ? initializer : undefined; + return e.kind === 191 /* FunctionExpression */ || e.kind === 192 /* ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 190 /* FunctionExpression */ || initializer.kind === 203 /* ClassExpression */) { + if (initializer.kind === 191 /* FunctionExpression */ || + initializer.kind === 204 /* ClassExpression */ || + initializer.kind === 192 /* ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -9885,7 +9923,7 @@ var ts; return 2 /* ModuleExports */; } else if (isEntityNameExpression(lhs.expression)) { - if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(expr.right)) { + if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) { // F.prototype = { ... } return 6 /* Prototype */; } @@ -9910,24 +9948,31 @@ var ts; return 0 /* None */; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; + function getInitializerOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.right)) { + expr = expr.right; + } + return expr.right; + } + ts.getInitializerOfBinaryExpression = getInitializerOfBinaryExpression; function isPrototypePropertyAssignment(node) { return ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === 3 /* PrototypeProperty */; } ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJavaScriptFile(expr) && - expr.parent && expr.parent.kind === 214 /* ExpressionStatement */ && + expr.parent && expr.parent.kind === 215 /* ExpressionStatement */ && !!ts.getJSDocTypeTag(expr.parent); } ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration; function importFromModuleSpecifier(node) { switch (node.parent.kind) { - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return node.parent; - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return node.parent.parent; - case 185 /* CallExpression */: + case 186 /* CallExpression */: return node.parent; default: return ts.Debug.fail(ts.Debug.showSyntaxKind(node)); @@ -9936,11 +9981,13 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return node.moduleSpecifier; - case 241 /* ImportEqualsDeclaration */: - return node.moduleReference.kind === 252 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 242 /* ImportEqualsDeclaration */: + return node.moduleReference.kind === 253 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 178 /* ImportType */: + return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; default: return ts.Debug.assertNever(node); } @@ -9948,11 +9995,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return node; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return undefined; default: return ts.Debug.assertNever(node); @@ -9960,7 +10007,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 242 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 243 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function hasQuestionToken(node) { @@ -9969,8 +10016,8 @@ var ts; case 148 /* Parameter */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: - case 269 /* ShorthandPropertyAssignment */: - case 268 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return node.questionToken !== undefined; @@ -9980,7 +10027,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 280 /* JSDocFunctionType */ && + return node.kind === 281 /* JSDocFunctionType */ && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -10002,7 +10049,7 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; case 151 /* PropertyDeclaration */: @@ -10015,9 +10062,9 @@ var ts; node.declarationList.declarations[0]; } function getNestedModuleDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */ && + return node.kind === 238 /* ModuleDeclaration */ && node.body && - node.body.kind === 237 /* ModuleDeclaration */ && + node.body.kind === 238 /* ModuleDeclaration */ && node.body; } function getJSDocCommentsAndTags(node) { @@ -10026,7 +10073,10 @@ var ts; return result || ts.emptyArray; function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; - if (parent && (parent.kind === 268 /* PropertyAssignment */ || parent.kind === 151 /* PropertyDeclaration */ || getNestedModuleDeclaration(parent))) { + if (parent && + (parent.kind === 269 /* PropertyAssignment */ || + parent.kind === 151 /* PropertyDeclaration */ || + getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement. @@ -10044,7 +10094,8 @@ var ts; getJSDocCommentsAndTagsWorker(parent.parent.parent); } if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 /* None */ || - node.kind === 183 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 214 /* ExpressionStatement */) { + parent && ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 /* None */ || + node.kind === 184 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 215 /* ExpressionStatement */) { getJSDocCommentsAndTagsWorker(parent); } // Pull parameter comments from declaring function as well @@ -10089,7 +10140,7 @@ var ts; } ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 282 /* JSDocComment */); + ts.Debug.assert(node.parent.kind === 283 /* JSDocComment */); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -10105,7 +10156,7 @@ var ts; } ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { - return node.dotDotDotToken !== undefined || node.type && node.type.kind === 281 /* JSDocVariadicType */; + return node.dotDotDotToken !== undefined || node.type && node.type.kind === 282 /* JSDocVariadicType */; } ts.isRestParameter = isRestParameter; var AssignmentKind; @@ -10118,31 +10169,31 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 58 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 43 /* PlusPlusToken */ || unaryOperator === 44 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; - case 189 /* ParenthesizedExpression */: - case 181 /* ArrayLiteralExpression */: - case 202 /* SpreadElement */: - case 207 /* NonNullExpression */: + case 190 /* ParenthesizedExpression */: + case 182 /* ArrayLiteralExpression */: + case 203 /* SpreadElement */: + case 208 /* NonNullExpression */: node = parent; break; - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } node = parent.parent; break; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: if (parent.name === node) { return 0 /* None */; } @@ -10169,22 +10220,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 211 /* Block */: - case 212 /* VariableStatement */: - case 224 /* WithStatement */: - case 215 /* IfStatement */: - case 225 /* SwitchStatement */: - case 239 /* CaseBlock */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: - case 226 /* LabeledStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 228 /* TryStatement */: - case 267 /* CatchClause */: + case 212 /* Block */: + case 213 /* VariableStatement */: + case 225 /* WithStatement */: + case 216 /* IfStatement */: + case 226 /* SwitchStatement */: + case 240 /* CaseBlock */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: + case 227 /* LabeledStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 229 /* TryStatement */: + case 268 /* CatchClause */: return true; } return false; @@ -10205,11 +10256,11 @@ var ts; } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 189 /* ParenthesizedExpression */); + return walkUp(node, 190 /* ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; function skipParentheses(node) { - while (node.kind === 189 /* ParenthesizedExpression */) { + while (node.kind === 190 /* ParenthesizedExpression */) { node = node.expression; } return node; @@ -10217,11 +10268,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 !== 183 /* PropertyAccessExpression */ && node.kind !== 184 /* ElementAccessExpression */) { + if (node.kind !== 184 /* PropertyAccessExpression */ && node.kind !== 185 /* ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 192 /* DeleteExpression */; + return node && node.kind === 193 /* DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -10270,26 +10321,26 @@ var ts; case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 271 /* EnumMember */: - case 268 /* PropertyAssignment */: - case 183 /* PropertyAccessExpression */: + case 272 /* EnumMember */: + case 269 /* PropertyAssignment */: + case 184 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; case 145 /* QualifiedName */: - // Name on right hand side of dot in a type query + // Name on right hand side of dot in a type query or type reference if (parent.right === node) { while (parent.kind === 145 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 164 /* TypeQuery */; + return parent.kind === 164 /* TypeQuery */ || parent.kind === 161 /* TypeReference */; } return false; - case 180 /* BindingElement */: - case 246 /* ImportSpecifier */: + case 181 /* BindingElement */: + case 247 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 250 /* ExportSpecifier */: - case 260 /* JsxAttribute */: + case 251 /* ExportSpecifier */: + case 261 /* JsxAttribute */: // Any name in an export specifier or JSX Attribute return true; } @@ -10305,13 +10356,13 @@ var ts; // export = // export default function isAliasSymbolDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */ || - node.kind === 240 /* NamespaceExportDeclaration */ || - node.kind === 243 /* ImportClause */ && !!node.name || - node.kind === 244 /* NamespaceImport */ || - node.kind === 246 /* ImportSpecifier */ || - node.kind === 250 /* ExportSpecifier */ || - node.kind === 247 /* ExportAssignment */ && exportAssignmentIsAlias(node); + return node.kind === 242 /* ImportEqualsDeclaration */ || + node.kind === 241 /* NamespaceExportDeclaration */ || + node.kind === 244 /* ImportClause */ && !!node.name || + node.kind === 245 /* NamespaceImport */ || + node.kind === 247 /* ImportSpecifier */ || + node.kind === 251 /* ExportSpecifier */ || + node.kind === 248 /* ExportAssignment */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -10404,14 +10455,14 @@ var ts; } var flags = 0 /* Normal */; switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* Generator */; } // falls through - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (hasModifier(node, 256 /* Async */)) { flags |= 2 /* Async */; } @@ -10425,9 +10476,9 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined @@ -10533,7 +10584,7 @@ var ts; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 180 /* BindingElement */) { + while (node.kind === 181 /* BindingElement */) { node = node.parent.parent; } return node; @@ -10542,14 +10593,14 @@ var ts; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; return kind === 154 /* Constructor */ - || kind === 190 /* FunctionExpression */ - || kind === 232 /* FunctionDeclaration */ - || kind === 191 /* ArrowFunction */ + || kind === 191 /* FunctionExpression */ + || kind === 233 /* FunctionDeclaration */ + || kind === 192 /* ArrowFunction */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ || kind === 156 /* SetAccessor */ - || kind === 237 /* ModuleDeclaration */ - || kind === 272 /* SourceFile */; + || kind === 238 /* ModuleDeclaration */ + || kind === 273 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -10568,23 +10619,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 /* NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 186 /* NewExpression */: + case 187 /* NewExpression */: return hasArguments ? 0 /* Left */ : 1 /* Right */; - case 196 /* PrefixUnaryExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 192 /* DeleteExpression */: - case 195 /* AwaitExpression */: - case 199 /* ConditionalExpression */: - case 201 /* YieldExpression */: + case 197 /* PrefixUnaryExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 193 /* DeleteExpression */: + case 196 /* AwaitExpression */: + case 200 /* ConditionalExpression */: + case 202 /* YieldExpression */: return 1 /* Right */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (operator) { case 40 /* AsteriskAsteriskToken */: case 58 /* EqualsToken */: @@ -10608,15 +10659,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 /* NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 198 /* BinaryExpression */) { + if (expression.kind === 199 /* BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 196 /* PrefixUnaryExpression */ || expression.kind === 197 /* PostfixUnaryExpression */) { + else if (expression.kind === 197 /* PrefixUnaryExpression */ || expression.kind === 198 /* PostfixUnaryExpression */) { return expression.operator; } else { @@ -10626,15 +10677,15 @@ var ts; ts.getOperator = getOperator; function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return 0; - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return 1; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return 2; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return 4; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (operatorKind) { case 26 /* CommaToken */: return 0; @@ -10655,21 +10706,21 @@ var ts; default: return getBinaryOperatorPrecedence(operatorKind); } - case 196 /* PrefixUnaryExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 192 /* DeleteExpression */: - case 195 /* AwaitExpression */: + case 197 /* PrefixUnaryExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 193 /* DeleteExpression */: + case 196 /* AwaitExpression */: return 16; - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return 17; - case 185 /* CallExpression */: + case 186 /* CallExpression */: return 18; - case 186 /* NewExpression */: + case 187 /* NewExpression */: return hasArguments ? 19 : 18; - case 187 /* TaggedTemplateExpression */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 188 /* TaggedTemplateExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: return 19; case 99 /* ThisKeyword */: case 97 /* SuperKeyword */: @@ -10679,19 +10730,19 @@ var ts; case 86 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - case 181 /* ArrayLiteralExpression */: - case 182 /* ObjectLiteralExpression */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 203 /* ClassExpression */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 257 /* JsxFragment */: + case 182 /* ArrayLiteralExpression */: + case 183 /* ObjectLiteralExpression */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 204 /* ClassExpression */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 258 /* JsxFragment */: case 12 /* RegularExpressionLiteral */: case 13 /* NoSubstitutionTemplateLiteral */: - case 200 /* TemplateExpression */: - case 189 /* ParenthesizedExpression */: - case 204 /* OmittedExpression */: + case 201 /* TemplateExpression */: + case 190 /* ParenthesizedExpression */: + case 205 /* OmittedExpression */: return 20; default: return -1; @@ -10748,17 +10799,12 @@ var ts; var filesWithDiagnostics = []; var fileDiagnostics = ts.createMap(); var hasReadNonFileDiagnostics = false; - var modificationCount = 0; return { add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount, reattachFileDiagnostics: reattachFileDiagnostics }; - function getModificationCount() { - return modificationCount; - } function reattachFileDiagnostics(newFile) { ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } @@ -10781,7 +10827,6 @@ var ts; diagnostics = nonFileDiagnostics; } ts.insertSorted(diagnostics, diagnostic, ts.compareDiagnostics); - modificationCount++; } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -11449,7 +11494,7 @@ var ts; ts.isAssignmentOperator = isAssignmentOperator; /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */ function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 205 /* ExpressionWithTypeArguments */ && + if (node.kind === 206 /* ExpressionWithTypeArguments */ && node.parent.token === 85 /* ExtendsKeyword */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; @@ -11467,8 +11512,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 182 /* ObjectLiteralExpression */ - || kind === 181 /* ArrayLiteralExpression */; + return kind === 183 /* ObjectLiteralExpression */ + || kind === 182 /* ArrayLiteralExpression */; } return false; } @@ -11478,7 +11523,7 @@ var ts; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isExpressionWithTypeArgumentsInClassImplementsClause(node) { - return node.kind === 205 /* ExpressionWithTypeArguments */ + return node.kind === 206 /* ExpressionWithTypeArguments */ && isEntityNameExpression(node.expression) && node.parent && node.parent.token === 108 /* ImplementsKeyword */ @@ -11500,16 +11545,16 @@ var ts; ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { return (node.parent.kind === 145 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node); + (node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteral(expression) { - return expression.kind === 182 /* ObjectLiteralExpression */ && + return expression.kind === 183 /* ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 181 /* ArrayLiteralExpression */ && + return expression.kind === 182 /* ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -11850,8 +11895,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 236 /* EnumDeclaration */: - case 237 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -11924,21 +11969,21 @@ var ts; if (!parent) return 0 /* Read */; switch (parent.kind) { - case 197 /* PostfixUnaryExpression */: - case 196 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: var operator = parent.operator; return operator === 43 /* PlusPlusToken */ || operator === 44 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? writeOrReadWrite() : 0 /* Read */; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return parent.name !== node ? 0 /* Read */ : accessKind(parent); default: return 0 /* 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 && parent.parent.kind === 214 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */; + return parent.parent && parent.parent.kind === 215 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */; } } function compareDataObjects(dst, src) { @@ -12302,7 +12347,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 147 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 234 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 235 /* InterfaceDeclaration */) { return current; } } @@ -12328,7 +12373,7 @@ var ts; } ts.isEmptyBindingElement = isEmptyBindingElement; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 180 /* BindingElement */ || ts.isBindingPattern(node))) { + while (node && (node.kind === 181 /* BindingElement */ || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -12336,14 +12381,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 230 /* VariableDeclaration */) { + if (node.kind === 231 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 231 /* VariableDeclarationList */) { + if (node && node.kind === 232 /* VariableDeclarationList */) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 212 /* VariableStatement */) { + if (node && node.kind === 213 /* VariableStatement */) { flags |= ts.getModifierFlags(node); } return flags; @@ -12359,14 +12404,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 230 /* VariableDeclaration */) { + if (node.kind === 231 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 231 /* VariableDeclarationList */) { + if (node && node.kind === 232 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 212 /* VariableStatement */) { + if (node && node.kind === 213 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -12503,17 +12548,17 @@ var ts; } // Covers remaining cases switch (hostNode.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } return undefined; - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: var expr = hostNode.expression; switch (expr.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return expr.name; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; @@ -12522,10 +12567,10 @@ var ts; return undefined; case 1 /* EndOfFileToken */: return undefined; - case 189 /* ParenthesizedExpression */: { + case 190 /* ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 226 /* LabeledStatement */: { + case 227 /* LabeledStatement */: { if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -12555,15 +12600,15 @@ var ts; switch (declaration.kind) { case 71 /* Identifier */: return declaration; - case 292 /* JSDocPropertyTag */: - case 287 /* JSDocParameterTag */: { + case 293 /* JSDocPropertyTag */: + case 288 /* JSDocParameterTag */: { var name = declaration.name; if (name.kind === 145 /* QualifiedName */) { return name.right; } break; } - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var expr = declaration; switch (ts.getSpecialPropertyAssignmentKind(expr)) { case 1 /* ExportsProperty */: @@ -12575,9 +12620,9 @@ var ts; return undefined; } } - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 247 /* ExportAssignment */: { + case 248 /* ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } @@ -12875,484 +12920,484 @@ var ts; ts.isLiteralTypeNode = isLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 178 /* ObjectBindingPattern */; + return node.kind === 179 /* ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 179 /* ArrayBindingPattern */; + return node.kind === 180 /* ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 180 /* BindingElement */; + return node.kind === 181 /* BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 181 /* ArrayLiteralExpression */; + return node.kind === 182 /* ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 182 /* ObjectLiteralExpression */; + return node.kind === 183 /* ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 183 /* PropertyAccessExpression */; + return node.kind === 184 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 184 /* ElementAccessExpression */; + return node.kind === 185 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 185 /* CallExpression */; + return node.kind === 186 /* CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 186 /* NewExpression */; + return node.kind === 187 /* NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 187 /* TaggedTemplateExpression */; + return node.kind === 188 /* TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertion(node) { - return node.kind === 188 /* TypeAssertionExpression */; + return node.kind === 189 /* TypeAssertionExpression */; } ts.isTypeAssertion = isTypeAssertion; function isParenthesizedExpression(node) { - return node.kind === 189 /* ParenthesizedExpression */; + return node.kind === 190 /* ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295 /* PartiallyEmittedExpression */) { + while (node.kind === 296 /* PartiallyEmittedExpression */) { node = node.expression; } return node; } ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; function isFunctionExpression(node) { - return node.kind === 190 /* FunctionExpression */; + return node.kind === 191 /* FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 191 /* ArrowFunction */; + return node.kind === 192 /* ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 192 /* DeleteExpression */; + return node.kind === 193 /* DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 193 /* TypeOfExpression */; + return node.kind === 194 /* TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 194 /* VoidExpression */; + return node.kind === 195 /* VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 195 /* AwaitExpression */; + return node.kind === 196 /* AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 196 /* PrefixUnaryExpression */; + return node.kind === 197 /* PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 197 /* PostfixUnaryExpression */; + return node.kind === 198 /* PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 198 /* BinaryExpression */; + return node.kind === 199 /* BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 199 /* ConditionalExpression */; + return node.kind === 200 /* ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 200 /* TemplateExpression */; + return node.kind === 201 /* TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 201 /* YieldExpression */; + return node.kind === 202 /* YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 202 /* SpreadElement */; + return node.kind === 203 /* SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 203 /* ClassExpression */; + return node.kind === 204 /* ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 204 /* OmittedExpression */; + return node.kind === 205 /* OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 205 /* ExpressionWithTypeArguments */; + return node.kind === 206 /* ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 206 /* AsExpression */; + return node.kind === 207 /* AsExpression */; } ts.isAsExpression = isAsExpression; function isNonNullExpression(node) { - return node.kind === 207 /* NonNullExpression */; + return node.kind === 208 /* NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 208 /* MetaProperty */; + return node.kind === 209 /* MetaProperty */; } ts.isMetaProperty = isMetaProperty; // Misc function isTemplateSpan(node) { - return node.kind === 209 /* TemplateSpan */; + return node.kind === 210 /* TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 210 /* SemicolonClassElement */; + return node.kind === 211 /* SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Block function isBlock(node) { - return node.kind === 211 /* Block */; + return node.kind === 212 /* Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 212 /* VariableStatement */; + return node.kind === 213 /* VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 213 /* EmptyStatement */; + return node.kind === 214 /* EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 214 /* ExpressionStatement */; + return node.kind === 215 /* ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 215 /* IfStatement */; + return node.kind === 216 /* IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 216 /* DoStatement */; + return node.kind === 217 /* DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 217 /* WhileStatement */; + return node.kind === 218 /* WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 218 /* ForStatement */; + return node.kind === 219 /* ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 219 /* ForInStatement */; + return node.kind === 220 /* ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 220 /* ForOfStatement */; + return node.kind === 221 /* ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 221 /* ContinueStatement */; + return node.kind === 222 /* ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 222 /* BreakStatement */; + return node.kind === 223 /* BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isBreakOrContinueStatement(node) { - return node.kind === 222 /* BreakStatement */ || node.kind === 221 /* ContinueStatement */; + return node.kind === 223 /* BreakStatement */ || node.kind === 222 /* ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isReturnStatement(node) { - return node.kind === 223 /* ReturnStatement */; + return node.kind === 224 /* ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 224 /* WithStatement */; + return node.kind === 225 /* WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 225 /* SwitchStatement */; + return node.kind === 226 /* SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 226 /* LabeledStatement */; + return node.kind === 227 /* LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 227 /* ThrowStatement */; + return node.kind === 228 /* ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 228 /* TryStatement */; + return node.kind === 229 /* TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 229 /* DebuggerStatement */; + return node.kind === 230 /* DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 230 /* VariableDeclaration */; + return node.kind === 231 /* VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 231 /* VariableDeclarationList */; + return node.kind === 232 /* VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 232 /* FunctionDeclaration */; + return node.kind === 233 /* FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 233 /* ClassDeclaration */; + return node.kind === 234 /* ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 234 /* InterfaceDeclaration */; + return node.kind === 235 /* InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 235 /* TypeAliasDeclaration */; + return node.kind === 236 /* TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 236 /* EnumDeclaration */; + return node.kind === 237 /* EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */; + return node.kind === 238 /* ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 238 /* ModuleBlock */; + return node.kind === 239 /* ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 239 /* CaseBlock */; + return node.kind === 240 /* CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 240 /* NamespaceExportDeclaration */; + return node.kind === 241 /* NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */; + return node.kind === 242 /* ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 242 /* ImportDeclaration */; + return node.kind === 243 /* ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 243 /* ImportClause */; + return node.kind === 244 /* ImportClause */; } ts.isImportClause = isImportClause; function isNamespaceImport(node) { - return node.kind === 244 /* NamespaceImport */; + return node.kind === 245 /* NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamedImports(node) { - return node.kind === 245 /* NamedImports */; + return node.kind === 246 /* NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 246 /* ImportSpecifier */; + return node.kind === 247 /* ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 247 /* ExportAssignment */; + return node.kind === 248 /* ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 248 /* ExportDeclaration */; + return node.kind === 249 /* ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 249 /* NamedExports */; + return node.kind === 250 /* NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 250 /* ExportSpecifier */; + return node.kind === 251 /* ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 251 /* MissingDeclaration */; + return node.kind === 252 /* MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; // Module References function isExternalModuleReference(node) { - return node.kind === 252 /* ExternalModuleReference */; + return node.kind === 253 /* ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 253 /* JsxElement */; + return node.kind === 254 /* JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 254 /* JsxSelfClosingElement */; + return node.kind === 255 /* JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 255 /* JsxOpeningElement */; + return node.kind === 256 /* JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 256 /* JsxClosingElement */; + return node.kind === 257 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 257 /* JsxFragment */; + return node.kind === 258 /* JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 258 /* JsxOpeningFragment */; + return node.kind === 259 /* JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 259 /* JsxClosingFragment */; + return node.kind === 260 /* JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 260 /* JsxAttribute */; + return node.kind === 261 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 261 /* JsxAttributes */; + return node.kind === 262 /* JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 262 /* JsxSpreadAttribute */; + return node.kind === 263 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 263 /* JsxExpression */; + return node.kind === 264 /* JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 264 /* CaseClause */; + return node.kind === 265 /* CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 265 /* DefaultClause */; + return node.kind === 266 /* DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 266 /* HeritageClause */; + return node.kind === 267 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 267 /* CatchClause */; + return node.kind === 268 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 268 /* PropertyAssignment */; + return node.kind === 269 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 269 /* ShorthandPropertyAssignment */; + return node.kind === 270 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 270 /* SpreadAssignment */; + return node.kind === 271 /* SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 271 /* EnumMember */; + return node.kind === 272 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 272 /* SourceFile */; + return node.kind === 273 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 273 /* Bundle */; + return node.kind === 274 /* Bundle */; } ts.isBundle = isBundle; // JSDoc function isJSDocTypeExpression(node) { - return node.kind === 274 /* JSDocTypeExpression */; + return node.kind === 275 /* JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 275 /* JSDocAllType */; + return node.kind === 276 /* JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 276 /* JSDocUnknownType */; + return node.kind === 277 /* JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 277 /* JSDocNullableType */; + return node.kind === 278 /* JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 278 /* JSDocNonNullableType */; + return node.kind === 279 /* JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 279 /* JSDocOptionalType */; + return node.kind === 280 /* JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 280 /* JSDocFunctionType */; + return node.kind === 281 /* JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 281 /* JSDocVariadicType */; + return node.kind === 282 /* JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 282 /* JSDocComment */; + return node.kind === 283 /* JSDocComment */; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 285 /* JSDocAugmentsTag */; + return node.kind === 286 /* JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocClassTag(node) { - return node.kind === 286 /* JSDocClassTag */; + return node.kind === 287 /* JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocParameterTag(node) { - return node.kind === 287 /* JSDocParameterTag */; + return node.kind === 288 /* JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 288 /* JSDocReturnTag */; + return node.kind === 289 /* JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 289 /* JSDocTypeTag */; + return node.kind === 290 /* JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 290 /* JSDocTemplateTag */; + return node.kind === 291 /* JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 291 /* JSDocTypedefTag */; + return node.kind === 292 /* JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 292 /* JSDocPropertyTag */; + return node.kind === 293 /* JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 292 /* JSDocPropertyTag */ || node.kind === 287 /* JSDocParameterTag */; + return node.kind === 293 /* JSDocPropertyTag */ || node.kind === 288 /* JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 283 /* JSDocTypeLiteral */; + return node.kind === 284 /* JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); @@ -13363,7 +13408,7 @@ var ts; (function (ts) { /* @internal */ function isSyntaxList(n) { - return n.kind === 293 /* SyntaxList */; + return n.kind === 294 /* SyntaxList */; } ts.isSyntaxList = isSyntaxList; /* @internal */ @@ -13475,8 +13520,8 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 71 /* Identifier */ - || kind === 178 /* ObjectBindingPattern */ - || kind === 179 /* ArrayBindingPattern */; + || kind === 179 /* ObjectBindingPattern */ + || kind === 180 /* ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13491,13 +13536,13 @@ var ts; ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; default: return false; @@ -13511,7 +13556,7 @@ var ts; case 158 /* ConstructSignature */: case 159 /* IndexSignature */: case 162 /* FunctionType */: - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: case 163 /* ConstructorType */: return true; default: @@ -13533,12 +13578,12 @@ var ts; || kind === 155 /* GetAccessor */ || kind === 156 /* SetAccessor */ || kind === 159 /* IndexSignature */ - || kind === 210 /* SemicolonClassElement */ - || kind === 251 /* MissingDeclaration */; + || kind === 211 /* SemicolonClassElement */ + || kind === 252 /* MissingDeclaration */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 233 /* ClassDeclaration */ || node.kind === 203 /* ClassExpression */); + return node && (node.kind === 234 /* ClassDeclaration */ || node.kind === 204 /* ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { @@ -13565,23 +13610,23 @@ var ts; || kind === 150 /* PropertySignature */ || kind === 152 /* MethodSignature */ || kind === 159 /* IndexSignature */ - || kind === 251 /* MissingDeclaration */; + || kind === 252 /* MissingDeclaration */; } ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 268 /* PropertyAssignment */ - || kind === 269 /* ShorthandPropertyAssignment */ - || kind === 270 /* SpreadAssignment */ + return kind === 269 /* PropertyAssignment */ + || kind === 270 /* ShorthandPropertyAssignment */ + || kind === 271 /* SpreadAssignment */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ || kind === 156 /* SetAccessor */ - || kind === 251 /* MissingDeclaration */; + || kind === 252 /* MissingDeclaration */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type function isTypeNodeKind(kind) { - return (kind >= 160 /* FirstTypeNode */ && kind <= 177 /* LastTypeNode */) + return (kind >= 160 /* FirstTypeNode */ && kind <= 178 /* LastTypeNode */) || kind === 119 /* AnyKeyword */ || kind === 134 /* NumberKeyword */ || kind === 135 /* ObjectKeyword */ @@ -13593,14 +13638,14 @@ var ts; || kind === 140 /* UndefinedKeyword */ || kind === 95 /* NullKeyword */ || kind === 131 /* NeverKeyword */ - || kind === 205 /* ExpressionWithTypeArguments */ - || kind === 275 /* JSDocAllType */ - || kind === 276 /* JSDocUnknownType */ - || kind === 277 /* JSDocNullableType */ - || kind === 278 /* JSDocNonNullableType */ - || kind === 279 /* JSDocOptionalType */ - || kind === 280 /* JSDocFunctionType */ - || kind === 281 /* JSDocVariadicType */; + || kind === 206 /* ExpressionWithTypeArguments */ + || kind === 276 /* JSDocAllType */ + || kind === 277 /* JSDocUnknownType */ + || kind === 278 /* JSDocNullableType */ + || kind === 279 /* JSDocNonNullableType */ + || kind === 280 /* JSDocOptionalType */ + || kind === 281 /* JSDocFunctionType */ + || kind === 282 /* JSDocVariadicType */; } /** * Node test that determines whether a node is a valid type node. @@ -13625,8 +13670,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 179 /* ArrayBindingPattern */ - || kind === 178 /* ObjectBindingPattern */; + return kind === 180 /* ArrayBindingPattern */ + || kind === 179 /* ObjectBindingPattern */; } return false; } @@ -13634,15 +13679,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 181 /* ArrayLiteralExpression */ - || kind === 182 /* ObjectLiteralExpression */; + return kind === 182 /* ArrayLiteralExpression */ + || kind === 183 /* ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 180 /* BindingElement */ - || kind === 204 /* OmittedExpression */; + return kind === 181 /* BindingElement */ + || kind === 205 /* OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13651,9 +13696,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: - case 180 /* BindingElement */: + case 181 /* BindingElement */: return true; } return false; @@ -13674,8 +13719,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 178 /* ObjectBindingPattern */: - case 182 /* ObjectLiteralExpression */: + case 179 /* ObjectBindingPattern */: + case 183 /* ObjectLiteralExpression */: return true; } return false; @@ -13687,27 +13732,35 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 179 /* ArrayBindingPattern */: - case 181 /* ArrayLiteralExpression */: + case 180 /* ArrayBindingPattern */: + case 182 /* ArrayLiteralExpression */: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; + /* @internal */ + function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { + var kind = node.kind; + return kind === 184 /* PropertyAccessExpression */ + || kind === 145 /* QualifiedName */ + || kind === 178 /* ImportType */; + } + ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 183 /* PropertyAccessExpression */ + return kind === 184 /* PropertyAccessExpression */ || kind === 145 /* QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 187 /* TaggedTemplateExpression */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 188 /* TaggedTemplateExpression */: case 149 /* Decorator */: return true; default: @@ -13716,12 +13769,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 185 /* CallExpression */ || node.kind === 186 /* NewExpression */; + return node.kind === 186 /* CallExpression */ || node.kind === 187 /* NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 200 /* TemplateExpression */ + return kind === 201 /* TemplateExpression */ || kind === 13 /* NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -13732,32 +13785,32 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: - case 186 /* NewExpression */: - case 185 /* CallExpression */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 257 /* JsxFragment */: - case 187 /* TaggedTemplateExpression */: - case 181 /* ArrayLiteralExpression */: - case 189 /* ParenthesizedExpression */: - case 182 /* ObjectLiteralExpression */: - case 203 /* ClassExpression */: - case 190 /* FunctionExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 187 /* NewExpression */: + case 186 /* CallExpression */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 258 /* JsxFragment */: + case 188 /* TaggedTemplateExpression */: + case 182 /* ArrayLiteralExpression */: + case 190 /* ParenthesizedExpression */: + case 183 /* ObjectLiteralExpression */: + case 204 /* ClassExpression */: + case 191 /* FunctionExpression */: case 71 /* Identifier */: case 12 /* RegularExpressionLiteral */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 13 /* NoSubstitutionTemplateLiteral */: - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: case 86 /* FalseKeyword */: case 95 /* NullKeyword */: case 99 /* ThisKeyword */: case 101 /* TrueKeyword */: case 97 /* SuperKeyword */: - case 207 /* NonNullExpression */: - case 208 /* MetaProperty */: + case 208 /* NonNullExpression */: + case 209 /* MetaProperty */: case 91 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -13771,13 +13824,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: - case 192 /* DeleteExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 195 /* AwaitExpression */: - case 188 /* TypeAssertionExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 193 /* DeleteExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 196 /* AwaitExpression */: + case 189 /* TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -13786,9 +13839,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return true; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return expr.operator === 43 /* PlusPlusToken */ || expr.operator === 44 /* MinusMinusToken */; default: @@ -13807,15 +13860,15 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 199 /* ConditionalExpression */: - case 201 /* YieldExpression */: - case 191 /* ArrowFunction */: - case 198 /* BinaryExpression */: - case 202 /* SpreadElement */: - case 206 /* AsExpression */: - case 204 /* OmittedExpression */: - case 296 /* CommaListExpression */: - case 295 /* PartiallyEmittedExpression */: + case 200 /* ConditionalExpression */: + case 202 /* YieldExpression */: + case 192 /* ArrowFunction */: + case 199 /* BinaryExpression */: + case 203 /* SpreadElement */: + case 207 /* AsExpression */: + case 205 /* OmittedExpression */: + case 297 /* CommaListExpression */: + case 296 /* PartiallyEmittedExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -13823,18 +13876,18 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 188 /* TypeAssertionExpression */ - || kind === 206 /* AsExpression */; + return kind === 189 /* TypeAssertionExpression */ + || kind === 207 /* AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ function isPartiallyEmittedExpression(node) { - return node.kind === 295 /* PartiallyEmittedExpression */; + return node.kind === 296 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; /* @internal */ function isNotEmittedStatement(node) { - return node.kind === 294 /* NotEmittedStatement */; + return node.kind === 295 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ @@ -13845,13 +13898,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return true; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -13859,7 +13912,7 @@ var ts; ts.isIterationStatement = isIterationStatement; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 219 /* ForInStatement */ || node.kind === 220 /* ForOfStatement */; + return node.kind === 220 /* ForInStatement */ || node.kind === 221 /* ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -13883,111 +13936,111 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 238 /* ModuleBlock */ - || kind === 237 /* ModuleDeclaration */ + return kind === 239 /* ModuleBlock */ + || kind === 238 /* ModuleDeclaration */ || kind === 71 /* Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 238 /* ModuleBlock */ - || kind === 237 /* ModuleDeclaration */; + return kind === 239 /* ModuleBlock */ + || kind === 238 /* ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 71 /* Identifier */ - || kind === 237 /* ModuleDeclaration */; + || kind === 238 /* ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 245 /* NamedImports */ - || kind === 244 /* NamespaceImport */; + return kind === 246 /* NamedImports */ + || kind === 245 /* NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */ || node.kind === 236 /* EnumDeclaration */; + return node.kind === 238 /* ModuleDeclaration */ || node.kind === 237 /* EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 191 /* ArrowFunction */ - || kind === 180 /* BindingElement */ - || kind === 233 /* ClassDeclaration */ - || kind === 203 /* ClassExpression */ + return kind === 192 /* ArrowFunction */ + || kind === 181 /* BindingElement */ + || kind === 234 /* ClassDeclaration */ + || kind === 204 /* ClassExpression */ || kind === 154 /* Constructor */ - || kind === 236 /* EnumDeclaration */ - || kind === 271 /* EnumMember */ - || kind === 250 /* ExportSpecifier */ - || kind === 232 /* FunctionDeclaration */ - || kind === 190 /* FunctionExpression */ + || kind === 237 /* EnumDeclaration */ + || kind === 272 /* EnumMember */ + || kind === 251 /* ExportSpecifier */ + || kind === 233 /* FunctionDeclaration */ + || kind === 191 /* FunctionExpression */ || kind === 155 /* GetAccessor */ - || kind === 243 /* ImportClause */ - || kind === 241 /* ImportEqualsDeclaration */ - || kind === 246 /* ImportSpecifier */ - || kind === 234 /* InterfaceDeclaration */ - || kind === 260 /* JsxAttribute */ + || kind === 244 /* ImportClause */ + || kind === 242 /* ImportEqualsDeclaration */ + || kind === 247 /* ImportSpecifier */ + || kind === 235 /* InterfaceDeclaration */ + || kind === 261 /* JsxAttribute */ || kind === 153 /* MethodDeclaration */ || kind === 152 /* MethodSignature */ - || kind === 237 /* ModuleDeclaration */ - || kind === 240 /* NamespaceExportDeclaration */ - || kind === 244 /* NamespaceImport */ + || kind === 238 /* ModuleDeclaration */ + || kind === 241 /* NamespaceExportDeclaration */ + || kind === 245 /* NamespaceImport */ || kind === 148 /* Parameter */ - || kind === 268 /* PropertyAssignment */ + || kind === 269 /* PropertyAssignment */ || kind === 151 /* PropertyDeclaration */ || kind === 150 /* PropertySignature */ || kind === 156 /* SetAccessor */ - || kind === 269 /* ShorthandPropertyAssignment */ - || kind === 235 /* TypeAliasDeclaration */ + || kind === 270 /* ShorthandPropertyAssignment */ + || kind === 236 /* TypeAliasDeclaration */ || kind === 147 /* TypeParameter */ - || kind === 230 /* VariableDeclaration */ - || kind === 291 /* JSDocTypedefTag */; + || kind === 231 /* VariableDeclaration */ + || kind === 292 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { - return kind === 232 /* FunctionDeclaration */ - || kind === 251 /* MissingDeclaration */ - || kind === 233 /* ClassDeclaration */ - || kind === 234 /* InterfaceDeclaration */ - || kind === 235 /* TypeAliasDeclaration */ - || kind === 236 /* EnumDeclaration */ - || kind === 237 /* ModuleDeclaration */ - || kind === 242 /* ImportDeclaration */ - || kind === 241 /* ImportEqualsDeclaration */ - || kind === 248 /* ExportDeclaration */ - || kind === 247 /* ExportAssignment */ - || kind === 240 /* NamespaceExportDeclaration */; + return kind === 233 /* FunctionDeclaration */ + || kind === 252 /* MissingDeclaration */ + || kind === 234 /* ClassDeclaration */ + || kind === 235 /* InterfaceDeclaration */ + || kind === 236 /* TypeAliasDeclaration */ + || kind === 237 /* EnumDeclaration */ + || kind === 238 /* ModuleDeclaration */ + || kind === 243 /* ImportDeclaration */ + || kind === 242 /* ImportEqualsDeclaration */ + || kind === 249 /* ExportDeclaration */ + || kind === 248 /* ExportAssignment */ + || kind === 241 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 222 /* BreakStatement */ - || kind === 221 /* ContinueStatement */ - || kind === 229 /* DebuggerStatement */ - || kind === 216 /* DoStatement */ - || kind === 214 /* ExpressionStatement */ - || kind === 213 /* EmptyStatement */ - || kind === 219 /* ForInStatement */ - || kind === 220 /* ForOfStatement */ - || kind === 218 /* ForStatement */ - || kind === 215 /* IfStatement */ - || kind === 226 /* LabeledStatement */ - || kind === 223 /* ReturnStatement */ - || kind === 225 /* SwitchStatement */ - || kind === 227 /* ThrowStatement */ - || kind === 228 /* TryStatement */ - || kind === 212 /* VariableStatement */ - || kind === 217 /* WhileStatement */ - || kind === 224 /* WithStatement */ - || kind === 294 /* NotEmittedStatement */ - || kind === 298 /* EndOfDeclarationMarker */ - || kind === 297 /* MergeDeclarationMarker */; + return kind === 223 /* BreakStatement */ + || kind === 222 /* ContinueStatement */ + || kind === 230 /* DebuggerStatement */ + || kind === 217 /* DoStatement */ + || kind === 215 /* ExpressionStatement */ + || kind === 214 /* EmptyStatement */ + || kind === 220 /* ForInStatement */ + || kind === 221 /* ForOfStatement */ + || kind === 219 /* ForStatement */ + || kind === 216 /* IfStatement */ + || kind === 227 /* LabeledStatement */ + || kind === 224 /* ReturnStatement */ + || kind === 226 /* SwitchStatement */ + || kind === 228 /* ThrowStatement */ + || kind === 229 /* TryStatement */ + || kind === 213 /* VariableStatement */ + || kind === 218 /* WhileStatement */ + || kind === 225 /* WithStatement */ + || kind === 295 /* NotEmittedStatement */ + || kind === 299 /* EndOfDeclarationMarker */ + || kind === 298 /* MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { if (node.kind === 147 /* TypeParameter */) { - return node.parent.kind !== 290 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); + return node.parent.kind !== 291 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -14014,10 +14067,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 211 /* Block */) + if (node.kind !== 212 /* Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 228 /* TryStatement */ || node.parent.kind === 267 /* CatchClause */) { + if (node.parent.kind === 229 /* TryStatement */ || node.parent.kind === 268 /* CatchClause */) { return false; } } @@ -14027,7 +14080,7 @@ var ts; /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 252 /* ExternalModuleReference */ + return kind === 253 /* ExternalModuleReference */ || kind === 145 /* QualifiedName */ || kind === 71 /* Identifier */; } @@ -14038,62 +14091,62 @@ var ts; var kind = node.kind; return kind === 99 /* ThisKeyword */ || kind === 71 /* Identifier */ - || kind === 183 /* PropertyAccessExpression */; + || kind === 184 /* PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 253 /* JsxElement */ - || kind === 263 /* JsxExpression */ - || kind === 254 /* JsxSelfClosingElement */ + return kind === 254 /* JsxElement */ + || kind === 264 /* JsxExpression */ + || kind === 255 /* JsxSelfClosingElement */ || kind === 10 /* JsxText */ - || kind === 257 /* JsxFragment */; + || kind === 258 /* JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 260 /* JsxAttribute */ - || kind === 262 /* JsxSpreadAttribute */; + return kind === 261 /* JsxAttribute */ + || kind === 263 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 263 /* JsxExpression */; + || kind === 264 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 255 /* JsxOpeningElement */ - || kind === 254 /* JsxSelfClosingElement */; + return kind === 256 /* JsxOpeningElement */ + || kind === 255 /* JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 264 /* CaseClause */ - || kind === 265 /* DefaultClause */; + return kind === 265 /* CaseClause */ + || kind === 266 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 274 /* FirstJSDocNode */ && node.kind <= 292 /* LastJSDocNode */; + return node.kind >= 275 /* FirstJSDocNode */ && node.kind <= 293 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 282 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); + return node.kind === 283 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 284 /* FirstJSDocTagNode */ && node.kind <= 292 /* LastJSDocTagNode */; + return node.kind >= 285 /* FirstJSDocTagNode */ && node.kind <= 293 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -14137,19 +14190,19 @@ var ts; case 172 /* ParenthesizedType */: case 174 /* TypeOperator */: case 176 /* MappedType */: - case 188 /* TypeAssertionExpression */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 206 /* AsExpression */: - case 230 /* VariableDeclaration */: - case 232 /* FunctionDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 274 /* JSDocTypeExpression */: - case 277 /* JSDocNullableType */: - case 278 /* JSDocNonNullableType */: - case 279 /* JSDocOptionalType */: - case 280 /* JSDocFunctionType */: - case 281 /* JSDocVariadicType */: + case 189 /* TypeAssertionExpression */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 207 /* AsExpression */: + case 231 /* VariableDeclaration */: + case 233 /* FunctionDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 275 /* JSDocTypeExpression */: + case 278 /* JSDocNullableType */: + case 279 /* JSDocNonNullableType */: + case 280 /* JSDocOptionalType */: + case 281 /* JSDocFunctionType */: + case 282 /* JSDocVariadicType */: return true; } return false; @@ -14169,10 +14222,10 @@ var ts; ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { switch (node.kind) { - case 260 /* JsxAttribute */: - case 262 /* JsxSpreadAttribute */: - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 261 /* JsxAttribute */: + case 263 /* JsxSpreadAttribute */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: @@ -14184,7 +14237,7 @@ var ts; ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 161 /* TypeReference */ || node.kind === 205 /* ExpressionWithTypeArguments */; + return node.kind === 161 /* TypeReference */ || node.kind === 206 /* ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14238,7 +14291,7 @@ var ts; var SourceFileConstructor; // tslint:enable variable-name function createNode(kind, pos, end) { - if (kind === 272 /* SourceFile */) { + if (kind === 273 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71 /* Identifier */) { @@ -14302,14 +14355,14 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return visitNode(cbNode, node.expression); case 148 /* Parameter */: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -14334,20 +14387,20 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.initializer); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || @@ -14369,9 +14422,9 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -14406,6 +14459,10 @@ var ts; visitNode(cbNode, node.falseType); case 171 /* InferType */: return visitNode(cbNode, node.typeParameter); + case 178 /* ImportType */: + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); case 172 /* ParenthesizedType */: case 174 /* TypeOperator */: return visitNode(cbNode, node.type); @@ -14419,262 +14476,262 @@ var ts; visitNode(cbNode, node.type); case 177 /* LiteralType */: return visitNode(cbNode, node.literal); - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: return visitNodes(cbNode, cbNodes, node.elements); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return visitNodes(cbNode, cbNodes, node.elements); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitNodes(cbNode, cbNodes, node.properties); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNodes(cbNode, cbNodes, node.arguments); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 206 /* AsExpression */: + case 207 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return visitNode(cbNode, node.expression); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return visitNode(cbNode, node.name); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 211 /* Block */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 239 /* ModuleBlock */: return visitNodes(cbNode, cbNodes, node.statements); - case 272 /* SourceFile */: + case 273 /* SourceFile */: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return visitNodes(cbNode, cbNodes, node.declarations); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitNode(cbNode, node.awaitModifier) || visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: return visitNode(cbNode, node.label); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return visitNodes(cbNode, cbNodes, node.clauses); - case 264 /* CaseClause */: + case 265 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return visitNodes(cbNode, cbNodes, node.statements); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 149 /* Decorator */: return visitNode(cbNode, node.expression); - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return visitNodes(cbNode, cbNodes, node.decorators) || 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 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || 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 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); - case 271 /* EnumMember */: + case 272 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return visitNodes(cbNode, cbNodes, node.elements); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 146 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return visitNodes(cbNode, cbNodes, node.types); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 251 /* MissingDeclaration */: + case 252 /* MissingDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators); - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); - case 253 /* JsxElement */: + case 254 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return visitNode(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingFragment); - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.attributes); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return visitNodes(cbNode, cbNodes, node.properties); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 274 /* JSDocTypeExpression */: + case 275 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 278 /* JSDocNonNullableType */: + case 279 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 282 /* JSDocComment */: + case 283 /* JSDocComment */: return visitNodes(cbNode, cbNodes, node.tags); - case 287 /* JSDocParameterTag */: - case 292 /* JSDocPropertyTag */: + case 288 /* JSDocParameterTag */: + case 293 /* JSDocPropertyTag */: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -14683,17 +14740,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 288 /* JSDocReturnTag */: + case 289 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 289 /* JSDocTypeTag */: + case 290 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 285 /* JSDocAugmentsTag */: + case 286 /* JSDocAugmentsTag */: return visitNode(cbNode, node.class); - case 290 /* JSDocTemplateTag */: + case 291 /* JSDocTemplateTag */: return visitNodes(cbNode, cbNodes, node.typeParameters); - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: if (node.typeExpression && - node.typeExpression.kind === 274 /* JSDocTypeExpression */) { + node.typeExpression.kind === 275 /* JSDocTypeExpression */) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -14701,7 +14758,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 283 /* JSDocTypeLiteral */: + case 284 /* JSDocTypeLiteral */: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -14709,7 +14766,7 @@ var ts; } } return; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); } } @@ -15032,7 +15089,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(272 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(273 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -15836,7 +15893,7 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 151 /* PropertyDeclaration */: - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: return true; case 153 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal @@ -15853,8 +15910,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: return true; } } @@ -15863,42 +15920,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 212 /* VariableStatement */: - case 211 /* Block */: - case 215 /* IfStatement */: - case 214 /* ExpressionStatement */: - case 227 /* ThrowStatement */: - case 223 /* ReturnStatement */: - case 225 /* SwitchStatement */: - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 218 /* ForStatement */: - case 217 /* WhileStatement */: - case 224 /* WithStatement */: - case 213 /* EmptyStatement */: - case 228 /* TryStatement */: - case 226 /* LabeledStatement */: - case 216 /* DoStatement */: - case 229 /* DebuggerStatement */: - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: - case 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 233 /* FunctionDeclaration */: + case 213 /* VariableStatement */: + case 212 /* Block */: + case 216 /* IfStatement */: + case 215 /* ExpressionStatement */: + case 228 /* ThrowStatement */: + case 224 /* ReturnStatement */: + case 226 /* SwitchStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 219 /* ForStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: + case 214 /* EmptyStatement */: + case 229 /* TryStatement */: + case 227 /* LabeledStatement */: + case 217 /* DoStatement */: + case 230 /* DebuggerStatement */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 236 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 271 /* EnumMember */; + return node.kind === 272 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { @@ -15914,7 +15971,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 230 /* VariableDeclaration */) { + if (node.kind !== 231 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -16101,7 +16158,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(200 /* TemplateExpression */); + var template = createNode(201 /* TemplateExpression */); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 14 /* TemplateHead */, "Template head has wrong token kind"); var list = []; @@ -16113,7 +16170,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(209 /* TemplateSpan */); + var span = createNode(210 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token() === 18 /* CloseBraceToken */) { @@ -16184,9 +16241,9 @@ var ts; return finishNode(node); } function parseJSDocAllType(postFixEquals) { - var result = createNode(275 /* JSDocAllType */); + var result = createNode(276 /* JSDocAllType */); if (postFixEquals) { - return createJSDocPostfixType(279 /* JSDocOptionalType */, result); + return createJSDocPostfixType(280 /* JSDocOptionalType */, result); } else { nextToken(); @@ -16194,7 +16251,7 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(278 /* JSDocNonNullableType */); + var result = createNode(279 /* JSDocNonNullableType */); nextToken(); result.type = parseNonArrayType(); return finishNode(result); @@ -16218,18 +16275,18 @@ var ts; token() === 29 /* GreaterThanToken */ || token() === 58 /* EqualsToken */ || token() === 49 /* BarToken */) { - var result = createNode(276 /* JSDocUnknownType */, pos); + var result = createNode(277 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(277 /* JSDocNullableType */, pos); + var result = createNode(278 /* JSDocNullableType */, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNodeWithJSDoc(280 /* JSDocFunctionType */); + var result = createNodeWithJSDoc(281 /* JSDocFunctionType */); nextToken(); fillSignature(56 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result); return finishNode(result); @@ -16251,12 +16308,12 @@ var ts; var dotdotdot = parseOptionalToken(24 /* DotDotDotToken */); var type = parseType(); if (dotdotdot) { - var variadic = createNode(281 /* JSDocVariadicType */, dotdotdot.pos); + var variadic = createNode(282 /* JSDocVariadicType */, dotdotdot.pos); variadic.type = type; type = finishNode(variadic); } if (token() === 58 /* EqualsToken */) { - return createJSDocPostfixType(279 /* JSDocOptionalType */, type); + return createJSDocPostfixType(280 /* JSDocOptionalType */, type); } return type; } @@ -16634,7 +16691,7 @@ var ts; var node = createNode(177 /* LiteralType */); var unaryMinusExpression; if (negative) { - unaryMinusExpression = createNode(196 /* PrefixUnaryExpression */); + unaryMinusExpression = createNode(197 /* PrefixUnaryExpression */); unaryMinusExpression.operator = 38 /* MinusToken */; nextToken(); } @@ -16649,6 +16706,26 @@ var ts; node.literal = expression; return finishNode(node); } + function isStartOfTypeOfImportType() { + nextToken(); + return token() === 91 /* ImportKeyword */; + } + function parseImportType() { + sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */; + var node = createNode(178 /* ImportType */); + if (parseOptional(103 /* TypeOfKeyword */)) { + node.isTypeOf = true; + } + parseExpected(91 /* ImportKeyword */); + parseExpected(19 /* OpenParenToken */); + node.argument = parseType(); + parseExpected(20 /* CloseParenToken */); + if (parseOptional(23 /* DotToken */)) { + node.qualifier = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected); + } + node.typeArguments = tryParseTypeArguments(); + return finishNode(node); + } function nextTokenIsNumericLiteral() { return nextToken() === 8 /* NumericLiteral */; } @@ -16695,13 +16772,15 @@ var ts; } } case 103 /* TypeOfKeyword */: - return parseTypeQuery(); + return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); case 17 /* OpenBraceToken */: return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); case 21 /* OpenBracketToken */: return parseTupleType(); case 19 /* OpenParenToken */: return parseParenthesizedType(); + case 91 /* ImportKeyword */: + return parseImportType(); default: return parseTypeReference(); } @@ -16736,6 +16815,7 @@ var ts; case 51 /* ExclamationToken */: case 24 /* DotDotDotToken */: case 126 /* InferKeyword */: + case 91 /* ImportKeyword */: return true; case 38 /* MinusToken */: return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral); @@ -16756,14 +16836,14 @@ var ts; while (!scanner.hasPrecedingLineBreak()) { switch (token()) { case 51 /* ExclamationToken */: - type = createJSDocPostfixType(278 /* JSDocNonNullableType */, type); + type = createJSDocPostfixType(279 /* JSDocNonNullableType */, type); break; case 55 /* QuestionToken */: // If not in JSDoc and next token is start of a type we have a conditional type if (!(contextFlags & 1048576 /* JSDoc */) && lookAhead(nextTokenIsStartOfType)) { return type; } - type = createJSDocPostfixType(277 /* JSDocNullableType */, type); + type = createJSDocPostfixType(278 /* JSDocNullableType */, type); break; case 21 /* OpenBracketToken */: parseExpected(21 /* OpenBracketToken */); @@ -17117,7 +17197,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(201 /* YieldExpression */); + var node = createNode(202 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -17139,11 +17219,11 @@ var ts; ts.Debug.assert(token() === 36 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(191 /* ArrowFunction */, asyncModifier.pos); + node = createNode(192 /* ArrowFunction */, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(191 /* ArrowFunction */, identifier.pos); + node = createNode(192 /* ArrowFunction */, identifier.pos); } var parameter = createNode(148 /* Parameter */, identifier.pos); parameter.name = identifier; @@ -17341,7 +17421,7 @@ var ts; return 0 /* False */; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNodeWithJSDoc(191 /* ArrowFunction */); + var node = createNodeWithJSDoc(192 /* ArrowFunction */); node.modifiers = parseModifiersForArrowFunction(); var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */; // Arrow functions are never generators. @@ -17407,7 +17487,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(199 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(200 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -17487,39 +17567,39 @@ var ts; return ts.getBinaryOperatorPrecedence(token()) > 0; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(198 /* BinaryExpression */, left.pos); + var node = createNode(199 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(206 /* AsExpression */, left.pos); + var node = createNode(207 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(196 /* PrefixUnaryExpression */); + var node = createNode(197 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(192 /* DeleteExpression */); + var node = createNode(193 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(193 /* TypeOfExpression */); + var node = createNode(194 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(194 /* VoidExpression */); + var node = createNode(195 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -17535,7 +17615,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(195 /* AwaitExpression */); + var node = createNode(196 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -17579,7 +17659,7 @@ var ts; if (token() === 40 /* AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 188 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 189 /* 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 { @@ -17676,7 +17756,7 @@ var ts; */ function parseUpdateExpression() { if (token() === 43 /* PlusPlusToken */ || token() === 44 /* MinusMinusToken */) { - var node = createNode(196 /* PrefixUnaryExpression */); + var node = createNode(197 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -17689,7 +17769,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 43 /* PlusPlusToken */ || token() === 44 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(197 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(198 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -17804,7 +17884,7 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(183 /* PropertyAccessExpression */, expression.pos); + var node = createNode(184 /* PropertyAccessExpression */, expression.pos); node.expression = expression; parseExpectedToken(23 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -17829,8 +17909,8 @@ var ts; function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 255 /* JsxOpeningElement */) { - var node = createNode(253 /* JsxElement */, opening.pos); + if (opening.kind === 256 /* JsxOpeningElement */) { + var node = createNode(254 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -17839,15 +17919,15 @@ var ts; } result = finishNode(node); } - else if (opening.kind === 258 /* JsxOpeningFragment */) { - var node = createNode(257 /* JsxFragment */, opening.pos); + else if (opening.kind === 259 /* JsxOpeningFragment */) { + var node = createNode(258 /* JsxFragment */, opening.pos); node.openingFragment = opening; node.children = parseJsxChildren(node.openingFragment); node.closingFragment = parseJsxClosingFragment(inExpressionContext); result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 254 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 255 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -17862,7 +17942,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(198 /* BinaryExpression */, result.pos); + var badNode = createNode(199 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -17920,7 +18000,7 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(261 /* JsxAttributes */); + var jsxAttributes = createNode(262 /* JsxAttributes */); jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute); return finishNode(jsxAttributes); } @@ -17929,7 +18009,7 @@ var ts; parseExpected(27 /* LessThanToken */); if (token() === 29 /* GreaterThanToken */) { // See below for explanation of scanJsxText - var node_1 = createNode(258 /* JsxOpeningFragment */, fullStart); + var node_1 = createNode(259 /* JsxOpeningFragment */, fullStart); scanJsxText(); return finishNode(node_1); } @@ -17941,7 +18021,7 @@ var ts; // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(255 /* JsxOpeningElement */, fullStart); + node = createNode(256 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -17953,7 +18033,7 @@ var ts; parseExpected(29 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(254 /* JsxSelfClosingElement */, fullStart); + node = createNode(255 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.typeArguments = typeArguments; @@ -17970,7 +18050,7 @@ var ts; var expression = token() === 99 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName(); while (parseOptional(23 /* DotToken */)) { - var propertyAccess = createNode(183 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(184 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17978,7 +18058,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(263 /* JsxExpression */); + var node = createNode(264 /* JsxExpression */); if (!parseExpected(17 /* OpenBraceToken */)) { return undefined; } @@ -18000,7 +18080,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(260 /* JsxAttribute */); + var node = createNode(261 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 58 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -18015,7 +18095,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(262 /* JsxSpreadAttribute */); + var node = createNode(263 /* JsxSpreadAttribute */); parseExpected(17 /* OpenBraceToken */); parseExpected(24 /* DotDotDotToken */); node.expression = parseExpression(); @@ -18023,7 +18103,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(256 /* JsxClosingElement */); + var node = createNode(257 /* JsxClosingElement */); parseExpected(28 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -18036,7 +18116,7 @@ var ts; return finishNode(node); } function parseJsxClosingFragment(inExpressionContext) { - var node = createNode(259 /* JsxClosingFragment */); + var node = createNode(260 /* JsxClosingFragment */); parseExpected(28 /* LessThanSlashToken */); if (ts.tokenIsIdentifierOrKeyword(token())) { parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); @@ -18051,7 +18131,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(188 /* TypeAssertionExpression */); + var node = createNode(189 /* TypeAssertionExpression */); parseExpected(27 /* LessThanToken */); node.type = parseType(); parseExpected(29 /* GreaterThanToken */); @@ -18062,7 +18142,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(23 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(183 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(184 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -18070,14 +18150,14 @@ var ts; } if (token() === 51 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(207 /* NonNullExpression */, expression.pos); + var nonNullExpression = createNode(208 /* NonNullExpression */, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(21 /* OpenBracketToken */)) { - var indexedAccess = createNode(184 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(185 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -18093,7 +18173,7 @@ var ts; continue; } if (token() === 13 /* NoSubstitutionTemplateLiteral */ || token() === 14 /* TemplateHead */) { - var tagExpression = createNode(187 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(188 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 13 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -18116,7 +18196,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(185 /* CallExpression */, expression.pos); + var callExpr = createNode(186 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -18124,7 +18204,7 @@ var ts; continue; } else if (token() === 19 /* OpenParenToken */) { - var callExpr = createNode(185 /* CallExpression */, expression.pos); + var callExpr = createNode(186 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -18234,28 +18314,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNodeWithJSDoc(189 /* ParenthesizedExpression */); + var node = createNodeWithJSDoc(190 /* ParenthesizedExpression */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(20 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(202 /* SpreadElement */); + var node = createNode(203 /* SpreadElement */); parseExpected(24 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 24 /* DotDotDotToken */ ? parseSpreadElement() : - token() === 26 /* CommaToken */ ? createNode(204 /* OmittedExpression */) : + token() === 26 /* CommaToken */ ? createNode(205 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(181 /* ArrayLiteralExpression */); + var node = createNode(182 /* ArrayLiteralExpression */); parseExpected(21 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -18267,7 +18347,7 @@ var ts; function parseObjectLiteralElement() { var node = createNodeWithJSDoc(0 /* Unknown */); if (parseOptionalToken(24 /* DotDotDotToken */)) { - node.kind = 270 /* SpreadAssignment */; + node.kind = 271 /* SpreadAssignment */; node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -18294,7 +18374,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 /* CommaToken */ || token() === 18 /* CloseBraceToken */ || token() === 58 /* EqualsToken */); if (isShorthandPropertyAssignment) { - node.kind = 269 /* ShorthandPropertyAssignment */; + node.kind = 270 /* ShorthandPropertyAssignment */; var equalsToken = parseOptionalToken(58 /* EqualsToken */); if (equalsToken) { node.equalsToken = equalsToken; @@ -18302,14 +18382,14 @@ var ts; } } else { - node.kind = 268 /* PropertyAssignment */; + node.kind = 269 /* PropertyAssignment */; parseExpected(56 /* ColonToken */); node.initializer = allowInAnd(parseAssignmentExpressionOrHigher); } return finishNode(node); } function parseObjectLiteralExpression() { - var node = createNode(182 /* ObjectLiteralExpression */); + var node = createNode(183 /* ObjectLiteralExpression */); parseExpected(17 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -18328,7 +18408,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNodeWithJSDoc(190 /* FunctionExpression */); + var node = createNodeWithJSDoc(191 /* FunctionExpression */); node.modifiers = parseModifiers(); parseExpected(89 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(39 /* AsteriskToken */); @@ -18353,12 +18433,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94 /* NewKeyword */); if (parseOptional(23 /* DotToken */)) { - var node_2 = createNode(208 /* MetaProperty */, fullStart); + var node_2 = createNode(209 /* MetaProperty */, fullStart); node_2.keywordToken = 94 /* NewKeyword */; node_2.name = parseIdentifierName(); return finishNode(node_2); } - var node = createNode(186 /* NewExpression */, fullStart); + var node = createNode(187 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 19 /* OpenParenToken */) { @@ -18368,7 +18448,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(211 /* Block */); + var node = createNode(212 /* Block */); if (parseExpected(17 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -18401,12 +18481,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(213 /* EmptyStatement */); + var node = createNode(214 /* EmptyStatement */); parseExpected(25 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(215 /* IfStatement */); + var node = createNode(216 /* IfStatement */); parseExpected(90 /* IfKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -18416,7 +18496,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(216 /* DoStatement */); + var node = createNode(217 /* DoStatement */); parseExpected(81 /* DoKeyword */); node.statement = parseStatement(); parseExpected(106 /* WhileKeyword */); @@ -18431,7 +18511,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(217 /* WhileStatement */); + var node = createNode(218 /* WhileStatement */); parseExpected(106 /* WhileKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -18455,7 +18535,7 @@ var ts; } var forOrForInOrForOfStatement; if (awaitToken ? parseExpected(144 /* OfKeyword */) : parseOptional(144 /* OfKeyword */)) { - var forOfStatement = createNode(220 /* ForOfStatement */, pos); + var forOfStatement = createNode(221 /* ForOfStatement */, pos); forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); @@ -18463,14 +18543,14 @@ var ts; forOrForInOrForOfStatement = forOfStatement; } else if (parseOptional(92 /* InKeyword */)) { - var forInStatement = createNode(219 /* ForInStatement */, pos); + var forInStatement = createNode(220 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(20 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } else { - var forStatement = createNode(218 /* ForStatement */, pos); + var forStatement = createNode(219 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(25 /* SemicolonToken */); if (token() !== 25 /* SemicolonToken */ && token() !== 20 /* CloseParenToken */) { @@ -18488,7 +18568,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 222 /* BreakStatement */ ? 72 /* BreakKeyword */ : 77 /* ContinueKeyword */); + parseExpected(kind === 223 /* BreakStatement */ ? 72 /* BreakKeyword */ : 77 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -18496,7 +18576,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(223 /* ReturnStatement */); + var node = createNode(224 /* ReturnStatement */); parseExpected(96 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -18505,7 +18585,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(224 /* WithStatement */); + var node = createNode(225 /* WithStatement */); parseExpected(107 /* WithKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -18514,7 +18594,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(264 /* CaseClause */); + var node = createNode(265 /* CaseClause */); parseExpected(73 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(56 /* ColonToken */); @@ -18522,7 +18602,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(265 /* DefaultClause */); + var node = createNode(266 /* DefaultClause */); parseExpected(79 /* DefaultKeyword */); parseExpected(56 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -18532,12 +18612,12 @@ var ts; return token() === 73 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(225 /* SwitchStatement */); + var node = createNode(226 /* SwitchStatement */); parseExpected(98 /* SwitchKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(20 /* CloseParenToken */); - var caseBlock = createNode(239 /* CaseBlock */); + var caseBlock = createNode(240 /* CaseBlock */); parseExpected(17 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(18 /* CloseBraceToken */); @@ -18552,7 +18632,7 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(227 /* ThrowStatement */); + var node = createNode(228 /* ThrowStatement */); parseExpected(100 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -18560,7 +18640,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(228 /* TryStatement */); + var node = createNode(229 /* TryStatement */); parseExpected(102 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token() === 74 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -18573,7 +18653,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(267 /* CatchClause */); + var result = createNode(268 /* CatchClause */); parseExpected(74 /* CatchKeyword */); if (parseOptional(19 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -18587,7 +18667,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(229 /* DebuggerStatement */); + var node = createNode(230 /* DebuggerStatement */); parseExpected(78 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -18599,12 +18679,12 @@ var ts; var node = createNodeWithJSDoc(0 /* Unknown */); var expression = allowInAnd(parseExpression); if (expression.kind === 71 /* Identifier */ && parseOptional(56 /* ColonToken */)) { - node.kind = 226 /* LabeledStatement */; + node.kind = 227 /* LabeledStatement */; node.label = expression; node.statement = parseStatement(); } else { - node.kind = 214 /* ExpressionStatement */; + node.kind = 215 /* ExpressionStatement */; node.expression = expression; parseSemicolon(); } @@ -18771,16 +18851,16 @@ var ts; case 17 /* OpenBraceToken */: return parseBlock(/*ignoreMissingOpenBrace*/ false); case 104 /* VarKeyword */: - return parseVariableStatement(createNodeWithJSDoc(230 /* VariableDeclaration */)); + return parseVariableStatement(createNodeWithJSDoc(231 /* VariableDeclaration */)); case 110 /* LetKeyword */: if (isLetDeclaration()) { - return parseVariableStatement(createNodeWithJSDoc(230 /* VariableDeclaration */)); + return parseVariableStatement(createNodeWithJSDoc(231 /* VariableDeclaration */)); } break; case 89 /* FunctionKeyword */: - return parseFunctionDeclaration(createNodeWithJSDoc(232 /* FunctionDeclaration */)); + return parseFunctionDeclaration(createNodeWithJSDoc(233 /* FunctionDeclaration */)); case 75 /* ClassKeyword */: - return parseClassDeclaration(createNodeWithJSDoc(233 /* ClassDeclaration */)); + return parseClassDeclaration(createNodeWithJSDoc(234 /* ClassDeclaration */)); case 90 /* IfKeyword */: return parseIfStatement(); case 81 /* DoKeyword */: @@ -18790,9 +18870,9 @@ var ts; case 88 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 77 /* ContinueKeyword */: - return parseBreakOrContinueStatement(221 /* ContinueStatement */); + return parseBreakOrContinueStatement(222 /* ContinueStatement */); case 72 /* BreakKeyword */: - return parseBreakOrContinueStatement(222 /* BreakStatement */); + return parseBreakOrContinueStatement(223 /* BreakStatement */); case 96 /* ReturnKeyword */: return parseReturnStatement(); case 107 /* WithKeyword */: @@ -18889,7 +18969,7 @@ var ts; if (node.decorators || node.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(251 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(252 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); missing.pos = node.pos; missing.decorators = node.decorators; missing.modifiers = node.modifiers; @@ -18911,16 +18991,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token() === 26 /* CommaToken */) { - return createNode(204 /* OmittedExpression */); + return createNode(205 /* OmittedExpression */); } - var node = createNode(180 /* BindingElement */); + var node = createNode(181 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(180 /* BindingElement */); + var node = createNode(181 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -18936,14 +19016,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(178 /* ObjectBindingPattern */); + var node = createNode(179 /* ObjectBindingPattern */); parseExpected(17 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(18 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(179 /* ArrayBindingPattern */); + var node = createNode(180 /* ArrayBindingPattern */); parseExpected(21 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(22 /* CloseBracketToken */); @@ -18965,7 +19045,7 @@ var ts; return parseVariableDeclaration(/*allowExclamation*/ true); } function parseVariableDeclaration(allowExclamation) { - var node = createNode(230 /* VariableDeclaration */); + var node = createNode(231 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); if (allowExclamation && node.name.kind === 71 /* Identifier */ && token() === 51 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { @@ -18978,7 +19058,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(231 /* VariableDeclarationList */); + var node = createNode(232 /* VariableDeclarationList */); switch (token()) { case 104 /* VarKeyword */: break; @@ -19016,13 +19096,13 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 20 /* CloseParenToken */; } function parseVariableStatement(node) { - node.kind = 212 /* VariableStatement */; + node.kind = 213 /* VariableStatement */; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(node) { - node.kind = 232 /* FunctionDeclaration */; + node.kind = 233 /* FunctionDeclaration */; parseExpected(89 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(39 /* AsteriskToken */); node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier(); @@ -19204,7 +19284,7 @@ var ts; } function parseClassElement() { if (token() === 25 /* SemicolonToken */) { - var result = createNode(210 /* SemicolonClassElement */); + var result = createNode(211 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -19241,10 +19321,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 203 /* ClassExpression */); + return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 204 /* ClassExpression */); } function parseClassDeclaration(node) { - return parseClassDeclarationOrExpression(node, 233 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(node, 234 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(node, kind) { node.kind = kind; @@ -19287,7 +19367,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 /* ExtendsKeyword */ || tok === 108 /* ImplementsKeyword */) { - var node = createNode(266 /* HeritageClause */); + var node = createNode(267 /* HeritageClause */); node.token = tok; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -19296,7 +19376,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(205 /* ExpressionWithTypeArguments */); + var node = createNode(206 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); node.typeArguments = tryParseTypeArguments(); return finishNode(node); @@ -19313,7 +19393,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(node) { - node.kind = 234 /* InterfaceDeclaration */; + node.kind = 235 /* InterfaceDeclaration */; parseExpected(109 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -19322,7 +19402,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(node) { - node.kind = 235 /* TypeAliasDeclaration */; + node.kind = 236 /* TypeAliasDeclaration */; parseExpected(139 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -19336,13 +19416,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNodeWithJSDoc(271 /* EnumMember */); + var node = createNodeWithJSDoc(272 /* EnumMember */); node.name = parsePropertyName(); node.initializer = allowInAnd(parseInitializer); return finishNode(node); } function parseEnumDeclaration(node) { - node.kind = 236 /* EnumDeclaration */; + node.kind = 237 /* EnumDeclaration */; parseExpected(83 /* EnumKeyword */); node.name = parseIdentifier(); if (parseExpected(17 /* OpenBraceToken */)) { @@ -19355,7 +19435,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(238 /* ModuleBlock */); + var node = createNode(239 /* ModuleBlock */); if (parseExpected(17 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(18 /* CloseBraceToken */); @@ -19366,7 +19446,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(node, flags) { - node.kind = 237 /* ModuleDeclaration */; + node.kind = 238 /* ModuleDeclaration */; // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 16 /* Namespace */; @@ -19378,7 +19458,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(node) { - node.kind = 237 /* ModuleDeclaration */; + node.kind = 238 /* ModuleDeclaration */; if (token() === 143 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); @@ -19424,7 +19504,7 @@ var ts; return nextToken() === 41 /* SlashToken */; } function parseNamespaceExportDeclaration(node) { - node.kind = 240 /* NamespaceExportDeclaration */; + node.kind = 241 /* NamespaceExportDeclaration */; parseExpected(118 /* AsKeyword */); parseExpected(130 /* NamespaceKeyword */); node.name = parseIdentifier(); @@ -19442,7 +19522,7 @@ var ts; } } // Import statement - node.kind = 242 /* ImportDeclaration */; + node.kind = 243 /* ImportDeclaration */; // ImportDeclaration: // import ImportClause from ModuleSpecifier ; // import ModuleSpecifier; @@ -19457,7 +19537,7 @@ var ts; return finishNode(node); } function parseImportEqualsDeclaration(node, identifier) { - node.kind = 241 /* ImportEqualsDeclaration */; + node.kind = 242 /* ImportEqualsDeclaration */; node.name = identifier; parseExpected(58 /* EqualsToken */); node.moduleReference = parseModuleReference(); @@ -19471,7 +19551,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(243 /* ImportClause */, fullStart); + var importClause = createNode(244 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -19481,7 +19561,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(26 /* CommaToken */)) { - importClause.namedBindings = token() === 39 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(245 /* NamedImports */); + importClause.namedBindings = token() === 39 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(246 /* NamedImports */); } return finishNode(importClause); } @@ -19491,7 +19571,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(252 /* ExternalModuleReference */); + var node = createNode(253 /* ExternalModuleReference */); parseExpected(133 /* RequireKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -19514,7 +19594,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(244 /* NamespaceImport */); + var namespaceImport = createNode(245 /* NamespaceImport */); parseExpected(39 /* AsteriskToken */); parseExpected(118 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -19529,14 +19609,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 245 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 17 /* OpenBraceToken */, 18 /* CloseBraceToken */); + node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 246 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 17 /* OpenBraceToken */, 18 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(250 /* ExportSpecifier */); + return parseImportOrExportSpecifier(251 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(246 /* ImportSpecifier */); + return parseImportOrExportSpecifier(247 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -19561,19 +19641,19 @@ var ts; else { node.name = identifierName; } - if (kind === 246 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 247 /* ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(node) { - node.kind = 248 /* ExportDeclaration */; + node.kind = 249 /* ExportDeclaration */; if (parseOptional(39 /* AsteriskToken */)) { parseExpected(142 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(249 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(250 /* 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. @@ -19586,7 +19666,7 @@ var ts; return finishNode(node); } function parseExportAssignment(node) { - node.kind = 247 /* ExportAssignment */; + node.kind = 248 /* ExportAssignment */; if (parseOptional(58 /* EqualsToken */)) { node.isExportEquals = true; } @@ -19600,10 +19680,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1 /* Export */) - || node.kind === 241 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 252 /* ExternalModuleReference */ - || node.kind === 242 /* ImportDeclaration */ - || node.kind === 247 /* ExportAssignment */ - || node.kind === 248 /* ExportDeclaration */ + || node.kind === 242 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 253 /* ExternalModuleReference */ + || node.kind === 243 /* ImportDeclaration */ + || node.kind === 248 /* ExportAssignment */ + || node.kind === 249 /* ExportDeclaration */ ? node : undefined; }); @@ -19656,7 +19736,7 @@ var ts; JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; // Parses out a JSDoc type expression. function parseJSDocTypeExpression(mayOmitBraces) { - var result = createNode(274 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(275 /* JSDocTypeExpression */, scanner.getTokenPos()); var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(17 /* OpenBraceToken */); result.type = doInsideOfContext(1048576 /* JSDoc */, parseJSDocType); if (!mayOmitBraces || hasBrace) { @@ -19827,7 +19907,7 @@ var ts; } } function createJSDocComment() { - var result = createNode(282 /* JSDocComment */, start); + var result = createNode(283 /* JSDocComment */, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -19952,7 +20032,7 @@ var ts; return comments.length === 0 ? undefined : comments.join(""); } function parseUnknownTag(atToken, tagName) { - var result = createNode(284 /* JSDocTag */, atToken.pos); + var result = createNode(285 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -20009,9 +20089,9 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 /* Parameter */ ? - createNode(287 /* JSDocParameterTag */, atToken.pos) : - createNode(292 /* JSDocPropertyTag */, atToken.pos); - var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); + createNode(288 /* JSDocParameterTag */, atToken.pos) : + createNode(293 /* JSDocPropertyTag */, atToken.pos); + var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; isNameFirst = true; @@ -20024,18 +20104,20 @@ var ts; result.isBracketed = isBracketed; return finishNode(result); } - function parseNestedTypeLiteral(typeExpression, name) { + function parseNestedTypeLiteral(typeExpression, name, target) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(274 /* JSDocTypeExpression */, scanner.getTokenPos()); + var typeLiteralExpression = createNode(275 /* JSDocTypeExpression */, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); var children = void 0; - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(1 /* Parameter */, name); })) { - children = ts.append(children, child); + while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, name); })) { + if (child.kind === 288 /* JSDocParameterTag */ || child.kind === 293 /* JSDocPropertyTag */) { + children = ts.append(children, child); + } } if (children) { - jsdocTypeLiteral = createNode(283 /* JSDocTypeLiteral */, start_2); + jsdocTypeLiteral = createNode(284 /* JSDocTypeLiteral */, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 166 /* ArrayType */) { jsdocTypeLiteral.isArrayType = true; @@ -20046,27 +20128,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 288 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 289 /* JSDocReturnTag */; })) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(288 /* JSDocReturnTag */, atToken.pos); + var result = createNode(289 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 289 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 290 /* JSDocTypeTag */; })) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(289 /* JSDocTypeTag */, atToken.pos); + var result = createNode(290 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(285 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(286 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -20074,7 +20156,7 @@ var ts; } function parseExpressionWithTypeArgumentsForAugments() { var usedBrace = parseOptional(17 /* OpenBraceToken */); - var node = createNode(205 /* ExpressionWithTypeArguments */); + var node = createNode(206 /* ExpressionWithTypeArguments */); node.expression = parsePropertyAccessEntityNameExpression(); node.typeArguments = tryParseTypeArguments(); var res = finishNode(node); @@ -20086,7 +20168,7 @@ var ts; function parsePropertyAccessEntityNameExpression() { var node = parseJSDocIdentifierName(/*createIfMissing*/ true); while (parseOptional(23 /* DotToken */)) { - var prop = createNode(183 /* PropertyAccessExpression */, node.pos); + var prop = createNode(184 /* PropertyAccessExpression */, node.pos); prop.expression = node; prop.name = parseJSDocIdentifierName(); node = finishNode(prop); @@ -20094,7 +20176,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(286 /* JSDocClassTag */, atToken.pos); + var tag = createNode(287 /* JSDocClassTag */, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -20102,7 +20184,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(291 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(292 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); @@ -20125,11 +20207,11 @@ var ts; var jsdocTypeLiteral = void 0; var childTypeTag = void 0; var start_3 = scanner.getStartPos(); - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0 /* Property */); })) { + while (child = tryParse(function () { return parseChildPropertyTag(); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(283 /* JSDocTypeLiteral */, start_3); + jsdocTypeLiteral = createNode(284 /* JSDocTypeLiteral */, start_3); } - if (child.kind === 289 /* JSDocTypeTag */) { + if (child.kind === 290 /* JSDocTypeTag */) { if (childTypeTag) { break; } @@ -20155,7 +20237,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(23 /* DotToken */)) { - var jsDocNamespaceNode = createNode(237 /* ModuleDeclaration */, pos); + var jsDocNamespaceNode = createNode(238 /* ModuleDeclaration */, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */); @@ -20179,6 +20261,9 @@ var ts; } return a.escapedText === b.escapedText; } + function parseChildPropertyTag() { + return parseChildParameterOrPropertyTag(0 /* Property */); + } function parseChildParameterOrPropertyTag(target, name) { var canParseTag = true; var seenAsterisk = false; @@ -20187,7 +20272,7 @@ var ts; case 57 /* AtToken */: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 287 /* JSDocParameterTag */ && + if (child && child.kind === 288 /* JSDocParameterTag */ && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -20272,7 +20357,7 @@ var ts; break; } } - var result = createNode(290 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(291 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -21034,24 +21119,24 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: return 0 /* NonInstantiated */; // 2. const enum declarations - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: if (ts.isConst(node)) { return 2 /* ConstEnumOnly */; } break; // 3. non-exported import declarations - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: if (!(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } break; // 4. other uninstantiated module declarations. - case 238 /* ModuleBlock */: { + case 239 /* ModuleBlock */: { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateWorker(n); @@ -21073,7 +21158,7 @@ var ts; }); return state_1; } - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return getModuleInstanceState(node); case 71 /* Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -21220,7 +21305,7 @@ var ts; if (symbolFlags & 67216319 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 237 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 238 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -21229,7 +21314,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 === 247 /* ExportAssignment */) { + if (node.kind === 248 /* ExportAssignment */) { return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */; } var name = ts.getNameOfDeclaration(node); @@ -21260,28 +21345,28 @@ var ts; return "__new" /* New */; case 159 /* IndexSignature */: return "__index" /* Index */; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return "__export" /* ExportStar */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (ts.getSpecialPropertyAssignmentKind(node) === 2 /* ModuleExports */) { // module.exports = ... return "export=" /* ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: return (ts.hasModifier(node, 512 /* Default */) ? "default" /* Default */ : undefined); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */); case 148 /* 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 === 280 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); + ts.Debug.assert(node.parent.kind === 281 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: var name_2 = ts.getNameOfJSDocTypedef(node); return typeof name_2 !== "undefined" ? name_2.escapedText : undefined; } @@ -21374,7 +21459,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 && - (isDefaultExport || (node.kind === 247 /* ExportAssignment */ && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 248 /* ExportAssignment */ && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -21399,7 +21484,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 2097152 /* Alias */) { - if (node.kind === 250 /* ExportSpecifier */ || (node.kind === 241 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 251 /* ExportSpecifier */ || (node.kind === 242 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -21421,7 +21506,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - if (node.kind === 291 /* JSDocTypedefTag */) + if (node.kind === 292 /* JSDocTypedefTag */) ts.Debug.assert(ts.isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. var isJSDocTypedefInJSDocNamespace = ts.isJSDocTypedefTag(node) && node.name && node.name.kind === 71 /* Identifier */ && node.name.isInJSDocNamespace; if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32 /* ExportContext */)) || isJSDocTypedefInJSDocNamespace) { @@ -21464,7 +21549,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 /* IsContainer */) { - if (node.kind !== 191 /* ArrowFunction */) { + if (node.kind !== 192 /* ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -21508,7 +21593,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { node.flags |= emitFlags; } if (currentReturnTarget) { @@ -21557,8 +21642,8 @@ var ts; } } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 232 /* FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 232 /* FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 233 /* FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 233 /* FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -21607,79 +21692,79 @@ var ts; return; } switch (node.kind) { - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: bindWhileStatement(node); break; - case 216 /* DoStatement */: + case 217 /* DoStatement */: bindDoStatement(node); break; - case 218 /* ForStatement */: + case 219 /* ForStatement */: bindForStatement(node); break; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 215 /* IfStatement */: + case 216 /* IfStatement */: bindIfStatement(node); break; - case 223 /* ReturnStatement */: - case 227 /* ThrowStatement */: + case 224 /* ReturnStatement */: + case 228 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 228 /* TryStatement */: + case 229 /* TryStatement */: bindTryStatement(node); break; - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: bindSwitchStatement(node); break; - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: bindCaseBlock(node); break; - case 264 /* CaseClause */: + case 265 /* CaseClause */: bindCaseClause(node); break; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: bindLabeledStatement(node); break; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: bindBinaryExpressionFlow(node); break; - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 185 /* CallExpression */: + case 186 /* CallExpression */: bindCallExpressionFlow(node); break; - case 282 /* JSDocComment */: + case 283 /* JSDocComment */: bindJSDocComment(node); break; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: bindJSDocTypedefTag(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 272 /* SourceFile */: + case 273 /* SourceFile */: bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; - case 211 /* Block */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 239 /* ModuleBlock */: bindEachFunctionsFirst(node.statements); break; default: @@ -21691,15 +21776,15 @@ var ts; switch (expr.kind) { case 71 /* Identifier */: case 99 /* ThisKeyword */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return isNarrowableReference(expr); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return hasNarrowableArgument(expr); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isNarrowingExpression(expr.expression); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return expr.operator === 51 /* ExclamationToken */ && isNarrowingExpression(expr.operand); } return false; @@ -21708,7 +21793,7 @@ var ts; return expr.kind === 71 /* Identifier */ || expr.kind === 99 /* ThisKeyword */ || expr.kind === 97 /* SuperKeyword */ || - expr.kind === 183 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); + expr.kind === 184 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -21719,7 +21804,7 @@ var ts; } } } - if (expr.expression.kind === 183 /* PropertyAccessExpression */ && + if (expr.expression.kind === 184 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression.expression)) { return true; } @@ -21752,9 +21837,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (expr.operatorToken.kind) { case 58 /* EqualsToken */: return isNarrowableOperand(expr.left); @@ -21832,33 +21917,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 215 /* IfStatement */: - case 217 /* WhileStatement */: - case 216 /* DoStatement */: + case 216 /* IfStatement */: + case 218 /* WhileStatement */: + case 217 /* DoStatement */: return parent.expression === node; - case 218 /* ForStatement */: - case 199 /* ConditionalExpression */: + case 219 /* ForStatement */: + case 200 /* ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 189 /* ParenthesizedExpression */) { + if (node.kind === 190 /* ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 196 /* PrefixUnaryExpression */ && node.operator === 51 /* ExclamationToken */) { + else if (node.kind === 197 /* PrefixUnaryExpression */ && node.operator === 51 /* ExclamationToken */) { node = node.operand; } else { - return node.kind === 198 /* BinaryExpression */ && (node.operatorToken.kind === 53 /* AmpersandAmpersandToken */ || + return node.kind === 199 /* BinaryExpression */ && (node.operatorToken.kind === 53 /* AmpersandAmpersandToken */ || node.operatorToken.kind === 54 /* BarBarToken */); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 189 /* ParenthesizedExpression */ || - node.parent.kind === 196 /* PrefixUnaryExpression */ && + while (node.parent.kind === 190 /* ParenthesizedExpression */ || + node.parent.kind === 197 /* PrefixUnaryExpression */ && node.parent.operator === 51 /* ExclamationToken */) { node = node.parent; } @@ -21900,7 +21985,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 226 /* LabeledStatement */ + var enclosingLabeledStatement = node.parent.kind === 227 /* LabeledStatement */ ? ts.lastOrUndefined(activeLabels) : undefined; // if do statement is wrapped in labeled statement then target labels for break/continue with or without @@ -21934,13 +22019,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 220 /* ForOfStatement */) { + if (node.kind === 221 /* ForOfStatement */) { bind(node.awaitModifier); } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 231 /* VariableDeclarationList */) { + if (node.initializer.kind !== 232 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -21962,7 +22047,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 223 /* ReturnStatement */) { + if (node.kind === 224 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -21982,7 +22067,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 222 /* BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 223 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -22078,7 +22163,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 265 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 266 /* 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). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -22145,14 +22230,14 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 216 /* DoStatement */) { + if (!node.statement || node.statement.kind !== 217 /* DoStatement */) { // do statement sets current flow inside bindDoStatement addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 198 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */) { + if (node.kind === 199 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -22163,10 +22248,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 181 /* ArrayLiteralExpression */) { + else if (node.kind === 182 /* ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 202 /* SpreadElement */) { + if (e.kind === 203 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -22174,16 +22259,16 @@ var ts; } } } - else if (node.kind === 182 /* ObjectLiteralExpression */) { + else if (node.kind === 183 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 268 /* PropertyAssignment */) { + if (p.kind === 269 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 269 /* ShorthandPropertyAssignment */) { + else if (p.kind === 270 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 270 /* SpreadAssignment */) { + else if (p.kind === 271 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -22239,7 +22324,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 58 /* EqualsToken */ && node.left.kind === 184 /* ElementAccessExpression */) { + if (operator === 58 /* EqualsToken */ && node.left.kind === 185 /* ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -22250,7 +22335,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 183 /* PropertyAccessExpression */) { + if (node.expression.kind === 184 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -22289,7 +22374,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 291 /* JSDocTypedefTag */) { + if (n.kind !== 292 /* JSDocTypedefTag */) { bind(n); } }); @@ -22310,10 +22395,10 @@ 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 = node.expression; - while (expr.kind === 189 /* ParenthesizedExpression */) { + while (expr.kind === 190 /* ParenthesizedExpression */) { expr = expr.expression; } - if (expr.kind === 190 /* FunctionExpression */ || expr.kind === 191 /* ArrowFunction */) { + if (expr.kind === 191 /* FunctionExpression */ || expr.kind === 192 /* ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -22321,7 +22406,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 183 /* PropertyAccessExpression */) { + if (node.expression.kind === 184 /* PropertyAccessExpression */) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -22330,21 +22415,21 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 182 /* ObjectLiteralExpression */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 183 /* ObjectLiteralExpression */: case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: - case 261 /* JsxAttributes */: + case 284 /* JSDocTypeLiteral */: + case 262 /* JsxAttributes */: return 1 /* IsContainer */; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 237 /* ModuleDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 238 /* ModuleDeclaration */: + case 236 /* TypeAliasDeclaration */: case 176 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 272 /* SourceFile */: + case 273 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; case 153 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -22352,31 +22437,31 @@ var ts; } // falls through case 154 /* Constructor */: - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 157 /* CallSignature */: - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: case 162 /* FunctionType */: case 158 /* ConstructSignature */: case 159 /* IndexSignature */: case 163 /* ConstructorType */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; case 151 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 267 /* CatchClause */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 239 /* CaseBlock */: + case 268 /* CatchClause */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 240 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 211 /* Block */: + case 212 /* 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 @@ -22409,20 +22494,20 @@ 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 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 272 /* SourceFile */: + case 273 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: - case 182 /* ObjectLiteralExpression */: - case 234 /* InterfaceDeclaration */: - case 261 /* JsxAttributes */: + case 284 /* JSDocTypeLiteral */: + case 183 /* ObjectLiteralExpression */: + case 235 /* InterfaceDeclaration */: + case 262 /* 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 @@ -22439,11 +22524,11 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 280 /* JSDocFunctionType */: - case 235 /* TypeAliasDeclaration */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 281 /* JSDocFunctionType */: + case 236 /* TypeAliasDeclaration */: case 176 /* MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, @@ -22465,11 +22550,11 @@ var ts; : declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 272 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 272 /* SourceFile */ || body.kind === 238 /* ModuleBlock */)) { + var body = node.kind === 273 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 273 /* SourceFile */ || body.kind === 239 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 248 /* ExportDeclaration */ || stat.kind === 247 /* ExportAssignment */) { + if (stat.kind === 249 /* ExportDeclaration */ || stat.kind === 248 /* ExportAssignment */) { return true; } } @@ -22553,7 +22638,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 270 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { + if (prop.kind === 271 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { continue; } var identifier = prop.name; @@ -22565,7 +22650,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 268 /* PropertyAssignment */ || prop.kind === 269 /* ShorthandPropertyAssignment */ || prop.kind === 153 /* MethodDeclaration */ + var currentKind = prop.kind === 269 /* PropertyAssignment */ || prop.kind === 270 /* ShorthandPropertyAssignment */ || prop.kind === 153 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); @@ -22596,10 +22681,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -22709,8 +22794,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 272 /* SourceFile */ && - blockScopeContainer.kind !== 237 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 273 /* SourceFile */ && + blockScopeContainer.kind !== 238 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -22812,7 +22897,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 291 /* JSDocTypedefTag */) { + if (tag.kind === 292 /* JSDocTypedefTag */) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -22851,7 +22936,7 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 291 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 292 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 67901928 /* TypeAliasExcludes */); @@ -22859,11 +22944,11 @@ var ts; } // falls through case 99 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 269 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 270 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } @@ -22871,7 +22956,7 @@ var ts; bindSpecialPropertyDeclaration(node); } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { case 1 /* ExportsProperty */: @@ -22899,17 +22984,17 @@ var ts; ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return checkStrictModeCatchClause(node); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return checkStrictModeWithStatement(node); case 173 /* ThisType */: seenThisKeyword = true; @@ -22920,18 +23005,18 @@ var ts; return bindTypeParameter(node); case 148 /* Parameter */: return bindParameter(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return bindPropertyWorker(node); - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 271 /* EnumMember */: + case 272 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */); case 157 /* CallSignature */: case 158 /* ConstructSignature */: @@ -22944,7 +23029,7 @@ var ts; // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67208127 /* MethodExcludes */); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return bindFunctionDeclaration(node); case 154 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); @@ -22953,78 +23038,78 @@ var ts; case 156 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67183551 /* SetAccessorExcludes */); case 162 /* FunctionType */: - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: case 163 /* ConstructorType */: return bindFunctionOrConstructorType(node); case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: + case 284 /* JSDocTypeLiteral */: case 176 /* MappedType */: return bindAnonymousTypeWorker(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return bindFunctionExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 67901832 /* InterfaceExcludes */); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67901928 /* TypeAliasExcludes */); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return bindJsxAttributes(node); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); // Imports and exports - case 241 /* ImportEqualsDeclaration */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 242 /* ImportEqualsDeclaration */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return bindImportClause(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return bindExportDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return bindExportAssignment(node); - case 272 /* SourceFile */: + case 273 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 211 /* Block */: + case 212 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } // falls through - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 287 /* JSDocParameterTag */: - if (node.parent.kind !== 283 /* JSDocTypeLiteral */) { + case 288 /* JSDocParameterTag */: + if (node.parent.kind !== 284 /* JSDocTypeLiteral */) { break; } // falls through - case 292 /* JSDocPropertyTag */: + case 293 /* JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 279 /* JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 280 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); - case 291 /* JSDocTypedefTag */: { + case 292 /* JSDocTypedefTag */: { var fullName = node.fullName; if (!fullName || fullName.kind === 71 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67901928 /* TypeAliasExcludes */); @@ -23054,7 +23139,7 @@ var ts; bindAnonymousDeclaration(node, 2097152 /* Alias */, getDeclarationName(node)); } else { - var flags = node.kind === 247 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 248 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) // An export default clause with an EntityNameExpression exports all meanings of that identifier ? 2097152 /* Alias */ // An export default clause with any other expression exports a value @@ -23068,7 +23153,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 272 /* SourceFile */) { + if (node.parent.kind !== 273 /* SourceFile */) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -23145,8 +23230,8 @@ var ts; ts.Debug.assert(ts.isInJavaScriptFile(node)); var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* 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 === 58 /* EqualsToken */) { @@ -23173,7 +23258,7 @@ var ts; var symbolTable = ts.hasModifier(thisContainer, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* Property */, 0 /* None */, /*isReplaceableByMethod*/ true); break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: // this.foo assignment in a source file // Do not bind. It would be nice to support this someday though. break; @@ -23185,7 +23270,7 @@ var ts; if (node.expression.kind === 99 /* ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 272 /* SourceFile */) { + else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 273 /* SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -23245,9 +23330,9 @@ var ts; function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) { var symbol = getJSInitializerSymbolFromName(name); var isToplevelNamespaceableInitializer = ts.isBinaryExpression(propertyAccess.parent) - ? propertyAccess.parent.parent.parent.kind === 272 /* SourceFile */ && - !!ts.getJavascriptInitializer(propertyAccess.parent.right, ts.isPrototypeAccess(propertyAccess.parent.left)) - : propertyAccess.parent.parent.kind === 272 /* SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 273 /* SourceFile */ && + !!ts.getJavascriptInitializer(ts.getInitializerOfBinaryExpression(propertyAccess.parent), ts.isPrototypeAccess(propertyAccess.parent.left)) + : propertyAccess.parent.parent.kind === 273 /* SourceFile */; if (!isPrototypeProperty && (!symbol || !(symbol.flags & 1920 /* Namespace */)) && isToplevelNamespaceableInitializer) { // make symbols or add declarations for intermediate containers var flags_1 = 1536 /* Module */ | 67108864 /* JSContainer */; @@ -23271,10 +23356,18 @@ var ts; (symbol.members || (symbol.members = ts.createSymbolTable())) : (symbol.exports || (symbol.exports = ts.createSymbolTable())); // Declare the method/property - var symbolFlags = 4 /* Property */ | (isToplevelNamespaceableInitializer ? 67108864 /* JSContainer */ : 0); - var symbolExcludes = 0 /* PropertyExcludes */ & ~(isToplevelNamespaceableInitializer ? 67108864 /* JSContainer */ : 0); + var jsContainerFlag = isToplevelNamespaceableInitializer ? 67108864 /* JSContainer */ : 0; + var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(propertyAccess)); + var symbolFlags = (isMethod ? 8192 /* Method */ : 4 /* Property */) | jsContainerFlag; + var symbolExcludes = (isMethod ? 67208127 /* MethodExcludes */ : 0 /* PropertyExcludes */) & ~jsContainerFlag; declareSymbol(symbolTable, symbol, propertyAccess, symbolFlags, symbolExcludes); } + function getParentOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.parent)) { + expr = expr.parent; + } + return expr.parent; + } function lookupSymbolForPropertyAccess(node, lookupContainer) { if (lookupContainer === void 0) { lookupContainer = container; } if (ts.isIdentifier(node)) { @@ -23306,7 +23399,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */); } else { @@ -23465,13 +23558,13 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 213 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 214 /* EmptyStatement */) || // report error on class declarations - node.kind === 233 /* ClassDeclaration */ || + node.kind === 234 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 237 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 238 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 236 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 237 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; // unreachable code is reported if @@ -23485,7 +23578,7 @@ var ts; // On the other side we do want to report errors on non-initialized 'lets' because of TDZ var reportUnreachableCode = !options.allowUnreachableCode && !(node.flags & 2097152 /* Ambient */) && - (node.kind !== 212 /* VariableStatement */ || + (node.kind !== 213 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -23528,43 +23621,43 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: return computeCallExpression(node, subtreeFlags); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return computeNewExpression(node, subtreeFlags); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return computeModuleDeclaration(node, subtreeFlags); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return computeParenthesizedExpression(node, subtreeFlags); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return computeBinaryExpression(node, subtreeFlags); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return computeExpressionStatement(node, subtreeFlags); case 148 /* Parameter */: return computeParameter(node, subtreeFlags); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return computeArrowFunction(node, subtreeFlags); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return computeFunctionExpression(node, subtreeFlags); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return computeFunctionDeclaration(node, subtreeFlags); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return computeVariableDeclaration(node, subtreeFlags); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return computeVariableDeclarationList(node, subtreeFlags); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return computeVariableStatement(node, subtreeFlags); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return computeLabeledStatement(node, subtreeFlags); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return computeClassDeclaration(node, subtreeFlags); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return computeCatchClause(node, subtreeFlags); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); case 154 /* Constructor */: return computeConstructor(node, subtreeFlags); @@ -23575,11 +23668,11 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: return computeAccessor(node, subtreeFlags); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return computeImportEquals(node, subtreeFlags); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return computePropertyAccess(node, subtreeFlags); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return computeElementAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -23631,12 +23724,12 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 182 /* ObjectLiteralExpression */) { + if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 183 /* ObjectLiteralExpression */) { // Destructuring object assignments with are ES2015 syntax // and possibly ESNext if they contain rest transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } - else if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 181 /* ArrayLiteralExpression */) { + else if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 182 /* ArrayLiteralExpression */) { // Destructuring assignments are ES2015 syntax. transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } @@ -23685,8 +23778,8 @@ var ts; // If the node is synthesized, it means the emitter put the parentheses there, // not the user. If we didn't want them, the emitter would not have put them // there. - if (expressionKind === 206 /* AsExpression */ - || expressionKind === 188 /* TypeAssertionExpression */) { + if (expressionKind === 207 /* AsExpression */ + || expressionKind === 189 /* TypeAssertionExpression */) { transformFlags |= 3 /* AssertTypeScript */; } // If the expression of a ParenthesizedExpression is a destructuring assignment, @@ -24063,13 +24156,13 @@ var ts; var excludeFlags = 939525441 /* NodeExcludes */; switch (kind) { case 120 /* AsyncKeyword */: - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: // async/await is ES2017 syntax, but may be ESNext syntax (for async generators) transformFlags |= 8 /* AssertESNext */ | 16 /* AssertES2017 */; break; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: - case 295 /* PartiallyEmittedExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: + case 296 /* PartiallyEmittedExpression */: // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; excludeFlags = 536872257 /* OuterExpressionExcludes */; @@ -24080,25 +24173,25 @@ var ts; case 117 /* AbstractKeyword */: case 124 /* DeclareKeyword */: case 76 /* ConstKeyword */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 207 /* NonNullExpression */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 208 /* NonNullExpression */: case 132 /* ReadonlyKeyword */: // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; break; - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: case 10 /* JsxText */: - case 256 /* JsxClosingElement */: - case 257 /* JsxFragment */: - case 258 /* JsxOpeningFragment */: - case 259 /* JsxClosingFragment */: - case 260 /* JsxAttribute */: - case 261 /* JsxAttributes */: - case 262 /* JsxSpreadAttribute */: - case 263 /* JsxExpression */: + case 257 /* JsxClosingElement */: + case 258 /* JsxFragment */: + case 259 /* JsxOpeningFragment */: + case 260 /* JsxClosingFragment */: + case 261 /* JsxAttribute */: + case 262 /* JsxAttributes */: + case 263 /* JsxSpreadAttribute */: + case 264 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; @@ -24106,11 +24199,11 @@ var ts; case 14 /* TemplateHead */: case 15 /* TemplateMiddle */: case 16 /* TemplateTail */: - case 200 /* TemplateExpression */: - case 187 /* TaggedTemplateExpression */: - case 269 /* ShorthandPropertyAssignment */: + case 201 /* TemplateExpression */: + case 188 /* TaggedTemplateExpression */: + case 270 /* ShorthandPropertyAssignment */: case 115 /* StaticKeyword */: - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: // These nodes are ES6 syntax. transformFlags |= 192 /* AssertES2015 */; break; @@ -24124,14 +24217,14 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: // This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of). if (node.awaitModifier) { transformFlags |= 8 /* AssertESNext */; } transformFlags |= 192 /* AssertES2015 */; break; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: // This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async // generator). transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; @@ -24163,14 +24256,14 @@ var ts; case 170 /* ConditionalType */: case 171 /* InferType */: case 172 /* ParenthesizedType */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: case 173 /* ThisType */: case 174 /* TypeOperator */: case 175 /* IndexedAccessType */: case 176 /* MappedType */: case 177 /* LiteralType */: - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: // Types and signatures are TypeScript syntax, and exclude all other facts. transformFlags = 3 /* AssertTypeScript */; excludeFlags = -3 /* TypeExcludes */; @@ -24192,10 +24285,10 @@ var ts; transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */; } break; - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 97 /* SuperKeyword */: @@ -24207,18 +24300,18 @@ var ts; // Mark this node and its ancestors as containing a lexical `this` keyword. transformFlags |= 16384 /* ContainsLexicalThis */; break; - case 178 /* ObjectBindingPattern */: + case 179 /* ObjectBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; if (subtreeFlags & 524288 /* ContainsRest */) { transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */; } excludeFlags = 940049729 /* BindingPatternExcludes */; break; - case 179 /* ArrayBindingPattern */: + case 180 /* ArrayBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; excludeFlags = 940049729 /* BindingPatternExcludes */; break; - case 180 /* BindingElement */: + case 181 /* BindingElement */: transformFlags |= 192 /* AssertES2015 */; if (node.dotDotDotToken) { transformFlags |= 524288 /* ContainsRest */; @@ -24228,7 +24321,7 @@ var ts; // This node is TypeScript syntax, and marks its container as also being TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */; break; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: excludeFlags = 942740801 /* ObjectLiteralExcludes */; if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) { // If an ObjectLiteralExpression contains a ComputedPropertyName, then it @@ -24246,8 +24339,8 @@ var ts; transformFlags |= 8 /* AssertESNext */; } break; - case 181 /* ArrayLiteralExpression */: - case 186 /* NewExpression */: + case 182 /* ArrayLiteralExpression */: + case 187 /* NewExpression */: excludeFlags = 940049729 /* ArrayLiteralOrCallOrNewExcludes */; if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadExpression, then it is an ES6 @@ -24255,23 +24348,23 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 223 /* ReturnStatement */: - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 224 /* ReturnStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } @@ -24287,27 +24380,27 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 160 /* FirstTypeNode */ && kind <= 177 /* LastTypeNode */) { + if (kind >= 160 /* FirstTypeNode */ && kind <= 178 /* LastTypeNode */) { return -3 /* TypeExcludes */; } switch (kind) { - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 181 /* ArrayLiteralExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 182 /* ArrayLiteralExpression */: return 940049729 /* ArrayLiteralOrCallOrNewExcludes */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return 977327425 /* ModuleExcludes */; case 148 /* Parameter */: return 939525441 /* ParameterExcludes */; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return 1003902273 /* ArrowFunctionExcludes */; - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: return 1003935041 /* FunctionExcludes */; - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return 948962625 /* VariableDeclarationListExcludes */; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return 942011713 /* ClassExcludes */; case 154 /* Constructor */: return 1003668801 /* ConstructorExcludes */; @@ -24329,24 +24422,24 @@ var ts; case 157 /* CallSignature */: case 158 /* ConstructSignature */: case 159 /* IndexSignature */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return 942740801 /* ObjectLiteralExcludes */; - case 267 /* CatchClause */: + case 268 /* CatchClause */: return 940574017 /* CatchClauseExcludes */; - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: return 940049729 /* BindingPatternExcludes */; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: - case 295 /* PartiallyEmittedExpression */: - case 189 /* ParenthesizedExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: + case 296 /* PartiallyEmittedExpression */: + case 190 /* ParenthesizedExpression */: case 97 /* SuperKeyword */: return 536872257 /* OuterExpressionExcludes */; - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: return 671089985 /* PropertyAccessExcludes */; default: return 939525441 /* NodeExcludes */; @@ -25174,6 +25267,7 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); } + ts.Debug.assert(host.fileExists(real), path + " linked to nonexistent file " + real); // tslint:disable-line return real; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { @@ -25819,7 +25913,7 @@ var ts; return node ? getConstantValue(node) : undefined; }, isValidPropertyAccess: function (node, propertyName) { - node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); + node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedNameOrImportTypeNode); return !!node && isValidPropertyAccess(node, ts.escapeLeadingUnderscores(propertyName)); }, isValidPropertyAccessForCompletions: function (node, type, property) { @@ -25888,6 +25982,7 @@ var ts; getAllPossiblePropertiesOfTypes: getAllPossiblePropertiesOfTypes, getSuggestionForNonexistentProperty: function (node, type) { return getSuggestionForNonexistentProperty(node, type); }, getSuggestionForNonexistentSymbol: function (location, name, meaning) { return getSuggestionForNonexistentSymbol(location, ts.escapeLeadingUnderscores(name), meaning); }, + getSuggestionForNonexistentModule: function (node, target) { return getSuggestionForNonexistentModule(node, target); }, getBaseConstraintOfType: getBaseConstraintOfType, getDefaultFromTypeParameter: function (type) { return type && type.flags & 32768 /* TypeParameter */ ? getDefaultFromTypeParameter(type) : undefined; }, resolveName: function (name, location, meaning, excludeGlobals) { @@ -26451,7 +26546,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 237 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 237 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 238 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 238 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } @@ -26581,7 +26676,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 }); } function isGlobalSourceFile(node) { - return node.kind === 272 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 273 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -26639,17 +26734,17 @@ var ts; } if (declaration.pos <= usage.pos) { // declaration is before usage - if (declaration.kind === 180 /* BindingElement */) { + if (declaration.kind === 181 /* 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, 180 /* BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 181 /* 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, 230 /* VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 231 /* VariableDeclaration */), usage); } - else if (declaration.kind === 230 /* VariableDeclaration */) { + else if (declaration.kind === 231 /* VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -26663,12 +26758,12 @@ var ts; // 5. inside a TS export= declaration (since we will move the export statement during emit to avoid TDZ) // or if usage is in a type context: // 1. inside a type query (typeof in type position) - if (usage.parent.kind === 250 /* ExportSpecifier */ || (usage.parent.kind === 247 /* ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 251 /* ExportSpecifier */ || (usage.parent.kind === 248 /* 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 === 247 /* ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 248 /* ExportAssignment */ && usage.isExportEquals) { return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -26676,9 +26771,9 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 212 /* VariableStatement */: - case 218 /* ForStatement */: - case 220 /* ForOfStatement */: + case 213 /* VariableStatement */: + case 219 /* ForStatement */: + case 221 /* 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, container)) { @@ -26748,7 +26843,7 @@ 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 & 67901928 /* Type */ && lastLocation.kind !== 282 /* JSDocComment */) { + if (meaning & result.flags & 67901928 /* Type */ && lastLocation.kind !== 283 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || @@ -26782,14 +26877,14 @@ var ts; } } switch (location.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 272 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 273 /* SourceFile */ || ts.isAmbientModule(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" /* Default */)) { @@ -26813,7 +26908,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && - ts.getDeclarationOfKind(moduleExport, 250 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExport, 251 /* ExportSpecifier */)) { break; } } @@ -26821,7 +26916,7 @@ var ts; break loop; } break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } @@ -26844,9 +26939,9 @@ var ts; } } break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: if (result = lookup(getMembersOfSymbol(getSymbolOfNode(location)), name, meaning & 67901928 /* Type */)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { // ignore type parameters not declared in this container @@ -26862,7 +26957,7 @@ var ts; } break loop; } - if (location.kind === 203 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 204 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -26870,7 +26965,7 @@ var ts; } } break; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 85 /* ExtendsKeyword */) { var container = location.parent.parent; @@ -26892,7 +26987,7 @@ var ts; // case 146 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 234 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 235 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67901928 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -26905,14 +27000,14 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -26957,12 +27052,12 @@ var ts; // We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`. // If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself. // That means that this is a self-reference of `lastLocation`, and shouldn't count this when considering whether `lastLocation` is used. - if (isUse && result && nameNotFoundMessage && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { + if (isUse && result && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { result.isReferenced |= meaning; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 272 /* SourceFile */); + ts.Debug.assert(lastLocation.kind === 273 /* SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports") { return lastLocation.symbol; } @@ -27023,9 +27118,9 @@ var ts; } } // If we're in an external module, we can't reference value symbols created from UMD export declarations - if (result && isInExternalModule && (meaning & 67216319 /* Value */) === 67216319 /* Value */) { + if (result && isInExternalModule && (meaning & 67216319 /* Value */) === 67216319 /* Value */ && !(originalLocation.flags & 1048576 /* JSDoc */)) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 240 /* NamespaceExportDeclaration */) { + if (decls && decls.length === 1 && decls[0].kind === 241 /* NamespaceExportDeclaration */) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); } } @@ -27034,12 +27129,12 @@ var ts; } function isSelfReferenceLocation(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 237 /* ModuleDeclaration */: // For `namespace N { N; }` + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 238 /* ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -27104,9 +27199,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 71 /* Identifier */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -27170,7 +27265,7 @@ var ts; function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */)); // Block-scoped variables cannot be used before their definition - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 236 /* EnumDeclaration */) ? d : undefined; }); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 237 /* EnumDeclaration */) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); if (!(declaration.flags & 2097152 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { if (result.flags & 2 /* BlockScopedVariable */) { @@ -27193,13 +27288,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return node; - case 243 /* ImportClause */: + case 244 /* ImportClause */: return node.parent; - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return node.parent.parent; - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -27209,7 +27304,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { - if (node.moduleReference.kind === 252 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 253 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); @@ -27230,8 +27325,8 @@ var ts; // Declaration files (and ambient modules) if (!file || file.isDeclarationFile) { // Definitely cannot have a synthetic default if they have a syntactic default member specified - var defaultExportSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, dontResolveAlias); - if (defaultExportSymbol && defaultExportSymbol.valueDeclaration && isSyntacticDefault(defaultExportSymbol.valueDeclaration)) { + var defaultExportSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, /*dontResolveAlias*/ true); // Dont resolve alias because we want the immediately exported symbol's declaration + if (defaultExportSymbol && ts.some(defaultExportSymbol.declarations, isSyntacticDefault)) { return false; } // It _might_ still be incorrect to assume there is no __esModule marker on the import at runtime, even if there is no `default` member @@ -27382,32 +27477,40 @@ var ts; resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias); } function getTargetOfExportAssignment(node, dontResolveAlias) { - return resolveEntityName(node.expression, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); + var aliasLike = resolveEntityName(node.expression, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias); + if (aliasLike) { + return aliasLike; + } + checkExpression(node.expression); + return getNodeLinks(node.expression).resolvedSymbol; } function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 250 /* ExportSpecifier */: + case 251 /* ExportSpecifier */: return getTargetOfExportSpecifier(node, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); } } /** * Indicates that a symbol is an alias that does not merge with a local declaration. + * OR Is a JSContainer which may merge an alias with a local declaration */ function isNonLocalAlias(symbol, excludes) { if (excludes === void 0) { excludes = 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */; } - return symbol && (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */; + if (!symbol) + return false; + return (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */ || (symbol.flags & 2097152 /* Alias */ && symbol.flags & 67108864 /* JSContainer */); } function resolveSymbol(symbol, dontResolveAlias) { var shouldResolve = !dontResolveAlias && isNonLocalAlias(symbol); @@ -27453,11 +27556,11 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 247 /* ExportAssignment */) { + if (node.kind === 248 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 250 /* ExportSpecifier */) { + else if (node.kind === 251 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -27485,7 +27588,7 @@ var ts; else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 241 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 242 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } @@ -27508,7 +27611,7 @@ var ts; return undefined; } } - else if (name.kind === 145 /* QualifiedName */ || name.kind === 183 /* PropertyAccessExpression */) { + else if (name.kind === 145 /* QualifiedName */ || name.kind === 184 /* PropertyAccessExpression */) { var left = name.kind === 145 /* QualifiedName */ ? name.left : name.expression; var right = name.kind === 145 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); @@ -27574,7 +27677,8 @@ var ts; if (ambientModule) { return ambientModule; } - var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference); + var currentSourceFile = ts.getSourceFileOfNode(location); + var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference); var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule); var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { @@ -27641,15 +27745,15 @@ var ts; // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may // combine other declarations with the module or variable (e.g. a class/module, function/module, interface/variable). - function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression, dontResolveAlias) { + function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) { var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) { - error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); + error(referencingLocation, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); return symbol; } if (compilerOptions.esModuleInterop) { - var referenceParent = moduleReferenceExpression.parent; + var referenceParent = referencingLocation.parent; if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) || ts.isImportCall(referenceParent)) { var type = getTypeOfSymbol(symbol); @@ -27892,12 +27996,12 @@ var ts; } } switch (location.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location).exports)) { return result; } @@ -27916,11 +28020,8 @@ var ts; return undefined; } var id = "" + getSymbolId(symbol); - var visitedSymbolTables; - if (visitedSymbolTablesMap.has(id)) { - visitedSymbolTables = visitedSymbolTablesMap.get(id); - } - else { + var visitedSymbolTables = visitedSymbolTablesMap.get(id); + if (!visitedSymbolTables) { visitedSymbolTablesMap.set(id, visitedSymbolTables = []); } return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); @@ -27992,7 +28093,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 250 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 251 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -28096,7 +28197,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 272 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 273 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -28136,8 +28237,8 @@ var ts; // Typeof value meaning = 67216319 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 145 /* QualifiedName */ || entityName.kind === 183 /* PropertyAccessExpression */ || - entityName.parent.kind === 241 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 145 /* QualifiedName */ || entityName.kind === 184 /* PropertyAccessExpression */ || + entityName.parent.kind === 242 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -28323,7 +28424,7 @@ var ts; if (type.flags & 1024 /* UniqueESSymbol */) { if (!(context.flags & 1048576 /* AllowUniqueESSymbolType */)) { if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) { - return ts.createTypeQueryNode(symbolToName(type.symbol, context, 67216319 /* Value */, /*expectsIdentifier*/ false)); + return symbolToTypeNode(type.symbol, context, 67216319 /* Value */); } if (context.tracker.reportInaccessibleUniqueSymbolError) { context.tracker.reportInaccessibleUniqueSymbolError(); @@ -28434,18 +28535,17 @@ var ts; var symbol = type.symbol; if (symbol) { // Always use 'typeof T' for type of class, enum, and module objects - if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 203 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) || + if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 204 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol()) { - return createTypeQueryNodeFromSymbol(symbol, 67216319 /* Value */); + return symbolToTypeNode(symbol, context, 67216319 /* Value */); } else if (ts.contains(context.symbolStack, symbol)) { // If type is an anonymous type literal in a type alias declaration, use type alias name var typeAlias = getTypeAliasForTypeLiteral(type); if (typeAlias) { // The specified symbol flags need to be reinterpreted as type flags - var entityName = symbolToName(typeAlias, context, 67901928 /* Type */, /*expectsIdentifier*/ false); - return ts.createTypeReferenceNode(entityName, /*typeArguments*/ undefined); + return symbolToTypeNode(typeAlias, context, 67901928 /* Type */); } else { return ts.createKeywordTypeNode(119 /* AnyKeyword */); @@ -28479,7 +28579,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 272 /* SourceFile */ || declaration.parent.kind === 238 /* ModuleBlock */; + return declaration.parent.kind === 273 /* SourceFile */ || declaration.parent.kind === 239 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -28515,10 +28615,6 @@ var ts; var typeLiteralNode = ts.createTypeLiteralNode(members); return ts.setEmitFlags(typeLiteralNode, (context.flags & 1024 /* MultilineObjectLiterals */) ? 0 : 1 /* SingleLine */); } - function createTypeQueryNodeFromSymbol(symbol, symbolFlags) { - var entityName = symbolToName(symbol, context, symbolFlags, /*expectsIdentifier*/ false); - return ts.createTypeQueryNode(entityName); - } function symbolToTypeReferenceName(symbol) { // Unnamed function expressions and arrow functions have reserved names that we don't want to display var entityName = symbol.flags & 32 /* Class */ || !isReservedMemberName(symbol.escapedName) ? symbolToName(symbol, context, 67901928 /* Type */, /*expectsIdentifier*/ false) : ts.createIdentifier(""); @@ -28674,6 +28770,10 @@ var ts; var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 152 /* MethodSignature */, context); methodDeclaration.name = propertyName; methodDeclaration.questionToken = optionalToken; + if (propertySymbol.valueDeclaration) { + // Copy comments to node for declaration emit + ts.setCommentRange(methodDeclaration, propertySymbol.valueDeclaration); + } typeElements.push(methodDeclaration); } } @@ -28685,6 +28785,10 @@ var ts; var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(132 /* ReadonlyKeyword */)] : undefined; var propertySignature = ts.createPropertySignature(modifiers, propertyName, optionalToken, propertyTypeNode, /*initializer*/ undefined); + if (propertySymbol.valueDeclaration) { + // Copy comments to node for declaration emit + ts.setCommentRange(propertySignature, propertySymbol.valueDeclaration); + } typeElements.push(propertySignature); } } @@ -28729,7 +28833,7 @@ var ts; else { typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); }); } - var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context); }); + var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 154 /* Constructor */); }); if (signature.thisParameter) { var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context); parameters.unshift(thisParameter); @@ -28768,7 +28872,7 @@ var ts; context.flags = savedContextFlags; return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); } - function symbolToParameterDeclaration(parameterSymbol, context) { + function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) { var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 148 /* Parameter */); ts.Debug.assert(!!parameterDeclaration || isTransientSymbol(parameterSymbol) && !!parameterSymbol.isRestParameter); var parameterType = getTypeOfSymbol(parameterSymbol); @@ -28776,7 +28880,7 @@ var ts; parameterType = getOptionalType(parameterType); } var parameterTypeNode = typeToTypeNodeHelper(parameterType, context); - var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone); + var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone); var dotDotDotToken = !parameterDeclaration || ts.isRestParameter(parameterDeclaration) ? ts.createToken(24 /* DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? @@ -28795,7 +28899,7 @@ var ts; function elideInitializerAndSetEmitFlags(node) { var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags); var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited); - if (clone.kind === 180 /* BindingElement */) { + if (clone.kind === 181 /* BindingElement */) { clone.initializer = undefined; } return ts.setEmitFlags(clone, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */); @@ -28870,6 +28974,35 @@ var ts; } return typeParameterNodes; } + function symbolToTypeNode(symbol, context, meaning) { + var chain = lookupSymbolChain(symbol, context, meaning); + context.flags |= 16777216 /* InInitialEntityName */; + var rootName = getNameOfSymbolAsWritten(chain[0], context); + context.flags ^= 16777216 /* InInitialEntityName */; + var isTypeOf = meaning === 67216319 /* Value */; + if (ambientModuleSymbolRegex.test(rootName)) { + // module is root, must use `ImportTypeNode` + var nonRootParts = chain.length > 1 ? createEntityNameFromSymbolChain(chain, chain.length - 1, 1) : undefined; + var typeParameterNodes = lookupTypeParameterNodes(chain, 0, context); + return ts.createImportTypeNode(ts.createLiteralTypeNode(ts.createLiteral(rootName.substring(1, rootName.length - 1))), nonRootParts, typeParameterNodes, isTypeOf); + } + var entityName = createEntityNameFromSymbolChain(chain, chain.length - 1, 0); + return isTypeOf ? ts.createTypeQueryNode(entityName) : ts.createTypeReferenceNode(entityName, /*typeArguments*/ undefined); + function createEntityNameFromSymbolChain(chain, index, stopper) { + var typeParameterNodes = lookupTypeParameterNodes(chain, index, context); + var symbol = chain[index]; + if (index === 0) { + context.flags |= 16777216 /* InInitialEntityName */; + } + var symbolName = getNameOfSymbolAsWritten(symbol, context); + if (index === 0) { + context.flags ^= 16777216 /* InInitialEntityName */; + } + var identifier = ts.setEmitFlags(ts.createIdentifier(symbolName, typeParameterNodes), 16777216 /* NoAsciiEscaping */); + identifier.symbol = symbol; + return index > stopper ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1, stopper), identifier) : identifier; + } + } function symbolToName(symbol, context, meaning, expectsIdentifier) { var chain = lookupSymbolChain(symbol, context, meaning); if (expectsIdentifier && chain.length !== 1 @@ -28984,7 +29117,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 172 /* ParenthesizedType */; }); - if (node.kind === 235 /* TypeAliasDeclaration */) { + if (node.kind === 236 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -28992,11 +29125,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 238 /* ModuleBlock */ && + node.parent.kind === 239 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 272 /* SourceFile */ || ts.isAmbientModule(location); + return location.kind === 273 /* SourceFile */ || ts.isAmbientModule(location); } /** * Gets a human-readable name for a symbol. @@ -29021,17 +29154,17 @@ var ts; if (name) { return ts.declarationNameToString(name); } - if (declaration.parent && declaration.parent.kind === 230 /* VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 231 /* VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) { context.encounteredError = true; } switch (declaration.kind) { - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return "(Anonymous class)"; - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -29054,22 +29187,22 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 180 /* BindingElement */: + case 181 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 230 /* VariableDeclaration */: + case 231 /* 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 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 232 /* FunctionDeclaration */: - case 236 /* EnumDeclaration */: - case 241 /* ImportEqualsDeclaration */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 233 /* FunctionDeclaration */: + case 237 /* EnumDeclaration */: + case 242 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -29077,7 +29210,7 @@ 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 /* Export */) && - !(node.kind !== 241 /* ImportEqualsDeclaration */ && parent.kind !== 272 /* SourceFile */ && parent.flags & 2097152 /* Ambient */)) { + !(node.kind !== 242 /* ImportEqualsDeclaration */ && parent.kind !== 273 /* SourceFile */ && parent.flags & 2097152 /* Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible @@ -29099,7 +29232,7 @@ var ts; case 157 /* CallSignature */: case 159 /* IndexSignature */: case 148 /* Parameter */: - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: case 162 /* FunctionType */: case 163 /* ConstructorType */: case 165 /* TypeLiteral */: @@ -29112,18 +29245,18 @@ var ts; return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: return false; // Type parameters are always visible case 147 /* TypeParameter */: // Source file and namespace export are always visible - case 272 /* SourceFile */: - case 240 /* NamespaceExportDeclaration */: + case 273 /* SourceFile */: + case 241 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return false; default: return false; @@ -29132,10 +29265,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 247 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 248 /* ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 250 /* ExportSpecifier */) { + else if (node.parent.kind === 251 /* ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */); } var result; @@ -29231,12 +29364,12 @@ var ts; function getDeclarationContainer(node) { node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 230 /* VariableDeclaration */: - case 231 /* VariableDeclarationList */: - case 246 /* ImportSpecifier */: - case 245 /* NamedImports */: - case 244 /* NamespaceImport */: - case 243 /* ImportClause */: + case 231 /* VariableDeclaration */: + case 232 /* VariableDeclarationList */: + case 247 /* ImportSpecifier */: + case 246 /* NamedImports */: + case 245 /* NamespaceImport */: + case 244 /* ImportClause */: return false; default: return true; @@ -29314,7 +29447,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 178 /* ObjectBindingPattern */) { + if (pattern.kind === 179 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -29401,7 +29534,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 181 /* ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 182 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, optional) { if (optional === void 0) { optional = true; } @@ -29411,11 +29544,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { // 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 === 219 /* ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 220 /* ForInStatement */) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (32768 /* TypeParameter */ | 524288 /* Index */) ? indexType : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 220 /* ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 221 /* 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, @@ -29434,7 +29567,7 @@ var ts; return addOptionality(declaredType, isOptional); } if ((noImplicitAny || ts.isInJavaScriptFile(declaration)) && - declaration.kind === 230 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + declaration.kind === 231 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 2097152 /* Ambient */)) { // If --noImplicitAny is on or the declaration is in a Javascript file, // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no @@ -29507,8 +29640,8 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var declarationInConstructor = false; - var expression = declaration.kind === 198 /* BinaryExpression */ ? declaration : - declaration.kind === 183 /* PropertyAccessExpression */ ? ts.getAncestor(declaration, 198 /* BinaryExpression */) : + var expression = declaration.kind === 199 /* BinaryExpression */ ? declaration : + declaration.kind === 184 /* PropertyAccessExpression */ ? ts.getAncestor(declaration, 199 /* BinaryExpression */) : undefined; if (!expression) { return unknownType; @@ -29518,8 +29651,8 @@ var ts; // Properties defined in a constructor (or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. declarationInConstructor = thisContainer.kind === 154 /* Constructor */ || - thisContainer.kind === 232 /* FunctionDeclaration */ || - (thisContainer.kind === 190 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + thisContainer.kind === 233 /* FunctionDeclaration */ || + (thisContainer.kind === 191 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); if (declarationInConstructor) { definedInConstructor = true; } @@ -29641,7 +29774,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 178 /* ObjectBindingPattern */ + return pattern.kind === 179 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -29700,7 +29833,7 @@ var ts; return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 247 /* ExportAssignment */) { + if (declaration.kind === 248 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } if (ts.isInJavaScriptFile(declaration) && ts.isJSDocPropertyLikeTag(declaration) && declaration.typeExpression) { @@ -29716,8 +29849,8 @@ var ts; // * exports.p = expr // * this.p = expr // * className.prototype.method = expr - if (declaration.kind === 198 /* BinaryExpression */ || - declaration.kind === 183 /* PropertyAccessExpression */ && declaration.parent.kind === 198 /* BinaryExpression */) { + if (declaration.kind === 199 /* BinaryExpression */ || + declaration.kind === 184 /* PropertyAccessExpression */ && declaration.parent.kind === 199 /* BinaryExpression */) { type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } else if (ts.isJSDocPropertyTag(declaration) @@ -29847,6 +29980,10 @@ var ts; if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { links.type = anyType; } + else if (symbol.valueDeclaration.kind === 199 /* BinaryExpression */ || + symbol.valueDeclaration.kind === 184 /* PropertyAccessExpression */ && symbol.valueDeclaration.parent.kind === 199 /* BinaryExpression */) { + links.type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); + } else { var type = createObjectType(16 /* Anonymous */, symbol); if (symbol.flags & 32 /* Class */) { @@ -29980,21 +30117,21 @@ var ts; return undefined; } switch (node.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: case 152 /* MethodSignature */: case 162 /* FunctionType */: case 163 /* ConstructorType */: - case 280 /* JSDocFunctionType */: - case 232 /* FunctionDeclaration */: + case 281 /* JSDocFunctionType */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 235 /* TypeAliasDeclaration */: - case 290 /* JSDocTemplateTag */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 236 /* TypeAliasDeclaration */: + case 291 /* JSDocTemplateTag */: case 176 /* MappedType */: case 170 /* ConditionalType */: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); @@ -30006,7 +30143,7 @@ var ts; } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node) || ts.emptyArray); var thisType = includeThisTypes && - (node.kind === 233 /* ClassDeclaration */ || node.kind === 203 /* ClassExpression */ || node.kind === 234 /* InterfaceDeclaration */) && + (node.kind === 234 /* ClassDeclaration */ || node.kind === 204 /* ClassExpression */ || node.kind === 235 /* InterfaceDeclaration */) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } @@ -30014,7 +30151,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 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 234 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 235 /* InterfaceDeclaration */); return getOuterTypeParameters(declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -30023,8 +30160,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 234 /* InterfaceDeclaration */ || node.kind === 233 /* ClassDeclaration */ || - node.kind === 203 /* ClassExpression */ || node.kind === 235 /* TypeAliasDeclaration */) { + if (node.kind === 235 /* InterfaceDeclaration */ || node.kind === 234 /* ClassDeclaration */ || + node.kind === 204 /* ClassExpression */ || node.kind === 236 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -30211,7 +30348,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 234 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 235 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -30247,7 +30384,7 @@ var ts; function isThislessInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 234 /* InterfaceDeclaration */) { + if (declaration.kind === 235 /* InterfaceDeclaration */) { if (declaration.flags & 64 /* ContainsThis */) { return false; } @@ -30305,9 +30442,9 @@ var ts; return unknownType; } var declaration = ts.find(symbol.declarations, function (d) { - return d.kind === 291 /* JSDocTypedefTag */ || d.kind === 235 /* TypeAliasDeclaration */; + return d.kind === 292 /* JSDocTypedefTag */ || d.kind === 236 /* TypeAliasDeclaration */; }); - var typeNode = declaration.kind === 291 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; + var typeNode = declaration.kind === 292 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; // If typeNode is missing, we will error in checkJSDocTypedefTag. var type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { @@ -30337,7 +30474,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return true; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return expr.operator === 38 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; case 71 /* Identifier */: @@ -30354,7 +30491,7 @@ var ts; var hasNonLiteralMember = false; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 236 /* EnumDeclaration */) { + if (declaration.kind === 237 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && member.initializer.kind === 9 /* StringLiteral */) { @@ -30381,7 +30518,7 @@ var ts; var memberTypeList = []; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 236 /* EnumDeclaration */) { + if (declaration.kind === 237 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var memberType = getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member)); @@ -31350,7 +31487,12 @@ var ts; return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; } function getDefaultConstraintOfConditionalType(type) { - return getUnionType([getInferredTrueTypeFromConditionalType(type), getFalseTypeFromConditionalType(type)]); + if (!type.resolvedDefaultConstraint) { + var rootTrueType = type.root.trueType; + var rootTrueConstraint = rootTrueType.flags & 4194304 /* Substitution */ ? rootTrueType.substitute : rootTrueType; + type.resolvedDefaultConstraint = getUnionType([instantiateType(rootTrueConstraint, type.combinedMapper || type.mapper), getFalseTypeFromConditionalType(type)]); + } + return type.resolvedDefaultConstraint; } function getConstraintOfDistributiveConditionalType(type) { // Check if we have a conditional type of the form 'T extends U ? X : Y', where T is a constrained @@ -31362,7 +31504,10 @@ var ts; var constraint = getConstraintOfType(type.checkType); if (constraint) { var mapper = createTypeMapper([type.root.checkType], [constraint]); - return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + var instantiated = getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + if (!(instantiated.flags & 16384 /* Never */)) { + return instantiated; + } } } return undefined; @@ -31549,7 +31694,7 @@ var ts; (modifiers & 16 /* Protected */ ? 128 /* ContainsProtected */ : 0) | (modifiers & 8 /* Private */ ? 256 /* ContainsPrivate */ : 0) | (modifiers & 32 /* Static */ ? 512 /* ContainsStatic */ : 0); - if (!isMethodLike(prop)) { + if (!isPrototypeProperty(prop)) { syntheticFlag = 2 /* SyntheticProperty */; } } @@ -31708,10 +31853,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJavaScriptFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 279 /* JSDocOptionalType */ + node.type && node.type.kind === 280 /* JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 279 /* JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 280 /* JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -31951,7 +32096,8 @@ var ts; return ts.emptyArray; var result = []; for (var i = 0; i < symbol.declarations.length; i++) { - var node = symbol.declarations[i]; + var decl = symbol.declarations[i]; + var node = ts.isPropertyAccessExpression(decl) ? ts.getAssignedJavascriptInitializer(decl) : decl; if (!ts.isFunctionLike(node)) continue; // Don't include signature if node is the implementation of an overloaded function. A node is considered @@ -32270,7 +32416,7 @@ var ts; var isJs = ts.isInJavaScriptFile(node); var isJsImplicitAny = !noImplicitAny && isJs; if (!isJsImplicitAny && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { - var missingAugmentsTag = isJs && node.parent.kind !== 285 /* JSDocAugmentsTag */; + var missingAugmentsTag = isJs && node.parent.kind !== 286 /* JSDocAugmentsTag */; var diag = minTypeArgumentCount === typeParameters.length ? missingAugmentsTag ? ts.Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag @@ -32329,7 +32475,7 @@ var ts; switch (node.kind) { case 161 /* TypeReference */: return node.typeName; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -32407,7 +32553,7 @@ var ts; } function getConstrainedTypeVariable(typeVariable, node) { var constraints; - while (ts.isPartOfTypeNode(node)) { + while (node && !ts.isStatement(node)) { var parent = node.parent; if (parent.kind === 170 /* ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType); @@ -32424,7 +32570,7 @@ var ts; } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : ts.declarationNameToString(node.typeName)); + error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? ts.declarationNameToString(node.typeName) : "(anonymous)"); return false; } return true; @@ -32521,9 +32667,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: return declaration; } } @@ -33071,7 +33217,7 @@ var ts; return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 184 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 185 /* ElementAccessExpression */ ? accessNode : undefined; var propName = isTypeUsableAsLateBoundName(indexType) ? getLateBoundNameFromType(indexType) : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ? ts.getPropertyNameForKnownSymbolName(ts.idText(accessExpression.argumentExpression.name)) : @@ -33121,7 +33267,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 184 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 185 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)); } @@ -33218,7 +33364,7 @@ var ts; // object type. Note that 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 === 184 /* ElementAccessExpression */) && isGenericObjectType(objectType)) { + if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind === 185 /* ElementAccessExpression */) && isGenericObjectType(objectType)) { if (objectType.flags & 1 /* Any */) { return objectType; } @@ -33339,11 +33485,6 @@ var ts; function getFalseTypeFromConditionalType(type) { return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper)); } - function getInferredTrueTypeFromConditionalType(type) { - return type.combinedMapper ? - type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper)) : - getTrueTypeFromConditionalType(type); - } function getInferTypeParameters(node) { var result; if (node.locals) { @@ -33355,13 +33496,27 @@ var ts; } return result; } + function isPossiblyReferencedInConditionalType(tp, node) { + if (isTypeParameterPossiblyReferenced(tp, node)) { + return true; + } + while (node) { + if (node.kind === 170 /* ConditionalType */) { + if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) { + return true; + } + } + node = node.parent; + } + return false; + } function getTypeFromConditionalTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var checkType = getTypeFromTypeNode(node.checkType); var aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true); - var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); }); + var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); }); var root = { node: node, checkType: checkType, @@ -33390,6 +33545,76 @@ var ts; } return links.resolvedType; } + function getIdentifierChain(node) { + if (ts.isIdentifier(node)) { + return [node]; + } + else { + return ts.append(getIdentifierChain(node.left), node.right); + } + } + function getTypeFromImportTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + if (node.isTypeOf && node.typeArguments) { // Only the non-typeof form can make use of type arguments + error(node, ts.Diagnostics.Type_arguments_cannot_be_used_here); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + if (!ts.isLiteralImportTypeNode(node)) { + error(node.argument, ts.Diagnostics.String_literal_expected); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + var argumentType = getTypeFromTypeNode(node.argument); + var targetMeaning = node.isTypeOf ? 67216319 /* Value */ : 67901928 /* Type */; + // TODO: Future work: support unions/generics/whatever via a deferred import-type + var moduleName = argumentType.value; + var innerModuleSymbol = resolveExternalModule(node, moduleName, ts.Diagnostics.Cannot_find_module_0, node, /*isForAugmentation*/ false); + if (!innerModuleSymbol) { + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + var moduleSymbol = resolveExternalModuleSymbol(innerModuleSymbol, /*dontResolveAlias*/ false); + if (!ts.nodeIsMissing(node.qualifier)) { + var nameStack = getIdentifierChain(node.qualifier); + var currentNamespace = moduleSymbol; + var current = void 0; + while (current = nameStack.shift()) { + var meaning = nameStack.length ? 1920 /* Namespace */ : targetMeaning; + var next = getSymbol(getExportsOfSymbol(getMergedSymbol(resolveSymbol(currentNamespace))), current.escapedText, meaning); + if (!next) { + error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current)); + return links.resolvedType = unknownType; + } + getNodeLinks(current).resolvedSymbol = next; + getNodeLinks(current.parent).resolvedSymbol = next; + currentNamespace = next; + } + resolveImportSymbolType(node, links, currentNamespace, targetMeaning); + } + else { + if (moduleSymbol.flags & targetMeaning) { + resolveImportSymbolType(node, links, moduleSymbol, targetMeaning); + } + else { + error(node, targetMeaning === 67216319 /* Value */ ? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here, moduleName); + links.resolvedSymbol = unknownSymbol; + links.resolvedType = unknownType; + } + } + } + return links.resolvedType; + } + function resolveImportSymbolType(node, links, symbol, meaning) { + links.resolvedSymbol = symbol; + if (meaning === 67216319 /* Value */) { + return links.resolvedType = getTypeOfSymbol(symbol); + } + else { + return links.resolvedType = getTypeReferenceType(node, symbol); + } + } function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -33411,7 +33636,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 235 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 236 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -33572,7 +33797,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 === 234 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 235 /* InterfaceDeclaration */)) { if (!ts.hasModifier(container, 32 /* Static */) && (container.kind !== 154 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -33591,8 +33816,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 119 /* AnyKeyword */: - case 275 /* JSDocAllType */: - case 276 /* JSDocUnknownType */: + case 276 /* JSDocAllType */: + case 277 /* JSDocUnknownType */: return anyType; case 137 /* StringKeyword */: return stringType; @@ -33621,7 +33846,7 @@ var ts; return getTypeFromTypeReference(node); case 160 /* TypePredicate */: return booleanType; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); case 164 /* TypeQuery */: return getTypeFromTypeQueryNode(node); @@ -33633,21 +33858,21 @@ var ts; return getTypeFromUnionTypeNode(node); case 169 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); case 172 /* ParenthesizedType */: - case 278 /* JSDocNonNullableType */: - case 274 /* JSDocTypeExpression */: + case 279 /* JSDocNonNullableType */: + case 275 /* JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); case 162 /* FunctionType */: case 163 /* ConstructorType */: case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: - case 280 /* JSDocFunctionType */: + case 284 /* JSDocTypeLiteral */: + case 281 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 174 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); @@ -33659,6 +33884,8 @@ var ts; return getTypeFromConditionalTypeNode(node); case 171 /* InferType */: return getTypeFromInferTypeNode(node); + case 178 /* ImportType */: + return getTypeFromImportTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 71 /* Identifier */: @@ -33806,7 +34033,7 @@ var ts; } // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and // also transient so that we can just store data on it directly. - var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */); + var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | (ts.getCheckFlags(symbol) & 1024 /* Late */)); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -33857,13 +34084,17 @@ var ts; } return type; } + function maybeTypeParameterReference(node) { + return !(node.kind === 145 /* QualifiedName */ || + node.parent.kind === 161 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName); + } function isTypeParameterPossiblyReferenced(tp, node) { // If the type parameter doesn't have exactly one declaration, if there are invening 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. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container_2 = tp.symbol.declarations[0].parent; - if (ts.findAncestor(node, function (n) { return n.kind === 211 /* Block */ ? "quit" : n === container_2; })) { + if (ts.findAncestor(node, function (n) { return n.kind === 212 /* Block */ ? "quit" : n === container_2; })) { return ts.forEachChild(node, containsReference); } } @@ -33873,7 +34104,8 @@ var ts; case 173 /* ThisType */: return tp.isThisType; case 71 /* Identifier */: - return !tp.isThisType && ts.isPartOfTypeNode(node) && getTypeFromTypeNode(node) === tp; + return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && + getTypeFromTypeNode(node) === tp; case 164 /* TypeQuery */: return true; } @@ -34007,30 +34239,30 @@ var ts; function isContextSensitive(node) { ts.Debug.assert(node.kind !== 153 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: return isContextSensitiveFunctionLikeDeclaration(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return node.operatorToken.kind === 54 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isContextSensitive(node.expression); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return ts.forEach(node.properties, isContextSensitive); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. return node.initializer && isContextSensitive(node.initializer); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: // It is possible to that node.expression is undefined (e.g
) return node.expression && isContextSensitive(node.expression); } @@ -34045,7 +34277,7 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 191 /* ArrowFunction */) { + if (node.kind !== 192 /* 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); @@ -34054,7 +34286,7 @@ var ts; } } // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return node.body.kind === 211 /* Block */ ? false : isContextSensitive(node.body); + return node.body.kind === 212 /* Block */ ? false : isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (ts.isInJavaScriptFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && @@ -36171,7 +36403,7 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; @@ -36181,16 +36413,16 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 180 /* BindingElement */: + case 181 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -36862,13 +37094,13 @@ var ts; if (node.kind === 99 /* ThisKeyword */) { return "0"; } - if (node.kind === 183 /* PropertyAccessExpression */) { + if (node.kind === 184 /* PropertyAccessExpression */) { var key = getFlowCacheKey(node.expression); return key && key + "." + ts.idText(node.name); } - if (node.kind === 180 /* BindingElement */) { + if (node.kind === 181 /* BindingElement */) { var container = node.parent.parent; - var key = container.kind === 180 /* BindingElement */ ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); + var key = container.kind === 181 /* BindingElement */ ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); var text = getBindingElementNameText(node); var result = key && text && (key + "." + text); return result; @@ -36876,7 +37108,7 @@ var ts; return undefined; } function getBindingElementNameText(element) { - if (element.parent.kind === 178 /* ObjectBindingPattern */) { + if (element.parent.kind === 179 /* ObjectBindingPattern */) { var name = element.propertyName || element.name; switch (name.kind) { case 71 /* Identifier */: @@ -36899,26 +37131,26 @@ var ts; switch (source.kind) { case 71 /* Identifier */: return target.kind === 71 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 230 /* VariableDeclaration */ || target.kind === 180 /* BindingElement */) && + (target.kind === 231 /* VariableDeclaration */ || target.kind === 181 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 99 /* ThisKeyword */: return target.kind === 99 /* ThisKeyword */; case 97 /* SuperKeyword */: return target.kind === 97 /* SuperKeyword */; - case 183 /* PropertyAccessExpression */: - return target.kind === 183 /* PropertyAccessExpression */ && + case 184 /* PropertyAccessExpression */: + return target.kind === 184 /* PropertyAccessExpression */ && source.name.escapedText === target.name.escapedText && isMatchingReference(source.expression, target.expression); - case 180 /* BindingElement */: - if (target.kind !== 183 /* PropertyAccessExpression */) + case 181 /* BindingElement */: + if (target.kind !== 184 /* PropertyAccessExpression */) return false; var t = target; if (t.name.escapedText !== getBindingElementNameText(source)) return false; - if (source.parent.parent.kind === 180 /* BindingElement */ && isMatchingReference(source.parent.parent, t.expression)) { + if (source.parent.parent.kind === 181 /* BindingElement */ && isMatchingReference(source.parent.parent, t.expression)) { return true; } - if (source.parent.parent.kind === 230 /* VariableDeclaration */) { + if (source.parent.parent.kind === 231 /* VariableDeclaration */) { var maybeId = source.parent.parent.initializer; return maybeId && isMatchingReference(maybeId, t.expression); } @@ -36926,7 +37158,7 @@ var ts; return false; } function containsMatchingReference(source, target) { - while (source.kind === 183 /* PropertyAccessExpression */) { + while (source.kind === 184 /* PropertyAccessExpression */) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -36939,7 +37171,7 @@ var ts; // a possible discriminant if its type differs in the constituents of containing union type, and if every // choice is a unit type or a union of unit types. function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 183 /* PropertyAccessExpression */ && + return target.kind === 184 /* PropertyAccessExpression */ && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.escapedText); } @@ -36947,7 +37179,7 @@ var ts; if (expr.kind === 71 /* Identifier */) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 183 /* PropertyAccessExpression */) { + if (expr.kind === 184 /* PropertyAccessExpression */) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.escapedText); } @@ -36991,7 +37223,7 @@ var ts; } } } - if (callExpression.expression.kind === 183 /* PropertyAccessExpression */ && + if (callExpression.expression.kind === 184 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -37125,15 +37357,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 181 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 268 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 182 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 269 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 198 /* BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 220 /* ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 199 /* BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 221 /* ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -37150,21 +37382,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return stringType; - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return undefinedType; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -37172,7 +37404,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 178 /* ObjectBindingPattern */ ? + var type = pattern.kind === 179 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -37190,35 +37422,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 219 /* ForInStatement */) { + if (node.parent.parent.kind === 220 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 220 /* ForOfStatement */) { + if (node.parent.parent.kind === 221 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 230 /* VariableDeclaration */ ? + return node.kind === 231 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */ ? + return node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */ ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 230 /* VariableDeclaration */ && node.initializer && + return node.kind === 231 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 180 /* BindingElement */ && node.parent.kind === 198 /* BinaryExpression */ && + node.kind !== 181 /* BindingElement */ && node.parent.kind === 199 /* BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (node.operatorToken.kind) { case 58 /* EqualsToken */: return getReferenceCandidate(node.left); @@ -37230,13 +37462,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 189 /* ParenthesizedExpression */ || - parent.kind === 198 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */ && parent.left === node || - parent.kind === 198 /* BinaryExpression */ && parent.operatorToken.kind === 26 /* CommaToken */ && parent.right === node ? + return parent.kind === 190 /* ParenthesizedExpression */ || + parent.kind === 199 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */ && parent.left === node || + parent.kind === 199 /* BinaryExpression */ && parent.operatorToken.kind === 26 /* CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 264 /* CaseClause */) { + if (clause.kind === 265 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -37409,11 +37641,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 183 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" || - parent.parent.kind === 185 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 184 /* ElementAccessExpression */ && + var isLengthPushOrUnshift = parent.kind === 184 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" || + parent.parent.kind === 186 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 185 /* ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 198 /* BinaryExpression */ && + parent.parent.kind === 199 /* BinaryExpression */ && parent.parent.operatorToken.kind === 58 /* EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -37461,7 +37693,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 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent && reference.parent.kind === 207 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 16384 /* Never */) { + if (reference.parent && reference.parent.kind === 208 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 16384 /* Never */) { return declaredType; } return resultType; @@ -37532,7 +37764,7 @@ var ts; else if (flags & 2 /* Start */) { // Check if we should continue with the control flow of the containing function. var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 183 /* PropertyAccessExpression */ && reference.kind !== 99 /* ThisKeyword */) { + if (container && container !== flowContainer && reference.kind !== 184 /* PropertyAccessExpression */ && reference.kind !== 99 /* ThisKeyword */) { flow = container.flowNode; continue; } @@ -37588,7 +37820,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 185 /* CallExpression */ ? + var expr = node.kind === 186 /* CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -37596,7 +37828,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 185 /* CallExpression */) { + if (node.kind === 186 /* CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -37761,7 +37993,7 @@ var ts; return result; } function isMatchingReferenceDiscriminant(expr, computedType) { - return expr.kind === 183 /* PropertyAccessExpression */ && + return expr.kind === 184 /* PropertyAccessExpression */ && computedType.flags & 131072 /* Union */ && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(computedType, expr.name.escapedText); @@ -37812,10 +38044,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 193 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) { + if (left_1.kind === 194 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 193 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) { + if (right_1.kind === 194 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -38027,7 +38259,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 184 /* ElementAccessExpression */ || invokedExpression.kind === 183 /* PropertyAccessExpression */) { + if (invokedExpression.kind === 185 /* ElementAccessExpression */ || invokedExpression.kind === 184 /* PropertyAccessExpression */) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -38047,15 +38279,15 @@ var ts; case 71 /* Identifier */: case 99 /* ThisKeyword */: case 97 /* SuperKeyword */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: if (expr.operator === 51 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -38091,8 +38323,8 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 238 /* ModuleBlock */ || - node.kind === 272 /* SourceFile */ || + node.kind === 239 /* ModuleBlock */ || + node.kind === 273 /* SourceFile */ || node.kind === 151 /* PropertyDeclaration */; }); } @@ -38138,10 +38370,10 @@ var ts; } function isConstraintPosition(node) { var parent = node.parent; - return parent.kind === 183 /* PropertyAccessExpression */ || - parent.kind === 185 /* CallExpression */ && parent.expression === node || - parent.kind === 184 /* ElementAccessExpression */ && parent.expression === node || - parent.kind === 180 /* BindingElement */ && parent.name === node && !!parent.initializer; + return parent.kind === 184 /* PropertyAccessExpression */ || + parent.kind === 186 /* CallExpression */ && parent.expression === node || + parent.kind === 185 /* ElementAccessExpression */ && parent.expression === node || + parent.kind === 181 /* BindingElement */ && parent.name === node && !!parent.initializer; } function typeHasNullableConstraint(type) { return type.flags & 7372800 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 12288 /* Nullable */); @@ -38175,7 +38407,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ES2015 */) { - if (container.kind === 191 /* ArrowFunction */) { + if (container.kind === 192 /* 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.hasModifier(container, 256 /* Async */)) { @@ -38196,7 +38428,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 === 233 /* ClassDeclaration */ + if (declaration.kind === 234 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -38208,7 +38440,7 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 203 /* ClassExpression */) { + else if (declaration.kind === 204 /* 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. @@ -38225,9 +38457,6 @@ var ts; } } } - checkCollisionWithCapturedSuperVariable(node, node); - checkCollisionWithCapturedThisVariable(node, node); - checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getConstraintForLocation(getTypeOfSymbol(localOrExportSymbol), node); var assignmentKind = ts.getAssignmentTargetKind(node); @@ -38269,8 +38498,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 === 190 /* FunctionExpression */ || - flowContainer.kind === 191 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 191 /* FunctionExpression */ || + flowContainer.kind === 192 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -38279,9 +38508,9 @@ var ts; // declaration container are the same). var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAsignmentTarget || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0 || - isInTypeQuery(node) || node.parent.kind === 250 /* ExportSpecifier */) || - node.parent.kind === 207 /* NonNullExpression */ || - declaration.kind === 230 /* VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 251 /* ExportSpecifier */) || + node.parent.kind === 208 /* NonNullExpression */ || + declaration.kind === 231 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 2097152 /* Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -38312,7 +38541,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 267 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 268 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -38337,8 +38566,8 @@ 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 (container.kind === 218 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 231 /* VariableDeclarationList */).parent === container && + if (container.kind === 219 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 232 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -38352,7 +38581,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 189 /* ParenthesizedExpression */) { + while (current.parent.kind === 190 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -38360,7 +38589,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 196 /* PrefixUnaryExpression */ || current.parent.kind === 197 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 197 /* PrefixUnaryExpression */ || current.parent.kind === 198 /* PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 43 /* PlusPlusToken */ || expr.operator === 44 /* MinusMinusToken */; } @@ -38445,17 +38674,17 @@ var ts; 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 === 191 /* ArrowFunction */) { + if (container.kind === 192 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES2015 */); } switch (container.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* 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 236 /* EnumDeclaration */: + case 237 /* 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; @@ -38493,8 +38722,8 @@ var ts; // Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated. // If this is a function in a JS file, it might be a class method. Check if it's the RHS // of a x.prototype.y = function [name]() { .... } - if (container.kind === 190 /* FunctionExpression */ && - container.parent.kind === 198 /* BinaryExpression */ && + if (container.kind === 191 /* FunctionExpression */ && + container.parent.kind === 199 /* BinaryExpression */ && ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') var className = container.parent // x.prototype.y = f @@ -38525,7 +38754,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 280 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 281 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -38538,12 +38767,12 @@ var ts; return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 148 /* Parameter */; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 185 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 186 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); 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 === 191 /* ArrowFunction */) { + while (container && container.kind === 192 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */; } @@ -38563,7 +38792,7 @@ var ts; 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 === 182 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 183 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -38651,7 +38880,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 182 /* ObjectLiteralExpression */) { + if (container.parent.kind === 183 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -38695,7 +38924,7 @@ 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 === 182 /* ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 183 /* ObjectLiteralExpression */) { if (ts.hasModifier(container, 32 /* Static */)) { return container.kind === 153 /* MethodDeclaration */ || container.kind === 152 /* MethodSignature */ || @@ -38719,8 +38948,8 @@ var ts; function getContainingObjectLiteral(func) { return (func.kind === 153 /* MethodDeclaration */ || func.kind === 155 /* GetAccessor */ || - func.kind === 156 /* SetAccessor */) && func.parent.kind === 182 /* ObjectLiteralExpression */ ? func.parent : - func.kind === 190 /* FunctionExpression */ && func.parent.kind === 268 /* PropertyAssignment */ ? func.parent.parent : + func.kind === 156 /* SetAccessor */) && func.parent.kind === 183 /* ObjectLiteralExpression */ ? func.parent : + func.kind === 191 /* FunctionExpression */ && func.parent.kind === 269 /* PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -38732,7 +38961,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 191 /* ArrowFunction */) { + if (func.kind === 192 /* ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -38759,7 +38988,7 @@ var ts; if (thisType) { return instantiateType(thisType, getContextualMapper(containingLiteral)); } - if (literal.parent.kind !== 268 /* PropertyAssignment */) { + if (literal.parent.kind !== 269 /* PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -38773,9 +39002,9 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = func.parent; - if (parent.kind === 198 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */) { + if (parent.kind === 199 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */) { var target = parent.left; - if (target.kind === 183 /* PropertyAccessExpression */ || target.kind === 184 /* ElementAccessExpression */) { + if (target.kind === 184 /* PropertyAccessExpression */ || target.kind === 185 /* ElementAccessExpression */) { var expression = target.expression; // Don't contextually type `this` as `exports` in `exports.Point = function(x, y) { this.x = x; this.y = y; }` if (inJs && ts.isIdentifier(expression)) { @@ -38862,7 +39091,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; var name = declaration.propertyName || declaration.name; - if (parentDeclaration.kind !== 180 /* BindingElement */) { + if (parentDeclaration.kind !== 181 /* BindingElement */) { var parentTypeNode = ts.getEffectiveTypeAnnotationNode(parentDeclaration); if (parentTypeNode && !ts.isBindingPattern(name)) { var text = ts.getTextOfPropertyName(name); @@ -38944,7 +39173,7 @@ var ts; return getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 187 /* TaggedTemplateExpression */) { + if (template.parent.kind === 188 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -39090,7 +39319,7 @@ var ts; var prop = _a[_i]; if (!prop.symbol) continue; - if (prop.kind !== 268 /* PropertyAssignment */) + if (prop.kind !== 269 /* PropertyAssignment */) continue; if (isDiscriminantProperty(contextualType, prop.symbol.escapedName)) { var discriminatingType = getTypeOfNode(prop.initializer); @@ -39138,52 +39367,52 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 180 /* BindingElement */: + case 181 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 191 /* ArrowFunction */: - case 223 /* ReturnStatement */: + case 192 /* ArrowFunction */: + case 224 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return getApparentTypeOfContextualType(parent.parent); - case 181 /* ArrayLiteralExpression */: { + case 182 /* ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 209 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 200 /* TemplateExpression */); + case 210 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 201 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 189 /* ParenthesizedExpression */: { + case 190 /* ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); } - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return getContextualTypeForJsxExpression(parent); - case 260 /* JsxAttribute */: - case 262 /* JsxSpreadAttribute */: + case 261 /* JsxAttribute */: + case 263 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent); } return undefined; @@ -39243,64 +39472,59 @@ var ts; if (context.typeArguments) { signatures = ts.mapDefined(signatures, function (s) { return getJsxSignatureTypeArgumentInstantiation(s, context, isJs); }); } - return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromConstructSignature(t, isJs, context); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0 /* None */); + return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, /*reportErrors*/ false); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0 /* None */); } function getJsxPropsTypeFromCallSignature(sig, context) { - var propsType = getTypeOfFirstParameterOfSignature(sig); + var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType); var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (intrinsicAttribs !== unknownType) { propsType = intersectTypes(intrinsicAttribs, propsType); } return propsType; } - function getJsxPropsTypeFromClassType(hostClassType, isJs, context) { - if (isTypeAny(hostClassType)) { - return hostClassType; + function getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation) { + var instanceType = getReturnTypeOfSignature(sig); + return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation); + } + function getJsxPropsTypeFromClassType(sig, isJs, context, reportErrors) { + var forcedLookupLocation = getJsxElementPropertiesName(getJsxNamespaceAt(context)); + var attributesType = forcedLookupLocation === undefined + // If there is no type ElementAttributesProperty, return the type of the first parameter of the signature, which should be the props type + ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType) + : forcedLookupLocation === "" + // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead + ? getReturnTypeOfSignature(sig) + // Otherwise get the type of the property on the signature return type + : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation); + if (!attributesType) { + // There is no property named 'props' on this instance type + if (reportErrors && !!forcedLookupLocation && !!ts.length(context.attributes.properties)) { + error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation)); + } + return emptyObjectType; } - var propsName = getJsxElementPropertiesName(getJsxNamespaceAt(context)); - if (propsName === undefined) { - // There is no type ElementAttributesProperty, return 'any' - return anyType; - } - else if (propsName === "") { - // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead - return hostClassType; + else if (isTypeAny(attributesType)) { + // Props is of type 'any' or unknown + return attributesType; } else { - var attributesType = getTypeOfPropertyOfType(hostClassType, propsName); - if (!attributesType) { - // There is no property named 'props' on this instance type - return emptyObjectType; + // Normal case -- add in IntrinsicClassElements and IntrinsicElements + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); + if (intrinsicClassAttribs !== unknownType) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + var hostClassType = getReturnTypeOfSignature(sig); + apparentAttributesType = intersectTypes(typeParams + ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) + : intrinsicClassAttribs, apparentAttributesType); } - else if (isTypeAny(attributesType)) { - // Props is of type 'any' or unknown - return attributesType; - } - else { - // Normal case -- add in IntrinsicClassElements and IntrinsicElements - var apparentAttributesType = attributesType; - var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); - if (intrinsicClassAttribs !== unknownType) { - var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) - : intrinsicClassAttribs, apparentAttributesType); - } - var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); - if (intrinsicAttribs !== unknownType) { - apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); - } - return apparentAttributesType; + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); } + return apparentAttributesType; } } - function getJsxPropsTypeFromConstructSignature(sig, isJs, context) { - var hostClassType = getReturnTypeOfSignature(sig); - if (hostClassType) { - return getJsxPropsTypeFromClassType(hostClassType, isJs, context); - } - return getJsxPropsTypeFromCallSignature(sig, context); - } // If the given type is an object or union type with a single signature, and if that signature has at // least as many parameters as the given function, return the signature. Otherwise return undefined. function getContextualCallSignature(type, node) { @@ -39328,7 +39552,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 190 /* FunctionExpression */ || node.kind === 191 /* ArrowFunction */; + return node.kind === 191 /* FunctionExpression */ || node.kind === 192 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -39400,8 +39624,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterables*/ false); } function hasDefaultValue(node) { - return (node.kind === 180 /* BindingElement */ && !!node.initializer) || - (node.kind === 198 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */); + return (node.kind === 181 /* BindingElement */ && !!node.initializer) || + (node.kind === 199 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */); } function checkArrayLiteral(node, checkMode) { var elements = node.elements; @@ -39411,7 +39635,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); for (var index = 0; index < elements.length; index++) { var e = elements[index]; - if (inDestructuringPattern && e.kind === 202 /* SpreadElement */) { + if (inDestructuringPattern && e.kind === 203 /* SpreadElement */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -39436,7 +39660,7 @@ var ts; var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 202 /* SpreadElement */; + hasSpreadElement = hasSpreadElement || e.kind === 203 /* SpreadElement */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -39450,7 +39674,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 179 /* ArrayBindingPattern */ || pattern.kind === 181 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 180 /* ArrayBindingPattern */ || pattern.kind === 182 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -39458,7 +39682,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 204 /* OmittedExpression */) { + if (patternElement.kind !== 205 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType); @@ -39556,7 +39780,7 @@ var ts; var propagatedFlags = 8388608 /* FreshLiteral */; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 178 /* ObjectBindingPattern */ || contextualType.pattern.kind === 182 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 179 /* ObjectBindingPattern */ || contextualType.pattern.kind === 183 /* ObjectLiteralExpression */); var isInJSFile = ts.isInJavaScriptFile(node); var isJSObjectLiteral = !contextualType && isInJSFile; var typeFlags = 0; @@ -39578,15 +39802,15 @@ var ts; var memberDecl = node.properties[i]; var member = getSymbolOfNode(memberDecl); var literalName = void 0; - if (memberDecl.kind === 268 /* PropertyAssignment */ || - memberDecl.kind === 269 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 269 /* PropertyAssignment */ || + memberDecl.kind === 270 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var jsdocType = void 0; if (isInJSFile) { jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); } var type = void 0; - if (memberDecl.kind === 268 /* PropertyAssignment */) { + if (memberDecl.kind === 269 /* PropertyAssignment */) { if (memberDecl.name.kind === 146 /* ComputedPropertyName */) { var t = checkComputedPropertyName(memberDecl.name); if (t.flags & 224 /* Literal */) { @@ -39599,7 +39823,7 @@ var ts; type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 269 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 270 /* ShorthandPropertyAssignment */); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } if (jsdocType) { @@ -39618,8 +39842,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 === 268 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 269 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 269 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 270 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* Optional */; } @@ -39647,7 +39871,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 270 /* SpreadAssignment */) { + else if (memberDecl.kind === 271 /* SpreadAssignment */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -39774,7 +39998,7 @@ var ts; function isJsxIntrinsicIdentifier(tagName) { // TODO (yuisu): comment switch (tagName.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 99 /* ThisKeyword */: return false; case 71 /* Identifier */: @@ -39824,7 +40048,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 262 /* JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 263 /* JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, /*typeFlags*/ 0, 4096 /* JsxAttributes */); attributesTable = ts.createSymbolTable(); @@ -39847,7 +40071,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 253 /* JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 254 /* 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); @@ -39956,29 +40180,7 @@ var ts; } return links.resolvedSymbol; } - /** - * Given a JSX element that is a class element, finds the Element Instance Type. If the - * element is not a class element, or the class element type cannot be determined, returns 'undefined'. - * For example, in the element , the element instance type is `MyClass` (not `typeof MyClass`). - */ - function getJsxElementInstanceType(node, valueType) { - ts.Debug.assert(!(valueType.flags & 131072 /* Union */)); - if (isTypeAny(valueType)) { - // Short-circuit if the class tag is using an element type 'any' - return anyType; - } - // Resolve the signatures, preferring constructor - var signatures = getSignaturesOfType(valueType, 1 /* Construct */); - if (signatures.length === 0) { - // No construct signatures, try call signatures - signatures = getSignaturesOfType(valueType, 0 /* Call */); - if (signatures.length === 0) { - // We found no signatures at all, which is an error - error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName)); - return unknownType; - } - } - // Instantiate in context of source type + function instantiateJsxSignatures(node, signatures) { var instantiatedSignatures = []; var candidateForTypeArgumentError; var hasTypeArgumentError = !!node.typeArguments; @@ -40013,7 +40215,7 @@ var ts; diagnostics.add(getTypeArgumentArityError(node, signatures, node.typeArguments)); } } - return getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2 /* Subtype */); + return instantiatedSignatures; } function getJsxSignatureTypeArgumentInstantiation(signature, node, isJavascript, reportErrors) { if (!node.typeArguments) { @@ -40212,8 +40414,12 @@ var ts; return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType); }), 2 /* Subtype */); } + // Shortcircuit any + if (isTypeAny(elementType)) { + return elementType; + } // If the elemType is a string type, we have to return anyType to prevent an error downstream as we will try to find construct or call signature of the type - if (elementType.flags & 2 /* String */) { + else if (elementType.flags & 2 /* String */) { return anyType; } else if (elementType.flags & 32 /* StringLiteral */) { @@ -40238,7 +40444,20 @@ var ts; return anyType; } // Get the element instance type (the result of newing or invoking this tag) - var elemInstanceType = getJsxElementInstanceType(openingLikeElement, elementType); + // Resolve the signatures, preferring constructor + var signatures = getSignaturesOfType(elementType, 1 /* Construct */); + if (signatures.length === 0) { + // No construct signatures, try call signatures + signatures = getSignaturesOfType(elementType, 0 /* Call */); + if (signatures.length === 0) { + // We found no signatures at all, which is an error + error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName)); + return unknownType; + } + } + // Instantiate in context of source type + var instantiatedSignatures = instantiateJsxSignatures(openingLikeElement, signatures); + var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2 /* Subtype */); // If we should include all stateless attributes type, then get all attributes type from all stateless function signature. // Otherwise get only attributes type from the signature picked by choose-overload logic. var statelessAttributesType = shouldIncludeAllStatelessAttributesType ? @@ -40251,7 +40470,8 @@ var ts; if (elementClassType) { checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); } - return getJsxPropsTypeFromClassType(elemInstanceType, ts.isInJavaScriptFile(openingLikeElement), openingLikeElement); + var isJs = ts.isInJavaScriptFile(openingLikeElement); + return getUnionType(ts.map(instantiatedSignatures, function (sig) { return getJsxPropsTypeFromClassType(sig, isJs, openingLikeElement, /*reportErrors*/ true); })); } /** * Get attributes type of the given intrinsic opening-like Jsx element by resolving the tag name. @@ -40437,29 +40657,22 @@ var ts; // i.e
// attr1 and attr2 are treated as JSXAttributes attached in the JsxOpeningLikeElement as "attributes". var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode); - // If the targetAttributesType is an emptyObjectType, indicating that there is no property named 'props' on this instance type. - // but there exists a sourceAttributesType, we need to explicitly give an error as normal assignability check allow excess properties and will pass. - if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || getPropertiesOfType(sourceAttributesType).length > 0)) { - error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(getJsxElementPropertiesName(getJsxNamespaceAt(openingLikeElement)))); - } - else { - // Check if sourceAttributesType assignable to targetAttributesType though this check will allow excess properties - var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); - // After we check for assignability, we will do another pass to check that all explicitly specified attributes have correct name corresponding in targetAttributeType. - // This will allow excess properties in spread type as it is very common pattern to spread outer attributes into React component in its render method. - if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { - for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { - var attribute = _a[_i]; - if (!ts.isJsxAttribute(attribute)) { - continue; - } - var attrName = attribute.name; - var isNotIgnoredJsxProperty = (isUnhyphenatedJsxName(ts.idText(attrName)) || !!(getPropertyOfType(targetAttributesType, attrName.escapedText))); - if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, /*isComparingJsxAttributes*/ true)) { - error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); - // We break here so that errors won't be cascading - break; - } + // Check if sourceAttributesType assignable to targetAttributesType though this check will allow excess properties + var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); + // After we check for assignability, we will do another pass to check that all explicitly specified attributes have correct name corresponding in targetAttributeType. + // This will allow excess properties in spread type as it is very common pattern to spread outer attributes into React component in its render method. + if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { + for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { + var attribute = _a[_i]; + if (!ts.isJsxAttribute(attribute)) { + continue; + } + var attrName = attribute.name; + var isNotIgnoredJsxProperty = (isUnhyphenatedJsxName(ts.idText(attrName)) || !!(getPropertyOfType(targetAttributesType, attrName.escapedText))); + if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, /*isComparingJsxAttributes*/ true)) { + error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); + // We break here so that errors won't be cascading + break; } } } @@ -40484,10 +40697,19 @@ var ts; function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } - function isMethodLike(symbol) { - return !!(symbol.flags & 8192 /* Method */ || - ts.getCheckFlags(symbol) & 4 /* SyntheticMethod */ || - ts.isInJavaScriptFile(symbol.valueDeclaration) && ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(symbol.valueDeclaration))); + /** + * Return whether this symbol is a member of a prototype somewhere + * Note that this is not tracked well within the compiler, so the answer may be incorrect. + */ + function isPrototypeProperty(symbol) { + if (symbol.flags & 8192 /* Method */ || ts.getCheckFlags(symbol) & 4 /* SyntheticMethod */) { + return true; + } + if (ts.isInJavaScriptFile(symbol.valueDeclaration)) { + var parent = symbol.valueDeclaration.parent; + return parent && ts.isBinaryExpression(parent) && + ts.getSpecialPropertyAssignmentKind(parent) === 3 /* PrototypeProperty */; + } } /** * Check whether the requested property access is valid. @@ -40499,9 +40721,11 @@ var ts; */ function checkPropertyAccessibility(node, left, type, prop) { var flags = ts.getDeclarationModifierFlagsFromSymbol(prop); - var errorNode = node.kind === 183 /* PropertyAccessExpression */ || node.kind === 230 /* VariableDeclaration */ ? + var errorNode = node.kind === 184 /* PropertyAccessExpression */ || node.kind === 231 /* VariableDeclaration */ ? node.name : - node.right; + node.kind === 178 /* ImportType */ ? + node : + node.right; if (ts.getCheckFlags(prop) & 256 /* ContainsPrivate */) { // Synthetic property with private constituent property error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); @@ -40654,7 +40878,7 @@ var ts; // Only compute control flow type if this is a property access expression that isn't an // assignment target, and the referenced property was declared as a variable, property, // accessor, or optional method. - if (node.kind !== 183 /* PropertyAccessExpression */ || + if (node.kind !== 184 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 131072 /* Union */)) { return propType; @@ -40691,7 +40915,7 @@ var ts; && !isPropertyDeclaredInAncestorClass(prop)) { error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.idText(right)); } - else if (valueDeclaration.kind === 233 /* ClassDeclaration */ && + else if (valueDeclaration.kind === 234 /* ClassDeclaration */ && node.parent.kind !== 161 /* TypeReference */ && !(valueDeclaration.flags & 2097152 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { @@ -40703,7 +40927,7 @@ var ts; switch (node.kind) { case 151 /* PropertyDeclaration */: return true; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: // We might be in `a = { b: this.b }`, so keep looking. See `tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts`. return false; default: @@ -40721,11 +40945,11 @@ var ts; } var classType = getTypeOfSymbol(prop.parent); while (true) { - classType = getSuperClass(classType); + classType = classType.symbol && getSuperClass(classType); if (!classType) { return false; } - var superProperty = getPropertyOfObjectType(classType, prop.escapedName); + var superProperty = getPropertyOfType(classType, prop.escapedName); if (superProperty && superProperty.valueDeclaration) { return true; } @@ -40736,8 +40960,7 @@ var ts; if (x.length === 0) { return undefined; } - ts.Debug.assert(x.length === 1); - return x[0]; + return getIntersectionType(x); } function reportNonexistentProperty(propNode, containingType) { var errorInfo; @@ -40891,11 +41114,17 @@ var ts; (ts.getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = 67108863 /* All */; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 183 /* PropertyAccessExpression */ ? node.expression : node.left; - return isValidPropertyAccessWithType(node, left, propertyName, getWidenedType(checkExpression(left))); + switch (node.kind) { + case 184 /* PropertyAccessExpression */: + return isValidPropertyAccessWithType(node, node.expression, propertyName, getWidenedType(checkExpression(node.expression))); + case 145 /* QualifiedName */: + return isValidPropertyAccessWithType(node, node.left, propertyName, getWidenedType(checkExpression(node.left))); + case 178 /* ImportType */: + return isValidPropertyAccessWithType(node, node, propertyName, getTypeFromTypeNode(node)); + } } function isValidPropertyAccessForCompletions(node, type, property) { - return isValidPropertyAccessWithType(node, node.expression, property.escapedName, type) + return isValidPropertyAccessWithType(node, node.kind === 178 /* ImportType */ ? node : node.expression, property.escapedName, type) && (!(property.flags & 8192 /* Method */) || isValidMethodAccess(property, type)); } function isValidMethodAccess(method, actualThisType) { @@ -40929,7 +41158,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 231 /* VariableDeclarationList */) { + if (initializer.kind === 232 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -40958,7 +41187,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 219 /* ForInStatement */ && + if (node.kind === 220 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -40976,7 +41205,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 186 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 187 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -41043,7 +41272,7 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 187 /* TaggedTemplateExpression */) { + if (node.kind === 188 /* TaggedTemplateExpression */) { checkExpression(node.template); } else if (node.kind !== 149 /* Decorator */) { @@ -41112,7 +41341,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 202 /* SpreadElement */) { + if (arg && arg.kind === 203 /* SpreadElement */) { return i; } } @@ -41128,12 +41357,12 @@ var ts; // The arity check will be done in "checkApplicableSignatureForJsxOpeningLikeElement". return true; } - if (node.kind === 187 /* TaggedTemplateExpression */) { + if (node.kind === 188 /* TaggedTemplateExpression */) { // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length argCount = args.length; typeArguments = undefined; - if (node.template.kind === 200 /* TemplateExpression */) { + if (node.template.kind === 201 /* 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.lastOrUndefined(node.template.templateSpans); @@ -41156,7 +41385,7 @@ var ts; else { if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 186 /* NewExpression */); + ts.Debug.assert(node.kind === 187 /* NewExpression */); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -41274,7 +41503,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 204 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 205 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); // If the effective argument type is 'undefined', there is no synthetic type @@ -41364,7 +41593,7 @@ var ts; return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 186 /* NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 187 /* 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. @@ -41381,7 +41610,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 204 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 205 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); // If the effective argument type is undefined, there is no synthetic type for the argument. @@ -41405,12 +41634,9 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - if (node.kind === 185 /* CallExpression */) { - var callee = node.expression; - if (callee.kind === 183 /* PropertyAccessExpression */) { - return callee.expression; - } - else if (callee.kind === 184 /* ElementAccessExpression */) { + if (node.kind === 186 /* CallExpression */) { + var callee = ts.skipOuterExpressions(node.expression); + if (callee.kind === 184 /* PropertyAccessExpression */ || callee.kind === 185 /* ElementAccessExpression */) { return callee.expression; } } @@ -41425,10 +41651,10 @@ var ts; * will be supplied from calls to `getEffectiveArgumentCount` and `getEffectiveArgumentType`. */ function getEffectiveCallArguments(node) { - if (node.kind === 187 /* TaggedTemplateExpression */) { + if (node.kind === 188 /* TaggedTemplateExpression */) { var template = node.template; var args_4 = [undefined]; - if (template.kind === 200 /* TemplateExpression */) { + if (template.kind === 201 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_4.push(span.expression); }); @@ -41464,8 +41690,8 @@ var ts; function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 149 /* Decorator */) { switch (node.parent.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; case 151 /* PropertyDeclaration */: @@ -41508,7 +41734,7 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); @@ -41553,7 +41779,7 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } @@ -41607,7 +41833,7 @@ var ts; function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a parameter decorator - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } @@ -41656,7 +41882,7 @@ var ts; if (node.kind === 149 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 187 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 188 /* TaggedTemplateExpression */) { return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' @@ -41669,7 +41895,7 @@ var ts; function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. if (node.kind === 149 /* Decorator */ || - (argIndex === 0 && node.kind === 187 /* TaggedTemplateExpression */)) { + (argIndex === 0 && node.kind === 188 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -41682,7 +41908,7 @@ var ts; // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 187 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 188 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -41702,7 +41928,7 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, paramCount, typeArguments.length); } function resolveCall(node, signatures, candidatesOutArray, fallbackError) { - var isTaggedTemplate = node.kind === 187 /* TaggedTemplateExpression */; + var isTaggedTemplate = node.kind === 188 /* TaggedTemplateExpression */; var isDecorator = node.kind === 149 /* Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var typeArguments; @@ -41777,7 +42003,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 = candidatesOutArray && node.kind === 185 /* CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 186 /* 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 @@ -42164,8 +42390,8 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 148 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; @@ -42261,16 +42487,16 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray); case 149 /* Decorator */: return resolveDecorator(node, candidatesOutArray); - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: // This code-path is called by language service return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray) || unknownSignature; } @@ -42353,14 +42579,13 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 183 /* PropertyAccessExpression */) { + while (parent && parent.kind === 184 /* PropertyAccessExpression */) { parent = parent.parent; } - return parent && ts.isBinaryExpression(parent) && - ts.isPrototypeAccess(parent.left) && - parent.operatorToken.kind === 58 /* EqualsToken */ && - ts.isObjectLiteralExpression(parent.right) && - parent.right; + if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 58 /* EqualsToken */) { + var right = ts.getInitializerOfBinaryExpression(parent); + return ts.isObjectLiteralExpression(right) && right; + } } function getInferredClassType(symbol) { var links = getSymbolLinks(symbol); @@ -42386,7 +42611,7 @@ var ts; if (node.expression.kind === 97 /* SuperKeyword */) { return voidType; } - if (node.kind === 186 /* NewExpression */) { + if (node.kind === 187 /* NewExpression */) { var declaration = signature.declaration; if (declaration && declaration.kind !== 154 /* Constructor */ && @@ -42508,9 +42733,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 232 /* FunctionDeclaration */ + ? 233 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 230 /* VariableDeclaration */ + ? 231 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -42575,7 +42800,10 @@ var ts; pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function getTypeOfFirstParameterOfSignature(signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType); + } + function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType; } function inferFromAnnotatedParameters(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -42677,7 +42905,7 @@ var ts; } var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 211 /* Block */) { + if (func.body.kind !== 212 /* Block */) { type = checkExpressionCached(func.body, checkMode); if (functionFlags & 2 /* Async */) { // From within an async function you can return either a non-promise value or a promise. Any @@ -42791,7 +43019,7 @@ var ts; if (!(func.flags & 128 /* HasImplicitReturn */)) { return false; } - if (ts.some(func.body.statements, function (statement) { return statement.kind === 225 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) { + if (ts.some(func.body.statements, function (statement) { return statement.kind === 226 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) { return false; } return true; @@ -42834,11 +43062,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; case 153 /* MethodDeclaration */: - return func.parent.kind === 182 /* ObjectLiteralExpression */; + return func.parent.kind === 183 /* ObjectLiteralExpression */; default: return false; } @@ -42862,7 +43090,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 === 152 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 211 /* Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 152 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 212 /* Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; @@ -42902,7 +43130,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 190 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 191 /* FunctionExpression */) { checkGrammarForGenerator(node); } var links = getNodeLinks(node); @@ -42937,11 +43165,6 @@ var ts; checkNodeDeferred(node); } } - if (produceDiagnostics && node.kind !== 153 /* MethodDeclaration */) { - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); - } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { @@ -42965,7 +43188,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 211 /* Block */) { + if (node.body.kind === 212 /* Block */) { checkSourceElement(node.body); } else { @@ -43012,7 +43235,7 @@ var ts; if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 183 /* PropertyAccessExpression */ || expr.kind === 184 /* ElementAccessExpression */) && + (expr.kind === 184 /* PropertyAccessExpression */ || expr.kind === 185 /* ElementAccessExpression */) && expr.expression.kind === 99 /* ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var func = ts.getContainingFunction(expr); @@ -43029,13 +43252,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 183 /* PropertyAccessExpression */ || expr.kind === 184 /* ElementAccessExpression */) { + if (expr.kind === 184 /* PropertyAccessExpression */ || expr.kind === 185 /* ElementAccessExpression */) { var node = ts.skipParentheses(expr.expression); if (node.kind === 71 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 2097152 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 244 /* NamespaceImport */; + return declaration && declaration.kind === 245 /* NamespaceImport */; } } } @@ -43044,7 +43267,7 @@ var ts; function checkReferenceExpression(expr, invalidReferenceMessage) { // References are combinations of identifiers, parentheses, and property accesses. var node = ts.skipOuterExpressions(expr, 2 /* Assertions */ | 1 /* Parentheses */); - if (node.kind !== 71 /* Identifier */ && node.kind !== 183 /* PropertyAccessExpression */ && node.kind !== 184 /* ElementAccessExpression */) { + if (node.kind !== 71 /* Identifier */ && node.kind !== 184 /* PropertyAccessExpression */ && node.kind !== 185 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } @@ -43053,7 +43276,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 183 /* PropertyAccessExpression */ && expr.kind !== 184 /* ElementAccessExpression */) { + if (expr.kind !== 184 /* PropertyAccessExpression */ && expr.kind !== 185 /* ElementAccessExpression */) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -43219,6 +43442,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; + checkGrammarForDisallowedTrailingComma(properties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); if (strictNullChecks && properties.length === 0) { return checkNonNullType(sourceType, node); } @@ -43230,7 +43454,7 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 268 /* PropertyAssignment */ || property.kind === 269 /* ShorthandPropertyAssignment */) { + if (property.kind === 269 /* PropertyAssignment */ || property.kind === 270 /* ShorthandPropertyAssignment */) { var name = property.name; if (name.kind === 146 /* ComputedPropertyName */) { checkComputedPropertyName(name); @@ -43245,7 +43469,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 269 /* ShorthandPropertyAssignment */) { + if (property.kind === 270 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -43257,7 +43481,7 @@ var ts; error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 270 /* SpreadAssignment */) { + else if (property.kind === 271 /* SpreadAssignment */) { if (languageVersion < 6 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); } @@ -43275,6 +43499,8 @@ var ts; } } function checkArrayLiteralAssignment(node, sourceType, checkMode) { + var elements = node.elements; + checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* Read */); } @@ -43282,7 +43508,6 @@ var ts; // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType; - var elements = node.elements; for (var i = 0; i < elements.length; i++) { checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); } @@ -43291,8 +43516,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 204 /* OmittedExpression */) { - if (element.kind !== 202 /* SpreadElement */) { + if (element.kind !== 205 /* OmittedExpression */) { + if (element.kind !== 203 /* SpreadElement */) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -43320,7 +43545,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 198 /* BinaryExpression */ && restExpression.operatorToken.kind === 58 /* EqualsToken */) { + if (restExpression.kind === 199 /* BinaryExpression */ && restExpression.operatorToken.kind === 58 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -43333,7 +43558,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 269 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 270 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -43349,21 +43574,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 198 /* BinaryExpression */ && target.operatorToken.kind === 58 /* EqualsToken */) { + if (target.kind === 199 /* BinaryExpression */ && target.operatorToken.kind === 58 /* EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 182 /* ObjectLiteralExpression */) { + if (target.kind === 183 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 181 /* ArrayLiteralExpression */) { + if (target.kind === 182 /* 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 === 270 /* SpreadAssignment */ ? + var error = target.parent.kind === 271 /* 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; if (checkReferenceExpression(target, error)) { @@ -43385,35 +43610,35 @@ var ts; case 71 /* Identifier */: case 9 /* StringLiteral */: case 12 /* RegularExpressionLiteral */: - case 187 /* TaggedTemplateExpression */: - case 200 /* TemplateExpression */: + case 188 /* TaggedTemplateExpression */: + case 201 /* TemplateExpression */: case 13 /* NoSubstitutionTemplateLiteral */: case 8 /* NumericLiteral */: case 101 /* TrueKeyword */: case 86 /* FalseKeyword */: case 95 /* NullKeyword */: case 140 /* UndefinedKeyword */: - case 190 /* FunctionExpression */: - case 203 /* ClassExpression */: - case 191 /* ArrowFunction */: - case 181 /* ArrayLiteralExpression */: - case 182 /* ObjectLiteralExpression */: - case 193 /* TypeOfExpression */: - case 207 /* NonNullExpression */: - case 254 /* JsxSelfClosingElement */: - case 253 /* JsxElement */: + case 191 /* FunctionExpression */: + case 204 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 182 /* ArrayLiteralExpression */: + case 183 /* ObjectLiteralExpression */: + case 194 /* TypeOfExpression */: + case 208 /* NonNullExpression */: + case 255 /* JsxSelfClosingElement */: + case 254 /* JsxElement */: return true; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -43425,9 +43650,9 @@ var ts; } return false; // Some forms listed here for clarity - case 194 /* VoidExpression */: // Explicit opt-out - case 188 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 206 /* AsExpression */: // Not SEF, but can produce useful type warnings + case 195 /* VoidExpression */: // Explicit opt-out + case 189 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 207 /* AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -43443,7 +43668,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 58 /* EqualsToken */ && (left.kind === 182 /* ObjectLiteralExpression */ || left.kind === 181 /* ArrayLiteralExpression */)) { + if (operator === 58 /* EqualsToken */ && (left.kind === 183 /* ObjectLiteralExpression */ || left.kind === 182 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); } var leftType = checkExpression(left, checkMode); @@ -43693,12 +43918,14 @@ var ts; // A place where we actually *are* concerned with the expressions' types are // in tagged templates. ts.forEach(node.templateSpans, function (templateSpan) { - checkExpression(templateSpan.expression); + if (maybeTypeOfKind(checkExpression(templateSpan.expression), 1536 /* ESSymbolLike */)) { + error(templateSpan.expression, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1, typeToString(esSymbolType), typeToString(stringType)); + } }); return stringType; } function getContextNode(node) { - if (node.kind === 261 /* JsxAttributes */) { + if (node.kind === 262 /* JsxAttributes */) { 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; @@ -43734,7 +43961,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 188 /* TypeAssertionExpression */ || node.kind === 206 /* AsExpression */; + return node.kind === 189 /* TypeAssertionExpression */ || node.kind === 207 /* AsExpression */; } function checkDeclarationInitializer(declaration) { var inJs = ts.isInJavaScriptFile(declaration); @@ -43838,7 +44065,7 @@ var ts; function getTypeOfExpression(node, cache) { // Optimize for the common case of a call to a function with a single non-generic call // signature where we can just fetch the return type without checking the arguments. - if (node.kind === 185 /* CallExpression */ && node.expression.kind !== 97 /* SuperKeyword */ && !ts.isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(node)) { + if (node.kind === 186 /* CallExpression */ && node.expression.kind !== 97 /* SuperKeyword */ && !ts.isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(node)) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -43885,8 +44112,8 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 184 /* ElementAccessExpression */ && node.parent.expression === node) || + var ok = (node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 185 /* ElementAccessExpression */ && node.parent.expression === node) || ((node.kind === 71 /* Identifier */ || node.kind === 145 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || (node.parent.kind === 164 /* TypeQuery */ && node.parent.exprName === node)); if (!ok) { @@ -43922,74 +44149,74 @@ var ts; return trueType; case 86 /* FalseKeyword */: return falseType; - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return checkTemplateExpression(node); case 12 /* RegularExpressionLiteral */: return globalRegExpType; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (node.expression.kind === 91 /* ImportKeyword */) { return checkImportCallExpression(node); } /* falls through */ - case 186 /* NewExpression */: + case 187 /* NewExpression */: return checkCallExpression(node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return checkClassExpression(node); - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: return checkAssertion(node); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return checkNonNullAssertion(node); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return checkMetaProperty(node); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return checkDeleteExpression(node); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return checkVoidExpression(node); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return checkAwaitExpression(node); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return checkSpreadExpression(node, checkMode); - case 204 /* OmittedExpression */: + case 205 /* OmittedExpression */: return undefinedWideningType; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return checkYieldExpression(node); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return checkJsxExpression(node, checkMode); - case 253 /* JsxElement */: + case 254 /* JsxElement */: return checkJsxElement(node, checkMode); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return checkJsxFragment(node, checkMode); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 255 /* JsxOpeningElement */: + case 256 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -44104,10 +44331,10 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: case 157 /* CallSignature */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 162 /* FunctionType */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: @@ -44128,7 +44355,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 === 179 /* ArrayBindingPattern */ || name.kind === 178 /* ObjectBindingPattern */) { + else if (name.kind === 180 /* ArrayBindingPattern */ || name.kind === 179 /* ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -44141,7 +44368,7 @@ var ts; checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 162 /* FunctionType */ || node.kind === 232 /* FunctionDeclaration */ || node.kind === 163 /* ConstructorType */ || + else if (node.kind === 162 /* FunctionType */ || node.kind === 233 /* FunctionDeclaration */ || node.kind === 163 /* ConstructorType */ || node.kind === 157 /* CallSignature */ || node.kind === 154 /* Constructor */ || node.kind === 158 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); @@ -44333,7 +44560,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 234 /* InterfaceDeclaration */) { + if (node.kind === 235 /* 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 @@ -44444,7 +44671,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 214 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 215 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -44614,7 +44841,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType))) { - if (accessNode.kind === 184 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 185 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -44656,6 +44883,10 @@ var ts; } checkSourceElement(node.typeParameter); } + function checkImportType(node) { + checkSourceElement(node.argument); + getTypeFromTypeNode(node); + } function isPrivateWithinAmbient(node) { return ts.hasModifier(node, 8 /* Private */) && !!(node.flags & 2097152 /* Ambient */); } @@ -44663,9 +44894,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 !== 234 /* InterfaceDeclaration */ && - n.parent.kind !== 233 /* ClassDeclaration */ && - n.parent.kind !== 203 /* ClassExpression */ && + if (n.parent.kind !== 235 /* InterfaceDeclaration */ && + n.parent.kind !== 234 /* ClassDeclaration */ && + n.parent.kind !== 204 /* ClassExpression */ && n.flags & 2097152 /* Ambient */) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported @@ -44795,7 +45026,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = node.flags & 2097152 /* Ambient */; - var inAmbientContextOrInterface = node.parent.kind === 234 /* InterfaceDeclaration */ || node.parent.kind === 165 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 235 /* InterfaceDeclaration */ || node.parent.kind === 165 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -44806,7 +45037,7 @@ 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 === 232 /* FunctionDeclaration */ || node.kind === 153 /* MethodDeclaration */ || node.kind === 152 /* MethodSignature */ || node.kind === 154 /* Constructor */) { + if (node.kind === 233 /* FunctionDeclaration */ || node.kind === 153 /* MethodDeclaration */ || node.kind === 152 /* MethodSignature */ || node.kind === 154 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -44934,32 +45165,32 @@ var ts; })(DeclarationSpaces || (DeclarationSpaces = {})); function getDeclarationSpaces(d) { switch (d.kind) { - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: // A jsdoc typedef is, by definition, a type alias - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return 2 /* ExportType */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4 /* ExportNamespace */ | 1 /* ExportValue */ : 4 /* ExportNamespace */; - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: return 2 /* ExportType */ | 1 /* ExportValue */; - case 272 /* SourceFile */: + case 273 /* SourceFile */: return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */; // The below options all declare an Alias, which is allowed to merge with other values within the importing module - case 241 /* ImportEqualsDeclaration */: - case 244 /* NamespaceImport */: - case 243 /* ImportClause */: + case 242 /* ImportEqualsDeclaration */: + case 245 /* NamespaceImport */: + case 244 /* ImportClause */: var result_2 = 0 /* None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); }); return result_2; - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: - case 232 /* FunctionDeclaration */: - case 246 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 233 /* FunctionDeclaration */: + case 247 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 return 1 /* ExportValue */; default: ts.Debug.fail(ts.Debug.showSyntaxKind(d)); @@ -45229,7 +45460,7 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); @@ -45358,7 +45589,7 @@ var ts; checkExternalEmitHelpers(firstDecorator, 16 /* 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 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -45395,9 +45626,6 @@ var ts; if (produceDiagnostics) { checkFunctionOrMethodDeclaration(node); checkGrammarForGenerator(node); - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -45451,7 +45679,7 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return node; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return node.name; default: return undefined; @@ -45529,29 +45757,29 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 272 /* SourceFile */: - case 237 /* ModuleDeclaration */: + case 273 /* SourceFile */: + case 238 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: checkUnusedTypeParameters(node); break; - case 211 /* Block */: - case 239 /* CaseBlock */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 212 /* Block */: + case 240 /* CaseBlock */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: checkUnusedLocalsAndParameters(node); break; case 154 /* Constructor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: @@ -45565,7 +45793,7 @@ var ts; case 158 /* ConstructSignature */: case 162 /* FunctionType */: case 163 /* ConstructorType */: - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: checkUnusedTypeParameters(node); break; default: @@ -45608,7 +45836,7 @@ var ts; var node = ts.getNameOfDeclaration(declaration) || declaration; if (isIdentifierThatStartsWithUnderScore(node)) { var declaration_2 = ts.getRootDeclaration(node.parent); - if ((declaration_2.kind === 230 /* VariableDeclaration */ && ts.isForInOrOfStatement(declaration_2.parent.parent)) || + if ((declaration_2.kind === 231 /* VariableDeclaration */ && ts.isForInOrOfStatement(declaration_2.parent.parent)) || declaration_2.kind === 147 /* TypeParameter */) { return; } @@ -45650,7 +45878,7 @@ var ts; } break; case 159 /* IndexSignature */: - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: // Can't be private break; default: @@ -45724,19 +45952,19 @@ var ts; } } function isImportedDeclaration(node) { - return node.kind === 243 /* ImportClause */ || node.kind === 246 /* ImportSpecifier */ || node.kind === 244 /* NamespaceImport */; + return node.kind === 244 /* ImportClause */ || node.kind === 247 /* ImportSpecifier */ || node.kind === 245 /* NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 243 /* ImportClause */ ? decl : decl.kind === 244 /* NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 244 /* ImportClause */ ? decl : decl.kind === 245 /* NamespaceImport */ ? decl.parent : decl.parent.parent; } function forEachImportedDeclaration(importClause, cb) { var defaultName = importClause.name, namedBindings = importClause.namedBindings; return (defaultName && cb(importClause)) || - namedBindings && (namedBindings.kind === 244 /* NamespaceImport */ ? cb(namedBindings) : ts.forEach(namedBindings.elements, cb)); + namedBindings && (namedBindings.kind === 245 /* NamespaceImport */ ? cb(namedBindings) : ts.forEach(namedBindings.elements, cb)); } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 211 /* Block */) { + if (node.kind === 212 /* Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -45786,16 +46014,6 @@ var ts; } return true; } - function checkCollisionWithCapturedThisVariable(node, name) { - if (languageVersion <= 1 /* ES5 */ && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_this")) { - potentialThisCollisions.push(node); - } - } - function checkCollisionWithCapturedNewTargetVariable(node, name) { - if (languageVersion <= 1 /* ES5 */ && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_newTarget")) { - potentialNewTargetCollisions.push(node); - } - } // this function will run after checking the source file so 'CaptureThis' is correct for all nodes function checkIfThisIsCapturedInEnclosingScope(node) { ts.findAncestor(node, function (current) { @@ -45825,29 +46043,6 @@ var ts; } }); } - function checkCollisionWithCapturedSuperVariable(node, name) { - if (languageVersion >= 2 /* ES2015 */ || compilerOptions.noEmit) { - return; - } - if (!needCollisionCheckForIdentifier(node, name, "_super")) { - return; - } - // bubble up and find containing type - var enclosingClass = ts.getContainingClass(node); - // if containing type was not found or it is ambient - exit (no codegen) - if (!enclosingClass || enclosingClass.flags & 2097152 /* Ambient */) { - return; - } - if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_3 = node.kind !== 71 /* Identifier */; - if (isDeclaration_3) { - error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); - } - else { - error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference); - } - } - } function checkCollisionWithRequireExportsInGeneratedCode(node, name) { // No need to check for require or exports for ES6 modules and later if (modulekind >= ts.ModuleKind.ES2015 || compilerOptions.noEmit) { @@ -45862,7 +46057,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 === 272 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 273 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -45877,7 +46072,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 === 272 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 273 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(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)); } @@ -45912,7 +46107,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 === 230 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 231 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -45924,17 +46119,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 231 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 212 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 232 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 213 /* 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 === 211 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 238 /* ModuleBlock */ || - container.kind === 237 /* ModuleDeclaration */ || - container.kind === 272 /* SourceFile */); + (container.kind === 212 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 239 /* ModuleBlock */ || + container.kind === 238 /* ModuleDeclaration */ || + container.kind === 273 /* 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 @@ -45960,7 +46155,7 @@ var ts; // skip declaration names (i.e. in object literal expressions) return; } - if (n.kind === 183 /* PropertyAccessExpression */) { + if (n.kind === 184 /* PropertyAccessExpression */) { // skip property names in property access expression return visit(n.expression); } @@ -45980,7 +46175,7 @@ var ts; var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { if (symbol.valueDeclaration.kind === 148 /* Parameter */ || - symbol.valueDeclaration.kind === 180 /* BindingElement */) { + symbol.valueDeclaration.kind === 181 /* BindingElement */) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { @@ -46033,8 +46228,8 @@ var ts; checkExpressionCached(node.initializer); } } - if (node.kind === 180 /* BindingElement */) { - if (node.parent.kind === 178 /* ObjectBindingPattern */ && languageVersion < 6 /* ESNext */) { + if (node.kind === 181 /* BindingElement */) { + if (node.parent.kind === 179 /* ObjectBindingPattern */ && languageVersion < 6 /* ESNext */) { checkExternalEmitHelpers(node, 4 /* Rest */); } // check computed properties inside property names of binding elements @@ -46055,7 +46250,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 179 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 180 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -46068,7 +46263,7 @@ var ts; // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 219 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 220 /* ForInStatement */) { var initializerType = checkExpressionCached(node.initializer); if (strictNullChecks && node.name.elements.length === 0) { checkNonNullType(initializerType, node); @@ -46085,7 +46280,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 219 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 220 /* ForInStatement */) { var initializer = ts.isInJavaScriptFile(node) && ts.getDeclaredJavascriptInitializer(node) || node.initializer; checkTypeAssignableTo(checkExpressionCached(initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); @@ -46111,12 +46306,9 @@ var ts; if (node.kind !== 151 /* PropertyDeclaration */ && node.kind !== 150 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */) { + if (node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -46129,8 +46321,8 @@ var ts; error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType)); } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 148 /* Parameter */ && right.kind === 230 /* VariableDeclaration */) || - (left.kind === 230 /* VariableDeclaration */ && right.kind === 148 /* Parameter */)) { + if ((left.kind === 148 /* Parameter */ && right.kind === 231 /* VariableDeclaration */) || + (left.kind === 231 /* VariableDeclaration */ && right.kind === 148 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -46169,7 +46361,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 213 /* EmptyStatement */) { + if (node.thenStatement.kind === 214 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -46189,12 +46381,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 231 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 232 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 231 /* VariableDeclarationList */) { + if (node.initializer.kind === 232 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -46212,32 +46404,30 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.kind === 220 /* ForOfStatement */) { - if (node.awaitModifier) { - var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); - if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 6 /* ESNext */) { - // for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper - checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */); - } - } - else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ES2015 */) { - // for..of prior to ES2015 requires the __values helper when downlevelIteration is enabled - checkExternalEmitHelpers(node, 256 /* ForOfIncludes */); + if (node.awaitModifier) { + var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); + if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 6 /* ESNext */) { + // for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper + checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */); } } + else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ES2015 */) { + // for..of prior to ES2015 requires the __values helper when downlevelIteration is enabled + checkExternalEmitHelpers(node, 256 /* ForOfIncludes */); + } // Check the LHS and RHS // If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS // 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 === 231 /* VariableDeclarationList */) { + if (node.initializer.kind === 232 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); // There may be a destructuring assignment on the left side - if (varExpr.kind === 181 /* ArrayLiteralExpression */ || varExpr.kind === 182 /* ObjectLiteralExpression */) { + if (varExpr.kind === 182 /* ArrayLiteralExpression */ || varExpr.kind === 183 /* 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. @@ -46269,7 +46459,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 === 231 /* VariableDeclarationList */) { + if (node.initializer.kind === 232 /* 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); @@ -46283,7 +46473,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 === 181 /* ArrayLiteralExpression */ || varExpr.kind === 182 /* ObjectLiteralExpression */) { + if (varExpr.kind === 182 /* ArrayLiteralExpression */ || varExpr.kind === 183 /* 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)) { @@ -46296,8 +46486,8 @@ var ts; } // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeAssignableToKind(rightType, 134217728 /* NonPrimitive */ | 7372800 /* InstantiableNonPrimitive */)) { - error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); + if (rightType === neverType || !isTypeAssignableToKind(rightType, 134217728 /* NonPrimitive */ | 7372800 /* InstantiableNonPrimitive */)) { + error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)); } checkSourceElement(node.statement); if (node.locals) { @@ -46328,6 +46518,10 @@ var ts; * of a iterable (if defined globally) or element type of an array like for ES2015 or earlier. */ function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables, checkAssignability) { + if (inputType === neverType) { + reportTypeNotIterableError(errorNode, inputType, allowAsyncIterables); + return undefined; + } var uplevelIteration = languageVersion >= 2 /* ES2015 */; var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; // Get the iterated type of an `Iterable` or `IterableIterator` only in ES2015 @@ -46381,13 +46575,18 @@ var ts; // want to say that number is not an array type. But if the input was just // number and string input is allowed, we want to say that number is not an // array type or a string type. + var isIterable = !!getIteratedTypeOfIterable(inputType, /* errorNode */ undefined, allowAsyncIterables, /*allowSyncIterables*/ true, checkAssignability); var diagnostic = !allowStringInput || hasStringConstituent ? downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator - : ts.Diagnostics.Type_0_is_not_an_array_type + : isIterable + ? ts.Diagnostics.Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators + : ts.Diagnostics.Type_0_is_not_an_array_type : downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + : isIterable + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(errorNode, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : undefined; @@ -46477,10 +46676,8 @@ var ts; var signatures = methodType && getSignaturesOfType(methodType, 0 /* Call */); if (!ts.some(signatures)) { if (errorNode) { - error(errorNode, allowAsyncIterables - ? ts.Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator - : ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); // only report on the first error + reportTypeNotIterableError(errorNode, type, allowAsyncIterables); errorNode = undefined; } return undefined; @@ -46500,6 +46697,11 @@ var ts; : typeAsIterable.iteratedTypeOfIterable = iteratedType; } } + function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) { + error(errorNode, allowAsyncIterables + ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator, typeToString(type)); + } /** * This function has very similar logic as getIteratedTypeOfIterable, except that it operates on * Iterators instead of Iterables. Here is the structure: @@ -46684,7 +46886,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 === 265 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 266 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -46696,7 +46898,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 264 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 265 /* CaseClause */) { // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable // to or from the type of the 'switch' expression. @@ -46725,7 +46927,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 226 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 227 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -46830,7 +47032,7 @@ var ts; // this allows us to rule out cases when both property and indexer are inherited from the base class var errorNode; if (propDeclaration && - (propDeclaration.kind === 198 /* BinaryExpression */ || + (propDeclaration.kind === 199 /* BinaryExpression */ || ts.getNameOfDeclaration(propDeclaration).kind === 146 /* ComputedPropertyName */ || prop.parent === containingType.symbol)) { errorNode = propDeclaration; @@ -46976,8 +47178,6 @@ var ts; checkDecorators(node); if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -47116,7 +47316,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 233 /* ClassDeclaration */ || d.kind === 234 /* InterfaceDeclaration */; + return d.kind === 234 /* ClassDeclaration */ || d.kind === 235 /* InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -47155,7 +47355,7 @@ var ts; // 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 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) { - if (derivedClassDecl.kind === 203 /* ClassExpression */) { + if (derivedClassDecl.kind === 204 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -47170,12 +47370,12 @@ var ts; // either base or derived property is private - not override, skip it continue; } - if (isMethodLike(base) && isMethodLike(derived) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) { + if (isPrototypeProperty(base) && isPrototypeProperty(derived) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) { // method is overridden with method or property/accessor is overridden with property/accessor - correct case continue; } var errorMessage = void 0; - if (isMethodLike(base)) { + if (isPrototypeProperty(base)) { if (derived.flags & 98304 /* Accessor */) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } @@ -47183,11 +47383,11 @@ var ts; errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } - else if (base.flags & 4 /* Property */) { - errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + else if (base.flags & 98304 /* Accessor */) { + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } @@ -47269,7 +47469,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 234 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 235 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -47374,7 +47574,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -47384,7 +47584,7 @@ var ts; } } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -47409,18 +47609,18 @@ var ts; case 8 /* NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return evaluate(expr.expression); case 71 /* Identifier */: return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), expr.escapedText); - case 184 /* ElementAccessExpression */: - case 183 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 184 /* PropertyAccessExpression */: var ex = expr; if (isConstantMemberAccess(ex)) { var type = getTypeOfExpression(ex.expression); if (type.symbol && type.symbol.flags & 384 /* Enum */) { var name = void 0; - if (ex.kind === 183 /* PropertyAccessExpression */) { + if (ex.kind === 184 /* PropertyAccessExpression */) { name = ex.name.escapedText; } else { @@ -47452,8 +47652,8 @@ var ts; } function isConstantMemberAccess(node) { return node.kind === 71 /* Identifier */ || - node.kind === 183 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 184 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 184 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 185 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) && node.argumentExpression.kind === 9 /* StringLiteral */; } function checkEnumDeclaration(node) { @@ -47463,8 +47663,6 @@ var ts; // Grammar checking checkGrammarDecoratorsAndModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -47493,7 +47691,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 !== 236 /* EnumDeclaration */) { + if (declaration.kind !== 237 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -47516,8 +47714,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { var declaration = declarations_7[_i]; - if ((declaration.kind === 233 /* ClassDeclaration */ || - (declaration.kind === 232 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 234 /* ClassDeclaration */ || + (declaration.kind === 233 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 2097152 /* Ambient */)) { return declaration; } @@ -47559,7 +47757,6 @@ var ts; } } if (ts.isIdentifier(node.name)) { - checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -47581,7 +47778,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, 233 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 234 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -47631,23 +47828,23 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 247 /* ExportAssignment */: - case 248 /* ExportDeclaration */: + case 248 /* ExportAssignment */: + case 249 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 180 /* BindingElement */: - case 230 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 231 /* VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { @@ -47658,12 +47855,12 @@ var ts; break; } // falls through - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 232 /* FunctionDeclaration */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 233 /* FunctionDeclaration */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 236 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -47691,7 +47888,7 @@ var ts; node = node.left; } while (node.kind !== 71 /* Identifier */); return node; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 71 /* Identifier */); @@ -47708,9 +47905,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 238 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 272 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 248 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 239 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 273 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 249 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -47743,14 +47940,14 @@ var ts; (symbol.flags & 67901928 /* Type */ ? 67901928 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 250 /* ExportSpecifier */ ? + var message = node.kind === 251 /* 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)); } // Don't allow to re-export something with no value side when `--isolatedModules` is set. if (compilerOptions.isolatedModules - && node.kind === 250 /* ExportSpecifier */ + && node.kind === 251 /* ExportSpecifier */ && !(target.flags & 67216319 /* Value */) && !(node.flags & 2097152 /* Ambient */)) { error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided); @@ -47758,7 +47955,6 @@ var ts; } } function checkImportBinding(node) { - checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkAliasSymbol(node); @@ -47778,7 +47974,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 244 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 245 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -47799,7 +47995,7 @@ var ts; if (ts.hasModifier(node, 1 /* Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 252 /* ExternalModuleReference */) { + if (node.moduleReference.kind !== 253 /* ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 67216319 /* Value */) { @@ -47835,10 +48031,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 238 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 238 /* ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 239 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 239 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 2097152 /* Ambient */; - if (node.parent.kind !== 272 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 273 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -47855,7 +48051,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 272 /* SourceFile */ || node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 237 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 273 /* SourceFile */ || node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 238 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -47884,8 +48080,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 === 272 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 237 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 273 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 238 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -47973,7 +48169,7 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 232 /* FunctionDeclaration */ && declaration.kind !== 153 /* MethodDeclaration */) || + return (declaration.kind !== 233 /* FunctionDeclaration */ && declaration.kind !== 153 /* MethodDeclaration */) || !!declaration.body; } function checkSourceElement(node) { @@ -47991,10 +48187,10 @@ 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 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 232 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 233 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -48044,96 +48240,98 @@ var ts; return checkConditionalType(node); case 171 /* InferType */: return checkInferType(node); - case 285 /* JSDocAugmentsTag */: + case 178 /* ImportType */: + return checkImportType(node); + case 286 /* JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return checkJSDocTypedefTag(node); - case 287 /* JSDocParameterTag */: + case 288 /* JSDocParameterTag */: return checkJSDocParameterTag(node); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: checkSignatureDeclaration(node); // falls through - case 278 /* JSDocNonNullableType */: - case 277 /* JSDocNullableType */: - case 275 /* JSDocAllType */: - case 276 /* JSDocUnknownType */: + case 279 /* JSDocNonNullableType */: + case 278 /* JSDocNullableType */: + case 276 /* JSDocAllType */: + case 277 /* JSDocUnknownType */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 274 /* JSDocTypeExpression */: + case 275 /* JSDocTypeExpression */: return checkSourceElement(node.type); case 175 /* IndexedAccessType */: return checkIndexedAccessType(node); case 176 /* MappedType */: return checkMappedType(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 211 /* Block */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 239 /* ModuleBlock */: return checkBlock(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return checkVariableStatement(node); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return checkExpressionStatement(node); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return checkIfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return checkDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return checkWhileStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return checkForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return checkForInStatement(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return checkForOfStatement(node); - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return checkReturnStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return checkWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return checkSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return checkLabeledStatement(node); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return checkThrowStatement(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return checkTryStatement(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return checkBindingElement(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return checkClassDeclaration(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return checkImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return checkExportDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return checkExportAssignment(node); - case 213 /* EmptyStatement */: + case 214 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 229 /* DebuggerStatement */: + case 230 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 251 /* MissingDeclaration */: + case 252 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -48217,8 +48415,8 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); @@ -48227,7 +48425,7 @@ var ts; case 156 /* SetAccessor */: checkAccessorDeclaration(node); break; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: checkClassExpressionDeferred(node); break; } @@ -48347,13 +48545,13 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* ModuleMember */); break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -48361,8 +48559,8 @@ var ts; // falls through // 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 - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* 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. @@ -48371,7 +48569,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67901928 /* Type */); } break; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -48420,10 +48618,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 147 /* TypeParameter */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: return true; } } @@ -48437,10 +48635,10 @@ var ts; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 183 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 184 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 205 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 206 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -48471,10 +48669,10 @@ var ts; while (nodeOnRightSide.parent.kind === 145 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 241 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 242 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 247 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 248 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -48494,12 +48692,23 @@ var ts; return getSymbolOfNode(entityName.parent.parent); } } + function isImportTypeQualifierPart(node) { + var parent = node.parent; + while (ts.isQualifiedName(parent)) { + node = parent; + parent = parent.parent; + } + if (parent && parent.kind === 178 /* ImportType */ && parent.qualifier === node) { + return parent; + } + return undefined; + } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } if (ts.isInJavaScriptFile(entityName) && - entityName.parent.kind === 183 /* PropertyAccessExpression */ && + entityName.parent.kind === 184 /* PropertyAccessExpression */ && entityName.parent === entityName.parent.parent.left) { // Check if this is a special property assignment var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); @@ -48507,23 +48716,35 @@ var ts; return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 247 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { - return resolveEntityName(entityName, - /*all meanings*/ 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */); + if (entityName.parent.kind === 248 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression + var success = resolveEntityName(entityName, + /*all meanings*/ 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true); + if (success && success !== unknownSymbol) { + return success; + } } - if (entityName.kind !== 183 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { + else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 241 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 242 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } - if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (!ts.isPropertyAccessExpression(entityName)) { + var possibleImportNode = isImportTypeQualifierPart(entityName); + if (possibleImportNode) { + getTypeFromTypeNode(possibleImportNode); + var sym = getNodeLinks(entityName).resolvedSymbol; + return sym === unknownSymbol ? undefined : sym; + } + } + while (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 205 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 206 /* ExpressionWithTypeArguments */) { meaning = 67901928 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -48539,10 +48760,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 287 /* JSDocParameterTag */) { + if (entityName.parent.kind === 288 /* JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 147 /* TypeParameter */ && entityName.parent.parent.kind === 290 /* JSDocTemplateTag */) { + if (entityName.parent.kind === 147 /* TypeParameter */ && entityName.parent.parent.kind === 291 /* JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -48559,12 +48780,12 @@ var ts; } return resolveEntityName(entityName, 67216319 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.kind === 183 /* PropertyAccessExpression */ || entityName.kind === 145 /* QualifiedName */) { + else if (entityName.kind === 184 /* PropertyAccessExpression */ || entityName.kind === 145 /* QualifiedName */) { var links = getNodeLinks(entityName); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (entityName.kind === 183 /* PropertyAccessExpression */) { + if (entityName.kind === 184 /* PropertyAccessExpression */) { checkPropertyAccessExpression(entityName); } else { @@ -48577,7 +48798,7 @@ var ts; var meaning = entityName.parent.kind === 161 /* TypeReference */ ? 67901928 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 260 /* JsxAttribute */) { + else if (entityName.parent.kind === 261 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 160 /* TypePredicate */) { @@ -48587,7 +48808,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (node.flags & 4194304 /* InWithStatement */) { @@ -48605,8 +48826,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 180 /* BindingElement */ && - node.parent.parent.kind === 178 /* ObjectBindingPattern */ && + else if (node.parent.kind === 181 /* BindingElement */ && + node.parent.parent.kind === 179 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.escapedText); @@ -48617,7 +48838,7 @@ var ts; } switch (node.kind) { case 71 /* Identifier */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 145 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 99 /* ThisKeyword */: @@ -48648,9 +48869,11 @@ var ts; // 1). import x = require("./mo/*gotToDefinitionHere*/d") // 2). External module name in an import declaration // 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 === 242 /* ImportDeclaration */ || node.parent.kind === 248 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) || - ((ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent))) { + ((node.parent.kind === 243 /* ImportDeclaration */ || node.parent.kind === 249 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((ts.isInJavaScriptFile(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); } // falls through @@ -48666,6 +48889,8 @@ var ts; case 89 /* FunctionKeyword */: case 36 /* EqualsGreaterThanToken */: return getSymbolOfNode(node.parent); + case 178 /* ImportType */: + return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined; default: return undefined; } @@ -48674,7 +48899,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 269 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 270 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 67216319 /* Value */ | 2097152 /* Alias */); } return undefined; @@ -48747,28 +48972,28 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 182 /* ObjectLiteralExpression */ || expr.kind === 181 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 183 /* ObjectLiteralExpression */ || expr.kind === 182 /* ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 220 /* ForOfStatement */) { + if (expr.parent.kind === 221 /* ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 198 /* BinaryExpression */) { + if (expr.parent.kind === 199 /* BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 268 /* PropertyAssignment */) { + if (expr.parent.kind === 269 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } // Array literal assignment - array destructuring pattern - ts.Debug.assert(expr.parent.kind === 181 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.parent.kind === 182 /* ArrayLiteralExpression */); // [{ property1: p1, property2 }] = elems; var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType; @@ -48847,7 +49072,7 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - var isPropertyName_1 = node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node; + var isPropertyName_1 = node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.name === node; return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } @@ -48904,7 +49129,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 272 /* SourceFile */) { + if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 273 /* 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. @@ -48959,7 +49184,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 211 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 212 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -49000,16 +49225,16 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 242 /* ImportEqualsDeclaration */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return node.expression && node.expression.kind === 71 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -49019,7 +49244,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 272 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 273 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -49099,15 +49324,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 271 /* EnumMember */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 272 /* EnumMember */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 271 /* EnumMember */) { + if (node.kind === 272 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -49274,7 +49499,7 @@ var ts; // populate reverse mapping: file path -> type reference directive that was resolved to this file fileToDirective = ts.createMap(); resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { - if (!resolvedDirective) { + if (!resolvedDirective || !resolvedDirective.resolvedFileName) { return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); @@ -49333,18 +49558,22 @@ var ts; }, getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; } }; + function isInHeritageClause(node) { + return node.parent && node.parent.kind === 206 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 267 /* HeritageClause */; + } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { // program does not have any files with type reference directives - bail out if (!fileToDirective) { return undefined; } - // property access can only be used as values + // property access can only be used as values, or types when within an expression with type arguments inside a heritage clause // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries - var meaning = (node.kind === 183 /* PropertyAccessExpression */) || (node.kind === 71 /* Identifier */ && isInTypeQuery(node)) - ? 67216319 /* Value */ | 1048576 /* ExportValue */ - : 67901928 /* Type */ | 1920 /* Namespace */; + var meaning = 67901928 /* Type */ | 1920 /* Namespace */; + if ((node.kind === 71 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 184 /* PropertyAccessExpression */ && !isInHeritageClause(node))) { + meaning = 67216319 /* Value */ | 1048576 /* ExportValue */; + } var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; } @@ -49393,7 +49622,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 272 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 273 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -49408,12 +49637,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 237 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 238 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 272 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 273 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -49591,7 +49820,7 @@ var ts; } switch (modifier.kind) { case 76 /* ConstKeyword */: - if (node.kind !== 236 /* EnumDeclaration */ && node.parent.kind === 233 /* ClassDeclaration */) { + if (node.kind !== 237 /* EnumDeclaration */ && node.parent.kind === 234 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(76 /* ConstKeyword */)); } break; @@ -49611,7 +49840,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + else if (node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -49634,7 +49863,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + else if (node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 148 /* Parameter */) { @@ -49670,7 +49899,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 148 /* Parameter */) { @@ -49679,8 +49908,8 @@ var ts; flags |= 1 /* Export */; break; case 79 /* DefaultKeyword */: - var container = node.parent.kind === 272 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 237 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 273 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 238 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } flags |= 512 /* Default */; @@ -49692,13 +49921,13 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 148 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 2097152 /* Ambient */) && node.parent.kind === 238 /* ModuleBlock */) { + else if ((node.parent.flags & 2097152 /* Ambient */) && node.parent.kind === 239 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -49708,14 +49937,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 233 /* ClassDeclaration */) { + if (node.kind !== 234 /* ClassDeclaration */) { if (node.kind !== 153 /* MethodDeclaration */ && node.kind !== 151 /* PropertyDeclaration */ && node.kind !== 155 /* GetAccessor */ && node.kind !== 156 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 233 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) { + if (!(node.parent.kind === 234 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -49757,7 +49986,7 @@ var ts; } return; } - else if ((node.kind === 242 /* ImportDeclaration */ || node.kind === 241 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 243 /* ImportDeclaration */ || node.kind === 242 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 148 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { @@ -49791,29 +50020,29 @@ var ts; case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 159 /* IndexSignature */: - case 237 /* ModuleDeclaration */: - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 238 /* ModuleDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 148 /* Parameter */: return false; default: - if (node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + if (node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { return false; } switch (node.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return nodeHasAnyModifiersExcept(node, 120 /* AsyncKeyword */); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return nodeHasAnyModifiersExcept(node, 117 /* AbstractKeyword */); - case 234 /* InterfaceDeclaration */: - case 212 /* VariableStatement */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 213 /* VariableStatement */: + case 236 /* TypeAliasDeclaration */: return true; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 76 /* ConstKeyword */); default: ts.Debug.fail(); @@ -49827,18 +50056,17 @@ var ts; function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 153 /* MethodDeclaration */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } - function checkGrammarForDisallowedTrailingComma(list) { + function checkGrammarForDisallowedTrailingComma(list, diag) { + if (diag === void 0) { diag = ts.Diagnostics.Trailing_comma_not_allowed; } if (list && list.hasTrailingComma) { - var start = list.end - ",".length; - var end = list.end; - return grammarErrorAtPos(list[0], start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); + return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag); } } function checkGrammarTypeParameterList(typeParameters, file) { @@ -49857,6 +50085,9 @@ var ts; if (i !== (parameterCount - 1)) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); } + if (!(parameter.flags & 2097152 /* Ambient */)) { // Allow `...foo,` in ambient declarations; see GH#23070 + checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + } if (ts.isBindingPattern(parameter.name)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } @@ -49927,7 +50158,7 @@ var ts; if (type.flags & 2 /* String */ || type.flags & 4 /* Number */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type))); } - if (allTypesAssignableToKind(type, 32 /* StringLiteral */, /*strict*/ true)) { + if (type.flags & 131072 /* Union */ && allTypesAssignableToKind(type, 32 /* StringLiteral */, /*strict*/ true)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead); } return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); @@ -49956,7 +50187,7 @@ var ts; if (args) { for (var _i = 0, args_5 = args; _i < args_5.length; _i++) { var arg = args_5[_i]; - if (arg.kind === 204 /* OmittedExpression */) { + if (arg.kind === 205 /* OmittedExpression */) { return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -50036,14 +50267,14 @@ var ts; return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 198 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 26 /* CommaToken */) { + if (computedPropertyName.expression.kind === 199 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 26 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 232 /* FunctionDeclaration */ || - node.kind === 190 /* FunctionExpression */ || + ts.Debug.assert(node.kind === 233 /* FunctionDeclaration */ || + node.kind === 191 /* FunctionExpression */ || node.kind === 153 /* MethodDeclaration */); if (node.flags & 2097152 /* Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); @@ -50069,7 +50300,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 270 /* SpreadAssignment */) { + if (prop.kind === 271 /* SpreadAssignment */) { continue; } var name = prop.name; @@ -50077,7 +50308,7 @@ var ts; // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 269 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 270 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -50101,8 +50332,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 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8 /* NumericLiteral */) { @@ -50152,7 +50383,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 262 /* JsxSpreadAttribute */) { + if (attr.kind === 263 /* JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -50162,7 +50393,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 263 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 264 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -50171,12 +50402,12 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 220 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 221 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) { return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); } } - if (forInOrOfStatement.initializer.kind === 231 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 232 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -50191,20 +50422,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 219 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 220 /* 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 === 219 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 220 /* 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 === 219 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 220 /* 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); @@ -50272,7 +50503,7 @@ var ts; } var parent = ts.walkUpParenthesizedTypes(node.parent); switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: var decl = parent; if (decl.name.kind !== 71 /* Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -50310,7 +50541,7 @@ var ts; return true; } if (node.kind === 153 /* MethodDeclaration */) { - if (node.parent.kind === 182 /* ObjectLiteralExpression */) { + if (node.parent.kind === 183 /* 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 === 120 /* AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -50339,7 +50570,7 @@ var ts; 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 === 234 /* InterfaceDeclaration */) { + else if (node.parent.kind === 235 /* 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 === 165 /* TypeLiteral */) { @@ -50353,11 +50584,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 226 /* LabeledStatement */: + case 227 /* 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 === 221 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 222 /* 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); @@ -50365,8 +50596,8 @@ var ts; return false; } break; - case 225 /* SwitchStatement */: - if (node.kind === 222 /* BreakStatement */ && !node.label) { + case 226 /* SwitchStatement */: + if (node.kind === 223 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -50381,13 +50612,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 222 /* BreakStatement */ + var message = node.kind === 223 /* 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 === 222 /* BreakStatement */ + var message = node.kind === 223 /* 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); @@ -50399,7 +50630,8 @@ var ts; if (node !== ts.last(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 179 /* ArrayBindingPattern */ || node.name.kind === 178 /* ObjectBindingPattern */) { + checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + if (node.name.kind === 180 /* ArrayBindingPattern */ || node.name.kind === 179 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.propertyName) { @@ -50413,11 +50645,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ || - expr.kind === 196 /* PrefixUnaryExpression */ && expr.operator === 38 /* MinusToken */ && + expr.kind === 197 /* PrefixUnaryExpression */ && expr.operator === 38 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 219 /* ForInStatement */ && node.parent.parent.kind !== 220 /* ForOfStatement */) { + if (node.parent.parent.kind !== 220 /* ForInStatement */ && node.parent.parent.kind !== 221 /* ForOfStatement */) { if (node.flags & 2097152 /* Ambient */) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -50446,7 +50678,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 212 /* VariableStatement */ || !node.type || node.initializer || node.flags & 2097152 /* Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 213 /* VariableStatement */ || !node.type || node.initializer || node.flags & 2097152 /* Ambient */)) { return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); } if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && @@ -50505,15 +50737,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 215 /* IfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 224 /* WithStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 216 /* IfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: return false; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -50579,7 +50811,7 @@ var ts; return true; } } - else if (node.parent.kind === 234 /* InterfaceDeclaration */) { + else if (node.parent.kind === 235 /* 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; } @@ -50616,13 +50848,13 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 234 /* InterfaceDeclaration */ || - node.kind === 235 /* TypeAliasDeclaration */ || - node.kind === 242 /* ImportDeclaration */ || - node.kind === 241 /* ImportEqualsDeclaration */ || - node.kind === 248 /* ExportDeclaration */ || - node.kind === 247 /* ExportAssignment */ || - node.kind === 240 /* NamespaceExportDeclaration */ || + if (node.kind === 235 /* InterfaceDeclaration */ || + node.kind === 236 /* TypeAliasDeclaration */ || + node.kind === 243 /* ImportDeclaration */ || + node.kind === 242 /* ImportEqualsDeclaration */ || + node.kind === 249 /* ExportDeclaration */ || + node.kind === 248 /* ExportAssignment */ || + node.kind === 241 /* NamespaceExportDeclaration */ || ts.hasModifier(node, 2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } @@ -50631,7 +50863,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 === 212 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 213 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -50657,7 +50889,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 === 211 /* Block */ || node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + if (node.parent.kind === 212 /* Block */ || node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -50681,7 +50913,7 @@ var ts; else if (ts.isChildOfNodeWithKind(node, 177 /* LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 271 /* EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 272 /* EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -50733,8 +50965,8 @@ var ts; /** 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 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -50742,14 +50974,14 @@ var ts; } function isSomeImportDeclaration(decl) { switch (decl.kind) { - case 243 /* ImportClause */: // For default import - case 241 /* ImportEqualsDeclaration */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: // For rename import `x as y` + case 244 /* ImportClause */: // For default import + case 242 /* ImportEqualsDeclaration */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: // For rename import `x as y` return true; case 71 /* Identifier */: // For regular import, `decl` is an Identifier under the ImportSpecifier. - return decl.parent.kind === 246 /* ImportSpecifier */; + return decl.parent.kind === 247 /* ImportSpecifier */; default: return false; } @@ -50760,7 +50992,7 @@ var ts; JsxNames.JSX = "JSX"; JsxNames.IntrinsicElements = "IntrinsicElements"; JsxNames.ElementClass = "ElementClass"; - JsxNames.ElementAttributesPropertyNameContainer = "ElementAttributesProperty"; + JsxNames.ElementAttributesPropertyNameContainer = "ElementAttributesProperty"; // TODO: Deprecate and remove support JsxNames.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute"; JsxNames.Element = "Element"; JsxNames.IntrinsicAttributes = "IntrinsicAttributes"; @@ -50916,12 +51148,19 @@ var ts; /** Create a unique name based on the supplied text. */ function createOptimisticUniqueName(text) { var name = createIdentifier(text); - name.autoGenerateFlags = 5 /* OptimisticUnique */; + name.autoGenerateFlags = 3 /* Unique */ | 32 /* Optimistic */; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createOptimisticUniqueName = createOptimisticUniqueName; + /** Create a unique name based on the supplied text. This does not consider names injected by the transformer. */ + function createFileLevelUniqueName(text) { + var name = createOptimisticUniqueName(text); + name.autoGenerateFlags |= 64 /* FileLevel */; + return name; + } + ts.createFileLevelUniqueName = createFileLevelUniqueName; function getGeneratedNameForNode(node, shouldSkipNameGenerationScope) { var name = createIdentifier(""); name.autoGenerateFlags = 4 /* Node */; @@ -51020,7 +51259,7 @@ var ts; ts.updateQualifiedName = updateQualifiedName; function parenthesizeForComputedName(expression) { return (ts.isBinaryExpression(expression) && expression.operatorToken.kind === 26 /* CommaToken */) || - expression.kind === 296 /* CommaListExpression */ ? + expression.kind === 297 /* CommaListExpression */ ? createParen(expression) : expression; } @@ -51448,6 +51687,24 @@ var ts; : node; } ts.updateInferTypeNode = updateInferTypeNode; + function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) { + var node = createSynthesizedNode(178 /* ImportType */); + node.argument = argument; + node.qualifier = qualifier; + node.typeArguments = asNodeArray(typeArguments); + node.isTypeOf = isTypeOf; + return node; + } + ts.createImportTypeNode = createImportTypeNode; + function updateImportTypeNode(node, argument, qualifier, typeArguments, isTypeOf) { + return node.argument !== argument + || node.qualifier !== qualifier + || node.typeArguments !== typeArguments + || node.isTypeOf !== isTypeOf + ? updateNode(createImportTypeNode(argument, qualifier, typeArguments, isTypeOf), node) + : node; + } + ts.updateImportTypeNode = updateImportTypeNode; function createParenthesizedType(type) { var node = createSynthesizedNode(172 /* ParenthesizedType */); node.type = type; @@ -51521,7 +51778,7 @@ var ts; ts.updateLiteralTypeNode = updateLiteralTypeNode; // Binding Patterns function createObjectBindingPattern(elements) { - var node = createSynthesizedNode(178 /* ObjectBindingPattern */); + var node = createSynthesizedNode(179 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); return node; } @@ -51533,7 +51790,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements) { - var node = createSynthesizedNode(179 /* ArrayBindingPattern */); + var node = createSynthesizedNode(180 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); return node; } @@ -51545,7 +51802,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createSynthesizedNode(180 /* BindingElement */); + var node = createSynthesizedNode(181 /* BindingElement */); node.dotDotDotToken = dotDotDotToken; node.propertyName = asName(propertyName); node.name = asName(name); @@ -51564,7 +51821,7 @@ var ts; ts.updateBindingElement = updateBindingElement; // Expression function createArrayLiteral(elements, multiLine) { - var node = createSynthesizedNode(181 /* ArrayLiteralExpression */); + var node = createSynthesizedNode(182 /* ArrayLiteralExpression */); node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) node.multiLine = true; @@ -51578,7 +51835,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, multiLine) { - var node = createSynthesizedNode(182 /* ObjectLiteralExpression */); + var node = createSynthesizedNode(183 /* ObjectLiteralExpression */); node.properties = createNodeArray(properties); if (multiLine) node.multiLine = true; @@ -51592,7 +51849,7 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name) { - var node = createSynthesizedNode(183 /* PropertyAccessExpression */); + var node = createSynthesizedNode(184 /* PropertyAccessExpression */); node.expression = ts.parenthesizeForAccess(expression); node.name = asName(name); setEmitFlags(node, 131072 /* NoIndentation */); @@ -51609,7 +51866,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index) { - var node = createSynthesizedNode(184 /* ElementAccessExpression */); + var node = createSynthesizedNode(185 /* ElementAccessExpression */); node.expression = ts.parenthesizeForAccess(expression); node.argumentExpression = asExpression(index); return node; @@ -51623,7 +51880,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(185 /* CallExpression */); + var node = createSynthesizedNode(186 /* CallExpression */); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); @@ -51639,7 +51896,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(186 /* NewExpression */); + var node = createSynthesizedNode(187 /* NewExpression */); node.expression = ts.parenthesizeForNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -51655,7 +51912,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, template) { - var node = createSynthesizedNode(187 /* TaggedTemplateExpression */); + var node = createSynthesizedNode(188 /* TaggedTemplateExpression */); node.tag = ts.parenthesizeForAccess(tag); node.template = template; return node; @@ -51669,7 +51926,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createTypeAssertion(type, expression) { - var node = createSynthesizedNode(188 /* TypeAssertionExpression */); + var node = createSynthesizedNode(189 /* TypeAssertionExpression */); node.type = type; node.expression = ts.parenthesizePrefixOperand(expression); return node; @@ -51683,7 +51940,7 @@ var ts; } ts.updateTypeAssertion = updateTypeAssertion; function createParen(expression) { - var node = createSynthesizedNode(189 /* ParenthesizedExpression */); + var node = createSynthesizedNode(190 /* ParenthesizedExpression */); node.expression = expression; return node; } @@ -51695,7 +51952,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(190 /* FunctionExpression */); + var node = createSynthesizedNode(191 /* FunctionExpression */); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -51719,7 +51976,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createSynthesizedNode(191 /* ArrowFunction */); + var node = createSynthesizedNode(192 /* ArrowFunction */); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); @@ -51753,7 +52010,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression) { - var node = createSynthesizedNode(192 /* DeleteExpression */); + var node = createSynthesizedNode(193 /* DeleteExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -51765,7 +52022,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression) { - var node = createSynthesizedNode(193 /* TypeOfExpression */); + var node = createSynthesizedNode(194 /* TypeOfExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -51777,7 +52034,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression) { - var node = createSynthesizedNode(194 /* VoidExpression */); + var node = createSynthesizedNode(195 /* VoidExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -51789,7 +52046,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression) { - var node = createSynthesizedNode(195 /* AwaitExpression */); + var node = createSynthesizedNode(196 /* AwaitExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -51801,7 +52058,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand) { - var node = createSynthesizedNode(196 /* PrefixUnaryExpression */); + var node = createSynthesizedNode(197 /* PrefixUnaryExpression */); node.operator = operator; node.operand = ts.parenthesizePrefixOperand(operand); return node; @@ -51814,7 +52071,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator) { - var node = createSynthesizedNode(197 /* PostfixUnaryExpression */); + var node = createSynthesizedNode(198 /* PostfixUnaryExpression */); node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -51827,7 +52084,7 @@ var ts; } ts.updatePostfix = updatePostfix; function createBinary(left, operator, right) { - var node = createSynthesizedNode(198 /* BinaryExpression */); + var node = createSynthesizedNode(199 /* BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); @@ -51844,7 +52101,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { - var node = createSynthesizedNode(199 /* ConditionalExpression */); + var node = createSynthesizedNode(200 /* ConditionalExpression */); node.condition = ts.parenthesizeForConditionalHead(condition); node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(55 /* QuestionToken */); node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); @@ -51874,7 +52131,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans) { - var node = createSynthesizedNode(200 /* TemplateExpression */); + var node = createSynthesizedNode(201 /* TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -51912,7 +52169,7 @@ var ts; } ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral; function createYield(asteriskTokenOrExpression, expression) { - var node = createSynthesizedNode(201 /* YieldExpression */); + var node = createSynthesizedNode(202 /* YieldExpression */); node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 39 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined; node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 39 /* AsteriskToken */ ? asteriskTokenOrExpression : expression; return node; @@ -51926,7 +52183,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression) { - var node = createSynthesizedNode(202 /* SpreadElement */); + var node = createSynthesizedNode(203 /* SpreadElement */); node.expression = ts.parenthesizeExpressionForList(expression); return node; } @@ -51938,7 +52195,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(203 /* ClassExpression */); + var node = createSynthesizedNode(204 /* ClassExpression */); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -51959,11 +52216,11 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression() { - return createSynthesizedNode(204 /* OmittedExpression */); + return createSynthesizedNode(205 /* OmittedExpression */); } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression) { - var node = createSynthesizedNode(205 /* ExpressionWithTypeArguments */); + var node = createSynthesizedNode(206 /* ExpressionWithTypeArguments */); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); return node; @@ -51977,7 +52234,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createAsExpression(expression, type) { - var node = createSynthesizedNode(206 /* AsExpression */); + var node = createSynthesizedNode(207 /* AsExpression */); node.expression = expression; node.type = type; return node; @@ -51991,7 +52248,7 @@ var ts; } ts.updateAsExpression = updateAsExpression; function createNonNullExpression(expression) { - var node = createSynthesizedNode(207 /* NonNullExpression */); + var node = createSynthesizedNode(208 /* NonNullExpression */); node.expression = ts.parenthesizeForAccess(expression); return node; } @@ -52003,7 +52260,7 @@ var ts; } ts.updateNonNullExpression = updateNonNullExpression; function createMetaProperty(keywordToken, name) { - var node = createSynthesizedNode(208 /* MetaProperty */); + var node = createSynthesizedNode(209 /* MetaProperty */); node.keywordToken = keywordToken; node.name = name; return node; @@ -52017,7 +52274,7 @@ var ts; ts.updateMetaProperty = updateMetaProperty; // Misc function createTemplateSpan(expression, literal) { - var node = createSynthesizedNode(209 /* TemplateSpan */); + var node = createSynthesizedNode(210 /* TemplateSpan */); node.expression = expression; node.literal = literal; return node; @@ -52031,12 +52288,12 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createSemicolonClassElement() { - return createSynthesizedNode(210 /* SemicolonClassElement */); + return createSynthesizedNode(211 /* SemicolonClassElement */); } ts.createSemicolonClassElement = createSemicolonClassElement; // Element function createBlock(statements, multiLine) { - var block = createSynthesizedNode(211 /* Block */); + var block = createSynthesizedNode(212 /* Block */); block.statements = createNodeArray(statements); if (multiLine) block.multiLine = multiLine; @@ -52050,7 +52307,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList) { - var node = createSynthesizedNode(212 /* VariableStatement */); + var node = createSynthesizedNode(213 /* VariableStatement */); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -52065,11 +52322,11 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createEmptyStatement() { - return createSynthesizedNode(213 /* EmptyStatement */); + return createSynthesizedNode(214 /* EmptyStatement */); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression) { - var node = createSynthesizedNode(214 /* ExpressionStatement */); + var node = createSynthesizedNode(215 /* ExpressionStatement */); node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -52081,7 +52338,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement) { - var node = createSynthesizedNode(215 /* IfStatement */); + var node = createSynthesizedNode(216 /* IfStatement */); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -52097,7 +52354,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression) { - var node = createSynthesizedNode(216 /* DoStatement */); + var node = createSynthesizedNode(217 /* DoStatement */); node.statement = statement; node.expression = expression; return node; @@ -52111,7 +52368,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement) { - var node = createSynthesizedNode(217 /* WhileStatement */); + var node = createSynthesizedNode(218 /* WhileStatement */); node.expression = expression; node.statement = statement; return node; @@ -52125,7 +52382,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement) { - var node = createSynthesizedNode(218 /* ForStatement */); + var node = createSynthesizedNode(219 /* ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -52143,7 +52400,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement) { - var node = createSynthesizedNode(219 /* ForInStatement */); + var node = createSynthesizedNode(220 /* ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -52159,7 +52416,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(awaitModifier, initializer, expression, statement) { - var node = createSynthesizedNode(220 /* ForOfStatement */); + var node = createSynthesizedNode(221 /* ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; @@ -52177,7 +52434,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label) { - var node = createSynthesizedNode(221 /* ContinueStatement */); + var node = createSynthesizedNode(222 /* ContinueStatement */); node.label = asName(label); return node; } @@ -52189,7 +52446,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label) { - var node = createSynthesizedNode(222 /* BreakStatement */); + var node = createSynthesizedNode(223 /* BreakStatement */); node.label = asName(label); return node; } @@ -52201,7 +52458,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression) { - var node = createSynthesizedNode(223 /* ReturnStatement */); + var node = createSynthesizedNode(224 /* ReturnStatement */); node.expression = expression; return node; } @@ -52213,7 +52470,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement) { - var node = createSynthesizedNode(224 /* WithStatement */); + var node = createSynthesizedNode(225 /* WithStatement */); node.expression = expression; node.statement = statement; return node; @@ -52227,7 +52484,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock) { - var node = createSynthesizedNode(225 /* SwitchStatement */); + var node = createSynthesizedNode(226 /* SwitchStatement */); node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -52241,7 +52498,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement) { - var node = createSynthesizedNode(226 /* LabeledStatement */); + var node = createSynthesizedNode(227 /* LabeledStatement */); node.label = asName(label); node.statement = statement; return node; @@ -52255,7 +52512,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression) { - var node = createSynthesizedNode(227 /* ThrowStatement */); + var node = createSynthesizedNode(228 /* ThrowStatement */); node.expression = expression; return node; } @@ -52267,7 +52524,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock) { - var node = createSynthesizedNode(228 /* TryStatement */); + var node = createSynthesizedNode(229 /* TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -52283,11 +52540,11 @@ var ts; } ts.updateTry = updateTry; function createDebuggerStatement() { - return createSynthesizedNode(229 /* DebuggerStatement */); + return createSynthesizedNode(230 /* DebuggerStatement */); } ts.createDebuggerStatement = createDebuggerStatement; function createVariableDeclaration(name, type, initializer) { - var node = createSynthesizedNode(230 /* VariableDeclaration */); + var node = createSynthesizedNode(231 /* VariableDeclaration */); node.name = asName(name); node.type = type; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -52303,7 +52560,7 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createVariableDeclarationList(declarations, flags) { - var node = createSynthesizedNode(231 /* VariableDeclarationList */); + var node = createSynthesizedNode(232 /* VariableDeclarationList */); node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); return node; @@ -52316,7 +52573,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(232 /* FunctionDeclaration */); + var node = createSynthesizedNode(233 /* FunctionDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; @@ -52342,7 +52599,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(233 /* ClassDeclaration */); + var node = createSynthesizedNode(234 /* ClassDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -52364,7 +52621,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(234 /* InterfaceDeclaration */); + var node = createSynthesizedNode(235 /* InterfaceDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -52386,7 +52643,7 @@ var ts; } ts.updateInterfaceDeclaration = updateInterfaceDeclaration; function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) { - var node = createSynthesizedNode(235 /* TypeAliasDeclaration */); + var node = createSynthesizedNode(236 /* TypeAliasDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -52406,7 +52663,7 @@ var ts; } ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration; function createEnumDeclaration(decorators, modifiers, name, members) { - var node = createSynthesizedNode(236 /* EnumDeclaration */); + var node = createSynthesizedNode(237 /* EnumDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -52424,7 +52681,7 @@ var ts; } ts.updateEnumDeclaration = updateEnumDeclaration; function createModuleDeclaration(decorators, modifiers, name, body, flags) { - var node = createSynthesizedNode(237 /* ModuleDeclaration */); + var node = createSynthesizedNode(238 /* ModuleDeclaration */); node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 512 /* GlobalAugmentation */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -52443,7 +52700,7 @@ var ts; } ts.updateModuleDeclaration = updateModuleDeclaration; function createModuleBlock(statements) { - var node = createSynthesizedNode(238 /* ModuleBlock */); + var node = createSynthesizedNode(239 /* ModuleBlock */); node.statements = createNodeArray(statements); return node; } @@ -52455,7 +52712,7 @@ var ts; } ts.updateModuleBlock = updateModuleBlock; function createCaseBlock(clauses) { - var node = createSynthesizedNode(239 /* CaseBlock */); + var node = createSynthesizedNode(240 /* CaseBlock */); node.clauses = createNodeArray(clauses); return node; } @@ -52467,7 +52724,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createNamespaceExportDeclaration(name) { - var node = createSynthesizedNode(240 /* NamespaceExportDeclaration */); + var node = createSynthesizedNode(241 /* NamespaceExportDeclaration */); node.name = asName(name); return node; } @@ -52479,7 +52736,7 @@ var ts; } ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration; function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { - var node = createSynthesizedNode(241 /* ImportEqualsDeclaration */); + var node = createSynthesizedNode(242 /* ImportEqualsDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -52497,7 +52754,7 @@ var ts; } ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { - var node = createSynthesizedNode(242 /* ImportDeclaration */); + var node = createSynthesizedNode(243 /* ImportDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; @@ -52515,7 +52772,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings) { - var node = createSynthesizedNode(243 /* ImportClause */); + var node = createSynthesizedNode(244 /* ImportClause */); node.name = name; node.namedBindings = namedBindings; return node; @@ -52529,7 +52786,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name) { - var node = createSynthesizedNode(244 /* NamespaceImport */); + var node = createSynthesizedNode(245 /* NamespaceImport */); node.name = name; return node; } @@ -52541,7 +52798,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements) { - var node = createSynthesizedNode(245 /* NamedImports */); + var node = createSynthesizedNode(246 /* NamedImports */); node.elements = createNodeArray(elements); return node; } @@ -52553,7 +52810,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name) { - var node = createSynthesizedNode(246 /* ImportSpecifier */); + var node = createSynthesizedNode(247 /* ImportSpecifier */); node.propertyName = propertyName; node.name = name; return node; @@ -52567,7 +52824,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression) { - var node = createSynthesizedNode(247 /* ExportAssignment */); + var node = createSynthesizedNode(248 /* ExportAssignment */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; @@ -52584,7 +52841,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { - var node = createSynthesizedNode(248 /* ExportDeclaration */); + var node = createSynthesizedNode(249 /* ExportDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; @@ -52602,7 +52859,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements) { - var node = createSynthesizedNode(249 /* NamedExports */); + var node = createSynthesizedNode(250 /* NamedExports */); node.elements = createNodeArray(elements); return node; } @@ -52614,7 +52871,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(propertyName, name) { - var node = createSynthesizedNode(250 /* ExportSpecifier */); + var node = createSynthesizedNode(251 /* ExportSpecifier */); node.propertyName = asName(propertyName); node.name = asName(name); return node; @@ -52629,7 +52886,7 @@ var ts; ts.updateExportSpecifier = updateExportSpecifier; // Module references function createExternalModuleReference(expression) { - var node = createSynthesizedNode(252 /* ExternalModuleReference */); + var node = createSynthesizedNode(253 /* ExternalModuleReference */); node.expression = expression; return node; } @@ -52642,7 +52899,7 @@ var ts; ts.updateExternalModuleReference = updateExternalModuleReference; // JSX function createJsxElement(openingElement, children, closingElement) { - var node = createSynthesizedNode(253 /* JsxElement */); + var node = createSynthesizedNode(254 /* JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -52658,7 +52915,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(254 /* JsxSelfClosingElement */); + var node = createSynthesizedNode(255 /* JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = typeArguments && createNodeArray(typeArguments); node.attributes = attributes; @@ -52674,7 +52931,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(255 /* JsxOpeningElement */); + var node = createSynthesizedNode(256 /* JsxOpeningElement */); node.tagName = tagName; node.typeArguments = typeArguments && createNodeArray(typeArguments); node.attributes = attributes; @@ -52690,7 +52947,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName) { - var node = createSynthesizedNode(256 /* JsxClosingElement */); + var node = createSynthesizedNode(257 /* JsxClosingElement */); node.tagName = tagName; return node; } @@ -52702,7 +52959,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxFragment(openingFragment, children, closingFragment) { - var node = createSynthesizedNode(257 /* JsxFragment */); + var node = createSynthesizedNode(258 /* JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -52718,7 +52975,7 @@ var ts; } ts.updateJsxFragment = updateJsxFragment; function createJsxAttribute(name, initializer) { - var node = createSynthesizedNode(260 /* JsxAttribute */); + var node = createSynthesizedNode(261 /* JsxAttribute */); node.name = name; node.initializer = initializer; return node; @@ -52732,7 +52989,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(261 /* JsxAttributes */); + var node = createSynthesizedNode(262 /* JsxAttributes */); node.properties = createNodeArray(properties); return node; } @@ -52744,7 +53001,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(262 /* JsxSpreadAttribute */); + var node = createSynthesizedNode(263 /* JsxSpreadAttribute */); node.expression = expression; return node; } @@ -52756,7 +53013,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(263 /* JsxExpression */); + var node = createSynthesizedNode(264 /* JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -52770,7 +53027,7 @@ var ts; ts.updateJsxExpression = updateJsxExpression; // Clauses function createCaseClause(expression, statements) { - var node = createSynthesizedNode(264 /* CaseClause */); + var node = createSynthesizedNode(265 /* CaseClause */); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -52784,7 +53041,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(265 /* DefaultClause */); + var node = createSynthesizedNode(266 /* DefaultClause */); node.statements = createNodeArray(statements); return node; } @@ -52796,7 +53053,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(266 /* HeritageClause */); + var node = createSynthesizedNode(267 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); return node; @@ -52809,7 +53066,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(267 /* CatchClause */); + var node = createSynthesizedNode(268 /* CatchClause */); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -52824,7 +53081,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(268 /* PropertyAssignment */); + var node = createSynthesizedNode(269 /* PropertyAssignment */); node.name = asName(name); node.questionToken = undefined; node.initializer = ts.parenthesizeExpressionForList(initializer); @@ -52839,7 +53096,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(269 /* ShorthandPropertyAssignment */); + var node = createSynthesizedNode(270 /* ShorthandPropertyAssignment */); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -52853,7 +53110,7 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(270 /* SpreadAssignment */); + var node = createSynthesizedNode(271 /* SpreadAssignment */); node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; return node; } @@ -52866,7 +53123,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; // Enum function createEnumMember(name, initializer) { - var node = createSynthesizedNode(271 /* EnumMember */); + var node = createSynthesizedNode(272 /* EnumMember */); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -52880,12 +53137,13 @@ var ts; } ts.updateEnumMember = updateEnumMember; // Top-level nodes - function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences) { + function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib) { if (node.statements !== statements || (isDeclarationFile !== undefined && node.isDeclarationFile !== isDeclarationFile) || (referencedFiles !== undefined && node.referencedFiles !== referencedFiles) || - (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences)) { - var updated = createSynthesizedNode(272 /* SourceFile */); + (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) || + (hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) { + var updated = createSynthesizedNode(273 /* SourceFile */); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -52895,6 +53153,7 @@ var ts; updated.isDeclarationFile = isDeclarationFile === undefined ? node.isDeclarationFile : isDeclarationFile; updated.referencedFiles = referencedFiles === undefined ? node.referencedFiles : referencedFiles; updated.typeReferenceDirectives = typeReferences === undefined ? node.typeReferenceDirectives : typeReferences; + updated.hasNoDefaultLib = hasNoDefaultLib === undefined ? node.hasNoDefaultLib : hasNoDefaultLib; if (node.amdDependencies !== undefined) updated.amdDependencies = node.amdDependencies; if (node.moduleName !== undefined) @@ -52903,8 +53162,6 @@ var ts; updated.languageVariant = node.languageVariant; if (node.renamedDependencies !== undefined) updated.renamedDependencies = node.renamedDependencies; - if (node.hasNoDefaultLib !== undefined) - updated.hasNoDefaultLib = node.hasNoDefaultLib; if (node.languageVersion !== undefined) updated.languageVersion = node.languageVersion; if (node.scriptKind !== undefined) @@ -52967,7 +53224,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createSynthesizedNode(294 /* NotEmittedStatement */); + var node = createSynthesizedNode(295 /* NotEmittedStatement */); node.original = original; setTextRange(node, original); return node; @@ -52979,7 +53236,7 @@ var ts; */ /* @internal */ function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(298 /* EndOfDeclarationMarker */); + var node = createSynthesizedNode(299 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -52991,7 +53248,7 @@ var ts; */ /* @internal */ function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(297 /* MergeDeclarationMarker */); + var node = createSynthesizedNode(298 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -53006,7 +53263,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(295 /* PartiallyEmittedExpression */); + var node = createSynthesizedNode(296 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; setTextRange(node, original); @@ -53022,7 +53279,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 296 /* CommaListExpression */) { + if (node.kind === 297 /* CommaListExpression */) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26 /* CommaToken */) { @@ -53032,7 +53289,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(296 /* CommaListExpression */); + var node = createSynthesizedNode(297 /* CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -53044,7 +53301,7 @@ var ts; } ts.updateCommaList = updateCommaList; function createBundle(sourceFiles) { - var node = ts.createNode(273 /* Bundle */); + var node = ts.createNode(274 /* Bundle */); node.sourceFiles = sourceFiles; return node; } @@ -53180,7 +53437,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 === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -53682,7 +53939,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 226 /* LabeledStatement */ + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 227 /* LabeledStatement */ ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -53700,13 +53957,13 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return false; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -53732,7 +53989,7 @@ var ts; } else { switch (callee.kind) { - case 183 /* PropertyAccessExpression */: { + case 184 /* PropertyAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a.b()` target is `(_a = a).b` and thisArg is `_a` thisArg = ts.createTempVariable(recordTempVariable); @@ -53745,7 +54002,7 @@ var ts; } break; } - case 184 /* ElementAccessExpression */: { + case 185 /* ElementAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a` thisArg = ts.createTempVariable(recordTempVariable); @@ -53805,9 +54062,9 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); case 153 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); @@ -54133,7 +54390,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 === 189 /* ParenthesizedExpression */) { + if (skipped.kind === 190 /* ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -54167,8 +54424,8 @@ 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(198 /* BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(198 /* BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(199 /* BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(199 /* BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { @@ -54177,7 +54434,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ - && operand.kind === 201 /* YieldExpression */) { + && operand.kind === 202 /* YieldExpression */) { return false; } return true; @@ -54265,7 +54522,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 198 /* BinaryExpression */ && node.operatorToken.kind === 37 /* PlusToken */) { + if (node.kind === 199 /* BinaryExpression */ && node.operatorToken.kind === 37 /* PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -54280,7 +54537,7 @@ var ts; return 0 /* Unknown */; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(199 /* ConditionalExpression */, 55 /* QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(200 /* ConditionalExpression */, 55 /* QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { @@ -54294,8 +54551,8 @@ var ts; // so in case when comma expression is introduced as a part of previous transformations // if should be wrapped in parens since comma operator has the lowest precedence var emittedExpression = ts.skipPartiallyEmittedExpressions(e); - return emittedExpression.kind === 198 /* BinaryExpression */ && emittedExpression.operatorToken.kind === 26 /* CommaToken */ || - emittedExpression.kind === 296 /* CommaListExpression */ + return emittedExpression.kind === 199 /* BinaryExpression */ && emittedExpression.operatorToken.kind === 26 /* CommaToken */ || + emittedExpression.kind === 297 /* CommaListExpression */ ? ts.createParen(e) : e; } @@ -54313,9 +54570,9 @@ var ts; */ function parenthesizeDefaultExpression(e) { var check = ts.skipPartiallyEmittedExpressions(e); - return (check.kind === 203 /* ClassExpression */ || - check.kind === 190 /* FunctionExpression */ || - check.kind === 296 /* CommaListExpression */ || + return (check.kind === 204 /* ClassExpression */ || + check.kind === 191 /* FunctionExpression */ || + check.kind === 297 /* CommaListExpression */ || ts.isBinaryExpression(check) && check.operatorToken.kind === 26 /* CommaToken */) ? ts.createParen(e) : e; @@ -54330,9 +54587,9 @@ var ts; function parenthesizeForNew(expression) { var leftmostExpr = getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: return ts.createParen(expression); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return !leftmostExpr.arguments ? ts.createParen(expression) : expression; @@ -54355,7 +54612,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 186 /* NewExpression */ || emittedExpression.arguments)) { + && (emittedExpression.kind !== 187 /* NewExpression */ || emittedExpression.arguments)) { return expression; } return ts.setTextRange(ts.createParen(expression), expression); @@ -54393,7 +54650,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(198 /* BinaryExpression */, 26 /* CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(199 /* BinaryExpression */, 26 /* CommaToken */); return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(ts.createParen(expression), expression); @@ -54404,14 +54661,14 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 190 /* FunctionExpression */ || kind === 191 /* ArrowFunction */) { + if (kind === 191 /* FunctionExpression */ || kind === 192 /* ArrowFunction */) { var mutableCall = ts.getMutableClone(emittedExpression); mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreateOuterExpressions(expression, mutableCall, 4 /* PartiallyEmittedExpressions */); } } var leftmostExpressionKind = getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 182 /* ObjectLiteralExpression */ || leftmostExpressionKind === 190 /* FunctionExpression */) { + if (leftmostExpressionKind === 183 /* ObjectLiteralExpression */ || leftmostExpressionKind === 191 /* FunctionExpression */) { return ts.setTextRange(ts.createParen(expression), expression); } return expression; @@ -54461,25 +54718,25 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: node = node.operand; continue; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: node = node.left; continue; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: node = node.condition; continue; - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 184 /* ElementAccessExpression */: - case 183 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 184 /* PropertyAccessExpression */: node = node.expression; continue; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -54487,7 +54744,7 @@ var ts; } } function parenthesizeConciseBody(body) { - if (!ts.isBlock(body) && getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 182 /* ObjectLiteralExpression */) { + if (!ts.isBlock(body) && getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 183 /* ObjectLiteralExpression */) { return ts.setTextRange(ts.createParen(body), body); } return body; @@ -54503,13 +54760,13 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 7 /* All */; } switch (node.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return (kinds & 1 /* Parentheses */) !== 0; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: - case 207 /* NonNullExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: + case 208 /* NonNullExpression */: return (kinds & 2 /* Assertions */) !== 0; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0; } return false; @@ -54534,7 +54791,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipAssertions(node) { - while (ts.isAssertionExpression(node) || node.kind === 207 /* NonNullExpression */) { + while (ts.isAssertionExpression(node) || node.kind === 208 /* NonNullExpression */) { node = node.expression; } return node; @@ -54542,11 +54799,11 @@ var ts; ts.skipAssertions = skipAssertions; function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 189 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression); - case 188 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 206 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); - case 207 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); - case 295 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 190 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression); + case 189 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 207 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); + case 208 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); + case 296 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -54564,7 +54821,7 @@ var ts; * the containing expression is created/updated. */ function isIgnorableParen(node) { - return node.kind === 189 /* ParenthesizedExpression */ + return node.kind === 190 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node) && ts.nodeIsSynthesized(ts.getSourceMapRange(node)) && ts.nodeIsSynthesized(ts.getCommentRange(node)) @@ -54629,10 +54886,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 242 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 243 /* ImportDeclaration */ && node.importClause) { return ts.getGeneratedNameForNode(node); } - if (node.kind === 248 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 249 /* ExportDeclaration */ && node.moduleSpecifier) { return ts.getGeneratedNameForNode(node); } return undefined; @@ -54750,7 +55007,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -54762,11 +55019,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -54799,11 +55056,11 @@ var ts; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { case 148 /* Parameter */: - case 180 /* BindingElement */: + case 181 /* BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 202 /* SpreadElement */: - case 270 /* SpreadAssignment */: + case 203 /* SpreadElement */: + case 271 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -54815,7 +55072,7 @@ var ts; */ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 180 /* BindingElement */: + case 181 /* BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -54827,7 +55084,7 @@ var ts; : propertyName; } break; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -54839,7 +55096,7 @@ var ts; : propertyName; } break; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -54857,13 +55114,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: - case 181 /* ArrayLiteralExpression */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: + case 182 /* ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -54903,11 +55160,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 179 /* ArrayBindingPattern */: - case 181 /* ArrayLiteralExpression */: + case 180 /* ArrayBindingPattern */: + case 182 /* ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 178 /* ObjectBindingPattern */: - case 182 /* ObjectLiteralExpression */: + case 179 /* ObjectBindingPattern */: + case 183 /* ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -55135,6 +55392,8 @@ var ts; return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode)); case 171 /* InferType */: return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + case 178 /* ImportType */: + return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); case 172 /* ParenthesizedType */: return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode)); case 174 /* TypeOperator */: @@ -55146,195 +55405,195 @@ var ts; case 177 /* LiteralType */: return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); // Binding patterns - case 178 /* ObjectBindingPattern */: + case 179 /* ObjectBindingPattern */: return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 179 /* ArrayBindingPattern */: + case 180 /* ArrayBindingPattern */: return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); // Expression - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context)); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken)); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression)); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 206 /* AsExpression */: + case 207 /* AsExpression */: return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier)); // Misc - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); // Element - case 211 /* Block */: + case 212 /* Block */: return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 245 /* NamedImports */: + case 246 /* NamedImports */: return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 249 /* NamedExports */: + case 250 /* NamedExports */: return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 250 /* ExportSpecifier */: + case 251 /* ExportSpecifier */: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); // Module references - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); // JSX - case 253 /* JsxElement */: + case 254 /* JsxElement */: return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); - case 255 /* JsxOpeningElement */: + case 256 /* JsxOpeningElement */: return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 264 /* CaseClause */: + case 265 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Enum - case 271 /* EnumMember */: + case 272 /* EnumMember */: return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); // Top-level nodes - case 272 /* SourceFile */: + case 273 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: // No need to visit nodes with no children. @@ -55386,11 +55645,11 @@ var ts; var result = initial; switch (node.kind) { // Leaf nodes - case 210 /* SemicolonClassElement */: - case 213 /* EmptyStatement */: - case 204 /* OmittedExpression */: - case 229 /* DebuggerStatement */: - case 294 /* NotEmittedStatement */: + case 211 /* SemicolonClassElement */: + case 214 /* EmptyStatement */: + case 205 /* OmittedExpression */: + case 230 /* DebuggerStatement */: + case 295 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names @@ -55457,49 +55716,49 @@ var ts; result = reduceNode(node.body, cbNode, result); break; // Binding patterns - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: result = reduceNodes(node.elements, cbNodes, result); break; - case 180 /* BindingElement */: + case 181 /* BindingElement */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Expression - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: result = reduceNodes(node.elements, cbNodes, result); break; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: result = reduceNodes(node.properties, cbNodes, result); break; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 185 /* CallExpression */: + case 186 /* CallExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 186 /* NewExpression */: + case 187 /* NewExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: result = reduceNode(node.type, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -55507,123 +55766,123 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 189 /* ParenthesizedExpression */: - case 192 /* DeleteExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 195 /* AwaitExpression */: - case 201 /* YieldExpression */: - case 202 /* SpreadElement */: - case 207 /* NonNullExpression */: + case 190 /* ParenthesizedExpression */: + case 193 /* DeleteExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 196 /* AwaitExpression */: + case 202 /* YieldExpression */: + case 203 /* SpreadElement */: + case 208 /* NonNullExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: result = reduceNode(node.operand, cbNode, result); break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 206 /* AsExpression */: + case 207 /* AsExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.type, cbNode, result); break; // Misc - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; // Element - case 211 /* Block */: + case 212 /* Block */: result = reduceNodes(node.statements, cbNodes, result); break; - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 215 /* IfStatement */: + case 216 /* IfStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 216 /* DoStatement */: + case 217 /* DoStatement */: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 217 /* WhileStatement */: - case 224 /* WithStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 218 /* ForStatement */: + case 219 /* ForStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 223 /* ReturnStatement */: - case 227 /* ThrowStatement */: + case 224 /* ReturnStatement */: + case 228 /* ThrowStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 228 /* TryStatement */: + case 229 /* TryStatement */: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: result = reduceNodes(node.declarations, cbNodes, result); break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -55632,7 +55891,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -55640,139 +55899,139 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.members, cbNodes, result); break; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: result = reduceNodes(node.statements, cbNodes, result); break; - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: result = reduceNodes(node.clauses, cbNodes, result); break; - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.moduleReference, cbNode, result); break; - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 243 /* ImportClause */: + case 244 /* ImportClause */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: result = reduceNode(node.name, cbNode, result); break; - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: result = reduceNodes(node.elements, cbNodes, result); break; - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; // Module references - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: result = reduceNode(node.expression, cbNode, result); break; // JSX - case 253 /* JsxElement */: + case 254 /* JsxElement */: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: result = reduceNode(node.openingFragment, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingFragment, cbNode, result); break; - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: result = reduceNodes(node.properties, cbNodes, result); break; - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 264 /* CaseClause */: + case 265 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // falls through - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 267 /* CatchClause */: + case 268 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Enum - case 271 /* EnumMember */: + case 272 /* EnumMember */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Top-level nodes - case 272 /* SourceFile */: + case 273 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -55845,7 +56104,7 @@ var ts; function aggregateTransformFlagsForSubtree(node) { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 205 /* ExpressionWithTypeArguments */)) { + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 206 /* ExpressionWithTypeArguments */)) { return 0 /* None */; } // Aggregate the transform flags of each child. @@ -55978,21 +56237,21 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" // import { x, y } from "mod" externalImports.push(node); - hasImportStarOrImportDefault = getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); + hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); break; - case 241 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 252 /* ExternalModuleReference */) { + case 242 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 253 /* ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -56022,13 +56281,13 @@ var ts; } } break; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: if (ts.hasModifier(node, 1 /* Export */)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -56036,7 +56295,7 @@ var ts; } } break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default function() { } @@ -56056,7 +56315,7 @@ var ts; } } break; - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default class { } @@ -56130,6 +56389,26 @@ var ts; ts.isIdentifier(expression); } ts.isSimpleCopiableExpression = isSimpleCopiableExpression; + /** + * @param input Template string input strings + * @param args Names which need to be made file-level unique + */ + function helperString(input) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return function (uniqueName) { + var result = ""; + for (var i = 0; i < args.length; i++) { + result += input[i]; + result += uniqueName(args[i]); + } + result += input[input.length - 1]; + return result; + }; + } + ts.helperString = helperString; })(ts || (ts = {})); /// /// @@ -56656,8 +56935,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(184 /* ElementAccessExpression */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(185 /* ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -56726,15 +57005,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 272 /* SourceFile */: - case 239 /* CaseBlock */: - case 238 /* ModuleBlock */: - case 211 /* Block */: + case 273 /* SourceFile */: + case 240 /* CaseBlock */: + case 239 /* ModuleBlock */: + case 212 /* Block */: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 233 /* ClassDeclaration */: - case 232 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: + case 233 /* FunctionDeclaration */: if (ts.hasModifier(node, 2 /* Ambient */)) { break; } @@ -56746,7 +57025,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 === 233 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */)); + ts.Debug.assert(node.kind === 234 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */)); } break; } @@ -56790,10 +57069,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 247 /* ExportAssignment */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 248 /* ExportAssignment */: + case 249 /* ExportDeclaration */: return visitEllidableStatement(node); default: return visitorWorker(node); @@ -56814,13 +57093,13 @@ var ts; return node; } switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -56840,11 +57119,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 248 /* ExportDeclaration */ || - node.kind === 242 /* ImportDeclaration */ || - node.kind === 243 /* ImportClause */ || - (node.kind === 241 /* ImportEqualsDeclaration */ && - node.moduleReference.kind === 252 /* ExternalModuleReference */)) { + if (node.kind === 249 /* ExportDeclaration */ || + node.kind === 243 /* ImportDeclaration */ || + node.kind === 244 /* ImportClause */ || + (node.kind === 242 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 253 /* ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -56886,7 +57165,7 @@ var ts; case 153 /* MethodDeclaration */: // Fallback to the default visit behavior. return visitorWorker(node); - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: return node; default: return ts.Debug.failBadSyntaxKind(node); @@ -56955,22 +57234,22 @@ var ts; // TypeScript index signatures are elided. case 149 /* Decorator */: // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return undefined; case 151 /* PropertyDeclaration */: // TypeScript property declarations are elided. However their names are still visited, and can potentially be retained if they could have sideeffects return visitPropertyDeclaration(node); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; case 154 /* Constructor */: return visitConstructor(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return ts.createNotEmittedStatement(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: // This is a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -56981,7 +57260,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: // This is a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -56992,13 +57271,13 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); case 153 /* MethodDeclaration */: @@ -57011,13 +57290,13 @@ var ts; case 156 /* SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); case 148 /* Parameter */: @@ -57030,33 +57309,33 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return visitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return visitNewExpression(node); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); default: @@ -57537,7 +57816,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 214 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 215 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -58051,8 +58330,8 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: @@ -58074,8 +58353,8 @@ var ts; return serializeTypeNode(node.type); case 156 /* SetAccessor */: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: case 153 /* MethodDeclaration */: return ts.createIdentifier("Function"); default: @@ -58884,12 +59163,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentScope.kind === 272 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); + ], currentScope.kind === 273 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 236 /* EnumDeclaration */) { + if (node.kind === 237 /* EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -59008,7 +59287,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 238 /* ModuleBlock */) { + if (body.kind === 239 /* ModuleBlock */) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -59054,13 +59333,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 (body.kind !== 238 /* ModuleBlock */) { + if (body.kind !== 239 /* ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 237 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 238 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -59101,7 +59380,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 244 /* NamespaceImport */) { + if (node.kind === 245 /* NamespaceImport */) { // Elide a namespace import if it is not referenced. return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } @@ -59333,16 +59612,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(71 /* Identifier */); - context.enableSubstitution(269 /* ShorthandPropertyAssignment */); + context.enableSubstitution(270 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(237 /* ModuleDeclaration */); + context.enableEmitNotification(238 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 237 /* ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 238 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 236 /* EnumDeclaration */; + return ts.getOriginalNode(node).kind === 237 /* EnumDeclaration */; } /** * Hook for node emit. @@ -59403,9 +59682,9 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return substituteExpressionIdentifier(node); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -59443,9 +59722,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 !== 272 /* SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 237 /* ModuleDeclaration */) || - (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 236 /* EnumDeclaration */); + if (container && container.kind !== 273 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 238 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 237 /* EnumDeclaration */); if (substitute) { return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), /*location*/ node); @@ -59582,15 +59861,15 @@ var ts; case 120 /* AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return visitAwaitExpression(node); case 153 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return visitArrowFunction(node); default: return ts.visitEachChild(node, visitor, context); @@ -59599,27 +59878,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatementInAsyncBody(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatementInAsyncBody(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClauseInAsyncBody(node); - case 211 /* Block */: - case 225 /* SwitchStatement */: - case 239 /* CaseBlock */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: - case 228 /* TryStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 215 /* IfStatement */: - case 224 /* WithStatement */: - case 226 /* LabeledStatement */: + case 212 /* Block */: + case 226 /* SwitchStatement */: + case 240 /* CaseBlock */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: + case 229 /* TryStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 216 /* IfStatement */: + case 225 /* WithStatement */: + case 227 /* LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -59819,7 +60098,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 191 /* ArrowFunction */; + var isArrowFunction = node.kind === 192 /* ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* 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 @@ -59892,11 +60171,11 @@ var ts; enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(185 /* CallExpression */); - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(184 /* ElementAccessExpression */); + context.enableSubstitution(186 /* CallExpression */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(185 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(233 /* ClassDeclaration */); + context.enableEmitNotification(234 /* ClassDeclaration */); context.enableEmitNotification(153 /* MethodDeclaration */); context.enableEmitNotification(155 /* GetAccessor */); context.enableEmitNotification(156 /* SetAccessor */); @@ -59940,11 +60219,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return substituteCallExpression(node); } return node; @@ -59976,7 +60255,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 233 /* ClassDeclaration */ + return kind === 234 /* ClassDeclaration */ || kind === 154 /* Constructor */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ @@ -59984,11 +60263,11 @@ var ts; } function createSuperAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) { - return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createFileLevelUniqueName("_super"), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } else { - return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), + return ts.setTextRange(ts.createCall(ts.createFileLevelUniqueName("_super"), /*typeArguments*/ undefined, [argumentExpression]), location); } } @@ -60021,12 +60300,12 @@ var ts; ts.asyncSuperHelper = { name: "typescript:async-super", scoped: true, - text: "\n const _super = name => super[name];" + text: ts.helperString(__makeTemplateObject(["\n const ", " = name => super[name];"], ["\n const ", " = name => super[name];"]), "_super") }; ts.advancedAsyncSuperHelper = { name: "typescript:advanced-async-super", scoped: true, - text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" + text: ts.helperString(__makeTemplateObject(["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"], ["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"]), "_super") }; })(ts || (ts = {})); /// @@ -60078,23 +60357,23 @@ var ts; return node; } switch (node.kind) { - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return visitAwaitExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitYieldExpression(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node, noDestructuringValue); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return visitVoidExpression(node); case 154 /* Constructor */: return visitConstructorDeclaration(node); @@ -60104,19 +60383,19 @@ var ts; return visitGetAccessorDeclaration(node); case 156 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return visitArrowFunction(node); case 148 /* Parameter */: return visitParameter(node); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return visitExpressionStatement(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -60139,7 +60418,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 220 /* ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 221 /* ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node); @@ -60151,7 +60430,7 @@ var ts; var objects = []; for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { var e = elements_4[_i]; - if (e.kind === 270 /* SpreadAssignment */) { + if (e.kind === 271 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -60160,7 +60439,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 268 /* PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 269 /* PropertyAssignment */ ? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -60178,7 +60457,7 @@ var ts; // If the first element is a spread element, then the first argument to __assign is {}: // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 182 /* ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 183 /* ObjectLiteralExpression */) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -60257,6 +60536,11 @@ var ts; bodyLocation = node.statement; statementsLocation = node.statement.statements; } + else if (node.statement) { + ts.append(statements, node.statement); + bodyLocation = node.statement; + statementsLocation = node.statement; + } return ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer) ], 1 /* Let */), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), @@ -60486,11 +60770,11 @@ var ts; enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(185 /* CallExpression */); - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(184 /* ElementAccessExpression */); + context.enableSubstitution(186 /* CallExpression */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(185 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(233 /* ClassDeclaration */); + context.enableEmitNotification(234 /* ClassDeclaration */); context.enableEmitNotification(153 /* MethodDeclaration */); context.enableEmitNotification(155 /* GetAccessor */); context.enableEmitNotification(156 /* SetAccessor */); @@ -60534,11 +60818,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return substituteCallExpression(node); } return node; @@ -60570,7 +60854,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 233 /* ClassDeclaration */ + return kind === 234 /* ClassDeclaration */ || kind === 154 /* Constructor */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ @@ -60686,13 +60970,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 253 /* JsxElement */: + case 254 /* JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -60702,13 +60986,13 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return visitJsxExpression(node); - case 253 /* JsxElement */: + case 254 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -60781,7 +61065,7 @@ var ts; literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile); return ts.setTextRange(literal, node); } - else if (node.kind === 263 /* JsxExpression */) { + else if (node.kind === 264 /* JsxExpression */) { if (node.expression === undefined) { return ts.createTrue(); } @@ -60875,7 +61159,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 253 /* JsxElement */) { + if (node.kind === 254 /* JsxElement */) { return getTagName(node.openingElement); } else { @@ -61183,7 +61467,7 @@ var ts; return node; } switch (node.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -61419,13 +61703,13 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ - && node.kind === 223 /* ReturnStatement */ + && node.kind === 224 /* ReturnStatement */ && !node.expression; } function shouldVisitNode(node) { return (node.transformFlags & 128 /* ContainsES2015 */) !== 0 || convertedLoopState !== undefined - || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 211 /* Block */))) + || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 212 /* Block */))) || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)) || (ts.getEmitFlags(node) & 33554432 /* TypeScriptClassWrapper */) !== 0; } @@ -61453,63 +61737,63 @@ var ts; switch (node.kind) { case 115 /* StaticKeyword */: return undefined; // elide static keyword - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return visitClassDeclaration(node); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return visitClassExpression(node); case 148 /* Parameter */: return visitParameter(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return visitArrowFunction(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitVariableDeclaration(node); case 71 /* Identifier */: return visitIdentifier(node); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitSwitchStatement(node); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return visitCaseBlock(node); - case 211 /* Block */: + case 212 /* Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: return visitBreakOrContinueStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return visitExpressionStatement(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClause(node); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); case 146 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return visitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return visitNewExpression(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node, /*needsDestructuringValue*/ true); case 13 /* NoSubstitutionTemplateLiteral */: case 14 /* TemplateHead */: @@ -61520,28 +61804,28 @@ var ts; return visitStringLiteral(node); case 8 /* NumericLiteral */: return visitNumericLiteral(node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return visitTemplateExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitYieldExpression(node); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return visitSpreadElement(node); case 97 /* SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 99 /* ThisKeyword */: return visitThisKeyword(node); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return visitMetaProperty(node); case 153 /* MethodDeclaration */: return visitMethodDeclaration(node); case 155 /* GetAccessor */: case 156 /* SetAccessor */: return visitAccessorDeclaration(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); @@ -61580,7 +61864,7 @@ var ts; return updated; } function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + return ts.setOriginalNode(ts.createReturn(ts.createFileLevelUniqueName("_this")), node); } function visitReturnStatement(node) { if (convertedLoopState) { @@ -61628,13 +61912,13 @@ 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 === 222 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var jump = node.kind === 223 /* BreakStatement */ ? 2 /* Break */ : 4 /* 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; if (!node.label) { - if (node.kind === 222 /* BreakStatement */) { + if (node.kind === 223 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } @@ -61645,7 +61929,7 @@ var ts; } } else { - if (node.kind === 222 /* BreakStatement */) { + if (node.kind === 223 /* BreakStatement */) { labelMarker = "break-" + node.label.escapedText; setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(node.label), labelMarker); } @@ -61767,7 +62051,7 @@ var ts; /*modifiers*/ undefined, /*asteriskToken*/ undefined, /*name*/ undefined, - /*typeParameters*/ undefined, extendsClauseElement ? [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "_super")] : [], + /*typeParameters*/ undefined, extendsClauseElement ? [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, ts.createFileLevelUniqueName("_super"))] : [], /*type*/ undefined, transformClassBody(node, extendsClauseElement)); // To preserve the behavior of the old emitter, we explicitly indent // the body of the function here if it was requested in an earlier @@ -61923,7 +62207,7 @@ var ts; if (isDerivedClass && superCaptureStatus !== 2 /* ReplaceWithReturn */ && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { - statements.push(ts.createReturn(ts.createIdentifier("_this"))); + statements.push(ts.createReturn(ts.createFileLevelUniqueName("_this"))); } ts.addRange(statements, endLexicalEnvironment()); if (constructor) { @@ -61945,11 +62229,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 223 /* ReturnStatement */) { + if (statement.kind === 224 /* ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 215 /* IfStatement */) { + else if (statement.kind === 216 /* IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -61957,7 +62241,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 211 /* Block */) { + else if (statement.kind === 212 /* Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -62015,7 +62299,7 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 214 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { + if (firstStatement.kind === 215 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } @@ -62025,8 +62309,8 @@ var ts; && statementOffset === ctorStatements.length - 1 && !(ctor.transformFlags & (16384 /* ContainsLexicalThis */ | 32768 /* ContainsCapturedLexicalThis */))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 198 /* BinaryExpression */ - || superCallExpression.left.kind !== 185 /* CallExpression */) { + if (superCallExpression.kind !== 199 /* BinaryExpression */ + || superCallExpression.left.kind !== 186 /* CallExpression */) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } // Shift comments from the original super call to the return statement. @@ -62046,7 +62330,7 @@ var ts; return ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */); } function createDefaultSuperCallOrThis() { - return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createFileLevelUniqueName("_super"), ts.createNull()), ts.createFunctionApply(ts.createFileLevelUniqueName("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } /** * Visits a parameter declaration. @@ -62223,7 +62507,7 @@ var ts; * @param node A node. */ function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 191 /* ArrowFunction */) { + if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 192 /* ArrowFunction */) { captureThisForNode(statements, node, ts.createThis()); } } @@ -62231,7 +62515,7 @@ var ts; enableSubstitutionsForCapturedThis(); var captureThisStatement = ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("_this", + ts.createVariableDeclaration(ts.createFileLevelUniqueName("_this"), /*type*/ undefined, initializer) ])); ts.setEmitFlags(captureThisStatement, 1536 /* NoComments */ | 1048576 /* CustomPrologue */); @@ -62243,7 +62527,7 @@ var ts; if (hierarchyFacts & 16384 /* NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return statements; case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: @@ -62257,8 +62541,8 @@ var ts; // should be relatively safe to use. newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"); break; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* 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 = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 93 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); @@ -62268,7 +62552,7 @@ var ts; } var captureNewTargetStatement = ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("_newTarget", + ts.createVariableDeclaration(ts.createFileLevelUniqueName("_newTarget"), /*type*/ undefined, newTarget) ])); if (copyOnWrite) { @@ -62289,7 +62573,7 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; case 153 /* MethodDeclaration */: @@ -62494,7 +62778,7 @@ var ts; : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 232 /* FunctionDeclaration */ || node.kind === 190 /* FunctionExpression */)) { + if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 233 /* FunctionDeclaration */ || node.kind === 191 /* FunctionExpression */)) { name = ts.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); @@ -62542,7 +62826,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 191 /* ArrowFunction */); + ts.Debug.assert(node.kind === 192 /* 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 @@ -62609,9 +62893,9 @@ var ts; function visitExpressionStatement(node) { // If we are here it is most likely because our expression is a destructuring assignment. switch (node.expression.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } return ts.visitEachChild(node, visitor, context); @@ -62630,9 +62914,9 @@ var ts; // expression. If we are in a state where we do not need the destructuring value, // we pass that information along to the children that care about it. switch (node.expression.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } } @@ -62834,14 +63118,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -63098,11 +63382,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 231 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 232 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -63392,10 +63676,10 @@ var ts; case 153 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -63722,7 +64006,7 @@ var ts; ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var initializer = ts.createLogicalOr(resultingCall, actualThis); resultingCall = assignToCapturedThis - ? ts.createAssignment(ts.createIdentifier("_this"), initializer) + ? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer) : initializer; } return ts.setOriginalNode(resultingCall, node); @@ -63782,7 +64066,7 @@ var ts; else { if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 181 /* ArrayLiteralExpression */ + return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 182 /* ArrayLiteralExpression */ ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -63993,8 +64277,8 @@ var ts; function visitSuperKeyword(isExpressionOfCall) { return hierarchyFacts & 8 /* NonStaticClassElement */ && !isExpressionOfCall - ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") - : ts.createIdentifier("_super"); + ? ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), "prototype") + : ts.createFileLevelUniqueName("_super"); } function visitMetaProperty(node) { if (node.keywordToken === 94 /* NewKeyword */ && node.name.escapedText === "target") { @@ -64004,7 +64288,7 @@ var ts; else { hierarchyFacts |= 16384 /* NewTarget */; } - return ts.createIdentifier("_newTarget"); + return ts.createFileLevelUniqueName("_newTarget"); } return node; } @@ -64049,9 +64333,9 @@ var ts; context.enableEmitNotification(153 /* MethodDeclaration */); context.enableEmitNotification(155 /* GetAccessor */); context.enableEmitNotification(156 /* SetAccessor */); - context.enableEmitNotification(191 /* ArrowFunction */); - context.enableEmitNotification(190 /* FunctionExpression */); - context.enableEmitNotification(232 /* FunctionDeclaration */); + context.enableEmitNotification(192 /* ArrowFunction */); + context.enableEmitNotification(191 /* FunctionExpression */); + context.enableEmitNotification(233 /* FunctionDeclaration */); } } /** @@ -64093,10 +64377,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 180 /* BindingElement */: - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 230 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 231 /* VariableDeclaration */: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -64161,7 +64445,7 @@ var ts; function substituteThisKeyword(node) { if (enabledSubstitutions & 1 /* CapturedThis */ && hierarchyFacts & 16 /* CapturesThis */) { - return ts.setTextRange(ts.createIdentifier("_this"), node); + return ts.setTextRange(ts.createFileLevelUniqueName("_this"), node); } return node; } @@ -64178,11 +64462,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 214 /* ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 215 /* ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 185 /* CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 186 /* CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -64190,7 +64474,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 202 /* SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 203 /* SpreadElement */) { return false; } var expression = callArgument.expression; @@ -64203,7 +64487,7 @@ var ts; return ts.createCall(ts.getHelperName("__extends"), /*typeArguments*/ undefined, [ name, - ts.createIdentifier("_super") + ts.createFileLevelUniqueName("_super") ]); } function createTemplateObjectHelper(context, cooked, raw) { @@ -64245,15 +64529,15 @@ var ts; if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(255 /* JsxOpeningElement */); - context.enableEmitNotification(256 /* JsxClosingElement */); - context.enableEmitNotification(254 /* JsxSelfClosingElement */); + context.enableEmitNotification(256 /* JsxOpeningElement */); + context.enableEmitNotification(257 /* JsxClosingElement */); + context.enableEmitNotification(255 /* JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(268 /* PropertyAssignment */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(269 /* PropertyAssignment */); return transformSourceFile; /** * Transforms an ES5 source file to ES3. @@ -64272,9 +64556,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 255 /* JsxOpeningElement */: - case 256 /* JsxClosingElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 257 /* JsxClosingElement */: + case 255 /* JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -64607,13 +64891,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 216 /* DoStatement */: + case 217 /* DoStatement */: return visitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return visitWhileStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -64626,24 +64910,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); case 155 /* GetAccessor */: case 156 /* SetAccessor */: return visitAccessorDeclaration(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return visitBreakStatement(node); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return visitContinueStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 16777216 /* ContainsYield */) { @@ -64664,21 +64948,21 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return visitConditionalExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitYieldExpression(node); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return visitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -64691,9 +64975,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -64920,7 +65204,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: // [source] // a.b = yield; // @@ -64932,7 +65216,7 @@ var ts; // _a.b = %sent%; target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: // [source] // a[b] = yield; // @@ -65308,35 +65592,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 211 /* Block */: + case 212 /* Block */: return transformAndEmitBlock(node); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return transformAndEmitIfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return transformAndEmitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return transformAndEmitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return transformAndEmitWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -65766,7 +66050,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 265 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 266 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -65779,7 +66063,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 264 /* CaseClause */) { + if (clause.kind === 265 /* CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -67010,11 +67294,11 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(71 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(198 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(196 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(197 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(269 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(272 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(199 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(197 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(198 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(270 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(273 /* 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. @@ -67336,23 +67620,23 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return visitExportDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return visitClassDeclaration(node); - case 297 /* MergeDeclarationMarker */: + case 298 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 298 /* EndOfDeclarationMarker */: + case 299 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -67801,7 +68085,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 212 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 213 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -67856,10 +68140,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 245 /* NamedImports */: + case 246 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -68058,7 +68342,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -68122,10 +68406,10 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return substituteExpressionIdentifier(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return substituteBinaryExpression(node); - case 197 /* PostfixUnaryExpression */: - case 196 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -68146,7 +68430,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 272 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 273 /* SourceFile */) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), /*location*/ node); } @@ -68221,7 +68505,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 197 /* PostfixUnaryExpression */ + var expression = node.kind === 198 /* PostfixUnaryExpression */ ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 43 /* PlusPlusToken */ ? 59 /* PlusEqualsToken */ : 60 /* MinusEqualsToken */), ts.createLiteral(1)), /*location*/ node) : node; @@ -68300,11 +68584,11 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(71 /* Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(269 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(198 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(196 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(197 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(272 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(270 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(199 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(197 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(198 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableEmitNotification(273 /* 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. @@ -68525,7 +68809,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 248 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 249 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -68550,7 +68834,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 248 /* ExportDeclaration */) { + if (externalImport.kind !== 249 /* ExportDeclaration */) { continue; } if (!externalImport.exportClause) { @@ -68628,19 +68912,19 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -68690,15 +68974,15 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: // ExportDeclarations are elided as they are handled via // `appendExportsOfDeclaration`. return undefined; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -68874,7 +69158,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 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 272 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 273 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -68938,7 +69222,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 === 212 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 213 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -68969,6 +69253,12 @@ var ts; delete deferredExports[id]; return ts.append(statements, node); } + else { + var original = ts.getOriginalNode(node); + if (ts.isModuleOrEnumDeclaration(original)) { + return ts.append(appendExportsOfDeclaration(statements, original), node); + } + } return node; } /** @@ -68994,10 +69284,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 245 /* NamedImports */: + case 246 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -69177,43 +69467,43 @@ var ts; */ function nestedElementVisitor(node) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return visitClassDeclaration(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return visitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return visitWhileStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return visitWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitSwitchStatement(node); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return visitCaseBlock(node); - case 264 /* CaseClause */: + case 265 /* CaseClause */: return visitCaseClause(node); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return visitDefaultClause(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return visitTryStatement(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClause(node); - case 211 /* Block */: + case 212 /* Block */: return visitBlock(node); - case 297 /* MergeDeclarationMarker */: + case 298 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 298 /* EndOfDeclarationMarker */: + case 299 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -69399,7 +69689,7 @@ var ts; */ function destructuringAndImportCallVisitor(node) { if (node.transformFlags & 1024 /* DestructuringAssignment */ - && node.kind === 198 /* BinaryExpression */) { + && node.kind === 199 /* BinaryExpression */) { return visitDestructuringAssignment(node); } else if (ts.isImportCall(node)) { @@ -69464,7 +69754,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 272 /* SourceFile */; + return container !== undefined && container.kind === 273 /* SourceFile */; } else { return false; @@ -69497,7 +69787,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -69545,7 +69835,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -69581,10 +69871,10 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return substituteExpressionIdentifier(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return substituteBinaryExpression(node); - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -69677,14 +69967,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 197 /* PostfixUnaryExpression */ + var expression = node.kind === 198 /* PostfixUnaryExpression */ ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 197 /* PostfixUnaryExpression */) { + if (node.kind === 198 /* PostfixUnaryExpression */) { expression = node.operator === 43 /* PlusPlusToken */ ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -69706,7 +69996,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 272 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 273 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -69747,7 +70037,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(272 /* SourceFile */); + context.enableEmitNotification(273 /* SourceFile */); context.enableSubstitution(71 /* Identifier */); var currentSourceFile; return transformSourceFile; @@ -69776,10 +70066,10 @@ var ts; } function visitor(node) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // Elide `import=` as it is not legal with --module ES6 return undefined; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); } return node; @@ -69886,7 +70176,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 === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -69915,7 +70205,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 === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -69962,7 +70252,7 @@ var ts; ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */) { + if (node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -69981,7 +70271,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 === 233 /* ClassDeclaration */ || node.kind === 148 /* Parameter */) { + else if (node.parent.kind === 234 /* ClassDeclaration */ || node.kind === 148 /* Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -70072,7 +70362,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 === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* 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 : @@ -70086,7 +70376,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -70142,7 +70432,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 === 233 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 234 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* 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 : @@ -70155,7 +70445,7 @@ 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 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 162 /* FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -70170,10 +70460,10 @@ 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 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 158 /* ConstructSignature */: @@ -70187,17 +70477,17 @@ var ts; if (ts.hasModifier(node.parent, 32 /* Static */)) { 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 === 233 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 234 /* 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 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -70212,7 +70502,7 @@ var ts; function getHeritageClauseVisibilityError() { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 233 /* ClassDeclaration */) { + if (node.parent.parent.kind === 234 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = node.parent.token === 108 /* ImplementsKeyword */ ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -70351,15 +70641,17 @@ var ts; } } function transformRoot(node) { - if (node.kind === 272 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) { + if (node.kind === 273 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) { return node; } - if (node.kind === 273 /* Bundle */) { + if (node.kind === 274 /* Bundle */) { isBundledEmit = true; var refs_1 = ts.createMap(); + var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) return; // Omit declaration files from bundle results, too + hasNoDefaultLib_1 = hasNoDefaultLib_1 || sourceFile.hasNoDefaultLib; currentSourceFile = sourceFile; enclosingDeclaration = sourceFile; possibleImports = undefined; @@ -70371,15 +70663,16 @@ 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_5 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements_5)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ []); + var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements_5)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false); return newFile; } needsDeclare = true; var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - return ts.updateSourceFileNode(sourceFile, updated, /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ []); + return ts.updateSourceFileNode(sourceFile, updated, /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false); })); bundle.syntheticFileReferences = []; bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences(); + bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, /*forceDtsPaths*/ true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); refs_1.forEach(referenceVisitor_1); @@ -70403,15 +70696,29 @@ var ts; refs.forEach(referenceVisitor); var statements = ts.visitNodes(node.statements, visitDeclarationStatements); var combinedStatements = ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements)), node.statements); + var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax); if (ts.isExternalModule(node) && !resultHasExternalModuleIndicator) { combinedStatements = ts.setTextRange(ts.createNodeArray(combinedStatements.concat([ts.createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createNamedExports([]), /*moduleSpecifier*/ undefined)])), combinedStatements); } - var updated = ts.updateSourceFileNode(node, combinedStatements, /*isDeclarationFile*/ true, references, getFileReferencesForUsedTypeReferences()); + var updated = ts.updateSourceFileNode(node, combinedStatements, /*isDeclarationFile*/ true, references, getFileReferencesForUsedTypeReferences(), node.hasNoDefaultLib); return updated; function getFileReferencesForUsedTypeReferences() { - return necessaryTypeRefernces ? ts.map(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : []; + return necessaryTypeRefernces ? ts.mapDefined(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : []; } function getFileReferenceForTypeName(typeName) { + // Elide type references for which we have imports + for (var _i = 0, emittedImports_1 = emittedImports; _i < emittedImports_1.length; _i++) { + var importStatement = emittedImports_1[_i]; + if (ts.isImportEqualsDeclaration(importStatement) && ts.isExternalModuleReference(importStatement.moduleReference)) { + var expr = importStatement.moduleReference.expression; + if (ts.isStringLiteralLike(expr) && expr.text === typeName) { + return undefined; + } + } + else if (ts.isImportDeclaration(importStatement) && ts.isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) { + return undefined; + } + } return { fileName: typeName, pos: -1, end: -1 }; } function mapReferencesIntoArray(references, outputFilePath) { @@ -70453,7 +70760,7 @@ var ts; return name; } else { - if (name.kind === 179 /* ArrayBindingPattern */) { + if (name.kind === 180 /* ArrayBindingPattern */) { return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -70461,7 +70768,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 204 /* OmittedExpression */) { + if (elem.kind === 205 /* OmittedExpression */) { return elem; } return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined); @@ -70519,7 +70826,7 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */) { + if (node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } if (node.kind === 148 /* Parameter */ @@ -70541,20 +70848,20 @@ var ts; function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 237 /* ModuleDeclaration */: - case 234 /* InterfaceDeclaration */: - case 233 /* ClassDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: + case 233 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 235 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return !getBindingNameVisible(node); - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: return false; } return false; @@ -70608,7 +70915,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return; - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 237 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 238 /* ModuleDeclaration */ && parent.kind !== 178 /* ImportType */); if (input.kind === 9 /* StringLiteral */ && isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); if (newName) { @@ -70620,7 +70927,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 252 /* ExternalModuleReference */) { + if (decl.moduleReference.kind === 253 /* ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return ts.updateImportEqualsDeclaration(decl, @@ -70647,7 +70954,7 @@ var ts; return visibleDefaultBinding && ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier)); } - if (decl.importClause.namedBindings.kind === 244 /* NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 245 /* NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined; @@ -70683,7 +70990,7 @@ var ts; continue; } // Eagerly transform import equals - if they're not visible, we'll get nothing, if they are, we'll immediately add them since it's complete - if (i.kind === 241 /* ImportEqualsDeclaration */) { + if (i.kind === 242 /* ImportEqualsDeclaration */) { var result_3 = transformImportEqualsDeclaration(i); importDeclarationMap.set("" + ts.getNodeId(i), result_3); continue; @@ -70742,7 +71049,7 @@ var ts; if (ts.hasModifier(input, 8 /* Private */)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) return; // Elide all but the first overload - return cleanup(ts.createProperty(/*decorators*/ undefined, input.modifiers, input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined)); + return cleanup(ts.createProperty(/*decorators*/ undefined, ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined)); } } var canProdiceDiagnostic = ts.canProduceDiagnostics(input); @@ -70753,14 +71060,14 @@ var ts; checkEntityNameVisibility(input.exprName, enclosingDeclaration); } var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 165 /* TypeLiteral */ || input.kind === 176 /* MappedType */) && input.parent.kind !== 235 /* TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 165 /* TypeLiteral */ || input.kind === 176 /* MappedType */) && input.parent.kind !== 236 /* TypeAliasDeclaration */); if (shouldEnterSuppressNewDiagnosticsContextContext) { // We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do. suppressNewDiagnosticContexts = true; } if (isProcessedComponent(input)) { switch (input.kind) { - case 205 /* ExpressionWithTypeArguments */: { + case 206 /* ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } @@ -70812,7 +71119,7 @@ var ts; return cleanup(ts.updateIndexSignature(input, /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(119 /* AnyKeyword */))); } - case 230 /* VariableDeclaration */: { + case 231 /* VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -70844,6 +71151,11 @@ var ts; case 163 /* ConstructorType */: { return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } + case 178 /* ImportType */: { + if (!ts.isLiteralImportTypeNode(input)) + return cleanup(input); + return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); + } default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]); } } @@ -70878,7 +71190,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 248 /* ExportDeclaration */: { + case 249 /* ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -70886,7 +71198,7 @@ var ts; // Rewrite external module names if necessary return ts.updateExportDeclaration(input, /*decorators*/ undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier)); } - case 247 /* ExportAssignment */: { + case 248 /* ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -70905,8 +71217,8 @@ var ts; return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)]; } } - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: { + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: { // Different parts of the import may be marked visible at different times (via visibility checking), so we defer our first look until later // to reduce the likelihood we need to rewrite it possibleImports = possibleImports || []; @@ -70932,27 +71244,27 @@ var ts; } var oldPossibleImports; switch (input.kind) { - case 235 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all + case 236 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all return cleanup(ts.updateTypeAliasDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 234 /* InterfaceDeclaration */: { + case 235 /* InterfaceDeclaration */: { return cleanup(ts.updateInterfaceDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 232 /* FunctionDeclaration */: { + case 233 /* FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type return cleanup(ts.updateFunctionDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), /*body*/ undefined)); } - case 237 /* ModuleDeclaration */: { + case 238 /* ModuleDeclaration */: { previousNeedsDeclare = needsDeclare; needsDeclare = false; oldPossibleImports = possibleImports; possibleImports = undefined; var inner = input.body; - if (inner && inner.kind === 238 /* ModuleBlock */) { + if (inner && inner.kind === 239 /* ModuleBlock */) { var statements = ts.visitNodes(inner.statements, visitDeclarationStatements); var body = ts.updateModuleBlock(inner, filterCandidateImports(statements)); needsDeclare = previousNeedsDeclare; @@ -70968,7 +71280,7 @@ var ts; /*decorators*/ undefined, mods, input.name, ts.visitNode(inner, visitDeclarationStatements))); } } - case 233 /* ClassDeclaration */: { + case 234 /* ClassDeclaration */: { var modifiers = ts.createNodeArray(ensureModifiers(input)); var typeParameters = ensureTypeParams(input, input.typeParameters); var ctor = ts.getFirstConstructorWithBody(input); @@ -71038,7 +71350,7 @@ var ts; /*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 212 /* VariableStatement */: { + case 213 /* VariableStatement */: { if (!ts.forEach(input.declarationList.declarations, getBindingNameVisible)) return; var nodes = ts.visitNodes(input.declarationList.declarations, visitDeclarationSubtree); @@ -71046,7 +71358,7 @@ var ts; return; return cleanup(ts.updateVariableStatement(input, ts.createNodeArray(ensureModifiers(input)), ts.updateVariableDeclarationList(input.declarationList, nodes))); } - case 236 /* EnumDeclaration */: { + case 237 /* EnumDeclaration */: { return cleanup(ts.updateEnumDeclaration(input, /*decorators*/ undefined, ts.createNodeArray(ensureModifiers(input)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -71062,7 +71374,7 @@ var ts; if (isEnclosingDeclaration(input)) { enclosingDeclaration = previousEnclosingDeclaration; } - if (input.kind === 237 /* ModuleDeclaration */) { + if (input.kind === 238 /* ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; possibleImports = ts.concatenate(oldPossibleImports, possibleImports); } @@ -71085,7 +71397,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 204 /* OmittedExpression */) { + if (e.kind === 205 /* OmittedExpression */) { return; } if (e.name) { @@ -71139,7 +71451,7 @@ var ts; function ensureModifierFlags(node) { var mask = 3071 /* All */ ^ (4 /* Public */ | 256 /* Async */); // No async modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */; - var parentIsFile = node.parent.kind === 272 /* SourceFile */; + var parentIsFile = node.parent.kind === 273 /* SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= ((isBundledEmit && parentIsFile ? 0 : 1 /* Export */) | 512 /* Default */ | 2 /* Ambient */); additions = 0 /* None */; @@ -71187,7 +71499,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 234 /* InterfaceDeclaration */) { + if (node.kind === 235 /* InterfaceDeclaration */) { return true; } return false; @@ -71216,7 +71528,7 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 148 /* Parameter */: @@ -71226,17 +71538,17 @@ var ts; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 237 /* ModuleDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 234 /* InterfaceDeclaration */: - case 233 /* ClassDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: - case 212 /* VariableStatement */: - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: + case 233 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 235 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: + case 213 /* VariableStatement */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: return true; } return false; @@ -71253,13 +71565,14 @@ var ts; case 152 /* MethodSignature */: case 157 /* CallSignature */: case 159 /* IndexSignature */: - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 147 /* TypeParameter */: - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: case 161 /* TypeReference */: case 170 /* ConditionalType */: case 162 /* FunctionType */: case 163 /* ConstructorType */: + case 178 /* ImportType */: return true; } return false; @@ -71349,7 +71662,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(299 /* Count */); + var enabledSyntaxKindFeatures = new Array(300 /* Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -71695,7 +72008,7 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (sourceFileOrBundle.kind === 272 /* SourceFile */) { // emitting single module file + if (sourceFileOrBundle.kind === 273 /* SourceFile */) { // emitting single module file // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); @@ -71845,7 +72158,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 294 /* NotEmittedStatement */ + if (node.kind !== 295 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -71862,7 +72175,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 294 /* NotEmittedStatement */ + if (node.kind !== 295 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -72039,7 +72352,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 294 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 295 /* NotEmittedStatement */; // We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation. // It is expensive to walk entire tree just to set one kind of node to have no comments. var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 10 /* JsxText */; @@ -72060,7 +72373,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 === 231 /* VariableDeclarationList */) { + if (node.kind === 232 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -72404,7 +72717,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 273 /* Bundle */) { + if (sourceFile.kind === 274 /* Bundle */) { var jsFilePath = options.outFile || options.out; var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); var declarationFilePath = (forceDtsPaths || options.declaration) ? ts.removeFileExtension(jsFilePath) + ".d.ts" /* Dts */ : undefined; @@ -72446,7 +72759,6 @@ var ts; // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); - var moduleKind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); @@ -72459,9 +72771,6 @@ var ts; mapRoot: compilerOptions.mapRoot, extendedDiagnostics: compilerOptions.extendedDiagnostics, }); - var currentSourceFile; - var bundledHelpers; - var isOwnFileEmit; var emitSkipped = false; // Emit each output file ts.performance.mark("beforePrint"); @@ -72502,7 +72811,7 @@ var ts; // Transform the source files var transform = ts.transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, /*allowDtsFiles*/ false); // Create a printer to print the nodes - var printer = createPrinter(compilerOptions, { + var printer = createPrinter(__assign({}, compilerOptions, { noEmitHelpers: compilerOptions.noEmitHelpers }), { // resolver hooks hasGlobalName: resolver.hasGlobalName, // transform hooks @@ -72513,7 +72822,6 @@ var ts; onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, onEmitSourceMapOfPosition: sourceMap.emitPos, // emitter hooks - onEmitHelpers: emitHelpers, onSetSourceFile: setSourceFile, }); printSourceFileOrBundle(jsFilePath, sourceMapFilePath, ts.isSourceFile(sourceFileOrBundle) ? transform.transformed[0] : ts.createBundle(transform.transformed), printer, sourceMap); @@ -72535,7 +72843,7 @@ var ts; emitterDiagnostics.add(diagnostic); } } - var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: true }), { + var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: true, noEmitHelpers: true }), { // resolver hooks hasGlobalName: resolver.hasGlobalName, // sourcemap hooks @@ -72555,17 +72863,14 @@ var ts; declarationTransform.dispose(); } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapRecorder) { - var bundle = sourceFileOrBundle.kind === 273 /* Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 272 /* SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 274 /* Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 273 /* SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; mapRecorder.initialize(jsFilePath, sourceMapFilePath || "", sourceFileOrBundle, sourceMapDataList); if (bundle) { - bundledHelpers = ts.createMap(); - isOwnFileEmit = false; printer.writeBundle(bundle, writer); } else { - isOwnFileEmit = true; printer.writeFile(sourceFile, writer); } writer.writeLine(); @@ -72582,66 +72887,19 @@ var ts; // Reset state mapRecorder.reset(); writer.clear(); - currentSourceFile = undefined; - bundledHelpers = undefined; - isOwnFileEmit = false; } function setSourceFile(node) { - currentSourceFile = node; sourceMap.setSourceFile(node); } function setSourceFileForDeclarationSourceMaps(node) { - currentSourceFile = node; declarationSourceMap.setSourceFile(node); } - function emitHelpers(node, writeLines) { - var helpersEmitted = false; - var bundle = node.kind === 273 /* Bundle */ ? node : undefined; - if (bundle && moduleKind === ts.ModuleKind.None) { - return; - } - var numNodes = bundle ? bundle.sourceFiles.length : 1; - for (var i = 0; i < numNodes; i++) { - var currentNode = bundle ? bundle.sourceFiles[i] : node; - var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; - var shouldSkip = compilerOptions.noEmitHelpers || ts.getExternalHelpersModuleName(sourceFile) !== undefined; - var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; - var helpers = ts.getEmitHelpers(currentNode); - if (helpers) { - for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { - var helper = _b[_a]; - if (!helper.scoped) { - // Skip the helper if it can be skipped and the noEmitHelpers compiler - // option is set, or if it can be imported and the importHelpers compiler - // option is set. - if (shouldSkip) - continue; - // Skip the helper if it can be bundled but hasn't already been emitted and we - // are emitting a bundled module. - if (shouldBundle) { - if (bundledHelpers.get(helper.name)) { - continue; - } - bundledHelpers.set(helper.name, true); - } - } - else if (bundle) { - // Skip the helper if it is scoped and we are emitting bundled helpers - continue; - } - writeLines(helper.text); - helpersEmitted = true; - } - } - } - return helpersEmitted; - } } ts.emitFiles = emitFiles; function createPrinter(printerOptions, handlers) { if (printerOptions === void 0) { printerOptions = {}; } if (handlers === void 0) { handlers = {}; } - var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onEmitHelpers = handlers.onEmitHelpers, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; + var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; var newLine = ts.getNewLineCharacter(printerOptions); var comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition); var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition; @@ -72664,6 +72922,9 @@ var ts; writeSemicolon = deferWriteSemicolon; } var syntheticParent = { pos: -1, end: -1 }; + var moduleKind = ts.getEmitModuleKind(printerOptions); + var bundledHelpers = ts.createMap(); + var isOwnFileEmit; reset(); return { // public API @@ -72690,8 +72951,8 @@ var ts; break; } switch (node.kind) { - case 272 /* SourceFile */: return printFile(node); - case 273 /* Bundle */: return printBundle(node); + case 273 /* SourceFile */: return printFile(node); + case 274 /* Bundle */: return printBundle(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -72726,11 +72987,12 @@ var ts; writer = previousWriter; } function writeBundle(bundle, output) { + isOwnFileEmit = false; var previousWriter = writer; setWriter(output); emitShebangIfNeeded(bundle); emitPrologueDirectivesIfNeeded(bundle); - emitHelpersIndirect(bundle); + emitHelpers(bundle); emitSyntheticTripleSlashReferencesIfNeeded(bundle); for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) { var sourceFile = _b[_a]; @@ -72740,6 +73002,7 @@ var ts; writer = previousWriter; } function writeFile(sourceFile, output) { + isOwnFileEmit = true; var previousWriter = writer; setWriter(output); emitShebangIfNeeded(sourceFile); @@ -72846,7 +73109,7 @@ var ts; writeSpace(); writeKeyword("in"); writeSpace(); - emit(node.constraint); + emitIfPresent(node.constraint); } function pipelineEmitUnspecified(node) { var kind = node.kind; @@ -72906,7 +73169,7 @@ var ts; return emitTypeReference(node); case 162 /* FunctionType */: return emitFunctionType(node); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return emitJSDocFunctionType(node); case 163 /* ConstructorType */: return emitConstructorType(node); @@ -72928,7 +73191,7 @@ var ts; return emitInferType(node); case 172 /* ParenthesizedType */: return emitParenthesizedType(node); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); case 173 /* ThisType */: return emitThisType(); @@ -72940,154 +73203,156 @@ var ts; return emitMappedType(node); case 177 /* LiteralType */: return emitLiteralType(node); - case 275 /* JSDocAllType */: + case 178 /* ImportType */: + return emitImportTypeNode(node); + case 276 /* JSDocAllType */: write("*"); return; - case 276 /* JSDocUnknownType */: + case 277 /* JSDocUnknownType */: write("?"); return; - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return emitJSDocNullableType(node); - case 278 /* JSDocNonNullableType */: + case 279 /* JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return emitJSDocOptionalType(node); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return emitJSDocVariadicType(node); // Binding patterns - case 178 /* ObjectBindingPattern */: + case 179 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 179 /* ArrayBindingPattern */: + case 180 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return emitBindingElement(node); // Misc - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return emitTemplateSpan(node); - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 211 /* Block */: + case 212 /* Block */: return emitBlock(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return emitVariableStatement(node); - case 213 /* EmptyStatement */: + case 214 /* EmptyStatement */: return emitEmptyStatement(); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return emitExpressionStatement(node); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return emitIfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return emitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return emitWhileStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return emitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return emitForInStatement(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return emitForOfStatement(node); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return emitContinueStatement(node); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return emitBreakStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return emitReturnStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return emitWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return emitSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return emitLabeledStatement(node); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return emitThrowStatement(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return emitTryStatement(node); - case 229 /* DebuggerStatement */: + case 230 /* DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return emitClassDeclaration(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return emitModuleBlock(node); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return emitCaseBlock(node); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return emitImportDeclaration(node); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return emitImportClause(node); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return emitNamespaceImport(node); - case 245 /* NamedImports */: + case 246 /* NamedImports */: return emitNamedImports(node); - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return emitImportSpecifier(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return emitExportAssignment(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return emitExportDeclaration(node); - case 249 /* NamedExports */: + case 250 /* NamedExports */: return emitNamedExports(node); - case 250 /* ExportSpecifier */: + case 251 /* ExportSpecifier */: return emitExportSpecifier(node); - case 251 /* MissingDeclaration */: + case 252 /* MissingDeclaration */: return; // Module references - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 10 /* JsxText */: return emitJsxText(node); - case 255 /* JsxOpeningElement */: - case 258 /* JsxOpeningFragment */: + case 256 /* JsxOpeningElement */: + case 259 /* JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 256 /* JsxClosingElement */: - case 259 /* JsxClosingFragment */: + case 257 /* JsxClosingElement */: + case 260 /* JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return emitJsxAttribute(node); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return emitJsxAttributes(node); - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 264 /* CaseClause */: + case 265 /* CaseClause */: return emitCaseClause(node); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return emitDefaultClause(node); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return emitHeritageClause(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 271 /* EnumMember */: + case 272 /* EnumMember */: return emitEnumMember(node); // JSDoc nodes (ignored) // Transformation nodes (ignored) @@ -73125,81 +73390,123 @@ var ts; writeTokenNode(node, writeKeyword); return; // Expressions - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return emitElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return emitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return emitNewExpression(node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return emitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return emitArrowFunction(node); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return emitDeleteExpression(node); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return emitVoidExpression(node); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return emitAwaitExpression(node); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return emitBinaryExpression(node); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return emitConditionalExpression(node); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return emitTemplateExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return emitYieldExpression(node); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return emitSpreadExpression(node); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return emitClassExpression(node); - case 204 /* OmittedExpression */: + case 205 /* OmittedExpression */: return; - case 206 /* AsExpression */: + case 207 /* AsExpression */: return emitAsExpression(node); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return emitNonNullExpression(node); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return emitMetaProperty(node); // JSX - case 253 /* JsxElement */: + case 254 /* JsxElement */: return emitJsxElement(node); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return emitJsxFragment(node); // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return emitCommaList(node); } } function trySubstituteNode(hint, node) { return node && substituteNode && substituteNode(hint, node) || node; } - function emitHelpersIndirect(node) { - if (onEmitHelpers) { - onEmitHelpers(node, writeLines); + function emitHelpers(node) { + var helpersEmitted = false; + var bundle = node.kind === 274 /* Bundle */ ? node : undefined; + if (bundle && moduleKind === ts.ModuleKind.None) { + return; } + var numNodes = bundle ? bundle.sourceFiles.length : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? bundle.sourceFiles[i] : node; + var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; + var shouldSkip = printerOptions.noEmitHelpers || ts.getExternalHelpersModuleName(sourceFile) !== undefined; + var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; + var helpers = ts.getEmitHelpers(currentNode); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + // Skip the helper if it can be skipped and the noEmitHelpers compiler + // option is set, or if it can be imported and the importHelpers compiler + // option is set. + if (shouldSkip) + continue; + // Skip the helper if it can be bundled but hasn't already been emitted and we + // are emitting a bundled module. + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } + else if (bundle) { + // Skip the helper if it is scoped and we are emitting bundled helpers + continue; + } + if (typeof helper.text === "string") { + writeLines(helper.text); + } + else { + writeLines(helper.text(makeFileLevelOptmiisticUniqueName)); + } + helpersEmitted = true; + } + } + } + return helpersEmitted; } // // Literals/Pseudo-literals @@ -73280,8 +73587,8 @@ var ts; emitNodeWithWriter(node.name, writeParameter); } emitIfPresent(node.questionToken); - if (node.parent && node.parent.kind === 280 /* JSDocFunctionType */ && !node.name) { - emit(node.type); + if (node.parent && node.parent.kind === 281 /* JSDocFunctionType */ && !node.name) { + emitIfPresent(node.type); } else { emitTypeAnnotation(node.type); @@ -73393,13 +73700,13 @@ var ts; writeSpace(); writePunctuation("=>"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); } function emitJSDocFunctionType(node) { write("function"); emitParameters(node, node.parameters); write(":"); - emit(node.type); + emitIfPresent(node.type); } function emitJSDocNullableType(node) { write("?"); @@ -73421,7 +73728,7 @@ var ts; writeSpace(); writePunctuation("=>"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); } function emitTypeQuery(node) { writeKeyword("typeof"); @@ -73521,7 +73828,7 @@ var ts; } writePunctuation(":"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); writeSemicolon(); if (emitFlags & 1 /* SingleLine */) { writeSpace(); @@ -73535,6 +73842,21 @@ var ts; function emitLiteralType(node) { emitExpression(node.literal); } + function emitImportTypeNode(node) { + if (node.isTypeOf) { + writeKeyword("typeof"); + writeSpace(); + } + writeKeyword("import"); + writePunctuation("("); + emit(node.argument); + writePunctuation(")"); + if (node.qualifier) { + writePunctuation("."); + emit(node.qualifier); + } + emitTypeArguments(node, node.typeArguments); + } // // Binding patterns // @@ -73710,7 +74032,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 === 196 /* PrefixUnaryExpression */ + return operand.kind === 197 /* PrefixUnaryExpression */ && ((node.operator === 37 /* PlusToken */ && (operand.operator === 37 /* PlusToken */ || operand.operator === 43 /* PlusPlusToken */)) || (node.operator === 38 /* MinusToken */ && (operand.operator === 38 /* MinusToken */ || operand.operator === 44 /* MinusMinusToken */))); } @@ -73754,7 +74076,7 @@ var ts; } function emitYieldExpression(node) { emitTokenWithComment(116 /* YieldKeyword */, node.pos, writeKeyword, node); - emit(node.asteriskToken); + emitIfPresent(node.asteriskToken); emitExpressionWithLeadingSpace(node.expression); } function emitSpreadExpression(node) { @@ -73827,7 +74149,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node); emitTokenWithComment(82 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 215 /* IfStatement */) { + if (node.elseStatement.kind === 216 /* IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -73898,7 +74220,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 231 /* VariableDeclarationList */) { + if (node.kind === 232 /* VariableDeclarationList */) { emit(node); } else { @@ -74109,7 +74431,7 @@ var ts; // Emit all the prologue directives (like "use strict"). var statementOffset = emitPrologueDirectives(body.statements, /*startWithNewLine*/ true); var pos = writer.getTextPos(); - emitHelpersIndirect(body); + emitHelpers(body); if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) { decreaseIndent(); emitList(body, body.statements, 384 /* SingleLineFunctionBodyStatements */); @@ -74190,7 +74512,7 @@ var ts; var body = node.body; if (!body) return writeSemicolon(); - while (body.kind === 237 /* ModuleDeclaration */) { + while (body.kind === 238 /* ModuleDeclaration */) { writePunctuation("."); emit(body.name); body = body.body; @@ -74241,12 +74563,12 @@ var ts; writeSemicolon(); } function emitImportClause(node) { - emit(node.name); + emitIfPresent(node.name); if (node.name && node.namedBindings) { emitTokenWithComment(26 /* CommaToken */, node.name.end, writePunctuation, node); writeSpace(); } - emit(node.namedBindings); + emitIfPresent(node.namedBindings); } function emitNamespaceImport(node) { var asPos = emitTokenWithComment(39 /* AsteriskToken */, node.pos, writePunctuation, node); @@ -74512,20 +74834,40 @@ var ts; emitSourceFileWorker(node); } function emitSyntheticTripleSlashReferencesIfNeeded(node) { - emitTripleSlashDirectives(node.syntheticFileReferences || [], node.syntheticTypeReferences || []); + emitTripleSlashDirectives(node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || []); } function emitTripleSlashDirectivesIfNeeded(node) { if (node.isDeclarationFile) - emitTripleSlashDirectives(node.referencedFiles, node.typeReferenceDirectives); + emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives); } - function emitTripleSlashDirectives(files, types) { - for (var _a = 0, files_1 = files; _a < files_1.length; _a++) { - var directive = files_1[_a]; + function emitTripleSlashDirectives(hasNoDefaultLib, files, types) { + if (hasNoDefaultLib) { + write("/// "); + writeLine(); + } + if (currentSourceFile && currentSourceFile.moduleName) { + write("/// "); + writeLine(); + } + if (currentSourceFile && currentSourceFile.amdDependencies) { + for (var _a = 0, _b = currentSourceFile.amdDependencies; _a < _b.length; _a++) { + var dep = _b[_a]; + if (dep.name) { + write("/// "); + } + else { + write("/// "); + } + writeLine(); + } + } + for (var _c = 0, files_1 = files; _c < files_1.length; _c++) { + var directive = files_1[_c]; write("/// "); writeLine(); } - for (var _b = 0, types_18 = types; _b < types_18.length; _b++) { - var directive = types_18[_b]; + for (var _d = 0, types_18 = types; _d < types_18.length; _d++) { + var directive = types_18[_d]; write("/// "); writeLine(); } @@ -74533,7 +74875,7 @@ var ts; function emitSourceFileWorker(node) { var statements = node.statements; pushNameGenerationScope(node); - emitHelpersIndirect(node); + emitHelpers(node); var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); }); emitTripleSlashDirectivesIfNeeded(node); emitList(node, statements, 1 /* MultiLine */, index === -1 ? statements.length : index); @@ -75089,7 +75431,7 @@ var ts; && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 189 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 190 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -75185,11 +75527,16 @@ var ts; * or within the NameGenerator. */ function isUniqueName(name) { - return !(hasGlobalName && hasGlobalName(name)) - && !currentSourceFile.identifiers.has(name) + return isFileLevelUniqueName(name) && !generatedNames.has(name) && !(reservedNames && reservedNames.has(name)); } + /** + * Returns a value indicating whether a name is unique globally or within the current file. + */ + function isFileLevelUniqueName(name) { + return ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName); + } /** * Returns a value indicating whether a name is unique within a container. */ @@ -75245,9 +75592,10 @@ 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, optimistic) { + function makeUniqueName(baseName, checkFn, optimistic) { + if (checkFn === void 0) { checkFn = isUniqueName; } if (optimistic) { - if (isUniqueName(baseName)) { + if (checkFn(baseName)) { generatedNames.set(baseName, true); return baseName; } @@ -75259,13 +75607,16 @@ var ts; var i = 1; while (true) { var generatedName = baseName + i; - if (isUniqueName(generatedName)) { + if (checkFn(generatedName)) { generatedNames.set(generatedName, true); return generatedName; } i++; } } + function makeFileLevelOptmiisticUniqueName(name) { + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. */ @@ -75308,17 +75659,17 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return makeUniqueName(getTextOfNode(node)); - case 237 /* ModuleDeclaration */: - case 236 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: - case 247 /* ExportAssignment */: + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: + case 248 /* ExportAssignment */: return generateNameForExportDefault(); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return generateNameForClassExpression(); case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: @@ -75338,9 +75689,7 @@ var ts; case 2 /* Loop */: return makeTempVariableName(268435456 /* _i */, !!(name.autoGenerateFlags & 16 /* ReservedInNestedScopes */)); case 3 /* Unique */: - return makeUniqueName(ts.idText(name)); - case 5 /* OptimisticUnique */: - return makeUniqueName(ts.idText(name), /*optimistic*/ true); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 64 /* FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 32 /* Optimistic */)); } ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } @@ -75557,7 +75906,7 @@ var ts; } ts.createCompilerHost = createCompilerHost; function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { - var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + var diagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(cancellationToken), program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (program.getCompilerOptions().declaration) { ts.addRange(diagnostics, program.getDeclarationDiagnostics(sourceFile, cancellationToken)); } @@ -75766,6 +76115,12 @@ var ts; } } ts.isProgramUptoDate = isProgramUptoDate; + function getConfigFileParsingDiagnostics(configFileParseResult) { + return configFileParseResult.options.configFile ? + configFileParseResult.options.configFile.parseDiagnostics.concat(configFileParseResult.errors) : + configFileParseResult.errors; + } + ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics; /** * Determined if source file needs to be re-created even if its text hasn't changed */ @@ -75794,9 +76149,10 @@ var ts; * @param options - The compiler options which should be used. * @param host - The host interacts with the underlying file system. * @param oldProgram - Reuses an old program structure. + * @param configFileParsingDiagnostics - error during config file parsing * @returns A 'Program' object. */ - function createProgram(rootNames, options, host, oldProgram) { + function createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics) { var program; var files = []; var commonSourceDirectory; @@ -75837,7 +76193,7 @@ var ts; var resolveModuleNamesWorker; var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; if (host.resolveModuleNames) { - resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(checkAllDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { + resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. if (!resolved || resolved.extension !== undefined) { return resolved; @@ -75850,15 +76206,15 @@ var ts; else { moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; - resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(checkAllDefined(moduleNames), containingFile, loader_1); }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; if (host.resolveTypeReferenceDirectives) { - resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(checkAllDefined(typeDirectiveNames), containingFile); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile); }; } else { var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; - resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(checkAllDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; } // Map from a stringified PackageId to the source file with that id. // Only one source file may have a given packageId. Others become redirects (see createRedirectSourceFile). @@ -75895,8 +76251,9 @@ var ts; if (!skipDefaultLib) { // If '--lib' is not specified, include default library file according to '--target' // otherwise, using options specified in '--lib' instead of '--target' default library file - if (!options.lib) { - processRootFile(getDefaultLibraryFileName(), /*isDefaultLib*/ true); + var defaultLibraryFileName = getDefaultLibraryFileName(); + if (!options.lib && defaultLibraryFileName) { + processRootFile(defaultLibraryFileName, /*isDefaultLib*/ true); } else { ts.forEach(options.lib, function (libFileName) { @@ -75952,7 +76309,8 @@ var ts; getSourceFileFromReference: getSourceFileFromReference, sourceFileToPackageName: sourceFileToPackageName, redirectTargetsSet: redirectTargetsSet, - isEmittedFile: isEmittedFile + isEmittedFile: isEmittedFile, + getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics }; verifyCompilerOptions(); ts.performance.mark("afterProgram"); @@ -76539,10 +76897,10 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: - case 230 /* VariableDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: + case 231 /* VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -76550,41 +76908,41 @@ var ts; } } switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 108 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file)); return; - case 206 /* AsExpression */: + case 207 /* AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } var prevParent = parent; @@ -76597,25 +76955,25 @@ 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_to_remove_this_warning)); } switch (parent.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } // falls through - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 212 /* VariableStatement */); + return checkModifiers(nodes, parent.kind === 213 /* VariableStatement */); } break; case 151 /* PropertyDeclaration */: @@ -76637,11 +76995,11 @@ var ts; return; } break; - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 205 /* ExpressionWithTypeArguments */: - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 206 /* ExpressionWithTypeArguments */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); @@ -76728,6 +77086,9 @@ var ts; function getGlobalDiagnostics() { return ts.sortAndDeduplicateDiagnostics(getDiagnosticsProducingTypeChecker().getGlobalDiagnostics().slice()); } + function getConfigFileParsingDiagnostics() { + return configFileParsingDiagnostics || ts.emptyArray; + } function processRootFile(fileName, isDefaultLib) { processSourceFile(ts.normalizePath(fileName), isDefaultLib, /*packageId*/ undefined); } @@ -76823,9 +77184,18 @@ var ts; else if (ts.isImportCall(node) && node.arguments.length === 1 && ts.isStringLiteralLike(node.arguments[0])) { imports = ts.append(imports, node.arguments[0]); } - else { - ts.forEachChild(node, collectDynamicImportOrRequireCalls); + else if (ts.isLiteralImportTypeNode(node)) { + imports = ts.append(imports, node.argument.literal); } + else { + collectDynamicImportOrRequireCallsForEachChild(node); + if (ts.hasJSDocNodes(node)) { + ts.forEach(node.jsDoc, collectDynamicImportOrRequireCallsForEachChild); + } + } + } + function collectDynamicImportOrRequireCallsForEachChild(node) { + ts.forEachChild(node, collectDynamicImportOrRequireCalls); } } /** This should have similar behavior to 'processSourceFile' without diagnostics or mutation. */ @@ -77477,10 +77847,6 @@ var ts; } } ts.getResolutionDiagnostic = getResolutionDiagnostic; - function checkAllDefined(names) { - ts.Debug.assert(names.every(function (name) { return name !== undefined; }), "A name is undefined.", function () { return JSON.stringify(names); }); - return names; - } function getModuleNames(_a) { var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations; var res = imports.map(function (i) { return i.text; }); @@ -77962,26 +78328,36 @@ var ts; BuilderProgramKind[BuilderProgramKind["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram"; BuilderProgramKind[BuilderProgramKind["EmitAndSemanticDiagnosticsBuilderProgram"] = 1] = "EmitAndSemanticDiagnosticsBuilderProgram"; })(BuilderProgramKind = ts.BuilderProgramKind || (ts.BuilderProgramKind = {})); - function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { + function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { var host; var newProgram; - if (ts.isArray(newProgramOrRootNames)) { - newProgram = ts.createProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram && oldProgram.getProgram()); + var oldProgram; + if (newProgramOrRootNames === undefined) { + ts.Debug.assert(hostOrOptions === undefined); + host = oldProgramOrHost; + oldProgram = configFileParsingDiagnosticsOrOldProgram; + ts.Debug.assert(!!oldProgram); + newProgram = oldProgram.getProgram(); + } + else if (ts.isArray(newProgramOrRootNames)) { + oldProgram = configFileParsingDiagnosticsOrOldProgram; + newProgram = ts.createProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram && oldProgram.getProgram(), configFileParsingDiagnostics); host = oldProgramOrHost; } else { newProgram = newProgramOrRootNames; host = hostOrOptions; oldProgram = oldProgramOrHost; + configFileParsingDiagnostics = configFileParsingDiagnosticsOrOldProgram; } - return { host: host, newProgram: newProgram, oldProgram: oldProgram }; + return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray }; } ts.getBuilderCreationParameters = getBuilderCreationParameters; function createBuilderProgram(kind, _a) { - var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram; + var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics; // Return same program if underlying program doesnt change var oldState = oldProgram && oldProgram.getState(); - if (oldState && newProgram === oldState.program) { + if (oldState && newProgram === oldState.program && configFileParsingDiagnostics !== newProgram.getConfigFileParsingDiagnostics()) { newProgram = undefined; oldState = undefined; return oldProgram; @@ -78007,6 +78383,7 @@ var ts; getSourceFiles: function () { return state.program.getSourceFiles(); }, getOptionsDiagnostics: function (cancellationToken) { return state.program.getOptionsDiagnostics(cancellationToken); }, getGlobalDiagnostics: function (cancellationToken) { return state.program.getGlobalDiagnostics(cancellationToken); }, + getConfigFileParsingDiagnostics: function () { return configFileParsingDiagnostics || state.program.getConfigFileParsingDiagnostics(); }, getSyntacticDiagnostics: function (sourceFile, cancellationToken) { return state.program.getSyntacticDiagnostics(sourceFile, cancellationToken); }, getSemanticDiagnostics: getSemanticDiagnostics, emit: emit, @@ -78138,16 +78515,16 @@ var ts; ts.createBuilderProgram = createBuilderProgram; })(ts || (ts = {})); (function (ts) { - function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { - return ts.createBuilderProgram(ts.BuilderProgramKind.SemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram)); + function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { + return ts.createBuilderProgram(ts.BuilderProgramKind.SemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics)); } ts.createSemanticDiagnosticsBuilderProgram = createSemanticDiagnosticsBuilderProgram; - function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { - return ts.createBuilderProgram(ts.BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram)); + function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { + return ts.createBuilderProgram(ts.BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics)); } ts.createEmitAndSemanticDiagnosticsBuilderProgram = createEmitAndSemanticDiagnosticsBuilderProgram; - function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { - var program = ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram).newProgram; + function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { + var program = ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics).newProgram; return { // Only return program, all other methods are not implemented getProgram: function () { return program; }, @@ -78157,6 +78534,7 @@ var ts; getSourceFiles: ts.notImplemented, getOptionsDiagnostics: ts.notImplemented, getGlobalDiagnostics: ts.notImplemented, + getConfigFileParsingDiagnostics: ts.notImplemented, getSyntacticDiagnostics: ts.notImplemented, getSemanticDiagnostics: ts.notImplemented, emit: ts.notImplemented, @@ -79075,10 +79453,8 @@ var ts; /** Parses config file using System interface */ function parseConfigFileWithSystem(configFileName, optionsToExtend, system, reportDiagnostic) { var host = system; - host.onConfigFileDiagnostic = reportDiagnostic; host.onUnRecoverableConfigFileDiagnostic = function (diagnostic) { return reportUnrecoverableDiagnostic(ts.sys, reportDiagnostic, diagnostic); }; var result = getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host); - host.onConfigFileDiagnostic = undefined; host.onUnRecoverableConfigFileDiagnostic = undefined; return result; } @@ -79102,11 +79478,8 @@ var ts; return undefined; } var result = ts.parseJsonText(configFileName, configFileText); - result.parseDiagnostics.forEach(function (diagnostic) { return host.onConfigFileDiagnostic(diagnostic); }); var cwd = host.getCurrentDirectory(); - var configParseResult = ts.parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd)); - configParseResult.errors.forEach(function (diagnostic) { return host.onConfigFileDiagnostic(diagnostic); }); - return configParseResult; + return ts.parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd)); } ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile; /** @@ -79114,14 +79487,16 @@ var ts; */ function emitFilesAndReportErrors(program, reportDiagnostic, writeFileName) { // First get and report any syntactic errors. - var diagnostics = program.getSyntacticDiagnostics().slice(); + var diagnostics = program.getConfigFileParsingDiagnostics().slice(); + var configFileParsingDiagnosticsLength = diagnostics.length; + ts.addRange(diagnostics, program.getSyntacticDiagnostics()); var reportSemanticDiagnostics = false; // If we didn't have any syntactic errors, then also try getting the global and // semantic errors. - if (diagnostics.length === 0) { + if (diagnostics.length === configFileParsingDiagnosticsLength) { ts.addRange(diagnostics, program.getOptionsDiagnostics()); ts.addRange(diagnostics, program.getGlobalDiagnostics()); - if (diagnostics.length === 0) { + if (diagnostics.length === configFileParsingDiagnosticsLength) { reportSemanticDiagnostics = true; } } @@ -79221,7 +79596,6 @@ var ts; function createWatchCompilerHostOfConfigFile(configFileName, optionsToExtend, system, createProgram, reportDiagnostic, reportWatchStatus) { reportDiagnostic = reportDiagnostic || createDiagnosticReporter(system); var host = createWatchCompilerHost(system, createProgram, reportDiagnostic, reportWatchStatus); - host.onConfigFileDiagnostic = reportDiagnostic; host.onUnRecoverableConfigFileDiagnostic = function (diagnostic) { return reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic); }; host.configFileName = configFileName; host.optionsToExtend = optionsToExtend; @@ -79265,7 +79639,10 @@ var ts; var getCurrentDirectory = function () { return currentDirectory; }; var readFile = function (path, encoding) { return host.readFile(path, encoding); }; var configFileName = host.configFileName, _a = host.optionsToExtend, optionsToExtendForConfigFile = _a === void 0 ? {} : _a, createProgram = host.createProgram; - var rootFileNames = host.rootFiles, compilerOptions = host.options, configFileSpecs = host.configFileSpecs, configFileWildCardDirectories = host.configFileWildCardDirectories; + var rootFileNames = host.rootFiles, compilerOptions = host.options; + var configFileSpecs; + var configFileParsingDiagnostics; + var hasChangedConfigFileParsingErrors = false; var cachedDirectoryStructureHost = configFileName && ts.createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames); if (cachedDirectoryStructureHost && host.onCachedDirectoryStructureHostCreate) { host.onCachedDirectoryStructureHostCreate(cachedDirectoryStructureHost); @@ -79277,12 +79654,21 @@ var ts; fileExists: function (path) { return host.fileExists(path); }, readFile: readFile, getCurrentDirectory: getCurrentDirectory, - onConfigFileDiagnostic: host.onConfigFileDiagnostic, onUnRecoverableConfigFileDiagnostic: host.onUnRecoverableConfigFileDiagnostic }; // From tsc we want to get already parsed result and hence check for rootFileNames - if (configFileName && !rootFileNames) { - parseConfigFile(); + var newLine = updateNewLine(); + reportWatchDiagnostic(ts.Diagnostics.Starting_compilation_in_watch_mode); + if (configFileName) { + newLine = ts.getNewLineCharacter(optionsToExtendForConfigFile, function () { return host.getNewLine(); }); + if (host.configFileParsingResult) { + setConfigFileParsingResult(host.configFileParsingResult); + } + else { + ts.Debug.assert(!rootFileNames); + parseConfigFile(); + } + newLine = updateNewLine(); } var trace = host.trace && (function (s) { host.trace(s + newLine); }); var watchLogLevel = trace ? compilerOptions.extendedDiagnostics ? ts.WatchLogLevel.Verbose : @@ -79290,7 +79676,6 @@ var ts; var writeLog = watchLogLevel !== ts.WatchLogLevel.None ? trace : ts.noop; var _b = ts.getWatchFactory(watchLogLevel, writeLog), watchFile = _b.watchFile, watchFilePath = _b.watchFilePath, watchDirectoryWorker = _b.watchDirectory; var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - var newLine = updateNewLine(); writeLog("Current directory: " + currentDirectory + " CaseSensitiveFileNames: " + useCaseSensitiveFileNames); if (configFileName) { watchFile(host, configFileName, scheduleProgramReload, ts.PollingInterval.High); @@ -79343,7 +79728,6 @@ var ts; (function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }) : (function (typeDirectiveNames, containingFile) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; - reportWatchDiagnostic(ts.Diagnostics.Starting_compilation_in_watch_mode); synchronizeProgram(); // Update the wild card directory watch watchConfigFileWildCardDirectories(); @@ -79368,6 +79752,10 @@ 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)) { + if (hasChangedConfigFileParsingErrors) { + builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics); + hasChangedConfigFileParsingErrors = false; + } return builderProgram; } // Compile the program @@ -79378,10 +79766,11 @@ var ts; } var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !program; hasChangedCompilerOptions = false; + hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; - builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram); + builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics); resolutionCache.finishCachingPerDirectoryResolution(); // Update watches ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = ts.createMap()), watchMissingFilePath); @@ -79414,7 +79803,7 @@ var ts; scheduleProgramUpdate(); } function updateNewLine() { - return ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); }); + return ts.getNewLineCharacter(compilerOptions || optionsToExtendForConfigFile, function () { return host.getNewLine(); }); } function toPath(fileName) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); @@ -79530,7 +79919,7 @@ var ts; } function reportWatchDiagnostic(message) { if (host.onWatchStatusChange) { - host.onWatchStatusChange(ts.createCompilerDiagnostic(message), newLine, compilerOptions); + host.onWatchStatusChange(ts.createCompilerDiagnostic(message), newLine, compilerOptions || optionsToExtendForConfigFile); } } // Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch @@ -79565,8 +79954,13 @@ var ts; } function reloadFileNamesFromConfigFile() { var result = ts.getFileNamesFromConfigSpecs(configFileSpecs, ts.getDirectoryPath(configFileName), compilerOptions, parseConfigFileHost); - if (!configFileSpecs.filesSpecs && result.fileNames.length === 0) { - host.onConfigFileDiagnostic(ts.getErrorForNoInputFiles(configFileSpecs, configFileName)); + if (result.fileNames.length) { + configFileParsingDiagnostics = ts.filter(configFileParsingDiagnostics, function (error) { return !ts.isErrorNoInputFiles(error); }); + hasChangedConfigFileParsingErrors = true; + } + else if (!configFileSpecs.filesSpecs && !ts.some(configFileParsingDiagnostics, ts.isErrorNoInputFiles)) { + configFileParsingDiagnostics = configFileParsingDiagnostics.concat(ts.getErrorForNoInputFiles(configFileSpecs, configFileName)); + hasChangedConfigFileParsingErrors = true; } rootFileNames = result.fileNames; // Update the program @@ -79585,11 +79979,14 @@ var ts; watchConfigFileWildCardDirectories(); } function parseConfigFile() { - var configParseResult = ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost); - rootFileNames = configParseResult.fileNames; - compilerOptions = configParseResult.options; - configFileSpecs = configParseResult.configFileSpecs; - configFileWildCardDirectories = configParseResult.wildcardDirectories; + setConfigFileParsingResult(ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost)); + } + function setConfigFileParsingResult(configFileParseResult) { + rootFileNames = configFileParseResult.fileNames; + compilerOptions = configFileParseResult.options; + configFileSpecs = configFileParseResult.configFileSpecs; + configFileParsingDiagnostics = ts.getConfigFileParsingDiagnostics(configFileParseResult); + hasChangedConfigFileParsingErrors = true; } function onSourceFileChange(fileName, eventKind, path) { updateCachedSystemWithFile(fileName, path, eventKind); @@ -79624,8 +80021,8 @@ var ts; } } function watchConfigFileWildCardDirectories() { - if (configFileWildCardDirectories) { - ts.updateWatchingWildcardDirectories(watchedWildcardDirectories || (watchedWildcardDirectories = ts.createMap()), ts.createMapFromTemplate(configFileWildCardDirectories), watchWildcardDirectory); + if (configFileSpecs) { + ts.updateWatchingWildcardDirectories(watchedWildcardDirectories || (watchedWildcardDirectories = ts.createMap()), ts.createMapFromTemplate(configFileSpecs.wildcardDirectories), watchWildcardDirectory); } else if (watchedWildcardDirectories) { ts.clearMap(watchedWildcardDirectories, ts.closeFileWatcherOf); @@ -80702,7 +81099,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 268 /* PropertyAssignment */) { + if (element.kind !== 269 /* PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -80777,13 +81174,13 @@ var ts; case 8 /* NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return Number(valueExpression.text); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: if (valueExpression.operator !== 38 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return -Number(valueExpression.operand.text); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -80800,7 +81197,7 @@ var ts; return convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined); } - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element); } @@ -80923,13 +81320,21 @@ var ts; function makePadding(paddingLength) { return Array(paddingLength + 1).join(" "); } + function isAllowedOption(_a) { + var category = _a.category, name = _a.name; + // Skip options which do not have a category or have category `Command_line_Options` + // Exclude all possible `Advanced_Options` in tsconfig.json which were NOT defined in command line + return category !== undefined + && category !== ts.Diagnostics.Command_line_Options + && (category !== ts.Diagnostics.Advanced_Options || compilerOptionsMap.has(name)); + } function writeConfigurations() { // Filter applicable options to place in the file var categorizedOptions = ts.createMultiMap(); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; var category = option.category; - if (category !== undefined && category !== ts.Diagnostics.Command_line_Options && category !== ts.Diagnostics.Advanced_Options) { + if (isAllowedOption(option)) { categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); } } @@ -81974,35 +82379,35 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 148 /* Parameter */: - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 267 /* CatchClause */: - case 260 /* JsxAttribute */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 268 /* CatchClause */: + case 261 /* JsxAttribute */: return 1 /* Value */; case 147 /* TypeParameter */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: case 165 /* TypeLiteral */: return 2 /* Type */; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */; - case 271 /* EnumMember */: - case 233 /* ClassDeclaration */: + case 272 /* EnumMember */: + case 234 /* ClassDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -82012,26 +82417,26 @@ var ts; else { return 4 /* Namespace */; } - case 236 /* EnumDeclaration */: - case 245 /* NamedImports */: - case 246 /* ImportSpecifier */: - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: - case 247 /* ExportAssignment */: - case 248 /* ExportDeclaration */: + case 237 /* EnumDeclaration */: + case 246 /* NamedImports */: + case 247 /* ImportSpecifier */: + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 248 /* ExportAssignment */: + case 249 /* ExportDeclaration */: return 7 /* All */; // An external module can be a Value - case 272 /* SourceFile */: + case 273 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 7 /* All */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { return 1 /* Value */; } - else if (node.parent.kind === 247 /* ExportAssignment */) { + else if (node.parent.kind === 248 /* ExportAssignment */) { return 7 /* All */; } else if (isInRightSideOfInternalImportEqualsDeclaration(node)) { @@ -82060,7 +82465,7 @@ var ts; // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace var name = node.kind === 145 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 241 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; + return name && name.parent.kind === 242 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { while (node.parent.kind === 145 /* QualifiedName */) { @@ -82086,16 +82491,16 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 183 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 183 /* PropertyAccessExpression */) { + if (root.parent.kind === 184 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 184 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 205 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 266 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 206 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 267 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 233 /* ClassDeclaration */ && root.parent.parent.token === 108 /* ImplementsKeyword */) || - (decl.kind === 234 /* InterfaceDeclaration */ && root.parent.parent.token === 85 /* ExtendsKeyword */); + return (decl.kind === 234 /* ClassDeclaration */ && root.parent.parent.token === 108 /* ImplementsKeyword */) || + (decl.kind === 235 /* InterfaceDeclaration */ && root.parent.parent.token === 85 /* ExtendsKeyword */); } return false; } @@ -82112,17 +82517,17 @@ var ts; switch (node.parent.kind) { case 161 /* TypeReference */: return true; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent); } return false; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 185 /* CallExpression */); + return isCallOrNewExpressionTarget(node, 186 /* CallExpression */); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 186 /* NewExpression */); + return isCallOrNewExpressionTarget(node, 187 /* NewExpression */); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -82135,7 +82540,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 226 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 227 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -82160,11 +82565,11 @@ var ts; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 237 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 238 /* ModuleDeclaration */ && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -82176,15 +82581,15 @@ var ts; switch (node.parent.kind) { case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 268 /* PropertyAssignment */: - case 271 /* EnumMember */: + case 269 /* PropertyAssignment */: + case 272 /* EnumMember */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return node.parent.argumentExpression === node; case 146 /* ComputedPropertyName */: return true; @@ -82199,7 +82604,7 @@ var ts; } ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; function getContainerNode(node) { - if (node.kind === 291 /* JSDocTypedefTag */) { + if (node.kind === 292 /* JSDocTypedefTag */) { // This doesn't just apply to the node immediately under the comment, but to everything in its parent's scope. // node.parent = the JSDoc comment, node.parent.parent = the node having the comment. // Then we get parent again in the loop. @@ -82211,17 +82616,17 @@ var ts; return undefined; } switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 237 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: return node; } } @@ -82229,23 +82634,23 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return "module" /* moduleElement */; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return "class" /* classElement */; - case 234 /* InterfaceDeclaration */: return "interface" /* interfaceElement */; - case 235 /* TypeAliasDeclaration */: return "type" /* typeElement */; - case 236 /* EnumDeclaration */: return "enum" /* enumElement */; - case 230 /* VariableDeclaration */: + case 235 /* InterfaceDeclaration */: return "interface" /* interfaceElement */; + case 236 /* TypeAliasDeclaration */: return "type" /* typeElement */; + case 237 /* EnumDeclaration */: return "enum" /* enumElement */; + case 231 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return "function" /* functionElement */; case 155 /* GetAccessor */: return "getter" /* memberGetAccessorElement */; case 156 /* SetAccessor */: return "setter" /* memberSetAccessorElement */; @@ -82260,17 +82665,17 @@ var ts; case 157 /* CallSignature */: return "call" /* callSignatureElement */; case 154 /* Constructor */: return "constructor" /* constructorImplementationElement */; case 147 /* TypeParameter */: return "type parameter" /* typeParameterElement */; - case 271 /* EnumMember */: return "enum member" /* enumMemberElement */; + case 272 /* EnumMember */: return "enum member" /* enumMemberElement */; case 148 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */; - case 241 /* ImportEqualsDeclaration */: - case 246 /* ImportSpecifier */: - case 243 /* ImportClause */: - case 250 /* ExportSpecifier */: - case 244 /* NamespaceImport */: + case 242 /* ImportEqualsDeclaration */: + case 247 /* ImportSpecifier */: + case 244 /* ImportClause */: + case 251 /* ExportSpecifier */: + case 245 /* NamespaceImport */: return "alias" /* alias */; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return "type" /* typeElement */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var kind = ts.getSpecialPropertyAssignmentKind(node); var right = node.right; switch (kind) { @@ -82362,27 +82767,27 @@ var ts; return false; } switch (n.kind) { - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 182 /* ObjectLiteralExpression */: - case 178 /* ObjectBindingPattern */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 183 /* ObjectLiteralExpression */: + case 179 /* ObjectBindingPattern */: case 165 /* TypeLiteral */: - case 211 /* Block */: - case 238 /* ModuleBlock */: - case 239 /* CaseBlock */: - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 212 /* Block */: + case 239 /* ModuleBlock */: + case 240 /* CaseBlock */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return nodeEndsWith(n, 18 /* CloseBraceToken */, sourceFile); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 186 /* NewExpression */: + case 187 /* NewExpression */: if (!n.arguments) { return true; } // falls through - case 185 /* CallExpression */: - case 189 /* ParenthesizedExpression */: + case 186 /* CallExpression */: + case 190 /* ParenthesizedExpression */: case 172 /* ParenthesizedType */: return nodeEndsWith(n, 20 /* CloseParenToken */, sourceFile); case 162 /* FunctionType */: @@ -82391,13 +82796,13 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 158 /* ConstructSignature */: case 157 /* CallSignature */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -82407,19 +82812,19 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 20 /* CloseParenToken */, sourceFile); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 215 /* IfStatement */: + case 216 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 25 /* SemicolonToken */, sourceFile); - case 181 /* ArrayLiteralExpression */: - case 179 /* ArrayBindingPattern */: - case 184 /* ElementAccessExpression */: + case 182 /* ArrayLiteralExpression */: + case 180 /* ArrayBindingPattern */: + case 185 /* ElementAccessExpression */: case 146 /* ComputedPropertyName */: case 167 /* TupleType */: return nodeEndsWith(n, 22 /* CloseBracketToken */, sourceFile); @@ -82428,44 +82833,44 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 22 /* CloseBracketToken */, sourceFile); - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 217 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 218 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 216 /* DoStatement */: + case 217 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 106 /* WhileKeyword */, sourceFile) ? nodeEndsWith(n, 20 /* CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); case 164 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 193 /* TypeOfExpression */: - case 192 /* DeleteExpression */: - case 194 /* VoidExpression */: - case 201 /* YieldExpression */: - case 202 /* SpreadElement */: + case 194 /* TypeOfExpression */: + case 193 /* DeleteExpression */: + case 195 /* VoidExpression */: + case 202 /* YieldExpression */: + case 203 /* SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 248 /* ExportDeclaration */: - case 242 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -82662,7 +83067,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 272 /* SourceFile */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 273 /* SourceFile */ || 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. @@ -82734,17 +83139,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 263 /* JsxExpression */) { + if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 264 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 263 /* JsxExpression */) { + if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 264 /* JsxExpression */) { return true; } //
|
- if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 256 /* JsxClosingElement */) { + if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 257 /* JsxClosingElement */) { return true; } return false; @@ -82901,10 +83306,10 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 161 /* TypeReference */ || node.kind === 185 /* CallExpression */) { + if (node.kind === 161 /* TypeReference */ || node.kind === 186 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 233 /* ClassDeclaration */ || node.kind === 234 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 234 /* ClassDeclaration */ || node.kind === 235 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -82956,18 +83361,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 181 /* ArrayLiteralExpression */ || - node.kind === 182 /* ObjectLiteralExpression */) { + if (node.kind === 182 /* ArrayLiteralExpression */ || + node.kind === 183 /* ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 198 /* BinaryExpression */ && + if (node.parent.kind === 199 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 58 /* EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 220 /* ForOfStatement */ && + if (node.parent.kind === 221 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -82975,7 +83380,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 268 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 269 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -83062,6 +83467,17 @@ var ts; return result; } ts.repeatString = repeatString; + function skipConstraint(type) { + return type.isTypeParameter() ? type.getConstraint() : type; + } + ts.skipConstraint = skipConstraint; + function getNameFromPropertyName(name) { + return name.kind === 146 /* ComputedPropertyName */ + // treat computed property names where expression is string/numeric literal as just string/numeric literal + ? ts.isStringOrNumericLiteral(name.expression) ? name.expression.text : undefined + : ts.getTextOfIdentifierOrLiteral(name); + } + ts.getNameFromPropertyName = getNameFromPropertyName; })(ts || (ts = {})); // Display-part writer helpers /* @internal */ @@ -83260,7 +83676,7 @@ var ts; ts.signatureToDisplayParts = signatureToDisplayParts; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 246 /* ImportSpecifier */ || location.parent.kind === 250 /* ExportSpecifier */) && + (location.parent.kind === 247 /* ImportSpecifier */ || location.parent.kind === 251 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -83805,10 +84221,10 @@ 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 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 232 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 233 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -84019,16 +84435,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param" pos = tag.tagName.end; switch (tag.kind) { - case 287 /* JSDocParameterTag */: + case 288 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 290 /* JSDocTemplateTag */: + case 291 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 289 /* JSDocTypeTag */: + case 290 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 288 /* JSDocReturnTag */: + case 289 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -84115,22 +84531,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 255 /* JsxOpeningElement */: + case 256 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -84158,17 +84574,17 @@ var ts; if (token) { if (tokenKind === 58 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 230 /* VariableDeclaration */ || + if (token.parent.kind === 231 /* VariableDeclaration */ || token.parent.kind === 151 /* PropertyDeclaration */ || token.parent.kind === 148 /* Parameter */ || - token.parent.kind === 260 /* JsxAttribute */) { + token.parent.kind === 261 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 198 /* BinaryExpression */ || - token.parent.kind === 196 /* PrefixUnaryExpression */ || - token.parent.kind === 197 /* PostfixUnaryExpression */ || - token.parent.kind === 199 /* ConditionalExpression */) { + if (token.parent.kind === 199 /* BinaryExpression */ || + token.parent.kind === 197 /* PrefixUnaryExpression */ || + token.parent.kind === 198 /* PostfixUnaryExpression */ || + token.parent.kind === 200 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -84178,7 +84594,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 260 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 261 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 12 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -84194,7 +84610,7 @@ var ts; else if (tokenKind === 71 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } @@ -84204,17 +84620,17 @@ var ts; return 15 /* typeParameterName */; } return; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } @@ -84730,7 +85146,9 @@ var ts; GlobalsSearch[GlobalsSearch["Success"] = 1] = "Success"; GlobalsSearch[GlobalsSearch["Fail"] = 2] = "Fail"; })(GlobalsSearch || (GlobalsSearch = {})); - function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position, allSourceFiles, preferences) { + function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences) { + var typeChecker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); if (ts.isInReferenceComment(sourceFile, position)) { var entries = Completions.PathCompletions.getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); return entries && convertPathCompletions(entries); @@ -84745,7 +85163,7 @@ var ts; && (contextToken.kind === 72 /* BreakKeyword */ || contextToken.kind === 77 /* ContinueKeyword */ || contextToken.kind === 71 /* Identifier */)) { return getLabelCompletionAtPosition(contextToken.parent); } - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, preferences, compilerOptions.target); + var completionData = getCompletionData(program, log, sourceFile, position, preferences); if (!completionData) { return undefined; } @@ -84779,7 +85197,7 @@ var ts; } case 2 /* Types */: { var entries = completion.types.map(function (type) { return ({ name: type.value, kindModifiers: "" /* none */, kind: "type" /* typeElement */, sortText: "0" }); }); - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, entries: entries }; } default: return ts.Debug.assertNever(completion); @@ -84870,24 +85288,24 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var insertText; var replacementSpan; - if (preferences.includeCompletionsWithInsertText) { - if (origin && origin.type === "this-type") { - insertText = needsConvertPropertyAccess ? "this[" + quote(name, preferences) + "]" : "this." + name; - } - else if (needsConvertPropertyAccess) { - insertText = "[" + quote(name, preferences) + "]"; - var dot = ts.findChildOfKind(propertyAccessToConvert, 23 /* DotToken */, sourceFile); - // If the text after the '.' starts with this name, write over it. Else, add new text. - var end = ts.startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; - replacementSpan = ts.createTextSpanFromBounds(dot.getStart(sourceFile), end); - } - if (isJsxInitializer) { - if (insertText === undefined) - insertText = name; - insertText = "{" + insertText + "}"; - if (typeof isJsxInitializer !== "boolean") { - replacementSpan = ts.createTextSpanFromNode(isJsxInitializer, sourceFile); - } + if (origin && origin.type === "this-type") { + insertText = needsConvertPropertyAccess ? "this[" + quote(name, preferences) + "]" : "this." + name; + } + // We should only have needsConvertPropertyAccess if there's a property access to convert. But see #21790. + // Somehow there was a global with a non-identifier name. Hopefully someone will complain about getting a "foo bar" global completion and provide a repro. + else if ((origin && origin.type === "symbol-member" || needsConvertPropertyAccess) && propertyAccessToConvert) { + insertText = needsConvertPropertyAccess ? "[" + quote(name, preferences) + "]" : "[" + name + "]"; + var dot = ts.findChildOfKind(propertyAccessToConvert, 23 /* DotToken */, sourceFile); + // If the text after the '.' starts with this name, write over it. Else, add new text. + var end = ts.startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; + replacementSpan = ts.createTextSpanFromBounds(dot.getStart(sourceFile), end); + } + if (isJsxInitializer) { + if (insertText === undefined) + insertText = name; + insertText = "{" + insertText + "}"; + if (typeof isJsxInitializer !== "boolean") { + replacementSpan = ts.createTextSpanFromNode(isJsxInitializer, sourceFile); } } if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) { @@ -85002,7 +85420,7 @@ var ts; case 177 /* LiteralType */: switch (node.parent.parent.kind) { case 161 /* TypeReference */: - return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(node.parent), typeChecker) }; + return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(node.parent), typeChecker), isNewIdentifier: false }; case 175 /* IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { @@ -85011,10 +85429,12 @@ var ts; // } // let x: Foo["/*completion position*/"] return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(node.parent.parent.objectType)); + case 178 /* ImportType */: + return { kind: 0 /* Paths */, paths: Completions.PathCompletions.getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) }; default: return undefined; } - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: if (ts.isObjectLiteralExpression(node.parent.parent) && node.parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -85031,7 +85451,7 @@ var ts; return stringLiteralCompletionsFromProperties(typeChecker.getContextualType(node.parent.parent)); } return fromContextualType(); - case 184 /* ElementAccessExpression */: { + case 185 /* ElementAccessExpression */: { var _a = node.parent, expression = _a.expression, argumentExpression = _a.argumentExpression; if (node === argumentExpression) { // Get all names of properties on the expression @@ -85044,25 +85464,19 @@ var ts; } return undefined; } - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: if (!ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false) && !ts.isImportCall(node.parent)) { - var argumentInfo_1 = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - if (argumentInfo_1) { - var candidates = []; - typeChecker.getResolvedSignature(argumentInfo_1.invocation, candidates, argumentInfo_1.argumentCount); - var uniques_1 = ts.createMap(); - return { kind: 2 /* Types */, types: ts.flatMap(candidates, function (candidate) { return getStringLiteralTypes(typeChecker.getParameterType(candidate, argumentInfo_1.argumentIndex), typeChecker, uniques_1); }) }; - } - return fromContextualType(); + return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo, typeChecker) : fromContextualType(); } // falls through (is `require("")` or `import("")`) - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: - case 252 /* ExternalModuleReference */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 253 /* 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*/"); @@ -85076,26 +85490,40 @@ var ts; function fromContextualType() { // Get completion for string literal from string literal type // i.e. var x: "hi" | "hello" = "/*completion position*/" - return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker), typeChecker) }; + return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker), typeChecker), isNewIdentifier: false }; } } + function getStringLiteralCompletionsFromSignature(argumentInfo, checker) { + var isNewIdentifier = false; + var uniques = ts.createMap(); + var candidates = []; + checker.getResolvedSignature(argumentInfo.invocation, candidates, argumentInfo.argumentCount); + var types = ts.flatMap(candidates, function (candidate) { + if (!candidate.hasRestParameter && argumentInfo.argumentCount > candidate.parameters.length) + return; + var type = checker.getParameterType(candidate, argumentInfo.argumentIndex); + isNewIdentifier = isNewIdentifier || !!(type.flags & 2 /* String */); + return getStringLiteralTypes(type, checker, uniques); + }); + return { kind: 2 /* Types */, types: types, isNewIdentifier: isNewIdentifier }; + } function stringLiteralCompletionsFromProperties(type) { return type && { kind: 1 /* Properties */, symbols: type.getApparentProperties(), hasIndexSignature: hasIndexSignature(type) }; } function getStringLiteralTypes(type, typeChecker, uniques) { if (uniques === void 0) { uniques = ts.createMap(); } - if (type && type.flags & 32768 /* TypeParameter */) { - type = type.getConstraint(); - } - return type && type.flags & 131072 /* Union */ + if (!type) + return ts.emptyArray; + type = ts.skipConstraint(type); + return type.isUnion() ? ts.flatMap(type.types, function (t) { return getStringLiteralTypes(t, typeChecker, uniques); }) - : type && type.flags & 32 /* StringLiteral */ && !(type.flags & 256 /* EnumLiteral */) && ts.addToSeen(uniques, type.value) + : type.isStringLiteral() && !(type.flags & 256 /* EnumLiteral */) && ts.addToSeen(uniques, type.value) ? [type] : ts.emptyArray; } - function getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, _a, allSourceFiles) { + function getSymbolCompletionFromEntryId(program, log, sourceFile, position, _a) { var name = _a.name, source = _a.source; - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }, compilerOptions.target); + var completionData = getCompletionData(program, log, sourceFile, position, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }); if (!completionData) { return { type: "none" }; } @@ -85109,7 +85537,7 @@ var ts; // completion entry. return ts.firstDefined(symbols, function (symbol) { var origin = symbolToOriginInfoMap[ts.getSymbolId(symbol)]; - var info = getCompletionEntryDisplayNameForSymbol(symbol, compilerOptions.target, origin, completionKind); + var info = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, origin, completionKind); return info && info.name === name && getSourceFromOrigin(origin) === source ? { type: "symbol", symbol: symbol, location: location, symbolToOriginInfoMap: symbolToOriginInfoMap, previousToken: previousToken, isJsxInitializer: isJsxInitializer } : undefined; }) || { type: "none" }; } @@ -85120,8 +85548,9 @@ var ts; || ts.codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) : symbol.name; } - function getCompletionEntryDetails(program, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, formatContext, getCanonicalFileName, preferences) { + function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, getCanonicalFileName, preferences) { var typeChecker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); var name = entryId.name; var contextToken = ts.findPrecedingToken(position, sourceFile); if (ts.isInString(sourceFile, position, contextToken)) { @@ -85131,7 +85560,7 @@ var ts; return stringLiteralCompletions && stringLiteralCompletionDetails(name, contextToken, stringLiteralCompletions, sourceFile, typeChecker); } // Compute all the completion symbols again. - var symbolCompletion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); + var symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); switch (symbolCompletion.type) { case "request": { var request = symbolCompletion.request; @@ -85148,7 +85577,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, symbolToOriginInfoMap = symbolCompletion.symbolToOriginInfoMap, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, program, typeChecker, host, compilerOptions, sourceFile, previousToken, formatContext, getCanonicalFileName, allSourceFiles, preferences), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, program, typeChecker, host, compilerOptions, sourceFile, previousToken, formatContext, getCanonicalFileName, program.getSourceFiles(), preferences), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, codeActions, sourceDisplay); } case "none": @@ -85190,8 +85619,8 @@ var ts; var _a = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, getSymbolName(symbol, symbolOriginInfo, compilerOptions.target), host, program, checker, compilerOptions, allSourceFiles, formatContext, getCanonicalFileName, previousToken, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } - function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles) { - var completion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); + function getCompletionEntrySymbol(program, log, sourceFile, position, entryId) { + var completion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); return completion.type === "symbol" ? completion.symbol : undefined; } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; @@ -85226,11 +85655,11 @@ var ts; return getContextualTypeFromParent(currentToken, checker); case 58 /* EqualsToken */: switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return checker.getContextualType(parent.initializer); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -85240,7 +85669,7 @@ var ts; case 73 /* CaseKeyword */: return getSwitchedType(ts.cast(parent, ts.isCaseClause), checker); case 17 /* OpenBraceToken */: - return ts.isJsxExpression(parent) && parent.parent.kind !== 253 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined; + return ts.isJsxExpression(parent) && parent.parent.kind !== 254 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined; default: var argInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(currentToken, position, sourceFile); return argInfo @@ -85255,15 +85684,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 186 /* NewExpression */: + case 187 /* NewExpression */: return checker.getContextualType(parent); - case 198 /* BinaryExpression */: { + case 199 /* 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 264 /* CaseClause */: + case 265 /* CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -85279,9 +85708,10 @@ var ts; return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); } function isModuleSymbol(symbol) { - return symbol.declarations.some(function (d) { return d.kind === 272 /* SourceFile */; }); + return symbol.declarations.some(function (d) { return d.kind === 273 /* SourceFile */; }); } - function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, preferences, target) { + function getCompletionData(program, log, sourceFile, position, preferences) { + var typeChecker = program.getTypeChecker(); var start = ts.timestamp(); var currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false); // TODO: GH#15853 // We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.) @@ -85330,11 +85760,11 @@ var ts; if (tag.tagName.pos <= position && position <= tag.tagName.end) { return { kind: 1 /* JsDocTagName */ }; } - if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 274 /* JSDocTypeExpression */) { + if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 275 /* JSDocTypeExpression */) { currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ true); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 292 /* JSDocPropertyTag */ || + (currentToken.parent.kind !== 293 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression); @@ -85384,13 +85814,16 @@ var ts; if (contextToken.kind === 23 /* DotToken */) { isRightOfDot = true; switch (parent.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; break; case 145 /* QualifiedName */: node = parent.left; break; + case 178 /* ImportType */: + node = parent; + break; default: // There is nothing that precedes the dot, so this likely just a stray character // or leading into a '...' token. Just bail out instead. @@ -85401,7 +85834,7 @@ var ts; // // 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 === 183 /* PropertyAccessExpression */) { + if (parent && parent.kind === 184 /* PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -85409,39 +85842,39 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 29 /* GreaterThanToken */: - if (currentToken.parent.kind === 253 /* JsxElement */ || currentToken.parent.kind === 255 /* JsxOpeningElement */) { + if (currentToken.parent.kind === 254 /* JsxElement */ || currentToken.parent.kind === 256 /* JsxOpeningElement */) { location = currentToken; } break; case 41 /* SlashToken */: - if (currentToken.parent.kind === 254 /* JsxSelfClosingElement */) { + if (currentToken.parent.kind === 255 /* JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: if (contextToken.kind === 41 /* SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (!(parent.left.flags & 32768 /* ThisNodeHasError */)) { // It has a left-hand side, so we're not in an opening JSX tag. break; } // falls through - case 254 /* JsxSelfClosingElement */: - case 253 /* JsxElement */: - case 255 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 254 /* JsxElement */: + case 256 /* JsxOpeningElement */: if (contextToken.kind === 27 /* LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: switch (previousToken.kind) { case 58 /* EqualsToken */: isJsxInitializer = true; @@ -85495,11 +85928,11 @@ var ts; return { kind: 0 /* Data */, symbols: symbols, completionKind: completionKind, isInSnippetScope: isInSnippetScope, propertyAccessToConvert: propertyAccessToConvert, isNewIdentifierLocation: isNewIdentifierLocation, location: location, keywordFilters: keywordFilters, symbolToOriginInfoMap: symbolToOriginInfoMap, recommendedCompletion: recommendedCompletion, previousToken: previousToken, isJsxInitializer: isJsxInitializer }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 287 /* JSDocParameterTag */: - case 292 /* JSDocPropertyTag */: - case 288 /* JSDocReturnTag */: - case 289 /* JSDocTypeTag */: - case 291 /* JSDocTypedefTag */: + case 288 /* JSDocParameterTag */: + case 293 /* JSDocPropertyTag */: + case 289 /* JSDocReturnTag */: + case 290 /* JSDocTypeTag */: + case 292 /* JSDocTypedefTag */: return true; } } @@ -85507,17 +85940,18 @@ var ts; // Right of dot member completion list completionKind = 2 /* PropertyAccess */; // Since this is qualified name check its a type node location - var isTypeLocation = insideJsDocTagTypeExpression || ts.isPartOfTypeNode(node.parent); + var isImportType = ts.isLiteralImportTypeNode(node); + var isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !node.isTypeOf) || ts.isPartOfTypeNode(node.parent); var isRhsOfImportDeclaration = ts.isInRightSideOfInternalImportEqualsDeclaration(node); var allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile)); - if (ts.isEntityName(node)) { + if (ts.isEntityName(node) || isImportType) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { symbol = ts.skipAlias(symbol, typeChecker); if (symbol.flags & (1536 /* Module */ | 384 /* Enum */)) { // Extract module or enum members var exportedSymbols = ts.Debug.assertEachDefined(typeChecker.getExportsOfModule(symbol), "getExportsOfModule() should all be defined"); - var isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess((node.parent), symbol.name); }; + var isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess(isImportType ? node : (node.parent), symbol.name); }; var isValidTypeAccess_1 = function (symbol) { return symbolCanBeReferencedAtTypeLocation(symbol); }; var isValidAccess = allowTypeOrValue ? // Any kind is allowed when dotting off namespace in internal import equals declaration @@ -85530,7 +85964,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.some(function (d) { return d.kind !== 272 /* SourceFile */ && d.kind !== 237 /* ModuleDeclaration */ && d.kind !== 236 /* EnumDeclaration */; })) { + if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 273 /* SourceFile */ && d.kind !== 238 /* ModuleDeclaration */ && d.kind !== 237 /* EnumDeclaration */; })) { addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node)); } return; @@ -85554,12 +85988,31 @@ var ts; else { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; - if (typeChecker.isValidPropertyAccessForCompletions((node.parent), type, symbol)) { - symbols.push(symbol); + if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 178 /* ImportType */ ? node : node.parent, type, symbol)) { + addPropertySymbol(symbol); } } } } + function addPropertySymbol(symbol) { + // If this is e.g. [Symbol.iterator], add a completion for `Symbol`. + var symbolSymbol = ts.firstDefined(symbol.declarations, function (decl) { + var name = ts.getNameOfDeclaration(decl); + var leftName = name.kind === 146 /* ComputedPropertyName */ ? getLeftMostName(name.expression) : undefined; + return leftName && typeChecker.getSymbolAtLocation(leftName); + }); + if (symbolSymbol) { + symbols.push(symbolSymbol); + symbolToOriginInfoMap[ts.getSymbolId(symbolSymbol)] = { type: "symbol-member" }; + } + else { + symbols.push(symbol); + } + } + /** Given 'a.b.c', returns 'a'. */ + function getLeftMostName(e) { + return ts.isIdentifier(e) ? e : ts.isPropertyAccessExpression(e) ? getLeftMostName(e.expression) : undefined; + } function tryGetGlobalSymbols() { var result = tryGetObjectLikeCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() @@ -85634,7 +86087,7 @@ var ts; var symbolMeanings = 67901928 /* Type */ | 67216319 /* Value */ | 1920 /* Namespace */ | 2097152 /* Alias */; symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined"); // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 272 /* SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 273 /* SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode); if (thisType) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker, /*isForAccess*/ true); _i < _a.length; _i++) { @@ -85644,18 +86097,38 @@ var ts; } } } - // Don't suggest import completions for a commonjs-only module - if (preferences.includeCompletionsForModuleExports && !(sourceFile.commonJsModuleIndicator && !sourceFile.externalModuleIndicator)) { - getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", target); + if (shouldOfferImportCompletions()) { + getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", program.getCompilerOptions().target); } filterGlobalCompletion(symbols); } + function shouldOfferImportCompletions() { + // If not already a module, must have modules enabled and not currently be in a commonjs module. (TODO: import completions for commonjs) + if (!preferences.includeCompletionsForModuleExports) + return false; + // If already using ES6 modules, OK to continue using them. + if (sourceFile.externalModuleIndicator) + return true; + // If already using commonjs, don't introduce ES6. + if (sourceFile.commonJsModuleIndicator) + return false; + // If some file is using ES6 modules, assume that it's OK to add more. + if (program.getSourceFiles().some(function (s) { return !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!s.externalModuleIndicator; })) { + return true; + } + // For JS, stay on the safe side. + if (ts.isSourceFileJavaScript(sourceFile)) + return false; + // If module transpilation is enabled or we're targeting es6 or above, or not emitting, OK. + var compilerOptions = program.getCompilerOptions(); + return !!compilerOptions.module || compilerOptions.target >= 2 /* ES2015 */ || !!compilerOptions.noEmit; + } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 272 /* SourceFile */: - case 200 /* TemplateExpression */: - case 263 /* JsxExpression */: - case 211 /* Block */: + case 273 /* SourceFile */: + case 201 /* TemplateExpression */: + case 264 /* JsxExpression */: + case 212 /* Block */: return true; default: return ts.isStatement(scopeNode); @@ -85702,12 +86175,12 @@ var ts; return parentKind === 151 /* PropertyDeclaration */ || parentKind === 150 /* PropertySignature */ || parentKind === 148 /* Parameter */ || - parentKind === 230 /* VariableDeclaration */ || + parentKind === 231 /* VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 58 /* EqualsToken */: - return parentKind === 235 /* TypeAliasDeclaration */; + return parentKind === 236 /* TypeAliasDeclaration */; case 118 /* AsKeyword */: - return parentKind === 206 /* AsExpression */; + return parentKind === 207 /* AsExpression */; } } return false; @@ -85728,7 +86201,7 @@ var ts; } function getSymbolsFromOtherSourceFileExports(symbols, tokenText, target) { var tokenTextLowerCase = tokenText.toLowerCase(); - ts.codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, allSourceFiles, function (moduleSymbol) { + ts.codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, program.getSourceFiles(), function (moduleSymbol) { for (var _i = 0, _a = typeChecker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) { var symbol = _a[_i]; // Don't add a completion for a re-export, only for the original. @@ -85799,11 +86272,11 @@ var ts; return true; } if (contextToken.kind === 29 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 255 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 256 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 256 /* JsxClosingElement */ || contextToken.parent.kind === 254 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 253 /* JsxElement */; + if (contextToken.parent.kind === 257 /* JsxClosingElement */ || contextToken.parent.kind === 255 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 254 /* JsxElement */; } } return false; @@ -85813,36 +86286,36 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 26 /* CommaToken */: - return containingNodeKind === 185 /* CallExpression */ // func( a, | + return containingNodeKind === 186 /* CallExpression */ // func( a, | || containingNodeKind === 154 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 186 /* NewExpression */ // new C(a, | - || containingNodeKind === 181 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 198 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 187 /* NewExpression */ // new C(a, | + || containingNodeKind === 182 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 199 /* BinaryExpression */ // const x = (a, | || containingNodeKind === 162 /* FunctionType */; // var x: (s: string, list| case 19 /* OpenParenToken */: - return containingNodeKind === 185 /* CallExpression */ // func( | + return containingNodeKind === 186 /* CallExpression */ // func( | || containingNodeKind === 154 /* Constructor */ // constructor( | - || containingNodeKind === 186 /* NewExpression */ // new C(a| - || containingNodeKind === 189 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 187 /* NewExpression */ // new C(a| + || containingNodeKind === 190 /* ParenthesizedExpression */ // const x = (a| || containingNodeKind === 172 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 21 /* OpenBracketToken */: - return containingNodeKind === 181 /* ArrayLiteralExpression */ // [ | + return containingNodeKind === 182 /* ArrayLiteralExpression */ // [ | || containingNodeKind === 159 /* IndexSignature */ // [ | : string ] || containingNodeKind === 146 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 129 /* ModuleKeyword */: // module | case 130 /* NamespaceKeyword */: // namespace | return true; case 23 /* DotToken */: - return containingNodeKind === 237 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 238 /* ModuleDeclaration */; // module A.| case 17 /* OpenBraceToken */: - return containingNodeKind === 233 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 234 /* ClassDeclaration */; // class A{ | case 58 /* EqualsToken */: - return containingNodeKind === 230 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 198 /* BinaryExpression */; // x = a| + return containingNodeKind === 231 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 199 /* BinaryExpression */; // x = a| case 14 /* TemplateHead */: - return containingNodeKind === 200 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 201 /* TemplateExpression */; // `aa ${| case 15 /* TemplateMiddle */: - return containingNodeKind === 209 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 210 /* TemplateSpan */; // `aa ${10} dd ${| case 114 /* PublicKeyword */: case 112 /* PrivateKeyword */: case 113 /* ProtectedKeyword */: @@ -85892,7 +86365,7 @@ var ts; completionKind = 0 /* ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 182 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 183 /* ObjectLiteralExpression */) { var typeForObject = typeChecker.getContextualType(objectLikeContainer); if (!typeForObject) return 2 /* Fail */; @@ -85901,7 +86374,7 @@ var ts; existingMembers = objectLikeContainer.properties; } else { - ts.Debug.assert(objectLikeContainer.kind === 178 /* ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 179 /* ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -85912,7 +86385,7 @@ 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.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 220 /* ForOfStatement */; + var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 221 /* ForOfStatement */; if (!canGetType && rootDeclaration.kind === 148 /* Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); @@ -85957,9 +86430,9 @@ var ts; return undefined; // cursor is in an import clause // try to show exported member for imported module - var declarationKind = namedImportsOrExports.kind === 245 /* NamedImports */ ? - 242 /* ImportDeclaration */ : - 248 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 246 /* NamedImports */ ? + 243 /* ImportDeclaration */ : + 249 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -86044,8 +86517,8 @@ var ts; case 17 /* OpenBraceToken */: // import { | case 26 /* CommaToken */: // import { a as 0, | switch (contextToken.parent.kind) { - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return contextToken.parent; } } @@ -86096,14 +86569,14 @@ var ts; case 28 /* LessThanSlashToken */: case 41 /* SlashToken */: case 71 /* Identifier */: - case 183 /* PropertyAccessExpression */: - case 261 /* JsxAttributes */: - case 260 /* JsxAttribute */: - case 262 /* JsxSpreadAttribute */: - if (parent && (parent.kind === 254 /* JsxSelfClosingElement */ || parent.kind === 255 /* JsxOpeningElement */)) { + case 184 /* PropertyAccessExpression */: + case 262 /* JsxAttributes */: + case 261 /* JsxAttribute */: + case 263 /* JsxSpreadAttribute */: + if (parent && (parent.kind === 255 /* JsxSelfClosingElement */ || parent.kind === 256 /* JsxOpeningElement */)) { return parent; } - else if (parent.kind === 260 /* JsxAttribute */) { + else if (parent.kind === 261 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -86115,7 +86588,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent && ((parent.kind === 260 /* JsxAttribute */) || (parent.kind === 262 /* JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 261 /* JsxAttribute */) || (parent.kind === 263 /* JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -86125,8 +86598,8 @@ var ts; break; case 18 /* CloseBraceToken */: if (parent && - parent.kind === 263 /* JsxExpression */ && - parent.parent && parent.parent.kind === 260 /* JsxAttribute */) { + parent.kind === 264 /* JsxExpression */ && + parent.parent && parent.parent.kind === 261 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -86134,7 +86607,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 262 /* JsxSpreadAttribute */) { + if (parent && parent.kind === 263 /* JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -86153,50 +86626,50 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 26 /* CommaToken */: - return containingNodeKind === 230 /* VariableDeclaration */ || - containingNodeKind === 231 /* VariableDeclarationList */ || - containingNodeKind === 212 /* VariableStatement */ || - containingNodeKind === 236 /* EnumDeclaration */ || // enum a { foo, | + return containingNodeKind === 231 /* VariableDeclaration */ || + containingNodeKind === 232 /* VariableDeclarationList */ || + containingNodeKind === 213 /* VariableStatement */ || + containingNodeKind === 237 /* EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 234 /* InterfaceDeclaration */ || // interface A= contextToken.pos); case 23 /* DotToken */: - return containingNodeKind === 179 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 180 /* ArrayBindingPattern */; // var [.| case 56 /* ColonToken */: - return containingNodeKind === 180 /* BindingElement */; // var {x :html| + return containingNodeKind === 181 /* BindingElement */; // var {x :html| case 21 /* OpenBracketToken */: - return containingNodeKind === 179 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 180 /* ArrayBindingPattern */; // var [x| case 19 /* OpenParenToken */: - return containingNodeKind === 267 /* CatchClause */ || + return containingNodeKind === 268 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 17 /* OpenBraceToken */: - return containingNodeKind === 236 /* EnumDeclaration */; // enum a { | + return containingNodeKind === 237 /* EnumDeclaration */; // enum a { | case 27 /* LessThanToken */: - return containingNodeKind === 233 /* ClassDeclaration */ || // class A< | - containingNodeKind === 203 /* ClassExpression */ || // var C = class D< | - containingNodeKind === 234 /* InterfaceDeclaration */ || // interface A< | - containingNodeKind === 235 /* TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 234 /* ClassDeclaration */ || // class A< | + containingNodeKind === 204 /* ClassExpression */ || // var C = class D< | + containingNodeKind === 235 /* InterfaceDeclaration */ || // interface A< | + containingNodeKind === 236 /* TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 115 /* StaticKeyword */: return containingNodeKind === 151 /* PropertyDeclaration */ && !ts.isClassLike(contextToken.parent.parent); case 24 /* DotDotDotToken */: return containingNodeKind === 148 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 179 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 180 /* ArrayBindingPattern */); // var [...z| case 114 /* PublicKeyword */: case 112 /* PrivateKeyword */: case 113 /* ProtectedKeyword */: return containingNodeKind === 148 /* Parameter */ && !ts.isConstructorDeclaration(contextToken.parent.parent); case 118 /* AsKeyword */: - return containingNodeKind === 246 /* ImportSpecifier */ || - containingNodeKind === 250 /* ExportSpecifier */ || - containingNodeKind === 244 /* NamespaceImport */; + return containingNodeKind === 247 /* ImportSpecifier */ || + containingNodeKind === 251 /* ExportSpecifier */ || + containingNodeKind === 245 /* NamespaceImport */; case 125 /* GetKeyword */: case 136 /* SetKeyword */: if (isFromObjectTypeDeclaration(contextToken)) { @@ -86302,9 +86775,9 @@ 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 !== 268 /* PropertyAssignment */ && - m.kind !== 269 /* ShorthandPropertyAssignment */ && - m.kind !== 180 /* BindingElement */ && + if (m.kind !== 269 /* PropertyAssignment */ && + m.kind !== 270 /* ShorthandPropertyAssignment */ && + m.kind !== 181 /* BindingElement */ && m.kind !== 153 /* MethodDeclaration */ && m.kind !== 155 /* GetAccessor */ && m.kind !== 156 /* SetAccessor */) { @@ -86315,7 +86788,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 180 /* BindingElement */ && m.propertyName) { + if (m.kind === 181 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 71 /* Identifier */) { existingName = m.propertyName.escapedText; @@ -86385,7 +86858,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 260 /* JsxAttribute */) { + if (attr.kind === 261 /* JsxAttribute */) { seenNames.set(attr.name.escapedText, true); } } @@ -86415,7 +86888,7 @@ var ts; // TODO: GH#18169 return { name: JSON.stringify(name), needsConvertPropertyAccess: false }; case 2 /* PropertyAccess */: - case 1 /* Global */: + case 1 /* Global */: // For a 'this.' completion it will be in a global context, but may have a non-identifier name. // Don't add a completion for a name starting with a space. See https://github.com/Microsoft/TypeScript/pull/20547 return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true }; case 5 /* None */: @@ -86525,12 +86998,11 @@ var ts; * excludes array-like types or callable/constructable types. */ function getPropertiesForCompletion(type, checker, isForAccess) { - if (!(type.flags & 131072 /* Union */)) { + if (!(type.isUnion())) { return ts.Debug.assertEachDefined(type.getApparentProperties(), "getApparentProperties() should all be defined"); } - var types = type.types; // If we're providing completions for an object literal, skip primitive, array-like, or callable types since those shouldn't be implemented by object literals. - var filteredTypes = isForAccess ? types : types.filter(function (memberType) { + var filteredTypes = isForAccess ? type.types : type.types.filter(function (memberType) { return !(memberType.flags & 16382 /* Primitive */ || checker.isArrayLikeType(memberType) || ts.typeHasCallOrConstructSignatures(memberType, checker)); }); return ts.Debug.assertEachDefined(checker.getAllPossiblePropertiesOfTypes(filteredTypes), "getAllPossiblePropertiesOfTypes() should all be defined"); @@ -86542,7 +87014,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) { // class c { method() { } | method2() { } } switch (location.kind) { - case 293 /* SyntaxList */: + case 294 /* SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -86691,7 +87163,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 272 /* SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 273 /* SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -86723,16 +87195,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 225 /* SwitchStatement */: - if (statement.kind === 221 /* ContinueStatement */) { + case 226 /* SwitchStatement */: + if (statement.kind === 222 /* ContinueStatement */) { return false; } // falls through - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 217 /* WhileStatement */: - case 216 /* DoStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 218 /* WhileStatement */: + case 217 /* DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -86755,11 +87227,11 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 238 /* ModuleBlock */: - case 272 /* SourceFile */: - case 211 /* Block */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 239 /* ModuleBlock */: + case 273 /* SourceFile */: + case 212 /* Block */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */ && ts.isClassDeclaration(declaration)) { return declaration.members.concat([declaration]); @@ -86769,11 +87241,11 @@ var ts; } case 154 /* Constructor */: case 153 /* MethodDeclaration */: - case 232 /* FunctionDeclaration */: { + case 233 /* FunctionDeclaration */: { return container.parameters.concat((ts.isClassLike(container.parent) ? container.parent.members : [])); } - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: 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. @@ -86806,7 +87278,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 88 /* ForKeyword */, 106 /* WhileKeyword */, 81 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 216 /* DoStatement */) { + if (loopNode.kind === 217 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 106 /* WhileKeyword */)) { @@ -86826,13 +87298,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -87134,10 +87606,10 @@ var ts; } cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportEquals */ && parent.kind === 230 /* VariableDeclaration */) { + if (exportKind === 2 /* ExportEquals */ && parent.kind === 231 /* VariableDeclaration */) { var name = parent.name; if (name.kind === 71 /* Identifier */) { directImports.push(name); @@ -87148,12 +87620,12 @@ var ts; addIndirectUser(direct.getSourceFile()); } break; - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */)); break; - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 244 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 245 /* NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name); } else if (ts.isDefaultImport(direct)) { @@ -87167,7 +87639,7 @@ var ts; directImports.push(direct); } break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); @@ -87188,7 +87660,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 272 /* SourceFile */ || sourceFileLike.kind === 237 /* ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 273 /* SourceFile */ || sourceFileLike.kind === 238 /* ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUsers(sourceFileLike); } @@ -87243,7 +87715,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 241 /* ImportEqualsDeclaration */) { + if (decl.kind === 242 /* ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -87257,7 +87729,7 @@ var ts; if (decl.moduleSpecifier.kind !== 9 /* StringLiteral */) { return; } - if (decl.kind === 248 /* ExportDeclaration */) { + if (decl.kind === 249 /* ExportDeclaration */) { searchForNamedImport(decl.exportClause); return; } @@ -87266,7 +87738,7 @@ var ts; return; } var namedBindings = importClause.namedBindings; - if (namedBindings && namedBindings.kind === 244 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 245 /* NamespaceImport */) { handleNamespaceImportLike(namedBindings.name); return; } @@ -87318,7 +87790,7 @@ var ts; } } else { - var localSymbol = element.kind === 250 /* ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 251 /* 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); @@ -87334,7 +87806,7 @@ var ts; function findNamespaceReExports(sourceFileLike, name, checker) { var namespaceImportSymbol = checker.getSymbolAtLocation(name); return forEachPossibleImportOrExportStatement(sourceFileLike, function (statement) { - if (statement.kind !== 248 /* ExportDeclaration */) + if (statement.kind !== 249 /* ExportDeclaration */) return; var _a = statement, exportClause = _a.exportClause, moduleSpecifier = _a.moduleSpecifier; if (moduleSpecifier || !exportClause) @@ -87353,7 +87825,7 @@ var ts; for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { var referencingFile = sourceFiles_4[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if (searchSourceFile.kind === 272 /* SourceFile */) { + if (searchSourceFile.kind === 273 /* SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -87400,7 +87872,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 === 272 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 273 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -87415,20 +87887,18 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 248 /* ExportDeclaration */: - case 242 /* ImportDeclaration */: { + case 249 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: { var decl = statement; - if (decl.moduleSpecifier && decl.moduleSpecifier.kind === 9 /* StringLiteral */) { + if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 241 /* ImportEqualsDeclaration */: { + case 242 /* ImportEqualsDeclaration */: { var decl = statement; - var moduleReference = decl.moduleReference; - if (moduleReference.kind === 252 /* ExternalModuleReference */ && - moduleReference.expression.kind === 9 /* StringLiteral */) { - action(decl, moduleReference.expression); + if (isExternalModuleImportEquals(decl)) { + action(decl, decl.moduleReference.expression); } break; } @@ -87448,7 +87918,7 @@ var ts; function getExport() { var parent = node.parent; if (symbol.exportSymbol) { - if (parent.kind === 183 /* PropertyAccessExpression */) { + if (parent.kind === 184 /* 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 symbol.declarations.some(function (d) { return d === parent; }) && ts.isBinaryExpression(parent.parent) @@ -87564,10 +88034,10 @@ var ts; // 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. function getExportNode(parent, node) { - if (parent.kind === 230 /* VariableDeclaration */) { + if (parent.kind === 231 /* VariableDeclaration */) { var p = parent; return p.name !== node ? undefined : - p.parent.kind === 267 /* CatchClause */ ? undefined : p.parent.parent.kind === 212 /* VariableStatement */ ? p.parent.parent : undefined; + p.parent.kind === 268 /* CatchClause */ ? undefined : p.parent.parent.kind === 213 /* VariableStatement */ ? p.parent.parent : undefined; } else { return parent; @@ -87576,15 +88046,15 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent) ? { isNamedImport: false } : undefined; - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return parent.propertyName ? undefined : { isNamedImport: true }; - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: ts.Debug.assert(parent.name === node); return { isNamedImport: false }; default: @@ -87626,22 +88096,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 185 /* CallExpression */) { + if (node.kind === 186 /* CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 272 /* SourceFile */) { + if (parent.kind === 273 /* SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 238 /* ModuleBlock */); + ts.Debug.assert(parent.kind === 239 /* ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */; + return node.kind === 238 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */; } - function isExternalModuleImportEquals(_a) { - var moduleReference = _a.moduleReference; - return moduleReference.kind === 252 /* ExternalModuleReference */ && moduleReference.expression.kind === 9 /* StringLiteral */; + function isExternalModuleImportEquals(eq) { + return eq.moduleReference.kind === 253 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 9 /* StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -87675,13 +88144,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* 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 === 269 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 270 /* ShorthandPropertyAssignment */) { var result_5 = []; FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_5.push(nodeEntry(node)); }); return result_5; @@ -87783,13 +88252,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 182 /* ObjectLiteralExpression */) { + else if (node.kind === 183 /* ObjectLiteralExpression */) { return { kind: "interface" /* interfaceElement */, displayParts: [ts.punctuationPart(19 /* OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(20 /* CloseParenToken */)] }; } - else if (node.kind === 203 /* ClassExpression */) { + else if (node.kind === 204 /* ClassExpression */) { return { kind: "local class" /* localClassElement */, displayParts: [ts.punctuationPart(19 /* OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(20 /* CloseParenToken */)] @@ -87868,12 +88337,12 @@ var ts; return false; } switch (node.parent.kind) { - case 237 /* ModuleDeclaration */: - case 252 /* ExternalModuleReference */: - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 238 /* ModuleDeclaration */: + case 253 /* ExternalModuleReference */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return true; - case 185 /* CallExpression */: + case 186 /* CallExpression */: return ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false) || ts.isImportCall(node.parent); default: return false; @@ -87896,10 +88365,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 272 /* SourceFile */: + case 273 /* 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 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: references.push({ type: "node", node: decl.name }); break; default: @@ -87990,7 +88459,7 @@ var ts; return ts.firstDefined(symbol.declarations, function (decl) { if (!decl.parent) { // Assertions for GH#21814. We should be handling SourceFile symbols in `getReferencedSymbolsForModule` instead of getting here. - ts.Debug.assert(decl.kind === 272 /* SourceFile */); + ts.Debug.assert(decl.kind === 273 /* SourceFile */); ts.Debug.fail("Unexpected symbol at " + ts.Debug.showSyntaxKind(node) + ": " + ts.Debug.showSymbol(symbol)); } return ts.isTypeLiteralNode(decl.parent) && ts.isUnionTypeNode(decl.parent.parent) @@ -88156,9 +88625,9 @@ var ts; checker.getPropertySymbolOfDestructuringAssignment(location); } function getObjectBindingElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 180 /* BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 181 /* BindingElement */); if (bindingElement && - bindingElement.parent.kind === 178 /* ObjectBindingPattern */ && + bindingElement.parent.kind === 179 /* ObjectBindingPattern */ && !bindingElement.propertyName) { return bindingElement; } @@ -88188,7 +88657,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 === 190 /* FunctionExpression */ || valueDeclaration.kind === 203 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 191 /* FunctionExpression */ || valueDeclaration.kind === 204 /* ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -88198,7 +88667,7 @@ var ts; if (flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasModifier(d, 8 /* Private */); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 233 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 234 /* ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -88227,7 +88696,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 272 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 273 /* 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; @@ -88589,7 +89058,7 @@ var ts; if (refNode.kind !== 71 /* Identifier */) { return; } - if (refNode.parent.kind === 269 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 270 /* ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -88608,7 +89077,7 @@ var ts; } else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { var body = parent.body; - if (body.kind === 211 /* Block */) { + if (body.kind === 212 /* Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { addReference(returnStatement.expression); @@ -88631,7 +89100,7 @@ var ts; if (componentType.symbol && componentType.symbol.getFlags() & (32 /* Class */ | 64 /* Interface */)) { result.push(componentType.symbol); } - if (componentType.getFlags() & 393216 /* UnionOrIntersection */) { + if (componentType.isUnionOrIntersection()) { getSymbolsForClassAndInterfaceComponents(componentType, result); } } @@ -88649,12 +89118,12 @@ var ts; } function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { - if (node.kind === 205 /* ExpressionWithTypeArguments */ - && node.parent.kind === 266 /* HeritageClause */ + if (node.kind === 206 /* ExpressionWithTypeArguments */ + && node.parent.kind === 267 /* HeritageClause */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } - else if (node.kind === 71 /* Identifier */ || node.kind === 183 /* PropertyAccessExpression */) { + else if (node.kind === 71 /* Identifier */ || node.kind === 184 /* PropertyAccessExpression */) { return getContainingClassIfInHeritageClause(node.parent); } } @@ -88665,13 +89134,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 191 /* ArrowFunction */: - case 190 /* FunctionExpression */: - case 182 /* ObjectLiteralExpression */: - case 203 /* ClassExpression */: - case 181 /* ArrayLiteralExpression */: + case 192 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 183 /* ObjectLiteralExpression */: + case 204 /* ClassExpression */: + case 182 /* ArrayLiteralExpression */: return true; default: return false; @@ -88770,13 +89239,13 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // falls through - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* 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. @@ -88784,11 +89253,11 @@ var ts; return undefined; } var references = []; - for (var _i = 0, _a = searchSpaceNode.kind === 272 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()]; _i < _a.length; _i++) { + for (var _i = 0, _a = searchSpaceNode.kind === 273 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()]; _i < _a.length; _i++) { var sourceFile = _a[_i]; cancellationToken.throwIfCancellationRequested(); var positions = getPossibleSymbolReferencePositions(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode); - getThisReferencesInFile(sourceFile, searchSpaceNode.kind === 272 /* SourceFile */ ? sourceFile : searchSpaceNode, positions, staticFlag, references); + getThisReferencesInFile(sourceFile, searchSpaceNode.kind === 273 /* SourceFile */ ? sourceFile : searchSpaceNode, positions, staticFlag, references); } return [{ definition: { type: "this", node: thisOrSuperKeyword }, @@ -88803,8 +89272,8 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(FindAllReferences.nodeEntry(node)); } @@ -88815,16 +89284,16 @@ var ts; result.push(FindAllReferences.nodeEntry(node)); } break; - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { result.push(FindAllReferences.nodeEntry(node)); } break; - case 272 /* SourceFile */: - if (container.kind === 272 /* SourceFile */ && !ts.isExternalModule(container)) { + case 273 /* SourceFile */: + if (container.kind === 273 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(FindAllReferences.nodeEntry(node)); } break; @@ -88854,7 +89323,7 @@ var ts; // If the location is name of property symbol from object literal destructuring pattern // Search the property symbol // for ( { property: p2 } of elems) { } - if (containingObjectLiteralElement.kind !== 269 /* ShorthandPropertyAssignment */) { + if (containingObjectLiteralElement.kind !== 270 /* ShorthandPropertyAssignment */) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); if (propertySymbol) { result.push(propertySymbol); @@ -88905,7 +89374,7 @@ var ts; result.push(rootSymbol); // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, result, /*previousIterationSymbolsCache*/ ts.createSymbolTable(), checker); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, result); } } } @@ -88923,36 +89392,31 @@ var ts; * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. * The value of previousIterationSymbol is undefined when the function is first called. */ - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, checker) { - // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited - // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. - // For example: - // interface C extends C { - // /*findRef*/propName: string; - // } - // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, - // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, - // the function will add any found symbol of the property-name, then its sub-routine will call - // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already - // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. - if (!symbol || previousIterationSymbolsCache.has(symbol.escapedName)) { - return; - } - if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + function getPropertySymbolsFromBaseTypes(symbol, propertyName, checker, result) { + if (result === void 0) { result = []; } + var seen = ts.createMap(); + recur(symbol); + return result; + function recur(symbol) { + // Use `addToSeen` to ensure we don't infinitely recurse in this situation: + // interface C extends C { + // /*findRef*/propName: string; + // } + if (!(symbol.flags & (32 /* Class */ | 64 /* Interface */)) || !ts.addToSeen(seen, ts.getSymbolId(symbol))) + return; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; for (var _b = 0, _c = ts.getAllSuperTypeNodes(declaration); _b < _c.length; _b++) { var typeReference = _c[_b]; var type = checker.getTypeAtLocation(typeReference); - if (!type) + if (!(type && type.symbol)) continue; var propertySymbol = checker.getPropertyOfType(type, propertyName); if (propertySymbol) { result.push.apply(result, checker.getRootSymbols(propertySymbol)); } // Visit the typeReference as well to see if it directly or indirectly use that property - previousIterationSymbolsCache.set(symbol.escapedName, symbol); - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, checker); + recur(type.symbol); } } } @@ -89016,32 +89480,19 @@ var ts; if (search.parents && !ts.some(search.parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker); })) { return undefined; } - var result = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, result, /*previousIterationSymbolsCache*/ ts.createSymbolTable(), checker); - return result.some(search.includes) ? rootSymbol : undefined; + return getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker).some(search.includes) ? rootSymbol : undefined; } return undefined; }); } } - function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 146 /* ComputedPropertyName */) { - var nameExpression = node.name.expression; - // treat computed property names where expression is string/numeric literal as just string/numeric literal - if (ts.isStringOrNumericLiteral(nameExpression)) { - return nameExpression.text; - } - return undefined; - } - return ts.getTextOfIdentifierOrLiteral(node.name); - } /** Gets all symbols for one property. Does not get symbols for every property. */ function getPropertySymbolsFromContextualType(node, checker) { var contextualType = checker.getContextualType(node.parent); - var name = getNameFromObjectLiteralElement(node); + var name = ts.getNameFromPropertyName(node.name); var symbol = contextualType && name && contextualType.getProperty(name); return symbol ? [symbol] : - contextualType && contextualType.flags & 131072 /* Union */ ? ts.mapDefined(contextualType.types, function (t) { return t.getProperty(name); }) : ts.emptyArray; + contextualType && contextualType.isUnion() ? ts.mapDefined(contextualType.types, function (t) { return t.getProperty(name); }) : ts.emptyArray; } /** * Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations @@ -89114,19 +89565,12 @@ var ts; */ function getParentSymbolsOfPropertyAccess(location, symbol, checker) { var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(location); - if (!propertyAccessExpression) { - return undefined; - } - var localParentType = checker.getTypeAtLocation(propertyAccessExpression.expression); - if (!localParentType) { - return undefined; - } - if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== symbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 393216 /* UnionOrIntersection */) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } + var localParentType = propertyAccessExpression && checker.getTypeAtLocation(propertyAccessExpression.expression); + return localParentType && localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== symbol.parent + ? [localParentType.symbol] + : localParentType && localParentType.isUnionOrIntersection() + ? getSymbolsForClassAndInterfaceComponents(localParentType) + : undefined; } })(Core = FindAllReferences.Core || (FindAllReferences.Core = {})); })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); @@ -89176,7 +89620,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 === 269 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 270 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -89252,7 +89696,7 @@ var ts; if (!type) { return undefined; } - if (type.flags & 131072 /* Union */ && !(type.flags & 16 /* Enum */)) { + if (type.isUnion() && !(type.flags & 16 /* Enum */)) { return ts.flatMap(type.types, function (t) { return t.symbol && getDefinitionFromSymbol(typeChecker, t.symbol, node); }); } return type.symbol && getDefinitionFromSymbol(typeChecker, type.symbol, node); @@ -89286,11 +89730,11 @@ var ts; return true; } switch (declaration.kind) { - case 243 /* ImportClause */: - case 241 /* ImportEqualsDeclaration */: + case 244 /* ImportClause */: + case 242 /* ImportEqualsDeclaration */: return true; - case 246 /* ImportSpecifier */: - return declaration.parent.kind === 245 /* NamedImports */; + case 247 /* ImportSpecifier */: + return declaration.parent.kind === 246 /* NamedImports */; default: return false; } @@ -89325,7 +89769,7 @@ var ts; switch (node.kind) { case 154 /* Constructor */: case 158 /* ConstructSignature */: - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: return true; @@ -89477,9 +89921,9 @@ var ts; JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 292 /* JSDocPropertyTag */: + case 293 /* JSDocPropertyTag */: return [declaration]; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return [declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -89500,15 +89944,15 @@ var ts; function getCommentText(tag) { var comment = tag.comment; switch (tag.kind) { - case 285 /* JSDocAugmentsTag */: + case 286 /* JSDocAugmentsTag */: return withNode(tag.class); - case 290 /* JSDocTemplateTag */: + case 291 /* JSDocTemplateTag */: return withList(tag.typeParameters); - case 289 /* JSDocTypeTag */: + case 290 /* JSDocTypeTag */: return withNode(tag.typeExpression); - case 291 /* JSDocTypedefTag */: - case 292 /* JSDocPropertyTag */: - case 287 /* JSDocParameterTag */: + case 292 /* JSDocTypedefTag */: + case 293 /* JSDocPropertyTag */: + case 288 /* JSDocParameterTag */: var name = tag.name; return name ? withNode(name) : comment; default: @@ -89691,20 +90135,20 @@ var ts; function getCommentOwnerInfo(tokenAtPos) { for (var commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: case 152 /* MethodSignature */: var parameters = commentOwner.parameters; return { commentOwner: commentOwner, parameters: parameters }; - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: case 150 /* PropertySignature */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 235 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 236 /* TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 212 /* VariableStatement */: { + case 213 /* VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; var parameters_1 = varDeclarations.length === 1 && varDeclarations[0].initializer @@ -89712,14 +90156,14 @@ var ts; : undefined; return { commentOwner: commentOwner, parameters: parameters_1 }; } - case 272 /* SourceFile */: + case 273 /* SourceFile */: return undefined; - case 237 /* ModuleDeclaration */: + case 238 /* 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 === 237 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 198 /* BinaryExpression */: { + return commentOwner.parent.kind === 238 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 199 /* BinaryExpression */: { var be = commentOwner; if (ts.getSpecialPropertyAssignmentKind(be) === 0 /* None */) { return undefined; @@ -89739,14 +90183,14 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 189 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 190 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return rightHandSide.parameters; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; if (member.kind === 154 /* Constructor */) { @@ -90145,16 +90589,14 @@ var ts; continue; } } - var matchKind = bestMatchKind(containerMatches); - var isCaseSensitive = allMatchesAreCaseSensitive(containerMatches); - rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: isCaseSensitive, declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: Math.min.apply(Math, matches.map(function (m) { return m.kind; })), isCaseSensitive: matches.every(function (m) { return m.isCaseSensitive; }), declaration: declaration }); } } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 243 /* ImportClause */: - case 246 /* ImportSpecifier */: - case 241 /* ImportEqualsDeclaration */: + case 244 /* ImportClause */: + case 247 /* ImportSpecifier */: + case 242 /* ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -90162,17 +90604,6 @@ var ts; return true; } } - function allMatchesAreCaseSensitive(matches) { - ts.Debug.assert(matches.length > 0); - // This is a case sensitive match, only if all the submatches were case sensitive. - for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { - var match = matches_1[_i]; - if (!match.isCaseSensitive) { - return false; - } - } - return true; - } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); if (name && ts.isPropertyNameLiteral(name)) { @@ -90211,10 +90642,8 @@ 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.kind === 146 /* ComputedPropertyName */) { - if (!tryAddComputedPropertyName(name.expression, containers, /*includeLastPortion*/ false)) { - return undefined; - } + if (name.kind === 146 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers, /*includeLastPortion*/ false)) { + return undefined; } // Now, walk up our containers, adding all their names to the container array. declaration = ts.getContainerNode(declaration); @@ -90226,18 +90655,6 @@ var ts; } return containers; } - function bestMatchKind(matches) { - ts.Debug.assert(matches.length > 0); - var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) { - var match = matches_2[_i]; - var kind = match.kind; - if (kind < bestMatchKind) { - bestMatchKind = kind; - } - } - return bestMatchKind; - } function compareNavigateToItems(i1, i2) { // TODO(cyrusn): get the gamut of comparisons that VS already uses here. return ts.compareValues(i1.matchKind, i2.matchKind) @@ -90418,7 +90835,7 @@ var ts; addLeafNode(node); } break; - case 243 /* ImportClause */: + case 244 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -90430,7 +90847,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 244 /* NamespaceImport */) { + if (namedBindings.kind === 245 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -90441,8 +90858,8 @@ var ts; } } break; - case 180 /* BindingElement */: - case 230 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 231 /* VariableDeclaration */: var _d = node, name = _d.name, initializer = _d.initializer; if (ts.isBindingPattern(name)) { addChildrenRecursively(name); @@ -90463,12 +90880,12 @@ var ts; addNodeWithRecursiveChild(node, initializer); } break; - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -90478,9 +90895,9 @@ var ts; } endNode(); break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -90488,18 +90905,18 @@ var ts; } endNode(); break; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 250 /* ExportSpecifier */: - case 241 /* ImportEqualsDeclaration */: + case 251 /* ExportSpecifier */: + case 242 /* ImportEqualsDeclaration */: case 159 /* IndexSignature */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: addLeafNode(node); break; - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var special = ts.getSpecialPropertyAssignmentKind(node); switch (special) { case 1 /* ExportsProperty */: @@ -90521,7 +90938,7 @@ var ts; if (ts.hasJSDocNodes(node)) { ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 291 /* JSDocTypedefTag */) { + if (tag.kind === 292 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -90583,7 +91000,7 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: return ts.hasModifier(a, 32 /* Static */) === ts.hasModifier(b, 32 /* Static */); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return areSameModule(a, b); default: return true; @@ -90592,7 +91009,7 @@ var ts; // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes. // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { - return a.body.kind === b.body.kind && (a.body.kind !== 237 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 238 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -90622,7 +91039,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 237 /* ModuleDeclaration */) { + if (node.kind === 238 /* ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -90630,18 +91047,18 @@ var ts; return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); } switch (node.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 203 /* ClassExpression */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 204 /* ClassExpression */: return getFunctionOrClassName(node); - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 237 /* ModuleDeclaration */) { + if (node.kind === 238 /* ModuleDeclaration */) { return getModuleName(node); } var name = ts.getNameOfDeclaration(node); @@ -90652,16 +91069,16 @@ var ts; } } switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; } @@ -90677,7 +91094,7 @@ var ts; return "()"; case 159 /* IndexSignature */: return "[]"; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -90689,7 +91106,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 212 /* VariableStatement */) { + if (parentNode && parentNode.kind === 213 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 71 /* Identifier */) { @@ -90718,24 +91135,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 236 /* EnumDeclaration */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 272 /* SourceFile */: - case 235 /* TypeAliasDeclaration */: - case 291 /* JSDocTypedefTag */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 237 /* EnumDeclaration */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 273 /* SourceFile */: + case 236 /* TypeAliasDeclaration */: + case 292 /* JSDocTypedefTag */: return true; case 154 /* Constructor */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return hasSomeImportantChild(item); - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -90745,8 +91162,8 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 238 /* ModuleBlock */: - case 272 /* SourceFile */: + case 239 /* ModuleBlock */: + case 273 /* SourceFile */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: return true; @@ -90757,7 +91174,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 230 /* VariableDeclaration */ && childKind !== 180 /* BindingElement */; + return childKind !== 231 /* VariableDeclaration */ && childKind !== 181 /* BindingElement */; }); } } @@ -90813,7 +91230,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 237 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 238 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -90824,16 +91241,16 @@ var ts; * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again. */ function getInteriorModule(decl) { - return decl.body.kind === 237 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 238 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { return !member.name || member.name.kind === 146 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 272 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 273 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 230 /* VariableDeclaration */) { + if (node.parent && node.parent.kind === 231 /* VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -90843,16 +91260,16 @@ var ts; return ts.declarationNameToString(node.name); } // See if it is a var initializer. If so, use the var name. - else if (node.parent.kind === 230 /* VariableDeclaration */) { + else if (node.parent.kind === 231 /* VariableDeclaration */) { return ts.declarationNameToString(node.parent.name); } // See if it is of the form " = function(){...}". If so, use the text from the left-hand side. - else if (node.parent.kind === 198 /* BinaryExpression */ && + else if (node.parent.kind === 199 /* BinaryExpression */ && node.parent.operatorToken.kind === 58 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } // See if it is a property assignment, and if so use the property name - else if (node.parent.kind === 268 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 269 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } // Default exports are named "default" @@ -90865,9 +91282,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 191 /* ArrowFunction */: - case 190 /* FunctionExpression */: - case 203 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 204 /* ClassExpression */: return true; default: return false; @@ -91204,24 +91621,24 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 211 /* Block */: + case 212 /* Block */: if (ts.isFunctionBlock(n)) { - return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 191 /* ArrowFunction */); + return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 192 /* ArrowFunction */); } // Check if the block is standalone, or 'attached' to some parent statement. // 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 216 /* DoStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 218 /* ForStatement */: - case 215 /* IfStatement */: - case 217 /* WhileStatement */: - case 224 /* WithStatement */: - case 267 /* CatchClause */: + case 217 /* DoStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 219 /* ForStatement */: + case 216 /* IfStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: + case 268 /* CatchClause */: return spanForNode(n.parent); - case 228 /* TryStatement */: + case 229 /* TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -91236,16 +91653,16 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile)); } - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return spanForNode(n.parent); - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 239 /* CaseBlock */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 240 /* CaseBlock */: return spanForNode(n); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 21 /* OpenBracketToken */); } function spanForObjectOrArrayLiteral(node, open) { @@ -91288,12 +91705,10 @@ var ts; PatternMatchKind[PatternMatchKind["substring"] = 2] = "substring"; PatternMatchKind[PatternMatchKind["camelCase"] = 3] = "camelCase"; })(PatternMatchKind = ts.PatternMatchKind || (ts.PatternMatchKind = {})); - function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) { + function createPatternMatch(kind, isCaseSensitive) { return { kind: kind, - punctuationStripped: punctuationStripped, - isCaseSensitive: isCaseSensitive, - camelCaseWeight: camelCaseWeight + isCaseSensitive: isCaseSensitive }; } function createPatternMatcher(pattern) { @@ -91306,304 +91721,237 @@ var ts; var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { - getMatches: getMatches, - getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern, + getMatches: function (containers, candidate) { return skipMatch(candidate) ? undefined : getMatches(containers, candidate, dotSeparatedSegments, stringToWordSpans); }, + getMatchesForLastSegmentOfPattern: function (candidate) { return skipMatch(candidate) ? undefined : matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments), stringToWordSpans); }, patternContainsDots: dotSeparatedSegments.length > 1 }; // Quick checks so we can bail out when asked to match a candidate. function skipMatch(candidate) { return invalidPattern || !candidate; } - function getMatchesForLastSegmentOfPattern(candidate) { - if (skipMatch(candidate)) { - return undefined; - } - return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); - } - function getMatches(candidateContainers, candidate) { - if (skipMatch(candidate)) { - return undefined; - } - // First, check that the last part of the dot separated pattern matches the name of the - // candidate. If not, then there's no point in proceeding and doing the more - // expensive work. - var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); - if (!candidateMatch) { - return undefined; - } - candidateContainers = candidateContainers || []; - // -1 because the last part was checked against the name, and only the rest - // of the parts are checked against the container. - if (dotSeparatedSegments.length - 1 > candidateContainers.length) { - // There weren't enough container parts to match against the pattern parts. - // So this definitely doesn't match. - return undefined; - } - // So far so good. Now break up the container for the candidate and check if all - // the dotted parts match up correctly. - var totalMatch = candidateMatch; - for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { - var segment = dotSeparatedSegments[i]; - var containerName = candidateContainers[j]; - var containerMatch = matchSegment(containerName, segment); - if (!containerMatch) { - // This container didn't match the pattern piece. So there's no match at all. - return undefined; - } - ts.addRange(totalMatch, containerMatch); - } - // Success, this symbol's full name matched against the dotted name the user was asking - // about. - return totalMatch; - } - function getWordSpans(word) { - var spans = stringToWordSpans.get(word); - if (!spans) { - stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); - } - return spans; - } - function matchTextChunk(candidate, chunk, punctuationStripped) { - var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); - if (index === 0) { - if (chunk.text.length === candidate.length) { - // a) Check if the part matches the candidate entirely, in an case insensitive or - // sensitive manner. If it does, return that there was an exact match. - return createPatternMatch(PatternMatchKind.exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text); - } - else { - // b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive - // manner. If it does, return that there was a prefix match. - return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text)); - } - } - var isLowercase = chunk.isLowerCase; - if (isLowercase) { - if (index > 0) { - // c) If the part is entirely lowercase, then check if it is contained anywhere in the - // candidate in a case insensitive manner. If so, return that there was a substring - // match. - // - // Note: We only have a substring match if the lowercase part is prefix match of some - // word part. That way we don't match something like 'Class' when the user types 'a'. - // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). - var wordSpans = getWordSpans(candidate); - for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { - var span = wordSpans_1[_i]; - if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, - /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); - } - } - } - } - else { - // d) If the part was not entirely lowercase, then check if it is contained in the - // candidate in a case *sensitive* manner. If so, return that there was a substring - // match. - if (candidate.indexOf(chunk.text) > 0) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ true); - } - } - if (!isLowercase) { - // e) If the part was not entirely lowercase, then attempt a camel cased match as well. - if (chunk.characterSpans.length > 0) { - var candidateParts = getWordSpans(candidate); - var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); - if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); - } - camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true); - if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); - } - } - } - if (isLowercase) { - // f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? - // We could check every character boundary start of the candidate for the pattern. However, that's - // an m * n operation in the wost case. Instead, find the first instance of the pattern - // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to - // filter the list based on a substring that starts on a capital letter and also with a lowercase one. - // (Pattern: fogbar, Candidate: quuxfogbarFogBar). - if (chunk.text.length < candidate.length) { - if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ false); - } - } - } + } + ts.createPatternMatcher = createPatternMatcher; + function getMatches(candidateContainers, candidate, dotSeparatedSegments, stringToWordSpans) { + // First, check that the last part of the dot separated pattern matches the name of the + // candidate. If not, then there's no point in proceeding and doing the more + // expensive work. + var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments), stringToWordSpans); + if (!candidateMatch) { return undefined; } - function containsSpaceOrAsterisk(text) { - for (var i = 0; i < text.length; i++) { - var ch = text.charCodeAt(i); - if (ch === 32 /* space */ || ch === 42 /* asterisk */) { - return true; - } - } - return false; + candidateContainers = candidateContainers || []; + // -1 because the last part was checked against the name, and only the rest + // of the parts are checked against the container. + if (dotSeparatedSegments.length - 1 > candidateContainers.length) { + // There weren't enough container parts to match against the pattern parts. + // So this definitely doesn't match. + return undefined; } - function matchSegment(candidate, segment) { - // First check if the segment matches as is. This is also useful if the segment contains - // characters we would normally strip when splitting into parts that we also may want to - // match in the candidate. For example if the segment is "@int" and the candidate is - // "@int", then that will show up as an exact match here. - // - // Note: if the segment contains a space or an asterisk then we must assume that it's a - // multi-word segment. - if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { - var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); - if (match) { - return [match]; - } + // So far so good. Now break up the container for the candidate and check if all + // the dotted parts match up correctly. + var totalMatch = candidateMatch; + for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { + var segment = dotSeparatedSegments[i]; + var containerName = candidateContainers[j]; + var containerMatch = matchSegment(containerName, segment, stringToWordSpans); + if (!containerMatch) { + // This container didn't match the pattern piece. So there's no match at all. + return undefined; } - // The logic for pattern matching is now as follows: - // - // 1) Break the segment passed in into words. Breaking is rather simple and a - // good way to think about it that if gives you all the individual alphanumeric words - // of the pattern. - // - // 2) For each word try to match the word against the candidate value. - // - // 3) Matching is as follows: - // - // a) Check if the word matches the candidate entirely, in an case insensitive or - // sensitive manner. If it does, return that there was an exact match. - // - // b) Check if the word is a prefix of the candidate, in a case insensitive or - // sensitive manner. If it does, return that there was a prefix match. - // - // c) If the word is entirely lowercase, then check if it is contained anywhere in the - // candidate in a case insensitive manner. If so, return that there was a substring - // match. - // - // Note: We only have a substring match if the lowercase part is prefix match of - // some word part. That way we don't match something like 'Class' when the user - // types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with - // 'a'). - // - // d) If the word was not entirely lowercase, then check if it is contained in the - // candidate in a case *sensitive* manner. If so, return that there was a substring - // match. - // - // e) If the word was not entirely lowercase, then attempt a camel cased match as - // well. - // - // f) The word is all lower case. Is it a case insensitive substring of the candidate starting - // on a part boundary of the candidate? - // - // Only if all words have some sort of match is the pattern considered matched. - var subWordTextChunks = segment.subWordTextChunks; - var matches; - for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { - var subWordTextChunk = subWordTextChunks_1[_i]; - // Try to match the candidate with this word - var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); - if (!result) { - return undefined; - } - matches = matches || []; - matches.push(result); - } - return matches; + ts.addRange(totalMatch, containerMatch); } - function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { - var patternPartStart = patternSpan ? patternSpan.start : 0; - var patternPartLength = patternSpan ? patternSpan.length : pattern.length; - if (patternPartLength > candidateSpan.length) { - // Pattern part is longer than the candidate part. There can never be a match. - return false; - } - if (ignoreCase) { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (toLowerCase(ch1) !== toLowerCase(ch2)) { - return false; - } - } - } - else { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (ch1 !== ch2) { - return false; - } - } - } - return true; + // Success, this symbol's full name matched against the dotted name the user was asking + // about. + return totalMatch; + } + function getWordSpans(word, stringToWordSpans) { + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { - var chunkCharacterSpans = chunk.characterSpans; - // Note: we may have more pattern parts than candidate parts. This is because multiple - // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". - // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U - // and I will both match in UI. - var currentCandidate = 0; - var currentChunkSpan = 0; - var firstMatch; - var contiguous; - while (true) { - // Let's consider our termination cases - if (currentChunkSpan === chunkCharacterSpans.length) { - // We did match! We shall assign a weight to this - var weight = 0; - // Was this contiguous? - if (contiguous) { - weight += 1; - } - // Did we start at the beginning of the candidate? - if (firstMatch === 0) { - weight += 2; - } - return weight; + return spans; + } + function matchTextChunk(candidate, chunk, stringToWordSpans) { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + // a) Check if the word is a prefix of the candidate, in a case insensitive or + // sensitive manner. If it does, return that there was an exact match if the word and candidate are the same length, else a prefix match. + return createPatternMatch(chunk.text.length === candidate.length ? PatternMatchKind.exact : PatternMatchKind.prefix, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text)); + } + if (chunk.isLowerCase) { + if (index === -1) + return undefined; + // b) If the part is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of some + // word part. That way we don't match something like 'Class' when the user types 'a'. + // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). + var wordSpans = getWordSpans(candidate, stringToWordSpans); + for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { + var span = wordSpans_1[_i]; + if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { + return createPatternMatch(PatternMatchKind.substring, /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); } - else if (currentCandidate === candidateParts.length) { - // No match, since we still have more of the pattern to hit - return undefined; + } + // c) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? + // We could check every character boundary start of the candidate for the pattern. However, that's + // an m * n operation in the wost case. Instead, find the first instance of the pattern + // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to + // filter the list based on a substring that starts on a capital letter and also with a lowercase one. + // (Pattern: fogbar, Candidate: quuxfogbarFogBar). + if (chunk.text.length < candidate.length && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(PatternMatchKind.substring, /*isCaseSensitive:*/ false); + } + } + else { + // d) If the part was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(PatternMatchKind.substring, /*isCaseSensitive:*/ true); + } + // e) If the part was not entirely lowercase, then attempt a camel cased match as well. + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate, stringToWordSpans); + var isCaseSensitive = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false) ? true + : tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true) ? false : undefined; + if (isCaseSensitive !== undefined) { + return createPatternMatch(PatternMatchKind.camelCase, isCaseSensitive); } - var candidatePart = candidateParts[currentCandidate]; - var gotOneMatchThisCandidate = false; - // Consider the case of matching SiUI against SimpleUIElement. The candidate parts - // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' - // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to - // still keep matching pattern parts against that candidate part. - for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { - var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; - if (gotOneMatchThisCandidate) { - // We've already gotten one pattern part match in this candidate. We will - // only continue trying to consumer pattern parts if the last part and this - // part are both upper case. - if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || - !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { - break; - } - } - if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { - break; - } - gotOneMatchThisCandidate = true; - firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; - // If we were contiguous, then keep that value. If we weren't, then keep that - // value. If we don't know, then set the value to 'true' as an initial match is - // obviously contiguous. - contiguous = contiguous === undefined ? true : contiguous; - candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); - } - // Check if we matched anything at all. If we didn't, then we need to unset the - // contiguous bit if we currently had it set. - // If we haven't set the bit yet, then that means we haven't matched anything so - // far, and we don't want to change that. - if (!gotOneMatchThisCandidate && contiguous !== undefined) { - contiguous = false; - } - // Move onto the next candidate. - currentCandidate++; } } } - ts.createPatternMatcher = createPatternMatcher; + function matchSegment(candidate, segment, stringToWordSpans) { + // First check if the segment matches as is. This is also useful if the segment contains + // characters we would normally strip when splitting into parts that we also may want to + // match in the candidate. For example if the segment is "@int" and the candidate is + // "@int", then that will show up as an exact match here. + // + // Note: if the segment contains a space or an asterisk then we must assume that it's a + // multi-word segment. + if (every(segment.totalTextChunk.text, function (ch) { return ch !== 32 /* space */ && ch !== 42 /* asterisk */; })) { + var match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans); + if (match) { + return [match]; + } + } + // The logic for pattern matching is now as follows: + // + // 1) Break the segment passed in into words. Breaking is rather simple and a + // good way to think about it that if gives you all the individual alphanumeric words + // of the pattern. + // + // 2) For each word try to match the word against the candidate value. + // + // 3) Matching is as follows: + // + // a) Check if the word is a prefix of the candidate, in a case insensitive or + // sensitive manner. If it does, return that there was an exact match if the word and candidate are the same length, else a prefix match. + // + // If the word is entirely lowercase: + // b) Then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of + // some word part. That way we don't match something like 'Class' when the user + // types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with + // 'a'). + // + // c) The word is all lower case. Is it a case insensitive substring of the candidate starting + // on a part boundary of the candidate? + // + // Else: + // d) If the word was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + // + // e) If the word was not entirely lowercase, then attempt a camel cased match as + // well. + // + // Only if all words have some sort of match is the pattern considered matched. + var subWordTextChunks = segment.subWordTextChunks; + var matches; + for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { + var subWordTextChunk = subWordTextChunks_1[_i]; + // Try to match the candidate with this word + var result = matchTextChunk(candidate, subWordTextChunk, stringToWordSpans); + if (!result) { + return undefined; + } + matches = matches || []; + matches.push(result); + } + return matches; + } + function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { + if (patternSpan === void 0) { patternSpan = { start: 0, length: pattern.length }; } + return patternSpan.length <= candidateSpan.length // If pattern part is longer than the candidate part there can never be a match. + && everyInRange(0, patternSpan.length, function (i) { return equalChars(pattern.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase); }); + } + function equalChars(ch1, ch2, ignoreCase) { + return ignoreCase ? toLowerCase(ch1) === toLowerCase(ch2) : ch1 === ch2; + } + function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { + var chunkCharacterSpans = chunk.characterSpans; + // Note: we may have more pattern parts than candidate parts. This is because multiple + // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". + // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U + // and I will both match in UI. + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch; + var contiguous; + while (true) { + // Let's consider our termination cases + if (currentChunkSpan === chunkCharacterSpans.length) { + return true; + } + else if (currentCandidate === candidateParts.length) { + // No match, since we still have more of the pattern to hit + return false; + } + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + // Consider the case of matching SiUI against SimpleUIElement. The candidate parts + // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' + // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to + // still keep matching pattern parts against that candidate part. + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + if (gotOneMatchThisCandidate) { + // We've already gotten one pattern part match in this candidate. We will + // only continue trying to consumer pattern parts if the last part and this + // part are both upper case. + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + gotOneMatchThisCandidate = true; + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + // If we were contiguous, then keep that value. If we weren't, then keep that + // value. If we don't know, then set the value to 'true' as an initial match is + // obviously contiguous. + contiguous = contiguous === undefined ? true : contiguous; + candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + // Check if we matched anything at all. If we didn't, then we need to unset the + // contiguous bit if we currently had it set. + // If we haven't set the bit yet, then that means we haven't matched anything so + // far, and we don't want to change that. + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + // Move onto the next candidate. + currentCandidate++; + } + } function createSegment(text) { return { totalTextChunk: createTextChunk(text), @@ -91643,24 +91991,18 @@ var ts; // Assumes 'value' is already lowercase. function indexOfIgnoringCase(str, value) { var n = str.length - value.length; - for (var i = 0; i <= n; i++) { - if (startsWithIgnoringCase(str, value, i)) { - return i; + var _loop_10 = function (start) { + if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) { + return { value: start }; } + }; + for (var start = 0; start <= n; start++) { + var state_3 = _loop_10(start); + if (typeof state_3 === "object") + return state_3.value; } return -1; } - // Assumes 'value' is already lowercase. - function startsWithIgnoringCase(str, value, start) { - for (var i = 0; i < value.length; i++) { - var ch1 = toLowerCase(str.charCodeAt(i + start)); - var ch2 = value.charCodeAt(i); - if (ch1 !== ch2) { - return false; - } - } - return true; - } function toLowerCase(ch) { // Fast convert for the ascii range. if (ch >= 65 /* A */ && ch <= 90 /* Z */) { @@ -91728,7 +92070,7 @@ var ts; var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); - var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + var hasTransitionFromUpperToLower = word && transitionFromUpperToLower(identifier, i, wordStart); if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit !== currentIsDigit || @@ -91775,46 +92117,28 @@ var ts; return false; } function isAllPunctuation(identifier, start, end) { - for (var i = start; i < end; i++) { - var ch = identifier.charCodeAt(i); - // We don't consider _ or $ as punctuation as there may be things with that name. - if (!charIsPunctuation(ch) || ch === 95 /* _ */ || ch === 36 /* $ */) { - return false; - } - } - return true; + return every(identifier, function (ch) { return charIsPunctuation(ch) && ch !== 95 /* _ */; }, start, end); } - function transitionFromUpperToLower(identifier, word, index, wordStart) { - if (word) { - // Cases this supports: - // 1) IDisposable -> I, Disposable - // 2) UIElement -> UI, Element - // 3) HTMLDocument -> HTML, Document - // - // etc. - if (index !== wordStart && - index + 1 < identifier.length) { - var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); - if (currentIsUpper && nextIsLower) { - // We have a transition from an upper to a lower letter here. But we only - // want to break if all the letters that preceded are uppercase. i.e. if we - // have "Foo" we don't want to break that into "F, oo". But if we have - // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, - // Foo". i.e. the last uppercase letter belongs to the lowercase letters - // that follows. Note: this will make the following not split properly: - // "HELLOthere". However, these sorts of names do not show up in .Net - // programs. - for (var i = wordStart; i < index; i++) { - if (!isUpperCaseLetter(identifier.charCodeAt(i))) { - return false; - } - } - return true; - } - } - } - return false; + function transitionFromUpperToLower(identifier, index, wordStart) { + // Cases this supports: + // 1) IDisposable -> I, Disposable + // 2) UIElement -> UI, Element + // 3) HTMLDocument -> HTML, Document + // + // etc. + // We have a transition from an upper to a lower letter here. But we only + // want to break if all the letters that preceded are uppercase. i.e. if we + // have "Foo" we don't want to break that into "F, oo". But if we have + // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, + // Foo". i.e. the last uppercase letter belongs to the lowercase letters + // that follows. Note: this will make the following not split properly: + // "HELLOthere". However, these sorts of names do not show up in .Net + // programs. + return index !== wordStart + && index + 1 < identifier.length + && isUpperCaseLetter(identifier.charCodeAt(index)) + && isLowerCaseLetter(identifier.charCodeAt(index + 1)) + && every(identifier, isUpperCaseLetter, wordStart, index); } function transitionFromLowerToUpper(identifier, word, index) { var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); @@ -91832,10 +92156,20 @@ var ts; // on characters would be: A M // // We break the search string on characters. But we break the symbol name on words. - var transition = word - ? (currentIsUpper && !lastIsUpper) - : currentIsUpper; - return transition; + return currentIsUpper && (!word || !lastIsUpper); + } + function everyInRange(start, end, pred) { + for (var i = start; i < end; i++) { + if (!pred(i)) { + return false; + } + } + return true; + } + function every(s, pred, start, end) { + if (start === void 0) { start = 0; } + if (end === void 0) { end = s.length; } + return everyInRange(start, end, function (i) { return pred(s.charCodeAt(i), i); }); } })(ts || (ts = {})); var ts; @@ -92304,7 +92638,7 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 185 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 186 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -92386,25 +92720,25 @@ var ts; var argumentsSpan = getApplicableSpanForArguments(list, sourceFile); return { kind: kind, invocation: invocation, argumentsSpan: argumentsSpan, argumentIndex: argumentIndex, argumentCount: argumentCount }; } - else if (node.kind === 13 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 187 /* TaggedTemplateExpression */) { + else if (node.kind === 13 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 188 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile); } } - else if (node.kind === 14 /* TemplateHead */ && node.parent.parent.kind === 187 /* TaggedTemplateExpression */) { + else if (node.kind === 14 /* TemplateHead */ && node.parent.parent.kind === 188 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 200 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 201 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 209 /* TemplateSpan */ && node.parent.parent.parent.kind === 187 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 210 /* TemplateSpan */ && node.parent.parent.parent.kind === 188 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 200 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 201 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 16 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -92539,7 +92873,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 === 200 /* TemplateExpression */) { + if (template.kind === 201 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -92548,7 +92882,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 272 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 273 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -92682,8 +93016,8 @@ var ts; var isJsFile = ts.isSourceFileJavaScript(sourceFile); function check(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: if (isJsFile) { var symbol = node.symbol; if (symbol.members && (symbol.members.size > 0)) { @@ -92717,12 +93051,12 @@ var ts; ts.computeSuggestionDiagnostics = computeSuggestionDiagnostics; function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings.kind === 244 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings.kind === 245 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -92742,7 +93076,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* Class */) { - return ts.getDeclarationOfKind(symbol, 203 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 204 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; } if (flags & 384 /* Enum */) @@ -92822,11 +93156,11 @@ var ts; // If we requested completions after `x.` at the top-level, we may be at a source file location. switch (location.parent && location.parent.kind) { // If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'. - case 255 /* JsxOpeningElement */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: return location.kind === 71 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return "JSX attribute" /* jsxAttribute */; default: return "property" /* memberVariableElement */; @@ -92865,7 +93199,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location); - if (location.parent && location.parent.kind === 183 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 184 /* 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)) { @@ -92886,7 +93220,7 @@ var ts; if (callExpressionLike) { var candidateSignatures = []; signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); - var useConstructSignatures = callExpressionLike.kind === 186 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 97 /* SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 187 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 97 /* SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -92923,7 +93257,7 @@ var ts; // If it is call or construct signature of lambda's write type name displayParts.push(ts.punctuationPart(56 /* ColonToken */)); displayParts.push(ts.spacePart()); - if (!(type.flags & 65536 /* Object */ && type.objectFlags & 16 /* Anonymous */) && type.symbol) { + if (!(ts.getObjectFlags(type) & 16 /* Anonymous */) && type.symbol) { ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 4 /* AllowAnyNodeKind */ | 1 /* WriteTypeParametersOrArguments */)); displayParts.push(ts.lineBreakPart()); } @@ -92973,7 +93307,7 @@ var ts; } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 203 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 204 /* 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 @@ -93017,7 +93351,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 237 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 238 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 71 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 130 /* NamespaceKeyword */ : 129 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -93054,7 +93388,7 @@ var ts; } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 235 /* TypeAliasDeclaration */) { + else if (declaration.kind === 236 /* TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path @@ -93071,7 +93405,7 @@ var ts; symbolKind = "enum member" /* enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 271 /* EnumMember */) { + if (declaration.kind === 272 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -93100,12 +93434,12 @@ var ts; } } switch (symbol.declarations[0].kind) { - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(84 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(130 /* NamespaceKeyword */)); break; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: displayParts.push(ts.keywordPart(84 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 58 /* EqualsToken */ : 79 /* DefaultKeyword */)); @@ -93116,7 +93450,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 241 /* ImportEqualsDeclaration */) { + if (declaration.kind === 242 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -93194,10 +93528,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 && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 272 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 273 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 198 /* BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 199 /* BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -93302,16 +93636,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 190 /* FunctionExpression */) { + if (declaration.kind === 191 /* FunctionExpression */) { return true; } - if (declaration.kind !== 230 /* VariableDeclaration */ && declaration.kind !== 232 /* FunctionDeclaration */) { + if (declaration.kind !== 231 /* VariableDeclaration */ && declaration.kind !== 233 /* 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 === 272 /* SourceFile */ || parent.kind === 238 /* ModuleBlock */) { + if (parent.kind === 273 /* SourceFile */ || parent.kind === 239 /* ModuleBlock */) { return false; } } @@ -93423,7 +93757,7 @@ var ts; return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.cloneCompilerOptions(options); - var _loop_10 = function (opt) { + var _loop_11 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -93442,7 +93776,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_10(opt); + _loop_11(opt); } return options; } @@ -93621,10 +93955,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 260 /* JsxAttribute */: - case 255 /* JsxOpeningElement */: - case 256 /* JsxClosingElement */: - case 254 /* JsxSelfClosingElement */: + case 261 /* JsxAttribute */: + case 256 /* JsxOpeningElement */: + case 257 /* JsxClosingElement */: + case 255 /* 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 === 71 /* Identifier */; } @@ -93955,7 +94289,7 @@ var ts; rule("NoSpaceBetweenCloseParenAndAngularBracket", 20 /* CloseParenToken */, 27 /* LessThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), rule("NoSpaceAfterOpenAngularBracket", 27 /* LessThanToken */, anyToken, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), rule("NoSpaceBeforeCloseAngularBracket", anyToken, 29 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), - rule("NoSpaceAfterCloseAngularBracket", 29 /* GreaterThanToken */, [19 /* OpenParenToken */, 21 /* OpenBracketToken */, 29 /* GreaterThanToken */, 26 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), + rule("NoSpaceAfterCloseAngularBracket", 29 /* GreaterThanToken */, [19 /* OpenParenToken */, 21 /* OpenBracketToken */, 29 /* GreaterThanToken */, 26 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/], 8 /* Delete */), // decorators rule("SpaceBeforeAt", [20 /* CloseParenToken */, 71 /* Identifier */], 57 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */), rule("NoSpaceAfterAt", 57 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */), @@ -94104,44 +94438,44 @@ var ts; return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 218 /* ForStatement */; + return context.contextNode.kind === 219 /* ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 198 /* BinaryExpression */: - case 199 /* ConditionalExpression */: + case 199 /* BinaryExpression */: + case 200 /* ConditionalExpression */: case 170 /* ConditionalType */: - case 206 /* AsExpression */: - case 250 /* ExportSpecifier */: - case 246 /* ImportSpecifier */: + case 207 /* AsExpression */: + case 251 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: case 160 /* TypePredicate */: case 168 /* UnionType */: case 169 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 180 /* BindingElement */: + case 181 /* BindingElement */: // equals in type X = ... - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: // equal in p = 0; case 148 /* Parameter */: - case 271 /* EnumMember */: + case 272 /* EnumMember */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return context.currentTokenSpan.kind === 58 /* EqualsToken */ || context.nextTokenSpan.kind === 58 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: // "in" keyword in [P in keyof T]: T[P] case 147 /* TypeParameter */: return context.currentTokenSpan.kind === 92 /* InKeyword */ || context.nextTokenSpan.kind === 92 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return context.currentTokenSpan.kind === 144 /* OfKeyword */ || context.nextTokenSpan.kind === 144 /* OfKeyword */; } return false; @@ -94157,18 +94491,18 @@ var ts; return contextKind === 151 /* PropertyDeclaration */ || contextKind === 150 /* PropertySignature */ || contextKind === 148 /* Parameter */ || - contextKind === 230 /* VariableDeclaration */ || + contextKind === 231 /* VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 199 /* ConditionalExpression */ || + return context.contextNode.kind === 200 /* ConditionalExpression */ || context.contextNode.kind === 170 /* ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 178 /* ObjectBindingPattern */ || + return context.contextNode.kind === 179 /* ObjectBindingPattern */ || context.contextNode.kind === 176 /* MappedType */ || isSingleLineBlockContext(context); } @@ -94195,17 +94529,17 @@ var ts; return true; } switch (node.kind) { - case 211 /* Block */: - case 239 /* CaseBlock */: - case 182 /* ObjectLiteralExpression */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 240 /* CaseBlock */: + case 183 /* ObjectLiteralExpression */: + case 239 /* ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: @@ -94213,52 +94547,55 @@ var ts; case 156 /* SetAccessor */: // case SyntaxKind.MethodSignature: case 157 /* CallSignature */: - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: case 154 /* Constructor */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 234 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 235 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; } + function isNotFunctionDeclContext(context) { + return !isFunctionDeclContext(context); + } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 232 /* FunctionDeclaration */ || context.contextNode.kind === 190 /* FunctionExpression */; + return context.contextNode.kind === 233 /* FunctionDeclaration */ || context.contextNode.kind === 191 /* FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: case 165 /* TypeLiteral */: - case 237 /* ModuleDeclaration */: - case 248 /* ExportDeclaration */: - case 249 /* NamedExports */: - case 242 /* ImportDeclaration */: - case 245 /* NamedImports */: + case 238 /* ModuleDeclaration */: + case 249 /* ExportDeclaration */: + case 250 /* NamedExports */: + case 243 /* ImportDeclaration */: + case 246 /* NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 233 /* ClassDeclaration */: - case 237 /* ModuleDeclaration */: - case 236 /* EnumDeclaration */: - case 267 /* CatchClause */: - case 238 /* ModuleBlock */: - case 225 /* SwitchStatement */: + case 234 /* ClassDeclaration */: + case 238 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: + case 268 /* CatchClause */: + case 239 /* ModuleBlock */: + case 226 /* SwitchStatement */: return true; - case 211 /* Block */: { + case 212 /* 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 !== 191 /* ArrowFunction */ && blockParent.kind !== 190 /* FunctionExpression */) { + if (!blockParent || blockParent.kind !== 192 /* ArrowFunction */ && blockParent.kind !== 191 /* FunctionExpression */) { return true; } } @@ -94267,31 +94604,31 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 215 /* IfStatement */: - case 225 /* SwitchStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 217 /* WhileStatement */: - case 228 /* TryStatement */: - case 216 /* DoStatement */: - case 224 /* WithStatement */: + case 216 /* IfStatement */: + case 226 /* SwitchStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 218 /* WhileStatement */: + case 229 /* TryStatement */: + case 217 /* DoStatement */: + case 225 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 267 /* CatchClause */: + case 268 /* CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 182 /* ObjectLiteralExpression */; + return context.contextNode.kind === 183 /* ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 185 /* CallExpression */; + return context.contextNode.kind === 186 /* CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 186 /* NewExpression */; + return context.contextNode.kind === 187 /* NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -94303,25 +94640,25 @@ var ts; return context.nextTokenSpan.kind !== 22 /* CloseBracketToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 191 /* ArrowFunction */; + return context.contextNode.kind === 192 /* ArrowFunction */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 253 /* JsxElement */ && context.contextNode.kind !== 257 /* JsxFragment */; + return context.contextNode.kind !== 254 /* JsxElement */ && context.contextNode.kind !== 258 /* JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 263 /* JsxExpression */ || context.contextNode.kind === 262 /* JsxSpreadAttribute */; + return context.contextNode.kind === 264 /* JsxExpression */ || context.contextNode.kind === 263 /* JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 260 /* JsxAttribute */; + return context.nextTokenParent.kind === 261 /* JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 260 /* JsxAttribute */; + return context.contextNode.kind === 261 /* JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 254 /* JsxSelfClosingElement */; + return context.contextNode.kind === 255 /* JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -94339,14 +94676,14 @@ var ts; return node.kind === 149 /* Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 231 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 232 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 237 /* ModuleDeclaration */; + return context.contextNode.kind === 238 /* ModuleDeclaration */; } function isObjectTypeContext(context) { return context.contextNode.kind === 165 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; @@ -94360,21 +94697,21 @@ var ts; } switch (parent.kind) { case 161 /* TypeReference */: - case 188 /* TypeAssertionExpression */: - case 235 /* TypeAliasDeclaration */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 189 /* TypeAssertionExpression */: + case 236 /* TypeAliasDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 205 /* ExpressionWithTypeArguments */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 206 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -94385,16 +94722,16 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 188 /* TypeAssertionExpression */; + return context.contextNode.kind === 189 /* TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 105 /* VoidKeyword */ && context.currentTokenParent.kind === 194 /* VoidExpression */; + return context.currentTokenSpan.kind === 105 /* VoidKeyword */ && context.currentTokenParent.kind === 195 /* VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 201 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 202 /* YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 207 /* NonNullExpression */; + return context.contextNode.kind === 208 /* NonNullExpression */; } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -94633,17 +94970,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 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 238 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 272 /* SourceFile */: - case 211 /* Block */: - case 238 /* ModuleBlock */: + return body && body.kind === 239 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 273 /* SourceFile */: + case 212 /* Block */: + case 239 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -94747,7 +95084,7 @@ var ts; if (previousLine !== -1 /* Unknown */ && line !== previousLine) { break; } - if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) { + if (formatting.SmartIndenter.shouldIndentChildNode(options, n, child, sourceFile)) { return options.indentSize; } previousLine = line; @@ -94834,7 +95171,7 @@ var ts; return -1 /* Unknown */; } function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { - var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0; + var delta = formatting.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; if (effectiveParentStartLine === startLine) { // if node is located on the same line with the parent // - inherit indentation from the parent @@ -94866,10 +95203,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 233 /* ClassDeclaration */: return 75 /* ClassKeyword */; - case 234 /* InterfaceDeclaration */: return 109 /* InterfaceKeyword */; - case 232 /* FunctionDeclaration */: return 89 /* FunctionKeyword */; - case 236 /* EnumDeclaration */: return 236 /* EnumDeclaration */; + case 234 /* ClassDeclaration */: return 75 /* ClassKeyword */; + case 235 /* InterfaceDeclaration */: return 109 /* InterfaceKeyword */; + case 233 /* FunctionDeclaration */: return 89 /* FunctionKeyword */; + case 237 /* EnumDeclaration */: return 237 /* EnumDeclaration */; case 155 /* GetAccessor */: return 125 /* GetKeyword */; case 156 /* SetAccessor */: return 136 /* SetKeyword */; case 153 /* MethodDeclaration */: @@ -94903,9 +95240,9 @@ var ts; getIndentation: function () { return indentation; }, getDelta: getDelta, recomputeIndentation: function (lineAdded) { - if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(options, node.parent, node, sourceFile)) { indentation += lineAdded ? options.indentSize : -options.indentSize; - delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0; + delta = formatting.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; } } }; @@ -94923,9 +95260,9 @@ var ts; case 41 /* SlashToken */: case 29 /* GreaterThanToken */: switch (container.kind) { - case 255 /* JsxOpeningElement */: - case 256 /* JsxClosingElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 257 /* JsxClosingElement */: + case 255 /* JsxSelfClosingElement */: return false; } break; @@ -94943,7 +95280,7 @@ var ts; } function getDelta(child) { // Delta value should be zero when the node explicitly prevents indentation of the child node - return formatting.SmartIndenter.nodeWillIndentChild(node, child, /*indentByDefault*/ true) ? delta : 0; + return formatting.SmartIndenter.nodeWillIndentChild(options, node, child, sourceFile, /*indentByDefault*/ true) ? delta : 0; } } function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { @@ -95031,7 +95368,7 @@ var ts; indentMultilineCommentOrJsxText(range, childIndentation.indentation, /*firstLineIsIndented*/ true, /*indentFinalLine*/ false); } childContextNode = node; - if (isFirstListItem && parent.kind === 181 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent.kind === 182 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -95443,11 +95780,11 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 154 /* Constructor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (node.typeParameters === list) { return 27 /* LessThanToken */; } @@ -95455,8 +95792,8 @@ var ts; return 19 /* OpenParenToken */; } break; - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: if (node.typeArguments === list) { return 27 /* LessThanToken */; } @@ -95581,7 +95918,7 @@ var ts; if (options.indentStyle === ts.IndentStyle.Block) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 26 /* CommaToken */ && precedingToken.parent.kind !== 198 /* BinaryExpression */) { + if (precedingToken.kind === 26 /* CommaToken */ && precedingToken.parent.kind !== 199 /* 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 /* Unknown */) { @@ -95626,7 +95963,7 @@ var ts; var previous; var current = precedingToken; while (current) { - if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous, /*isNextChild*/ true)) { + if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(options, current, previous, sourceFile, /*isNextChild*/ true)) { var currentStart = getStartLineAndCharacterForNode(current, sourceFile); var nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile); var indentationDelta = nextTokenKind !== 0 /* Unknown */ @@ -95692,7 +96029,7 @@ var ts; } } // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line - if (shouldIndentChildNode(parent, current, isNextChild) && !parentAndChildShareLine) { + if (shouldIndentChildNode(options, parent, current, sourceFile, isNextChild) && !parentAndChildShareLine) { indentationDelta += options.indentSize; } // In our AST, a call argument's `parent` is the call-expression, not the argument list. @@ -95737,7 +96074,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 === 272 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 273 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -95785,7 +96122,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 215 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 216 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 82 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -95802,13 +96139,13 @@ var ts; switch (node.parent.kind) { case 161 /* TypeReference */: return getListIfStartEndIsInListRange(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd()); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return node.parent.properties; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return node.parent.elements; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 157 /* CallSignature */: @@ -95819,18 +96156,18 @@ var ts; return getListIfStartEndIsInListRange(node.parent.typeParameters, start, node.getEnd()) || getListIfStartEndIsInListRange(node.parent.parameters, start, node.getEnd()); } - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return getListIfStartEndIsInListRange(node.parent.typeParameters, node.getStart(sourceFile), node.getEnd()); - case 186 /* NewExpression */: - case 185 /* CallExpression */: { + case 187 /* NewExpression */: + case 186 /* CallExpression */: { var start = node.getStart(sourceFile); return getListIfStartEndIsInListRange(node.parent.typeArguments, start, node.getEnd()) || getListIfStartEndIsInListRange(node.parent.arguments, start, node.getEnd()); } - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return getListIfStartEndIsInListRange(node.parent.declarations, node.getStart(sourceFile), node.getEnd()); - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return getListIfStartEndIsInListRange(node.parent.elements, node.getStart(sourceFile), node.getEnd()); } } @@ -95870,10 +96207,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: node = node.expression; break; default: @@ -95937,37 +96274,37 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 214 /* ExpressionStatement */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 181 /* ArrayLiteralExpression */: - case 211 /* Block */: - case 238 /* ModuleBlock */: - case 182 /* ObjectLiteralExpression */: + case 215 /* ExpressionStatement */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 182 /* ArrayLiteralExpression */: + case 212 /* Block */: + case 239 /* ModuleBlock */: + case 183 /* ObjectLiteralExpression */: case 165 /* TypeLiteral */: case 176 /* MappedType */: case 167 /* TupleType */: - case 239 /* CaseBlock */: - case 265 /* DefaultClause */: - case 264 /* CaseClause */: - case 189 /* ParenthesizedExpression */: - case 183 /* PropertyAccessExpression */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 212 /* VariableStatement */: - case 230 /* VariableDeclaration */: - case 247 /* ExportAssignment */: - case 223 /* ReturnStatement */: - case 199 /* ConditionalExpression */: - case 179 /* ArrayBindingPattern */: - case 178 /* ObjectBindingPattern */: - case 255 /* JsxOpeningElement */: - case 258 /* JsxOpeningFragment */: - case 254 /* JsxSelfClosingElement */: - case 263 /* JsxExpression */: + case 240 /* CaseBlock */: + case 266 /* DefaultClause */: + case 265 /* CaseClause */: + case 190 /* ParenthesizedExpression */: + case 184 /* PropertyAccessExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 213 /* VariableStatement */: + case 231 /* VariableDeclaration */: + case 248 /* ExportAssignment */: + case 224 /* ReturnStatement */: + case 200 /* ConditionalExpression */: + case 180 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 256 /* JsxOpeningElement */: + case 259 /* JsxOpeningFragment */: + case 255 /* JsxSelfClosingElement */: + case 264 /* JsxExpression */: case 152 /* MethodSignature */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: @@ -95975,44 +96312,51 @@ var ts; case 162 /* FunctionType */: case 163 /* ConstructorType */: case 172 /* ParenthesizedType */: - case 187 /* TaggedTemplateExpression */: - case 195 /* AwaitExpression */: - case 249 /* NamedExports */: - case 245 /* NamedImports */: - case 250 /* ExportSpecifier */: - case 246 /* ImportSpecifier */: - case 268 /* PropertyAssignment */: + case 188 /* TaggedTemplateExpression */: + case 196 /* AwaitExpression */: + case 250 /* NamedExports */: + case 246 /* NamedImports */: + case 251 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 269 /* PropertyAssignment */: case 151 /* PropertyDeclaration */: return true; } return false; } - function nodeWillIndentChild(parent, child, indentByDefault) { + function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 218 /* ForStatement */: - case 215 /* IfStatement */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 231 /* VariableDeclaration */: + case 269 /* PropertyAssignment */: + case 183 /* ObjectLiteralExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 183 /* ObjectLiteralExpression */) { + return rangeIsOnOneLine(sourceFile, child); + } + break; + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 219 /* ForStatement */: + case 216 /* IfStatement */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - return childKind !== 211 /* Block */; - case 248 /* ExportDeclaration */: - return childKind !== 249 /* NamedExports */; - case 242 /* ImportDeclaration */: - return childKind !== 243 /* ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 245 /* NamedImports */); - case 253 /* JsxElement */: - return childKind !== 256 /* JsxClosingElement */; - case 257 /* JsxFragment */: - return childKind !== 259 /* JsxClosingFragment */; + return childKind !== 212 /* Block */; + case 249 /* ExportDeclaration */: + return childKind !== 250 /* NamedExports */; + case 243 /* ImportDeclaration */: + return childKind !== 244 /* ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 246 /* NamedImports */); + case 254 /* JsxElement */: + return childKind !== 257 /* JsxClosingElement */; + case 258 /* JsxFragment */: + return childKind !== 260 /* JsxClosingFragment */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -96020,17 +96364,17 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 223 /* ReturnStatement */: - case 227 /* ThrowStatement */: { - if (parent.kind !== 211 /* Block */) { + case 224 /* ReturnStatement */: + case 228 /* ThrowStatement */: { + if (parent.kind !== 212 /* Block */) { return true; } var grandParent = parent.parent; // In a function, we may want to write inner functions after this. - return !(grandParent && grandParent.kind === 190 /* FunctionExpression */ || grandParent.kind === 232 /* FunctionDeclaration */); + return !(grandParent && grandParent.kind === 191 /* FunctionExpression */ || grandParent.kind === 233 /* FunctionDeclaration */); } - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: return true; default: return false; @@ -96040,12 +96384,18 @@ var ts; * True when the parent node should indent the given child by an explicit rule. * @param isNextChild If true, we are judging indent of a hypothetical child *after* this one, not the current child. */ - function shouldIndentChildNode(parent, child, isNextChild) { + function shouldIndentChildNode(settings, parent, child, sourceFile, isNextChild) { if (isNextChild === void 0) { isNextChild = false; } - return (nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, /*indentByDefault*/ false)) + return (nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(settings, parent, child, sourceFile, /*indentByDefault*/ false)) && !(isNextChild && child && isControlFlowEndingStatement(child.kind, parent)); } SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; + function rangeIsOnOneLine(sourceFile, range) { + var rangeStart = ts.skipTrivia(sourceFile.text, range.pos); + var startLine = sourceFile.getLineAndCharacterOfPosition(rangeStart).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(range.end).line; + return startLine === endLine; + } })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -96153,7 +96503,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 === 26 /* CommaToken */ || (candidate.kind === 25 /* SemicolonToken */ && node.parent.kind === 182 /* ObjectLiteralExpression */)); + return candidate && node.parent && (candidate.kind === 26 /* CommaToken */ || (candidate.kind === 25 /* SemicolonToken */ && node.parent.kind === 183 /* ObjectLiteralExpression */)); } function spaces(count) { var s = ""; @@ -96310,12 +96660,21 @@ var ts; this.changes.push({ kind: ChangeKind.Text, sourceFile: sourceFile, range: { pos: pos, end: pos }, text: text }); }; /** Prefer this over replacing a node with another that has a type annotation, as it avoids reformatting the other parts of the node. */ - ChangeTracker.prototype.insertTypeAnnotation = function (sourceFile, node, type) { - var end = (ts.isFunctionLike(node) - // If no `)`, is an arrow function `x => x`, so use the end of the first parameter - ? ts.findChildOfKind(node, 20 /* CloseParenToken */, sourceFile) || ts.first(node.parameters) - : node.kind !== 230 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name).end; - this.insertNodeAt(sourceFile, end, type, { prefix: ": " }); + ChangeTracker.prototype.tryInsertTypeAnnotation = function (sourceFile, node, type) { + var endNode; + if (ts.isFunctionLike(node)) { + endNode = ts.findChildOfKind(node, 20 /* CloseParenToken */, sourceFile); + if (!endNode) { + if (!ts.isArrowFunction(node)) + return; // Function missing parentheses, give up + // If no `)`, is an arrow function `x => x`, so use the end of the first parameter + endNode = ts.first(node.parameters); + } + } + else { + endNode = node.kind !== 231 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name; + } + this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); }; ChangeTracker.prototype.insertTypeParameters = function (sourceFile, node, typeParameters) { // If no `(`, is an arrow function `x => x`, so use the pos of the first parameter @@ -96525,7 +96884,7 @@ var ts; var _this = this; this.nodesInsertedAtClassStarts.forEach(function (_a) { var sourceFile = _a.sourceFile, cls = _a.cls, members = _a.members; - var newCls = cls.kind === 233 /* ClassDeclaration */ + var newCls = cls.kind === 234 /* ClassDeclaration */ ? ts.updateClassDeclaration(cls, cls.decorators, cls.modifiers, cls.name, cls.typeParameters, cls.heritageClauses, members) : ts.updateClassExpression(cls, cls.modifiers, cls.name, cls.typeParameters, cls.heritageClauses, members); _this.replaceNode(sourceFile, cls, newCls); @@ -96551,14 +96910,14 @@ var ts; var sourceFile = changesInFile[0].sourceFile; // order changes by start position var normalized = ts.stableSort(changesInFile, function (a, b) { return a.range.pos - b.range.pos; }); - var _loop_11 = function (i) { + var _loop_12 = function (i) { ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () { return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range); }); }; // verify that change intervals do not overlap, except possibly at end points. for (var i = 0; i < normalized.length - 1; i++) { - _loop_11(i); + _loop_12(i); } var textChanges = normalized.map(function (c) { return ts.createTextChange(ts.createTextSpanFromRange(c.range), computeNewText(c, sourceFile, newLineCharacter, formatContext, validate)); @@ -96594,7 +96953,7 @@ var ts; ? indentation : ts.formatting.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix === newLineCharacter || ts.getLineStartPositionForPosition(pos, sourceFile) === pos); if (delta === undefined) { - delta = ts.formatting.SmartIndenter.shouldIndentChildNode(nodeIn) ? (formatOptions.indentSize || 0) : 0; + delta = ts.formatting.SmartIndenter.shouldIndentChildNode(formatContext.options, nodeIn) ? (formatOptions.indentSize || 0) : 0; } var file = { text: text, getLineAndCharacterOfPosition: function (pos) { return ts.getLineAndCharacterOfPosition(this, pos); } }; var changes = ts.formatting.formatNodeGivenIndentation(node, file, sourceFile.languageVariant, initialIndentation, delta, formatContext); @@ -97015,7 +97374,7 @@ var ts; if (!param.type) { var paramType = ts.getJSDocType(param); if (paramType) - changes.insertTypeAnnotation(sourceFile, param, transformJSDocType(paramType)); + changes.tryInsertTypeAnnotation(sourceFile, param, transformJSDocType(paramType)); } } if (needParens) @@ -97023,35 +97382,35 @@ var ts; if (!decl.type) { var returnType = ts.getJSDocReturnType(decl); if (returnType) - changes.insertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType)); + changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType)); } } else { var jsdocType = ts.Debug.assertDefined(ts.getJSDocType(decl)); // If not defined, shouldn't have been an error to fix ts.Debug.assert(!decl.type); // If defined, shouldn't have been an error to fix. - changes.insertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType)); + changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType)); } } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 230 /* VariableDeclaration */ || + node.kind === 231 /* VariableDeclaration */ || node.kind === 150 /* PropertySignature */ || node.kind === 151 /* PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 275 /* JSDocAllType */: - case 276 /* JSDocUnknownType */: + case 276 /* JSDocAllType */: + case 277 /* JSDocUnknownType */: return ts.createTypeReferenceNode("any", ts.emptyArray); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return transformJSDocOptionalType(node); - case 278 /* JSDocNonNullableType */: + case 279 /* JSDocNonNullableType */: return transformJSDocType(node.type); - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return transformJSDocNullableType(node); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return transformJSDocVariadicType(node); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return transformJSDocFunctionType(node); case 161 /* TypeReference */: return transformJSDocTypeReference(node); @@ -97075,7 +97434,7 @@ var ts; } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 281 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + var isRest = node.type.kind === 282 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.createToken(24 /* DotDotDotToken */) : node.dotDotDotToken; return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -97151,12 +97510,12 @@ var ts; var precedingNode; var newClassDeclaration; switch (ctorDeclaration.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: precedingNode = ctorDeclaration; deleteNode(ctorDeclaration); newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration); break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: precedingNode = ctorDeclaration.parent.parent; if (ctorDeclaration.parent.declarations.length === 1) { deleteNode(precedingNode); @@ -97216,8 +97575,8 @@ var ts; return ts.isFunctionLike(source); } function createClassElement(symbol, modifiers) { - // both properties and methods are bound as property symbols - if (!(symbol.flags & 4 /* Property */)) { + // Right now the only thing we can convert are function expressions, which are marked as methods + if (!(symbol.flags & 8192 /* Method */)) { return; } var memberDeclaration = symbol.valueDeclaration; @@ -97226,7 +97585,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 === 214 /* ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 215 /* ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; deleteNode(nodeToDelete); if (!assignmentBinaryExpression.right) { @@ -97234,7 +97593,7 @@ var ts; /*type*/ undefined, /*initializer*/ undefined); } switch (assignmentBinaryExpression.right.kind) { - case 190 /* FunctionExpression */: { + case 191 /* FunctionExpression */: { var functionExpression = assignmentBinaryExpression.right; var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 120 /* AsyncKeyword */)); var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined, @@ -97242,12 +97601,12 @@ var ts; copyComments(assignmentBinaryExpression, method, sourceFile); return method; } - case 191 /* ArrowFunction */: { + case 192 /* ArrowFunction */: { var arrowFunction = assignmentBinaryExpression.right; var arrowFunctionBody = arrowFunction.body; var bodyBlock = void 0; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 211 /* Block */) { + if (arrowFunctionBody.kind === 212 /* Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] @@ -97275,7 +97634,7 @@ var ts; } function createClassFromVariableDeclaration(node) { var initializer = node.initializer; - if (!initializer || initializer.kind !== 190 /* FunctionExpression */) { + if (!initializer || initializer.kind !== 191 /* FunctionExpression */) { return undefined; } if (node.name.kind !== 71 /* Identifier */) { @@ -97354,10 +97713,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier)); break; - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.createPropertyAccess(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -97410,20 +97769,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports) { switch (statement.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target); return false; - case 214 /* ExpressionStatement */: { + case 215 /* ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 185 /* CallExpression */: { + case 186 /* CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0])); } return false; } - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var _a = expression, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return operatorToken.kind === 58 /* EqualsToken */ && convertAssignment(sourceFile, checker, statement, left, right, changes, exports); } @@ -97465,8 +97824,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers) { switch (name.kind) { - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: { + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return [ @@ -97516,10 +97875,10 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. - case 269 /* ShorthandPropertyAssignment */: - case 270 /* SpreadAssignment */: + case 270 /* ShorthandPropertyAssignment */: + case 271 /* SpreadAssignment */: return undefined; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals(prop.name.text, prop.initializer); case 153 /* MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(84 /* ExportKeyword */)], prop); @@ -97550,18 +97909,18 @@ var ts; function convertModuleExportsToExportDefault(exported, checker) { var modifiers = [ts.createToken(84 /* ExportKeyword */), ts.createToken(79 /* DefaultKeyword */)]; switch (exported.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: { + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: { // `module.exports = function f() {}` --> `export default function f() {}` var fn = exported; return [[functionExpressionToDeclaration(fn.name && fn.name.text, modifiers, fn)], true]; } - case 203 /* ClassExpression */: { + case 204 /* ClassExpression */: { // `module.exports = class C {}` --> `export default class C {}` var cls = exported; return [[classExpressionToDeclaration(cls.name && cls.name.text, modifiers, cls)], true]; } - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (ts.isRequireCall(exported, /*checkArgumentIsStringLiteralLike*/ true)) { return convertReExportAll(exported.arguments[0], checker); } @@ -97592,7 +97951,7 @@ var ts; function convertExportsDotXEquals(name, exported) { var modifiers = [ts.createToken(84 /* ExportKeyword */)]; switch (exported.kind) { - case 190 /* FunctionExpression */: { + case 191 /* FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -97600,10 +97959,10 @@ var ts; } } // falls through - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported); default: @@ -97621,7 +97980,7 @@ var ts; */ function convertSingleImport(file, name, moduleSpecifier, changes, checker, identifiers, target) { switch (name.kind) { - case 178 /* ObjectBindingPattern */: { + case 179 /* 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 @@ -97632,7 +97991,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 179 /* ArrayBindingPattern */: { + case 180 /* ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -97711,9 +98070,9 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return parent.name !== node; - case 180 /* BindingElement */: + case 181 /* BindingElement */: return parent.propertyName !== node; default: return true; @@ -97909,40 +98268,19 @@ var ts; if (!ts.isIdentifier(token)) { return undefined; } - var classAndMakeStatic = getClassAndMakeStatic(token, checker); - if (!classAndMakeStatic) { - return undefined; - } - var classDeclaration = classAndMakeStatic.classDeclaration, makeStatic = classAndMakeStatic.makeStatic; - var classDeclarationSourceFile = classDeclaration.getSourceFile(); - var inJs = ts.isInJavaScriptFile(classDeclarationSourceFile); - var call = ts.tryCast(token.parent.parent, ts.isCallExpression); - return { token: token, classDeclaration: classDeclaration, makeStatic: makeStatic, classDeclarationSourceFile: classDeclarationSourceFile, inJs: inJs, call: call }; - } - function getClassAndMakeStatic(token, checker) { var parent = token.parent; - if (!ts.isPropertyAccessExpression(parent)) { + if (!ts.isPropertyAccessExpression(parent)) return undefined; - } - if (parent.expression.kind === 99 /* ThisKeyword */) { - var containingClassMemberDeclaration = ts.getThisContainer(token, /*includeArrowFunctions*/ false); - if (!ts.isClassElement(containingClassMemberDeclaration)) { - return undefined; - } - var classDeclaration = containingClassMemberDeclaration.parent; - // Property accesses on `this` in a static method are accesses of a static member. - return ts.isClassLike(classDeclaration) ? { classDeclaration: classDeclaration, makeStatic: ts.hasModifier(containingClassMemberDeclaration, 32 /* Static */) } : undefined; - } - else { - var leftExpressionType = checker.getTypeAtLocation(parent.expression); - var symbol = leftExpressionType.symbol; - if (!(symbol && leftExpressionType.flags & 65536 /* Object */ && symbol.flags & 32 /* Class */)) { - return undefined; - } - var classDeclaration = ts.cast(ts.first(symbol.declarations), ts.isClassLike); - // The expression is a class symbol but the type is not the instance-side. - return { classDeclaration: classDeclaration, makeStatic: leftExpressionType !== checker.getDeclaredTypeOfSymbol(symbol) }; - } + var leftExpressionType = ts.skipConstraint(checker.getTypeAtLocation(parent.expression)); + var symbol = leftExpressionType.symbol; + var classDeclaration = symbol && symbol.declarations && ts.find(symbol.declarations, ts.isClassLike); + if (!classDeclaration) + return undefined; + var makeStatic = leftExpressionType.target !== checker.getDeclaredTypeOfSymbol(symbol); + var classDeclarationSourceFile = classDeclaration.getSourceFile(); + var inJs = ts.isSourceFileJavaScript(classDeclarationSourceFile); + var call = ts.tryCast(parent.parent, ts.isCallExpression); + return { token: token, classDeclaration: classDeclaration, makeStatic: makeStatic, classDeclarationSourceFile: classDeclarationSourceFile, inJs: inJs, call: call }; } function getActionsForAddMissingMemberInJavaScriptFile(context, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingMemberInJs(t, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic); }); @@ -97951,7 +98289,7 @@ var ts; } function addMissingMemberInJs(changeTracker, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) { if (makeStatic) { - if (classDeclaration.kind === 203 /* ClassExpression */) { + if (classDeclaration.kind === 204 /* ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -97977,7 +98315,7 @@ var ts; } function getTypeNode(checker, classDeclaration, token) { var typeNode; - if (token.parent.parent.kind === 198 /* BinaryExpression */) { + if (token.parent.parent.kind === 199 /* 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))); @@ -98032,36 +98370,48 @@ var ts; var errorCodes = [ ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, + ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2.code, ]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile; - var info = getInfo(sourceFile, context.span.start, context.program.getTypeChecker()); + var info = getInfo(sourceFile, context.span.start, context); if (!info) return undefined; var node = info.node, suggestion = info.suggestion; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestion); }); + var target = context.host.getCompilationSettings().target; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestion, target); }); return [codefix.createCodeFixAction(changes, [ts.Diagnostics.Change_spelling_to_0, suggestion], fixId, ts.Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start, context.program.getTypeChecker()); + var info = getInfo(diag.file, diag.start, context); + var target = context.host.getCompilationSettings().target; if (info) - doChange(changes, context.sourceFile, info.node, info.suggestion); + doChange(changes, context.sourceFile, info.node, info.suggestion, target); }); }, }); - function getInfo(sourceFile, pos, checker) { + function getInfo(sourceFile, pos, context) { // This is the identifier of the misspelled word. eg: // this.speling = 1; // ^^^^^^^ var node = ts.getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false); // TODO: GH#15852 + var checker = context.program.getTypeChecker(); var suggestion; if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) { ts.Debug.assert(node.kind === 71 /* Identifier */); var containingType = checker.getTypeAtLocation(node.parent.expression); suggestion = checker.getSuggestionForNonexistentProperty(node, containingType); } + else if (ts.isImportSpecifier(node.parent) && node.parent.name === node) { + ts.Debug.assert(node.kind === 71 /* Identifier */); + var importDeclaration = ts.findAncestor(node, ts.isImportDeclaration); + var resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration); + if (resolvedSourceFile && resolvedSourceFile.symbol) { + suggestion = checker.getSuggestionForNonexistentModule(node, resolvedSourceFile.symbol); + } + } else { var meaning = ts.getMeaningFromLocation(node); var name = ts.getTextOfNode(node); @@ -98070,8 +98420,13 @@ var ts; } return suggestion === undefined ? undefined : { node: node, suggestion: suggestion }; } - function doChange(changes, sourceFile, node, suggestion) { - changes.replaceNode(sourceFile, node, ts.createIdentifier(suggestion)); + function doChange(changes, sourceFile, node, suggestion, target) { + if (!ts.isIdentifierText(suggestion, target) && ts.isPropertyAccessExpression(node.parent)) { + changes.replaceNode(sourceFile, node.parent, ts.createElementAccess(node.parent.expression, ts.createLiteral(suggestion))); + } + else { + changes.replaceNode(sourceFile, node, ts.createIdentifier(suggestion)); + } } function convertSemanticMeaningToSymbolFlags(meaning) { var flags = 0; @@ -98086,6 +98441,14 @@ var ts; } return flags; } + function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) { + if (!importDeclaration || !ts.isStringLiteralLike(importDeclaration.moduleSpecifier)) + return undefined; + var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text); + if (!resolvedModule) + return undefined; + return context.program.getSourceFile(resolvedModule.resolvedFileName); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -98426,11 +98789,11 @@ var ts; switch (token.parent.kind) { case 148 /* Parameter */: return true; - case 230 /* VariableDeclaration */: { + case 231 /* VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 220 /* ForOfStatement */: - case 219 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 220 /* ForInStatement */: return true; } } @@ -98443,7 +98806,7 @@ var ts; tryDeleteIdentifier(changes, sourceFile, token); break; case 151 /* PropertyDeclaration */: - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: changes.deleteNode(sourceFile, token.parent); break; default: @@ -98461,7 +98824,7 @@ var ts; function tryDeleteIdentifier(changes, sourceFile, identifier) { var parent = identifier.parent; switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: tryDeleteVariableDeclaration(changes, sourceFile, parent); break; case 147 /* TypeParameter */: @@ -98500,11 +98863,11 @@ var ts; } break; // handle case where 'import a = A;' - case 241 /* ImportEqualsDeclaration */: - var importEquals = ts.getAncestor(identifier, 241 /* ImportEqualsDeclaration */); + case 242 /* ImportEqualsDeclaration */: + var importEquals = ts.getAncestor(identifier, 242 /* ImportEqualsDeclaration */); changes.deleteNode(sourceFile, importEquals); break; - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: var namedImports = parent.parent; if (namedImports.elements.length === 1) { tryDeleteNamedImportBinding(changes, sourceFile, namedImports); @@ -98514,10 +98877,10 @@ var ts; changes.deleteNodeInList(sourceFile, parent); } break; - case 243 /* ImportClause */: // this covers both 'import |d|' and 'import |d,| *' + case 244 /* ImportClause */: // this covers both 'import |d|' and 'import |d,| *' var importClause = parent; if (!importClause.namedBindings) { // |import d from './file'| - changes.deleteNode(sourceFile, ts.getAncestor(importClause, 242 /* ImportDeclaration */)); + changes.deleteNode(sourceFile, ts.getAncestor(importClause, 243 /* ImportDeclaration */)); } else { // import |d,| * as ns from './file' @@ -98533,7 +98896,7 @@ var ts; } } break; - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: tryDeleteNamedImportBinding(changes, sourceFile, parent); break; default: @@ -98555,14 +98918,14 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(namedBindings, 242 /* ImportDeclaration */); + var importDecl = ts.getAncestor(namedBindings, 243 /* ImportDeclaration */); changes.deleteNode(sourceFile, importDecl); } } // token.parent is a variableDeclaration function tryDeleteVariableDeclaration(changes, sourceFile, varDecl) { switch (varDecl.parent.parent.kind) { - case 218 /* ForStatement */: { + case 219 /* ForStatement */: { var forStatement = varDecl.parent.parent; var forInitializer = forStatement.initializer; if (forInitializer.declarations.length === 1) { @@ -98573,14 +98936,14 @@ var ts; } break; } - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: var forOfStatement = varDecl.parent.parent; - ts.Debug.assert(forOfStatement.initializer.kind === 231 /* VariableDeclarationList */); + ts.Debug.assert(forOfStatement.initializer.kind === 232 /* VariableDeclarationList */); var forOfInitializer = forOfStatement.initializer; changes.replaceNode(sourceFile, forOfInitializer.declarations[0], ts.createObjectLiteral()); break; - case 219 /* ForInStatement */: - case 228 /* TryStatement */: + case 220 /* ForInStatement */: + case 229 /* TryStatement */: break; default: var variableStatement = varDecl.parent.parent; @@ -98613,7 +98976,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 === 277 /* JSDocNullableType */) { + if (typeNode.kind === 278 /* 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, 4096 /* Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -98633,7 +98996,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 277 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 4096 /* Undefined */) : type; + var fixedType = typeNode.kind === 278 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 4096 /* Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -98650,10 +99013,10 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 206 /* AsExpression */: + case 207 /* AsExpression */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 155 /* GetAccessor */: case 159 /* IndexSignature */: case 176 /* MappedType */: @@ -98663,9 +99026,9 @@ var ts; case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 156 /* SetAccessor */: - case 235 /* TypeAliasDeclaration */: - case 188 /* TypeAssertionExpression */: - case 230 /* VariableDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 189 /* TypeAssertionExpression */: + case 231 /* VariableDeclaration */: return true; default: return false; @@ -98722,11 +99085,11 @@ var ts; case 153 /* MethodDeclaration */: insertBefore = containingFunction.name; break; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 89 /* FunctionKeyword */, sourceFile); break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: insertBefore = ts.findChildOfKind(containingFunction, 19 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters); break; default: @@ -98847,9 +99210,9 @@ var ts; return useExistingImportActions.concat(getCodeActionsForAddImport(exportInfos, context, existingImports)); } function getNamespaceImportName(declaration) { - if (declaration.kind === 242 /* ImportDeclaration */) { + if (declaration.kind === 243 /* ImportDeclaration */) { var namedBindings = declaration.importClause && ts.isImportClause(declaration.importClause) && declaration.importClause.namedBindings; - return namedBindings && namedBindings.kind === 244 /* NamespaceImport */ ? namedBindings.name : undefined; + return namedBindings && namedBindings.kind === 245 /* NamespaceImport */ ? namedBindings.name : undefined; } else { return declaration.name; @@ -98865,7 +99228,7 @@ var ts; if (!cached) { cached = cachedImportDeclarations[moduleSymbolId] = ts.mapDefined(imports, function (moduleSpecifier) { var i = ts.importFromModuleSpecifier(moduleSpecifier); - return (i.kind === 242 /* ImportDeclaration */ || i.kind === 241 /* ImportEqualsDeclaration */) + return (i.kind === 243 /* ImportDeclaration */ || i.kind === 242 /* ImportEqualsDeclaration */) && checker.getSymbolAtLocation(moduleSpecifier) === moduleSymbol ? { declaration: i, importKind: importKind } : undefined; }); } @@ -99198,7 +99561,7 @@ var ts; function getCodeActionsForAddImport(exportInfos, ctx, existingImports) { var fromExistingImport = ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind; - if (declaration.kind === 242 /* ImportDeclaration */ && declaration.importClause) { + if (declaration.kind === 243 /* ImportDeclaration */ && declaration.importClause) { var changes = tryUpdateExistingImport(ctx, ts.isImportClause(declaration.importClause) && declaration.importClause || undefined, importKind); if (changes) { var moduleSpecifierWithoutQuotes = ts.stripQuotes(declaration.moduleSpecifier.getText()); @@ -99217,9 +99580,9 @@ var ts; } function newImportInfoFromExistingSpecifier(_a) { var declaration = _a.declaration, importKind = _a.importKind; - var expression = declaration.kind === 242 /* ImportDeclaration */ + var expression = declaration.kind === 243 /* ImportDeclaration */ ? declaration.moduleSpecifier - : declaration.moduleReference.kind === 252 /* ExternalModuleReference */ + : declaration.moduleReference.kind === 253 /* ExternalModuleReference */ ? declaration.moduleReference.expression : undefined; return expression && ts.isStringLiteral(expression) ? { moduleSpecifier: expression.text, importKind: importKind } : undefined; @@ -99227,7 +99590,7 @@ var ts; function tryUpdateExistingImport(context, importClause, importKind) { var symbolName = context.symbolName, sourceFile = context.sourceFile; var name = importClause.name; - var namedBindings = (importClause.kind !== 241 /* ImportEqualsDeclaration */ && importClause).namedBindings; + var namedBindings = (importClause.kind !== 242 /* ImportEqualsDeclaration */ && importClause).namedBindings; switch (importKind) { case 1 /* Default */: return name ? undefined : ChangeTracker.with(context, function (t) { @@ -99235,11 +99598,11 @@ var ts; }); case 0 /* Named */: { var newImportSpecifier_1 = ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(symbolName)); - if (namedBindings && namedBindings.kind === 245 /* NamedImports */ && namedBindings.elements.length !== 0) { + if (namedBindings && namedBindings.kind === 246 /* NamedImports */ && namedBindings.elements.length !== 0) { // There are already named imports; add another. return ChangeTracker.with(context, function (t) { return t.insertNodeInListAfter(sourceFile, namedBindings.elements[namedBindings.elements.length - 1], newImportSpecifier_1); }); } - if (!namedBindings || namedBindings.kind === 245 /* NamedImports */ && namedBindings.elements.length === 0) { + if (!namedBindings || namedBindings.kind === 246 /* NamedImports */ && namedBindings.elements.length === 0) { return ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, importClause, ts.createImportClause(name, ts.createNamedImports([newImportSpecifier_1]))); }); @@ -99290,7 +99653,7 @@ var ts; // The error wasn't for the symbolAtLocation, it was for the JSX tag itself, which needs access to e.g. `React`. var parent = token.parent; var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(parent); - if ((ts.isJsxOpeningLikeElement && parent.tagName === token) || parent.kind === 258 /* JsxOpeningFragment */) { + if ((ts.isJsxOpeningLikeElement && parent.tagName === token) || parent.kind === 259 /* JsxOpeningFragment */) { umdSymbol = checker.resolveName(checker.getJsxNamespace(parent), isNodeOpeningLikeElement ? parent.tagName : parent, 67216319 /* Value */, /*excludeGlobals*/ false); } } @@ -99802,11 +100165,11 @@ var ts; } function isApplicableFunctionForInference(declaration) { switch (declaration.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: return true; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return !!declaration.name; } return false; @@ -99838,7 +100201,7 @@ var ts; function annotate(changes, sourceFile, declaration, type, program) { var typeNode = type && getTypeNodeIfAccessible(type, declaration, program.getTypeChecker()); if (typeNode) - changes.insertTypeAnnotation(sourceFile, declaration, typeNode); + changes.tryInsertTypeAnnotation(sourceFile, declaration, typeNode); } function getTypeNodeIfAccessible(type, enclosingScope, checker) { var typeIsAccessible = true; @@ -99865,8 +100228,8 @@ var ts; function inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) { switch (containingFunction.kind) { case 154 /* Constructor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: var isConstructor = containingFunction.kind === 154 /* Constructor */; var searchToken = isConstructor ? @@ -99934,21 +100297,21 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: usageContext.isNumber = true; break; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpressionContext(node.parent, usageContext); break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext); break; - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext); break; - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpressionContext(node.parent, checker, usageContext); } @@ -99956,10 +100319,10 @@ var ts; inferTypeFromContextualType(node, checker, usageContext); } break; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: inferTypeFromPropertyAccessExpressionContext(node.parent, checker, usageContext); break; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext); break; default: @@ -100061,7 +100424,7 @@ var ts; // LogicalOperator case 54 /* BarBarToken */: if (node === parent.left && - (node.parent.parent.kind === 230 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 231 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usageContext, checker.getTypeAtLocation(parent.right)); @@ -100089,7 +100452,7 @@ var ts; } } inferTypeFromContext(parent, checker, callContext.returnType); - if (parent.kind === 185 /* CallExpression */) { + if (parent.kind === 186 /* CallExpression */) { (usageContext.callContexts || (usageContext.callContexts = [])).push(callContext); } else { @@ -100271,7 +100634,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 185 /* CallExpression */ : 186 /* NewExpression */; + var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 186 /* CallExpression */ : 187 /* NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false), function (a) { return a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length); }); if (!node) { return []; @@ -100386,13 +100749,13 @@ var ts; else if (type.flags & 8 /* Boolean */) { return ts.createFalse(); } - else if (type.flags & 224 /* Literal */) { + else if (type.isLiteral()) { return ts.createLiteral(type.value); } - else if (type.flags & 131072 /* Union */) { + else if (type.isUnion()) { return ts.firstDefined(type.types, function (t) { return getDefaultValueFromType(checker, t); }); } - else if (ts.getObjectFlags(type) & 1 /* Class */) { + else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); if (!classDeclaration || ts.hasModifier(classDeclaration, 128 /* Abstract */)) return undefined; @@ -100780,7 +101143,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 230 /* VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 231 /* VariableDeclaration */) ? node.parent.parent : node; if (ts.hasModifier(declaringNode, 1 /* Export */)) { (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; @@ -100789,13 +101152,13 @@ var ts; } // Some things can't be extracted in certain situations switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; case 97 /* 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 === 185 /* CallExpression */) { + if (node.parent.kind === 186 /* CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -100810,8 +101173,8 @@ var ts; } if (!node || ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node)) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); @@ -100823,20 +101186,20 @@ var ts; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 215 /* IfStatement */: + case 216 /* IfStatement */: permittedJumps = 0 /* None */; break; - case 228 /* TryStatement */: + case 229 /* TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* None */; break; - case 211 /* Block */: - if (node.parent && node.parent.kind === 228 /* TryStatement */ && node.parent.finallyBlock === node) { + case 212 /* Block */: + if (node.parent && node.parent.kind === 229 /* TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* Return */; } break; - case 264 /* CaseClause */: + case 265 /* CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* Break */; break; @@ -100852,7 +101215,7 @@ var ts; case 99 /* ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; break; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); @@ -100860,8 +101223,8 @@ var ts; seenLabels.pop(); break; } - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: { var label = node.label; if (label) { @@ -100871,20 +101234,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 222 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { + if (!(permittedJumps & (node.kind === 223 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: if (permittedJumps & 4 /* Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -100949,7 +101312,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 272 /* SourceFile */) { + if (current.kind === 273 /* SourceFile */) { return scopes; } } @@ -101041,12 +101404,12 @@ var ts; switch (scope.kind) { case 154 /* Constructor */: return "constructor"; - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: return scope.name ? "function '" + scope.name.text + "'" : "anonymous function"; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return "arrow function"; case 153 /* MethodDeclaration */: return "method '" + scope.name.getText(); @@ -101059,12 +101422,12 @@ var ts; } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 233 /* ClassDeclaration */ + return scope.kind === 234 /* ClassDeclaration */ ? scope.name ? "class '" + scope.name.text + "'" : "anonymous class declaration" : scope.name ? "class expression '" + scope.name.text + "'" : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 238 /* ModuleBlock */ + return scope.kind === 239 /* ModuleBlock */ ? "namespace '" + scope.parent.name.getText() + "'" : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */; } @@ -101349,7 +101712,7 @@ var ts; var localReference = ts.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 214 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 215 /* 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.createVariableStatement( @@ -101368,7 +101731,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 214 /* ExpressionStatement */) { + if (node.parent.kind === 215 /* ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.deleteNode(context.file, node.parent, ts.textChanges.useNonAdjustedPositions); } @@ -101485,7 +101848,7 @@ var ts; return { body: ts.createBlock(statements, /*multiLine*/ true), returnValueProperty: undefined }; } function visitor(node) { - if (!ignoreReturns && node.kind === 223 /* ReturnStatement */ && hasWritesOrVariableDeclarations) { + if (!ignoreReturns && node.kind === 224 /* ReturnStatement */ && hasWritesOrVariableDeclarations) { var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); if (node.expression) { if (!returnValueProperty) { @@ -101665,7 +102028,7 @@ var ts; var scope = scopes_1[_i]; usagesPerScope.push({ usages: ts.createMap(), typeParameterUsages: ts.createMap(), substitutions: ts.createMap() }); substitutionsPerScope.push(ts.createMap()); - functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 232 /* FunctionDeclaration */ + functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 233 /* FunctionDeclaration */ ? [ts.createDiagnosticForNode(scope, Messages.cannotExtractToOtherFunctionLike)] : []); var constantErrors = []; @@ -101728,7 +102091,7 @@ var ts; : ts.getEnclosingBlockScopeContainer(scopes[0]); ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations); } - var _loop_12 = function (i) { + var _loop_13 = function (i) { var scopeUsages = usagesPerScope[i]; // Special case: in the innermost scope, all usages are available. // (The computed value reflects the value at the top-level of the scope, but the @@ -101768,7 +102131,7 @@ var ts; } }; for (var i = 0; i < scopes.length; i++) { - _loop_12(i); + _loop_13(i); } return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations }; function hasTypeParameters(node) { @@ -101792,7 +102155,7 @@ var ts; var visitedTypes = symbolWalker.walkType(type).visitedTypes; for (var _i = 0, visitedTypes_1 = visitedTypes; _i < visitedTypes_1.length; _i++) { var visitedType = visitedTypes_1[_i]; - if (visitedType.flags & 32768 /* TypeParameter */) { + if (visitedType.isTypeParameter()) { allTypeParameterUsages.set(visitedType.id.toString(), visitedType); } } @@ -102004,30 +102367,30 @@ var ts; */ function isExtractableExpression(node) { switch (node.parent.kind) { - case 271 /* EnumMember */: + case 272 /* EnumMember */: return false; } switch (node.kind) { case 9 /* StringLiteral */: - return node.parent.kind !== 242 /* ImportDeclaration */ && - node.parent.kind !== 246 /* ImportSpecifier */; - case 202 /* SpreadElement */: - case 178 /* ObjectBindingPattern */: - case 180 /* BindingElement */: + return node.parent.kind !== 243 /* ImportDeclaration */ && + node.parent.kind !== 247 /* ImportSpecifier */; + case 203 /* SpreadElement */: + case 179 /* ObjectBindingPattern */: + case 181 /* BindingElement */: return false; case 71 /* Identifier */: - return node.parent.kind !== 180 /* BindingElement */ && - node.parent.kind !== 246 /* ImportSpecifier */ && - node.parent.kind !== 250 /* ExportSpecifier */; + return node.parent.kind !== 181 /* BindingElement */ && + node.parent.kind !== 247 /* ImportSpecifier */ && + node.parent.kind !== 251 /* ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 211 /* Block */: - case 272 /* SourceFile */: - case 238 /* ModuleBlock */: - case 264 /* CaseClause */: + case 212 /* Block */: + case 273 /* SourceFile */: + case 239 /* ModuleBlock */: + case 265 /* CaseClause */: return true; default: return false; @@ -102392,7 +102755,7 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 274 /* FirstJSDocNode */ || kid.kind > 292 /* LastJSDocNode */; }); + var child = ts.find(children, function (kid) { return kid.kind < 275 /* FirstJSDocNode */ || kid.kind > 293 /* LastJSDocNode */; }); return child.kind < 145 /* FirstNode */ ? child : child.getFirstToken(sourceFile); @@ -102462,7 +102825,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(293 /* SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(294 /* SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -102557,28 +102920,9 @@ var ts; return this.declarations; }; SymbolObject.prototype.getDocumentationComment = function (checker) { - if (this.documentationComment === undefined) { - if (this.declarations) { - this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations(this.declarations); - if (this.documentationComment.length === 0 || this.declarations.some(hasJSDocInheritDocTag)) { - if (checker) { - for (var _i = 0, _a = this.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - var inheritedDocs = findInheritedJSDocComments(declaration, this.getName(), checker); - if (inheritedDocs.length > 0) { - if (this.documentationComment.length > 0) { - inheritedDocs.push(ts.lineBreakPart()); - } - this.documentationComment = ts.concatenate(inheritedDocs, this.documentationComment); - break; - } - } - } - } - } - else { - this.documentationComment = []; - } + if (!this.documentationComment) { + this.documentationComment = ts.emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs + this.documentationComment = getDocumentationComment(this.declarations, checker); } return this.documentationComment; }; @@ -102647,9 +102991,7 @@ var ts; return this.checker.getIndexTypeOfType(this, 1 /* Number */); }; TypeObject.prototype.getBaseTypes = function () { - return this.flags & 65536 /* Object */ && this.objectFlags & (1 /* Class */ | 2 /* Interface */) - ? this.checker.getBaseTypes(this) - : undefined; + return this.isClassOrInterface() ? this.checker.getBaseTypes(this) : undefined; }; TypeObject.prototype.getNonNullableType = function () { return this.checker.getNonNullableType(this); @@ -102660,6 +103002,33 @@ var ts; TypeObject.prototype.getDefault = function () { return this.checker.getDefaultFromTypeParameter(this); }; + TypeObject.prototype.isUnion = function () { + return !!(this.flags & 131072 /* Union */); + }; + TypeObject.prototype.isIntersection = function () { + return !!(this.flags & 262144 /* Intersection */); + }; + TypeObject.prototype.isUnionOrIntersection = function () { + return !!(this.flags & 393216 /* UnionOrIntersection */); + }; + TypeObject.prototype.isLiteral = function () { + return !!(this.flags & 224 /* Literal */); + }; + TypeObject.prototype.isStringLiteral = function () { + return !!(this.flags & 32 /* StringLiteral */); + }; + TypeObject.prototype.isNumberLiteral = function () { + return !!(this.flags & 64 /* NumberLiteral */); + }; + TypeObject.prototype.isTypeParameter = function () { + return !!(this.flags & 32768 /* TypeParameter */); + }; + TypeObject.prototype.isClassOrInterface = function () { + return !!(ts.getObjectFlags(this) & 3 /* ClassOrInterface */); + }; + TypeObject.prototype.isClass = function () { + return !!(ts.getObjectFlags(this) & 1 /* Class */); + }; return TypeObject; }()); var SignatureObject = /** @class */ (function () { @@ -102679,22 +103048,7 @@ var ts; return this.checker.getReturnTypeOfSignature(this); }; SignatureObject.prototype.getDocumentationComment = function () { - if (this.documentationComment === undefined) { - if (this.declaration) { - this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations([this.declaration]); - if (this.documentationComment.length === 0 || hasJSDocInheritDocTag(this.declaration)) { - var inheritedDocs = findInheritedJSDocComments(this.declaration, this.declaration.symbol.getName(), this.checker); - if (this.documentationComment.length > 0) { - inheritedDocs.push(ts.lineBreakPart()); - } - this.documentationComment = ts.concatenate(inheritedDocs, this.documentationComment); - } - } - else { - this.documentationComment = []; - } - } - return this.documentationComment; + return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker)); }; SignatureObject.prototype.getJsDocTags = function () { if (this.jsDocTags === undefined) { @@ -102712,6 +103066,21 @@ var ts; function hasJSDocInheritDocTag(node) { return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; }); } + function getDocumentationComment(declarations, checker) { + if (!declarations) + return ts.emptyArray; + var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations); + if (doc.length === 0 || declarations.some(hasJSDocInheritDocTag)) { + for (var _i = 0, declarations_13 = declarations; _i < declarations_13.length; _i++) { + var declaration = declarations_13[_i]; + var inheritedDocs = findInheritedJSDocComments(declaration, declaration.symbol.name, checker); + // TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs + if (inheritedDocs) + doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc); + } + } + return doc; + } /** * Attempts to find JSDoc comments for possibly-inherited properties. Checks superclasses then traverses * implemented interfaces until a symbol is found with the same name and with documentation. @@ -102721,22 +103090,11 @@ var ts; * @returns A filled array of documentation comments if any were found, otherwise an empty array. */ function findInheritedJSDocComments(declaration, propertyName, typeChecker) { - var foundDocs = false; - return ts.flatMap(declaration.parent ? ts.getAllSuperTypeNodes(declaration.parent) : ts.emptyArray, function (superTypeNode) { - if (foundDocs) { - return ts.emptyArray; - } + return ts.firstDefined(declaration.parent ? ts.getAllSuperTypeNodes(declaration.parent) : ts.emptyArray, function (superTypeNode) { var superType = typeChecker.getTypeAtLocation(superTypeNode); - if (!superType) { - return ts.emptyArray; - } - var baseProperty = typeChecker.getPropertyOfType(superType, propertyName); - if (!baseProperty) { - return ts.emptyArray; - } - var inheritedDocs = baseProperty.getDocumentationComment(typeChecker); - foundDocs = inheritedDocs.length > 0; - return inheritedDocs; + var baseProperty = superType && typeChecker.getPropertyOfType(superType, propertyName); + var inheritedDocs = baseProperty && baseProperty.getDocumentationComment(typeChecker); + return inheritedDocs && inheritedDocs.length ? inheritedDocs : undefined; }); } var SourceFileObject = /** @class */ (function (_super) { @@ -102795,13 +103153,13 @@ var ts; } function getDeclarationName(declaration) { var name = ts.getNameOfDeclaration(declaration); - return name && (ts.isPropertyNameLiteral(name) ? ts.getTextOfIdentifierOrLiteral(name) : - name.kind === 146 /* ComputedPropertyName */ && ts.isPropertyAccessExpression(name.expression) ? name.expression.name.text : undefined); + return name && (ts.isComputedPropertyName(name) && ts.isPropertyAccessExpression(name.expression) ? name.expression.name.text + : ts.isPropertyName(name) ? ts.getNameFromPropertyName(name) : undefined); } function visit(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: var functionDeclaration = node; @@ -102823,17 +103181,17 @@ var ts; } ts.forEachChild(node, visit); break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: - case 237 /* ModuleDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 250 /* ExportSpecifier */: - case 246 /* ImportSpecifier */: - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 251 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 165 /* TypeLiteral */: @@ -102846,8 +103204,8 @@ var ts; break; } // falls through - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: { + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -102858,19 +103216,19 @@ var ts; } } // falls through - case 271 /* EnumMember */: + case 272 /* EnumMember */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: addDeclaration(node); break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -102882,7 +103240,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 244 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 245 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -102891,7 +103249,7 @@ var ts; } } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (ts.getSpecialPropertyAssignmentKind(node) !== 0 /* None */) { addDeclaration(node); } @@ -103426,16 +103784,16 @@ var ts; // Convert from deprecated options names to new names var fullPreferences = __assign({}, ts.identity(options), { includeCompletionsForModuleExports: options.includeCompletionsForModuleExports || options.includeExternalModuleExports, includeCompletionsWithInsertText: options.includeCompletionsWithInsertText || options.includeInsertTextCompletions }); synchronizeHostData(); - return ts.Completions.getCompletionsAtPosition(host, program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, program.getSourceFiles(), fullPreferences); + return ts.Completions.getCompletionsAtPosition(host, program, log, getValidSourceFile(fileName), position, fullPreferences); } function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences) { if (preferences === void 0) { preferences = ts.defaultPreferences; } synchronizeHostData(); - return ts.Completions.getCompletionEntryDetails(program, log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, formattingOptions && ts.formatting.getFormatContext(formattingOptions), getCanonicalFileName, preferences); + return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, formattingOptions && ts.formatting.getFormatContext(formattingOptions), getCanonicalFileName, preferences); } function getCompletionEntrySymbol(fileName, position, name, source) { synchronizeHostData(); - return ts.Completions.getCompletionEntrySymbol(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles()); + return ts.Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name: name, source: source }); } function getQuickInfoAtPosition(fileName, position) { synchronizeHostData(); @@ -103456,7 +103814,7 @@ var ts; return undefined; } // falls through - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 145 /* QualifiedName */: case 99 /* ThisKeyword */: case 173 /* ThisType */: @@ -103496,7 +103854,8 @@ var ts; } return checker.getSymbolAtLocation(node); } - var sourceMapCommentRegExp = /^\/\/[@#] sourceMappingURL=(.+)$/gm; + // Sometimes tools can sometimes see the following line as a source mapping url comment, so we mangle it a bit (the [M]) + var sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)$/gm; var base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/; function scanForSourcemapURL(fileName) { var mappedFile = sourcemappedFileCache.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); @@ -103723,7 +104082,7 @@ var ts; return; } switch (node.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 145 /* QualifiedName */: case 9 /* StringLiteral */: case 86 /* FalseKeyword */: @@ -103748,7 +104107,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 === 237 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 238 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -104178,7 +104537,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 252 /* ExternalModuleReference */ || + node.parent.kind === 253 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -104196,7 +104555,7 @@ var ts; // falls through case 71 /* Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 182 /* ObjectLiteralExpression */ || node.parent.parent.kind === 261 /* JsxAttributes */) && + (node.parent.parent.kind === 183 /* ObjectLiteralExpression */ || node.parent.parent.kind === 262 /* JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -104235,7 +104594,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 184 /* ElementAccessExpression */ && + node.parent.kind === 185 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -104316,114 +104675,114 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return spanInVariableDeclaration(node); case 148 /* Parameter */: return spanInParameterDeclaration(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 154 /* Constructor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 211 /* Block */: + case 212 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return spanInBlock(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return spanInBlock(node.block); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 216 /* DoStatement */: + case 217 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 229 /* DebuggerStatement */: + case 230 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 215 /* IfStatement */: + case 216 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return spanInForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 228 /* TryStatement */: + case 229 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } // falls through - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 180 /* BindingElement */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 181 /* BindingElement */: // span on complete node return textSpan(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: // span in statement return spanInNode(node.statement); case 149 /* Decorator */: return spanInNodeArray(node.parent.decorators); - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: return undefined; // Tokens: case 25 /* SemicolonToken */: @@ -104466,13 +104825,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 === 71 /* Identifier */ || - node.kind === 202 /* SpreadElement */ || - node.kind === 268 /* PropertyAssignment */ || - node.kind === 269 /* ShorthandPropertyAssignment */) && + node.kind === 203 /* SpreadElement */ || + node.kind === 269 /* PropertyAssignment */ || + node.kind === 270 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 198 /* BinaryExpression */) { + if (node.kind === 199 /* 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 @@ -104494,22 +104853,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (node.parent.kind) { - case 216 /* DoStatement */: + case 217 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); case 149 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 218 /* ForStatement */: - case 220 /* ForOfStatement */: + case 219 /* ForStatement */: + case 221 /* ForOfStatement */: return textSpan(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (node.parent.operatorToken.kind === 26 /* CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -104518,20 +104877,20 @@ var ts; } } switch (node.parent.kind) { - case 268 /* PropertyAssignment */: + case 269 /* 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 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; @@ -104540,7 +104899,7 @@ var ts; } break; } - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -104570,7 +104929,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 219 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 220 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern, set breakpoint in binding pattern @@ -104581,7 +104940,7 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1 /* Export */) || - variableDeclaration.parent.parent.kind === 220 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 221 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -104622,7 +104981,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1 /* Export */) || - (functionDeclaration.parent.kind === 233 /* ClassDeclaration */ && functionDeclaration.kind !== 154 /* Constructor */); + (functionDeclaration.parent.kind === 234 /* ClassDeclaration */ && functionDeclaration.kind !== 154 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -104645,26 +105004,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // falls through // Set on parent if on same line otherwise on first statement - case 217 /* WhileStatement */: - case 215 /* IfStatement */: - case 219 /* ForInStatement */: + case 218 /* WhileStatement */: + case 216 /* IfStatement */: + case 220 /* 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 218 /* ForStatement */: - case 220 /* ForOfStatement */: + case 219 /* ForStatement */: + case 221 /* 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 === 231 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 232 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -104689,21 +105048,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 204 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 205 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 180 /* BindingElement */) { + if (bindingPattern.parent.kind === 181 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 179 /* ArrayBindingPattern */ && node.kind !== 178 /* ObjectBindingPattern */); - var elements = node.kind === 181 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 204 /* OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 180 /* ArrayBindingPattern */ && node.kind !== 179 /* ObjectBindingPattern */); + var elements = node.kind === 182 /* ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 205 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -104711,18 +105070,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 === 198 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 199 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -104730,25 +105089,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } // falls through - case 236 /* EnumDeclaration */: - case 233 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 211 /* Block */: + case 212 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 267 /* CatchClause */: + case 268 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -104756,7 +105115,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 178 /* ObjectBindingPattern */: + case 179 /* 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); @@ -104772,7 +105131,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 179 /* ArrayBindingPattern */: + case 180 /* 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); @@ -104787,12 +105146,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 216 /* DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 185 /* CallExpression */ || - node.parent.kind === 186 /* NewExpression */) { + if (node.parent.kind === 217 /* DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 186 /* CallExpression */ || + node.parent.kind === 187 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 189 /* ParenthesizedExpression */) { + if (node.parent.kind === 190 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -104801,21 +105160,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 154 /* Constructor */: - case 217 /* WhileStatement */: - case 216 /* DoStatement */: - case 218 /* ForStatement */: - case 220 /* ForOfStatement */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 189 /* ParenthesizedExpression */: + case 218 /* WhileStatement */: + case 217 /* DoStatement */: + case 219 /* ForStatement */: + case 221 /* ForOfStatement */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 190 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -104825,20 +105184,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 268 /* PropertyAssignment */ || + node.parent.kind === 269 /* PropertyAssignment */ || node.parent.kind === 148 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 188 /* TypeAssertionExpression */) { + if (node.parent.kind === 189 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 216 /* DoStatement */) { + if (node.parent.kind === 217 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -104846,7 +105205,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 220 /* ForOfStatement */) { + if (node.parent.kind === 221 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 5fd6d55b4a2..ecf433425d9 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -240,128 +240,129 @@ declare namespace ts { IndexedAccessType = 175, MappedType = 176, LiteralType = 177, - ObjectBindingPattern = 178, - ArrayBindingPattern = 179, - BindingElement = 180, - ArrayLiteralExpression = 181, - ObjectLiteralExpression = 182, - PropertyAccessExpression = 183, - ElementAccessExpression = 184, - CallExpression = 185, - NewExpression = 186, - TaggedTemplateExpression = 187, - TypeAssertionExpression = 188, - ParenthesizedExpression = 189, - FunctionExpression = 190, - ArrowFunction = 191, - DeleteExpression = 192, - TypeOfExpression = 193, - VoidExpression = 194, - AwaitExpression = 195, - PrefixUnaryExpression = 196, - PostfixUnaryExpression = 197, - BinaryExpression = 198, - ConditionalExpression = 199, - TemplateExpression = 200, - YieldExpression = 201, - SpreadElement = 202, - ClassExpression = 203, - OmittedExpression = 204, - ExpressionWithTypeArguments = 205, - AsExpression = 206, - NonNullExpression = 207, - MetaProperty = 208, - TemplateSpan = 209, - SemicolonClassElement = 210, - Block = 211, - VariableStatement = 212, - EmptyStatement = 213, - ExpressionStatement = 214, - IfStatement = 215, - DoStatement = 216, - WhileStatement = 217, - ForStatement = 218, - ForInStatement = 219, - ForOfStatement = 220, - ContinueStatement = 221, - BreakStatement = 222, - ReturnStatement = 223, - WithStatement = 224, - SwitchStatement = 225, - LabeledStatement = 226, - ThrowStatement = 227, - TryStatement = 228, - DebuggerStatement = 229, - VariableDeclaration = 230, - VariableDeclarationList = 231, - FunctionDeclaration = 232, - ClassDeclaration = 233, - InterfaceDeclaration = 234, - TypeAliasDeclaration = 235, - EnumDeclaration = 236, - ModuleDeclaration = 237, - ModuleBlock = 238, - CaseBlock = 239, - NamespaceExportDeclaration = 240, - ImportEqualsDeclaration = 241, - ImportDeclaration = 242, - ImportClause = 243, - NamespaceImport = 244, - NamedImports = 245, - ImportSpecifier = 246, - ExportAssignment = 247, - ExportDeclaration = 248, - NamedExports = 249, - ExportSpecifier = 250, - MissingDeclaration = 251, - ExternalModuleReference = 252, - JsxElement = 253, - JsxSelfClosingElement = 254, - JsxOpeningElement = 255, - JsxClosingElement = 256, - JsxFragment = 257, - JsxOpeningFragment = 258, - JsxClosingFragment = 259, - JsxAttribute = 260, - JsxAttributes = 261, - JsxSpreadAttribute = 262, - JsxExpression = 263, - CaseClause = 264, - DefaultClause = 265, - HeritageClause = 266, - CatchClause = 267, - PropertyAssignment = 268, - ShorthandPropertyAssignment = 269, - SpreadAssignment = 270, - EnumMember = 271, - SourceFile = 272, - Bundle = 273, - JSDocTypeExpression = 274, - JSDocAllType = 275, - JSDocUnknownType = 276, - JSDocNullableType = 277, - JSDocNonNullableType = 278, - JSDocOptionalType = 279, - JSDocFunctionType = 280, - JSDocVariadicType = 281, - JSDocComment = 282, - JSDocTypeLiteral = 283, - JSDocTag = 284, - JSDocAugmentsTag = 285, - JSDocClassTag = 286, - JSDocParameterTag = 287, - JSDocReturnTag = 288, - JSDocTypeTag = 289, - JSDocTemplateTag = 290, - JSDocTypedefTag = 291, - JSDocPropertyTag = 292, - SyntaxList = 293, - NotEmittedStatement = 294, - PartiallyEmittedExpression = 295, - CommaListExpression = 296, - MergeDeclarationMarker = 297, - EndOfDeclarationMarker = 298, - Count = 299, + ImportType = 178, + ObjectBindingPattern = 179, + ArrayBindingPattern = 180, + BindingElement = 181, + ArrayLiteralExpression = 182, + ObjectLiteralExpression = 183, + PropertyAccessExpression = 184, + ElementAccessExpression = 185, + CallExpression = 186, + NewExpression = 187, + TaggedTemplateExpression = 188, + TypeAssertionExpression = 189, + ParenthesizedExpression = 190, + FunctionExpression = 191, + ArrowFunction = 192, + DeleteExpression = 193, + TypeOfExpression = 194, + VoidExpression = 195, + AwaitExpression = 196, + PrefixUnaryExpression = 197, + PostfixUnaryExpression = 198, + BinaryExpression = 199, + ConditionalExpression = 200, + TemplateExpression = 201, + YieldExpression = 202, + SpreadElement = 203, + ClassExpression = 204, + OmittedExpression = 205, + ExpressionWithTypeArguments = 206, + AsExpression = 207, + NonNullExpression = 208, + MetaProperty = 209, + TemplateSpan = 210, + SemicolonClassElement = 211, + Block = 212, + VariableStatement = 213, + EmptyStatement = 214, + ExpressionStatement = 215, + IfStatement = 216, + DoStatement = 217, + WhileStatement = 218, + ForStatement = 219, + ForInStatement = 220, + ForOfStatement = 221, + ContinueStatement = 222, + BreakStatement = 223, + ReturnStatement = 224, + WithStatement = 225, + SwitchStatement = 226, + LabeledStatement = 227, + ThrowStatement = 228, + TryStatement = 229, + DebuggerStatement = 230, + VariableDeclaration = 231, + VariableDeclarationList = 232, + FunctionDeclaration = 233, + ClassDeclaration = 234, + InterfaceDeclaration = 235, + TypeAliasDeclaration = 236, + EnumDeclaration = 237, + ModuleDeclaration = 238, + ModuleBlock = 239, + CaseBlock = 240, + NamespaceExportDeclaration = 241, + ImportEqualsDeclaration = 242, + ImportDeclaration = 243, + ImportClause = 244, + NamespaceImport = 245, + NamedImports = 246, + ImportSpecifier = 247, + ExportAssignment = 248, + ExportDeclaration = 249, + NamedExports = 250, + ExportSpecifier = 251, + MissingDeclaration = 252, + ExternalModuleReference = 253, + JsxElement = 254, + JsxSelfClosingElement = 255, + JsxOpeningElement = 256, + JsxClosingElement = 257, + JsxFragment = 258, + JsxOpeningFragment = 259, + JsxClosingFragment = 260, + JsxAttribute = 261, + JsxAttributes = 262, + JsxSpreadAttribute = 263, + JsxExpression = 264, + CaseClause = 265, + DefaultClause = 266, + HeritageClause = 267, + CatchClause = 268, + PropertyAssignment = 269, + ShorthandPropertyAssignment = 270, + SpreadAssignment = 271, + EnumMember = 272, + SourceFile = 273, + Bundle = 274, + JSDocTypeExpression = 275, + JSDocAllType = 276, + JSDocUnknownType = 277, + JSDocNullableType = 278, + JSDocNonNullableType = 279, + JSDocOptionalType = 280, + JSDocFunctionType = 281, + JSDocVariadicType = 282, + JSDocComment = 283, + JSDocTypeLiteral = 284, + JSDocTag = 285, + JSDocAugmentsTag = 286, + JSDocClassTag = 287, + JSDocParameterTag = 288, + JSDocReturnTag = 289, + JSDocTypeTag = 290, + JSDocTemplateTag = 291, + JSDocTypedefTag = 292, + JSDocPropertyTag = 293, + SyntaxList = 294, + NotEmittedStatement = 295, + PartiallyEmittedExpression = 296, + CommaListExpression = 297, + MergeDeclarationMarker = 298, + EndOfDeclarationMarker = 299, + Count = 300, FirstAssignment = 58, LastAssignment = 70, FirstCompoundAssignment = 59, @@ -373,7 +374,7 @@ declare namespace ts { FirstFutureReservedWord = 108, LastFutureReservedWord = 116, FirstTypeNode = 160, - LastTypeNode = 177, + LastTypeNode = 178, FirstPunctuation = 17, LastPunctuation = 70, FirstToken = 0, @@ -387,10 +388,10 @@ declare namespace ts { FirstBinaryOperator = 27, LastBinaryOperator = 70, FirstNode = 145, - FirstJSDocNode = 274, - LastJSDocNode = 292, - FirstJSDocTagNode = 284, - LastJSDocTagNode = 292 + FirstJSDocNode = 275, + LastJSDocNode = 293, + FirstJSDocTagNode = 285, + LastJSDocTagNode = 293 } enum NodeFlags { None = 0, @@ -697,6 +698,12 @@ declare namespace ts { interface KeywordTypeNode extends TypeNode { kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.VoidKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.NullKeyword | SyntaxKind.NeverKeyword; } + interface ImportTypeNode extends NodeWithTypeArguments { + kind: SyntaxKind.ImportType; + isTypeOf?: boolean; + argument: TypeNode; + qualifier?: EntityName; + } interface ThisTypeNode extends TypeNode { kind: SyntaxKind.ThisType; } @@ -707,11 +714,13 @@ declare namespace ts { interface ConstructorTypeNode extends TypeNode, SignatureDeclarationBase { kind: SyntaxKind.ConstructorType; } + interface NodeWithTypeArguments extends TypeNode { + typeArguments?: NodeArray; + } type TypeReferenceType = TypeReferenceNode | ExpressionWithTypeArguments; - interface TypeReferenceNode extends TypeNode { + interface TypeReferenceNode extends NodeWithTypeArguments { kind: SyntaxKind.TypeReference; typeName: EntityName; - typeArguments?: NodeArray; } interface TypePredicateNode extends TypeNode { kind: SyntaxKind.TypePredicate; @@ -1027,11 +1036,10 @@ declare namespace ts { interface ImportCall extends CallExpression { expression: ImportExpression; } - interface ExpressionWithTypeArguments extends TypeNode { + interface ExpressionWithTypeArguments extends NodeWithTypeArguments { kind: SyntaxKind.ExpressionWithTypeArguments; parent?: HeritageClause; expression: LeftHandSideExpression; - typeArguments?: NodeArray; } interface NewExpression extends PrimaryExpression, Declaration { kind: SyntaxKind.NewExpression; @@ -1689,6 +1697,7 @@ declare namespace ts { getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + getConfigFileParsingDiagnostics(): ReadonlyArray; /** * Gets a type checker that can be used to semantically analyze source files in the program. */ @@ -1812,7 +1821,7 @@ declare namespace ts { isArgumentsSymbol(symbol: Symbol): boolean; isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; - isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean; /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; @@ -1824,6 +1833,7 @@ declare namespace ts { getApparentType(type: Type): Type; getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined; getSuggestionForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): string | undefined; + getSuggestionForNonexistentModule(node: Identifier, target: Symbol): string | undefined; getBaseConstraintOfType(type: Type): Type | undefined; getDefaultFromTypeParameter(type: Type): Type | undefined; } @@ -2583,9 +2593,10 @@ declare namespace ts { interface EmitHelper { readonly name: string; readonly scoped: boolean; - readonly text: string; + readonly text: string | ((node: EmitHelperUniqueNameCallback) => string); readonly priority?: number; } + type EmitHelperUniqueNameCallback = (name: string) => string; enum EmitHint { SourceFile = 0, Expression = 1, @@ -2757,6 +2768,7 @@ declare namespace ts { removeComments?: boolean; newLine?: NewLineKind; omitTrailingSemicolon?: boolean; + noEmitHelpers?: boolean; } /** @deprecated See comment on SymbolWriter */ interface SymbolTracker { @@ -3396,6 +3408,8 @@ declare namespace ts { function createUniqueName(text: string): Identifier; /** Create a unique name based on the supplied text. */ function createOptimisticUniqueName(text: string): Identifier; + /** Create a unique name based on the supplied text. This does not consider names injected by the transformer. */ + function createFileLevelUniqueName(text: string): Identifier; /** Create a unique name generated for a node. */ function getGeneratedNameForNode(node: Node): Identifier; function createToken(token: TKind): Token; @@ -3430,9 +3444,9 @@ declare namespace ts { function updateGetAccessor(node: GetAccessorDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: PropertyName, parameters: ReadonlyArray, type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; function createSetAccessor(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: string | PropertyName, parameters: ReadonlyArray, body: Block | undefined): SetAccessorDeclaration; function updateSetAccessor(node: SetAccessorDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: PropertyName, parameters: ReadonlyArray, body: Block | undefined): SetAccessorDeclaration; - function createCallSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration; + function createCallSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): CallSignatureDeclaration; function updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; - function createConstructSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; + function createConstructSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function createIndexSignature(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; function updateIndexSignature(node: IndexSignatureDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; @@ -3441,9 +3455,9 @@ declare namespace ts { function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; function createTypeReferenceNode(typeName: string | EntityName, typeArguments: ReadonlyArray | undefined): TypeReferenceNode; function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray | undefined): TypeReferenceNode; - function createFunctionTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): FunctionTypeNode; + function createFunctionTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): FunctionTypeNode; function updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): FunctionTypeNode; - function createConstructorTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructorTypeNode; + function createConstructorTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): ConstructorTypeNode; function updateConstructorTypeNode(node: ConstructorTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructorTypeNode; function createTypeQueryNode(exprName: EntityName): TypeQueryNode; function updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName): TypeQueryNode; @@ -3453,15 +3467,17 @@ declare namespace ts { function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; function createTupleTypeNode(elementTypes: ReadonlyArray): TupleTypeNode; function updateTypleTypeNode(node: TupleTypeNode, elementTypes: ReadonlyArray): TupleTypeNode; - function createUnionTypeNode(types: TypeNode[]): UnionTypeNode; + function createUnionTypeNode(types: ReadonlyArray): UnionTypeNode; function updateUnionTypeNode(node: UnionTypeNode, types: NodeArray): UnionTypeNode; - function createIntersectionTypeNode(types: TypeNode[]): IntersectionTypeNode; + function createIntersectionTypeNode(types: ReadonlyArray): IntersectionTypeNode; function updateIntersectionTypeNode(node: IntersectionTypeNode, types: NodeArray): IntersectionTypeNode; function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: ReadonlyArray): UnionOrIntersectionTypeNode; function createConditionalTypeNode(checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; function updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; function createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; function updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; + function createImportTypeNode(argument: TypeNode, qualifier?: EntityName, typeArguments?: ReadonlyArray, isTypeOf?: boolean): ImportTypeNode; + function updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, qualifier?: EntityName, typeArguments?: ReadonlyArray, isTypeOf?: boolean): ImportTypeNode; function createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; function createThisTypeNode(): ThisTypeNode; @@ -3660,7 +3676,7 @@ declare namespace ts { function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment; function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember; function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember; - function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"]): SourceFile; + function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean): SourceFile; /** * Creates a shallow, memberwise clone of a node for mutation. */ @@ -3686,10 +3702,10 @@ declare namespace ts { function updateCommaList(node: CommaListExpression, elements: ReadonlyArray): CommaListExpression; function createBundle(sourceFiles: ReadonlyArray): Bundle; function updateBundle(node: Bundle, sourceFiles: ReadonlyArray): Bundle; - function createImmediatelyInvokedFunctionExpression(statements: Statement[]): CallExpression; - function createImmediatelyInvokedFunctionExpression(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; - function createImmediatelyInvokedArrowFunction(statements: Statement[]): CallExpression; - function createImmediatelyInvokedArrowFunction(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; + function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray): CallExpression; + function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; + function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray): CallExpression; + function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; function createComma(left: Expression, right: Expression): Expression; function createLessThan(left: Expression, right: Expression): Expression; function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment; @@ -3877,6 +3893,7 @@ declare namespace ts { function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string; function formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; + function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): ReadonlyArray; /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' * that represent a compilation unit. @@ -3888,9 +3905,10 @@ declare namespace ts { * @param options - The compiler options which should be used. * @param host - The host interacts with the underlying file system. * @param oldProgram - Reuses an old program structure. + * @param configFileParsingDiagnostics - error during config file parsing * @returns A 'Program' object. */ - function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; + function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray): Program; } declare namespace ts { interface EmitOutput { @@ -3951,6 +3969,10 @@ declare namespace ts { * Get the diagnostics that dont belong to any file */ getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + /** + * Get the diagnostics from config file parsing + */ + getConfigFileParsingDiagnostics(): ReadonlyArray; /** * Get the syntax diagnostics, for all source files if source file is not supplied */ @@ -4010,24 +4032,25 @@ declare namespace ts { /** * Create the builder to manage semantic diagnostics and cache them */ - function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram): SemanticDiagnosticsBuilderProgram; - function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram): SemanticDiagnosticsBuilderProgram; + function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram; + function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram; /** * Create the builder that can handle the changes in program and iterate through changed files * to emit the those files and manage semantic diagnostics cache as well */ - function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram): EmitAndSemanticDiagnosticsBuilderProgram; - function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram): EmitAndSemanticDiagnosticsBuilderProgram; + function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram; + function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram; /** * Creates a builder thats just abstraction over program and can be used with watch */ - function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram): BuilderProgram; - function createAbstractBuilder(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: BuilderProgram): BuilderProgram; + function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; + function createAbstractBuilder(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; } declare namespace ts { type DiagnosticReporter = (diagnostic: Diagnostic) => void; type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void; - type CreateProgram = (rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: T) => T; + /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */ + type CreateProgram = (rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: ReadonlyArray) => T; interface WatchCompilerHost { /** * Used to create the program when need for program creation or recreation detected @@ -4091,10 +4114,6 @@ declare namespace ts { * Reports config file diagnostics */ interface ConfigFileDiagnosticsReporter { - /** - * Reports the diagnostics in reading/writing or parsing of the config file - */ - onConfigFileDiagnostic: DiagnosticReporter; /** * Reports unrecoverable error when parsing config file */ @@ -4241,6 +4260,15 @@ declare namespace ts { getNonNullableType(): Type; getConstraint(): Type | undefined; getDefault(): Type | undefined; + isUnion(): this is UnionType; + isIntersection(): this is IntersectionType; + isUnionOrIntersection(): this is UnionOrIntersectionType; + isLiteral(): this is LiteralType; + isStringLiteral(): this is StringLiteralType; + isNumberLiteral(): this is NumberLiteralType; + isTypeParameter(): this is TypeParameter; + isClassOrInterface(): this is InterfaceType; + isClass(): this is InterfaceType; } interface Signature { getDeclaration(): SignatureDeclaration; @@ -4655,6 +4683,7 @@ declare namespace ts { placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; insertSpaceBeforeTypeAnnotation?: boolean; + indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean; } interface DefinitionInfo { fileName: string; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 06d660a8873..b343a3c3135 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -22,6 +22,10 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { } return t; }; +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || @@ -239,144 +243,145 @@ var ts; SyntaxKind[SyntaxKind["IndexedAccessType"] = 175] = "IndexedAccessType"; SyntaxKind[SyntaxKind["MappedType"] = 176] = "MappedType"; SyntaxKind[SyntaxKind["LiteralType"] = 177] = "LiteralType"; + SyntaxKind[SyntaxKind["ImportType"] = 178] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 178] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 179] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 180] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 179] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 180] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 181] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 181] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 182] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 183] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 184] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 185] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 186] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 187] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 188] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 189] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 190] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 191] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 192] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 193] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 194] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 195] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 196] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 197] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 198] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 199] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 200] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 201] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 202] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 203] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 204] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 205] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 206] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 207] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 208] = "MetaProperty"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 182] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 183] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 184] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 185] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 186] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 187] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 188] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 189] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 190] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 191] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 192] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 193] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 194] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 195] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 196] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 197] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 198] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 199] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 200] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 201] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 202] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 203] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 204] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 205] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 206] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 207] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 208] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 209] = "MetaProperty"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 209] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 210] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 210] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 211] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 211] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 212] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 213] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 214] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 215] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 216] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 217] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 218] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 219] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 220] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 221] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 222] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 223] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 224] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 225] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 226] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 227] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 228] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 229] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 230] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 231] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 232] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 233] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 234] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 235] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 236] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 237] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 238] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 239] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 240] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 241] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 242] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 243] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 244] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 245] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 246] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 247] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 248] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 249] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 250] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 251] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 212] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 213] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 214] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 215] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 216] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 217] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 218] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 219] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 220] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 221] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 222] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 223] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 224] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 225] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 226] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 227] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 228] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 229] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 230] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 231] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 232] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 233] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 234] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 235] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 236] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 237] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 238] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 239] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 240] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 241] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 242] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 243] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 244] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 245] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 246] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 247] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 248] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 249] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 250] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 251] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 252] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 252] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 253] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 253] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 254] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 255] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 256] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 257] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 258] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 259] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 260] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 261] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 262] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 263] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 254] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 255] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 256] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 257] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 258] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 259] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 260] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 261] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 262] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 263] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 264] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 264] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 265] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 266] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 267] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 265] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 266] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 267] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 268] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 268] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 269] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 270] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 269] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 270] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 271] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 271] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 272] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 272] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 273] = "Bundle"; + SyntaxKind[SyntaxKind["SourceFile"] = 273] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 274] = "Bundle"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 274] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 275] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 275] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 276] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 276] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 277] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 278] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 279] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 280] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 281] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 282] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 283] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocTag"] = 284] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 285] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 286] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 287] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 288] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 289] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 290] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 291] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 292] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 277] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 278] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 279] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 280] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 281] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 282] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 283] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 284] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocTag"] = 285] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 286] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 287] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 288] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 289] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 290] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 291] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 292] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 293] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 294] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 296] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 297] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 298] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 295] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 296] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 297] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 298] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 299] = "EndOfDeclarationMarker"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 299] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 300] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment"; @@ -389,7 +394,7 @@ var ts; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 108] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 116] = "LastFutureReservedWord"; SyntaxKind[SyntaxKind["FirstTypeNode"] = 160] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 177] = "LastTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 178] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 17] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 70] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; @@ -403,10 +408,10 @@ var ts; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 27] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 145] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 274] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 292] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 284] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 275] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 293] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 285] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 293] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword"; /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 144] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); @@ -501,11 +506,12 @@ var ts; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Loop"] = 2] = "Loop"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Unique"] = 3] = "Unique"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["Node"] = 4] = "Node"; - GeneratedIdentifierFlags[GeneratedIdentifierFlags["OptimisticUnique"] = 5] = "OptimisticUnique"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["KindMask"] = 7] = "KindMask"; // Flags GeneratedIdentifierFlags[GeneratedIdentifierFlags["SkipNameGenerationScope"] = 8] = "SkipNameGenerationScope"; GeneratedIdentifierFlags[GeneratedIdentifierFlags["ReservedInNestedScopes"] = 16] = "ReservedInNestedScopes"; + GeneratedIdentifierFlags[GeneratedIdentifierFlags["Optimistic"] = 32] = "Optimistic"; + GeneratedIdentifierFlags[GeneratedIdentifierFlags["FileLevel"] = 64] = "FileLevel"; })(GeneratedIdentifierFlags = ts.GeneratedIdentifierFlags || (ts.GeneratedIdentifierFlags = {})); /* @internal */ var TokenFlags; @@ -3028,7 +3034,7 @@ var ts; ts.compose = compose; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (_match, index) { return Debug.assertDefined(args[+index + baseIndex]); }); } ts.formatStringFromArgs = formatStringFromArgs; function getLocaleSpecificMessage(message) { @@ -4801,13 +4807,18 @@ var ts; */ function watchChildDirectories(parentDir, existingChildWatches, callback) { var newChildWatches; - ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? host.getAccessileSortedChildDirectories(parentDir) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(ts.getNormalizedAbsolutePath(child, parentDir), childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); + ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? ts.mapDefined(host.getAccessibleSortedChildDirectories(parentDir), function (child) { + var childFullName = ts.getNormalizedAbsolutePath(child, parentDir); + // Filter our the symbolic link directories since those arent included in recursive watch + // which is same behaviour when recursive: true is passed to fs.watch + return host.filePathComparer(childFullName, host.realpath(childFullName)) === 0 /* EqualTo */ ? childFullName : undefined; + }) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); return newChildWatches || ts.emptyArray; /** * Create new childDirectoryWatcher and add it to the new ChildDirectoryWatcher list */ function createAndAddChildDirectoryWatcher(childName) { - var result = createDirectoryWatcher(ts.getNormalizedAbsolutePath(childName, parentDir), callback); + var result = createDirectoryWatcher(childName, callback); addChildDirectoryWatcher(result); } /** @@ -4916,14 +4927,7 @@ var ts; exit: function (exitCode) { process.exit(exitCode); }, - realpath: function (path) { - try { - return _fs.realpathSync(path); - } - catch (_a) { - return path; - } - }, + realpath: realpath, debugMode: ts.some(process.execArgv, function (arg) { return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg); }), tryEnableSourceMapsForHost: function () { try { @@ -5009,8 +5013,9 @@ var ts; var watchDirectoryRecursively = createRecursiveDirectoryWatcher({ filePathComparer: useCaseSensitiveFileNames ? ts.compareStringsCaseSensitive : ts.compareStringsCaseInsensitive, directoryExists: directoryExists, - getAccessileSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, - watchDirectory: watchDirectory + getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, + watchDirectory: watchDirectory, + realpath: realpath }); return function (directoryName, callback, recursive) { if (recursive) { @@ -5312,6 +5317,14 @@ var ts; function getDirectories(path) { return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); }); } + function realpath(path) { + try { + return _fs.realpathSync(path); + } + catch (_a) { + return path; + } + } function getModifiedTime(path) { try { return _fs.statSync(path).mtime; @@ -5428,6 +5441,7 @@ var ts; Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), Unexpected_token: diag(1012, ts.DiagnosticCategory.Error, "Unexpected_token_1012", "Unexpected token."), + A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma: diag(1013, ts.DiagnosticCategory.Error, "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013", "A rest parameter or binding pattern may not have a trailing comma."), A_rest_parameter_must_be_last_in_a_parameter_list: diag(1014, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."), Parameter_cannot_have_question_mark_and_initializer: diag(1015, ts.DiagnosticCategory.Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."), A_required_parameter_cannot_follow_an_optional_parameter: diag(1016, ts.DiagnosticCategory.Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."), @@ -5659,6 +5673,9 @@ var ts; An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead: diag(1336, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead_1336", "An index signature parameter type cannot be a type alias. Consider writing '[{0}: {1}]: {2}' instead."), An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead: diag(1337, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead_1337", "An index signature parameter type cannot be a union type. Consider using a mapped object type instead."), infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."), + Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."), + Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340", "Module '{0}' does not refer to a type, but is used as a type here."), + Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."), Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."), Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."), @@ -5764,7 +5781,7 @@ var ts; The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."), The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: diag(2405, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."), The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: diag(2406, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."), - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter."), + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."), Setters_cannot_return_a_value: diag(2408, ts.DiagnosticCategory.Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."), Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: diag(2409, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."), The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: diag(2410, ts.DiagnosticCategory.Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."), @@ -5838,7 +5855,7 @@ var ts; The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: diag(2483, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."), Export_declaration_conflicts_with_exported_declaration_of_0: diag(2484, ts.DiagnosticCategory.Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."), The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: diag(2487, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."), - Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type must have a '[Symbol.iterator]()' method that returns an iterator."), + Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."), An_iterator_must_have_a_next_method: diag(2489, ts.DiagnosticCategory.Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."), The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: diag(2490, ts.DiagnosticCategory.Error, "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the 'next()' method of an iterator must have a 'value' property."), The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: diag(2491, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."), @@ -5854,7 +5871,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: diag(2501, ts.DiagnosticCategory.Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."), _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: diag(2502, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."), Cannot_find_namespace_0: diag(2503, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."), - Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), + Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), A_generator_cannot_have_a_void_type_annotation: diag(2505, ts.DiagnosticCategory.Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."), _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: diag(2506, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."), Type_0_is_not_a_constructor_function_type: diag(2507, ts.DiagnosticCategory.Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."), @@ -5918,6 +5935,8 @@ var ts; Property_0_is_used_before_being_assigned: diag(2565, ts.DiagnosticCategory.Error, "Property_0_is_used_before_being_assigned_2565", "Property '{0}' is used before being assigned."), A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."), Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."), + Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2568, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568", "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), + Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."), The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."), JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."), @@ -8485,7 +8504,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 272 /* SourceFile */) { + while (node && node.kind !== 273 /* SourceFile */) { node = node.parent; } return node; @@ -8493,11 +8512,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 211 /* Block */: - case 239 /* CaseBlock */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 212 /* Block */: + case 240 /* CaseBlock */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: return true; } return false; @@ -8541,6 +8560,14 @@ var ts; } } ts.getEndLinePosition = getEndLinePosition; + /** + * Returns a value indicating whether a name is unique globally or within the current file + */ + function isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) { + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name); + } + ts.isFileLevelUniqueName = isFileLevelUniqueName; // Returns true if this node is missing from the actual source code. A 'missing' node is different // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes // in the tree), it is definitely missing. However, a node may be defined, but still be @@ -8606,7 +8633,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 === 293 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 294 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -8720,7 +8747,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 230 /* VariableDeclaration */ && node.parent.kind === 267 /* CatchClause */; + return node.kind === 231 /* VariableDeclaration */ && node.parent.kind === 268 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -8742,11 +8769,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 === 237 /* ModuleDeclaration */ && (!node.body); + return node && node.kind === 238 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 272 /* SourceFile */ || - node.kind === 237 /* ModuleDeclaration */ || + return node.kind === 273 /* SourceFile */ || + node.kind === 238 /* ModuleDeclaration */ || ts.isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -8763,9 +8790,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 272 /* SourceFile */: + case 273 /* SourceFile */: return ts.isExternalModule(node.parent); - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -8777,22 +8804,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 272 /* SourceFile */: - case 239 /* CaseBlock */: - case 267 /* CatchClause */: - case 237 /* ModuleDeclaration */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 273 /* SourceFile */: + case 240 /* CaseBlock */: + case 268 /* CatchClause */: + case 238 /* ModuleDeclaration */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: case 154 /* Constructor */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; - case 211 /* Block */: + case 212 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return parentNode && !ts.isFunctionLike(parentNode); @@ -8808,19 +8835,19 @@ var ts; case 159 /* IndexSignature */: case 162 /* FunctionType */: case 163 /* ConstructorType */: - case 280 /* JSDocFunctionType */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 290 /* JSDocTemplateTag */: - case 232 /* FunctionDeclaration */: + case 281 /* JSDocFunctionType */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 291 /* JSDocTemplateTag */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; default: ts.assertTypeIsNever(node); @@ -8830,8 +8857,8 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isAnyImportSyntax(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: return true; default: return false; @@ -8885,7 +8912,7 @@ var ts; return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); case 145 /* QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -8932,7 +8959,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 211 /* Block */) { + if (node.body && node.body.kind === 212 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -8946,7 +8973,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* 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 @@ -8955,23 +8982,23 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: errorNode = node.name; break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -9000,7 +9027,7 @@ var ts; } ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isConstEnumDeclaration(node) { - return node.kind === 236 /* EnumDeclaration */ && isConst(node); + return node.kind === 237 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -9013,15 +9040,21 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 185 /* CallExpression */ && n.expression.kind === 97 /* SuperKeyword */; + return n.kind === 186 /* CallExpression */ && n.expression.kind === 97 /* SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 185 /* CallExpression */ && n.expression.kind === 91 /* ImportKeyword */; + return n.kind === 186 /* CallExpression */ && n.expression.kind === 91 /* ImportKeyword */; } ts.isImportCall = isImportCall; + function isLiteralImportTypeNode(n) { + return n.kind === 178 /* ImportType */ && + n.argument.kind === 177 /* LiteralType */ && + ts.isStringLiteral(n.argument.literal); + } + ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 214 /* ExpressionStatement */ + return node.kind === 215 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -9032,9 +9065,9 @@ var ts; function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 148 /* Parameter */ || node.kind === 147 /* TypeParameter */ || - node.kind === 190 /* FunctionExpression */ || - node.kind === 191 /* ArrowFunction */ || - node.kind === 189 /* ParenthesizedExpression */) ? + node.kind === 191 /* FunctionExpression */ || + node.kind === 192 /* ArrowFunction */ || + node.kind === 190 /* ParenthesizedExpression */) ? 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 '/**/' @@ -9050,7 +9083,7 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (160 /* FirstTypeNode */ <= node.kind && node.kind <= 177 /* LastTypeNode */) { + if (160 /* FirstTypeNode */ <= node.kind && node.kind <= 178 /* LastTypeNode */) { return true; } switch (node.kind) { @@ -9063,8 +9096,8 @@ var ts; case 131 /* NeverKeyword */: return true; case 105 /* VoidKeyword */: - return node.parent.kind !== 194 /* VoidExpression */; - case 205 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 195 /* VoidExpression */; + case 206 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 147 /* TypeParameter */: return node.parent.kind === 176 /* MappedType */ || node.parent.kind === 171 /* InferType */; @@ -9075,41 +9108,44 @@ var ts; if (node.parent.kind === 145 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 184 /* 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 === 71 /* Identifier */ || node.kind === 145 /* QualifiedName */ || node.kind === 183 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 71 /* Identifier */ || node.kind === 145 /* QualifiedName */ || node.kind === 184 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through case 145 /* QualifiedName */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 99 /* ThisKeyword */: var parent = node.parent; if (parent.kind === 164 /* TypeQuery */) { return false; } + if (parent.kind === 178 /* ImportType */) { + return !parent.isTypeOf; + } // Do not recursively call isPartOfTypeNode on the parent. In the example: // // let a: A.B.C; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (160 /* FirstTypeNode */ <= parent.kind && parent.kind <= 177 /* LastTypeNode */) { + if (160 /* FirstTypeNode */ <= parent.kind && parent.kind <= 178 /* LastTypeNode */) { return true; } switch (parent.kind) { - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 147 /* TypeParameter */: return node === parent.constraint; case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 148 /* Parameter */: - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return node === parent.type; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 154 /* Constructor */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: @@ -9120,12 +9156,12 @@ var ts; case 158 /* ConstructSignature */: case 159 /* IndexSignature */: return node === parent.type; - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return node === parent.type; - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: return ts.contains(parent.typeArguments, node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -9149,23 +9185,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitor(node); - case 239 /* CaseBlock */: - case 211 /* Block */: - case 215 /* IfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 224 /* WithStatement */: - case 225 /* SwitchStatement */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: - case 226 /* LabeledStatement */: - case 228 /* TryStatement */: - case 267 /* CatchClause */: + case 240 /* CaseBlock */: + case 212 /* Block */: + case 216 /* IfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 225 /* WithStatement */: + case 226 /* SwitchStatement */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: + case 227 /* LabeledStatement */: + case 229 /* TryStatement */: + case 268 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -9175,19 +9211,19 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 236 /* EnumDeclaration */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 237 /* EnumDeclaration */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. @@ -9230,12 +9266,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 234 /* InterfaceDeclaration */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: case 165 /* TypeLiteral */: return node.members; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return node.properties; } } @@ -9243,14 +9279,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 180 /* BindingElement */: - case 271 /* EnumMember */: + case 181 /* BindingElement */: + case 272 /* EnumMember */: case 148 /* Parameter */: - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 269 /* ShorthandPropertyAssignment */: - case 230 /* VariableDeclaration */: + case 270 /* ShorthandPropertyAssignment */: + case 231 /* VariableDeclaration */: return true; } } @@ -9262,8 +9298,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 231 /* VariableDeclarationList */ - && node.parent.parent.kind === 212 /* VariableStatement */; + return node.parent.kind === 232 /* VariableDeclarationList */ + && node.parent.parent.kind === 213 /* VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isValidESSymbolDeclaration(node) { @@ -9279,8 +9315,8 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return true; } return false; @@ -9291,7 +9327,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 226 /* LabeledStatement */) { + if (node.statement.kind !== 227 /* LabeledStatement */) { return node.statement; } node = node.statement; @@ -9299,17 +9335,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 211 /* Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 212 /* Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 153 /* MethodDeclaration */ && node.parent.kind === 182 /* ObjectLiteralExpression */; + return node && node.kind === 153 /* MethodDeclaration */ && node.parent.kind === 183 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { return node.kind === 153 /* MethodDeclaration */ && - (node.parent.kind === 182 /* ObjectLiteralExpression */ || - node.parent.kind === 203 /* ClassExpression */); + (node.parent.kind === 183 /* ObjectLiteralExpression */ || + node.parent.kind === 204 /* ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -9322,7 +9358,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 268 /* PropertyAssignment */) { + if (property.kind === 269 /* PropertyAssignment */) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -9372,14 +9408,14 @@ var ts; node = node.parent; } break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 237 /* ModuleDeclaration */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 238 /* ModuleDeclaration */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 153 /* MethodDeclaration */: @@ -9390,8 +9426,8 @@ var ts; case 157 /* CallSignature */: case 158 /* ConstructSignature */: case 159 /* IndexSignature */: - case 236 /* EnumDeclaration */: - case 272 /* SourceFile */: + case 237 /* EnumDeclaration */: + case 273 /* SourceFile */: return node; } } @@ -9402,8 +9438,8 @@ var ts; if (container) { switch (container.kind) { case 154 /* Constructor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return container; } } @@ -9428,9 +9464,9 @@ var ts; case 146 /* ComputedPropertyName */: node = node.parent; break; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: if (!stopOnFunctions) { continue; } @@ -9461,14 +9497,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 190 /* FunctionExpression */ || func.kind === 191 /* ArrowFunction */) { + if (func.kind === 191 /* FunctionExpression */ || func.kind === 192 /* ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 189 /* ParenthesizedExpression */) { + while (parent.kind === 190 /* ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 185 /* CallExpression */ && parent.expression === prev) { + if (parent.kind === 186 /* CallExpression */ && parent.expression === prev) { return parent; } } @@ -9479,7 +9515,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 183 /* PropertyAccessExpression */ || kind === 184 /* ElementAccessExpression */) + return (kind === 184 /* PropertyAccessExpression */ || kind === 185 /* ElementAccessExpression */) && node.expression.kind === 97 /* SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -9488,7 +9524,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 183 /* PropertyAccessExpression */ || kind === 184 /* ElementAccessExpression */) + return (kind === 184 /* PropertyAccessExpression */ || kind === 185 /* ElementAccessExpression */) && node.expression.kind === 99 /* ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -9496,7 +9532,7 @@ var ts; switch (node.kind) { case 161 /* TypeReference */: return node.typeName; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; @@ -9509,10 +9545,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return node.tag; - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -9521,25 +9557,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node, parent, grandparent) { switch (node.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: // classes are valid targets return true; case 151 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 233 /* ClassDeclaration */; + return parent.kind === 234 /* ClassDeclaration */; case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 153 /* 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 === 233 /* ClassDeclaration */; + && parent.kind === 234 /* ClassDeclaration */; case 148 /* 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 === 154 /* Constructor */ || parent.kind === 153 /* MethodDeclaration */ || parent.kind === 156 /* SetAccessor */) - && grandparent.kind === 233 /* ClassDeclaration */; + && grandparent.kind === 234 /* ClassDeclaration */; } return false; } @@ -9555,7 +9591,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return ts.forEach(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); case 153 /* MethodDeclaration */: case 156 /* SetAccessor */: @@ -9565,9 +9601,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 255 /* JsxOpeningElement */ || - parent.kind === 254 /* JsxSelfClosingElement */ || - parent.kind === 256 /* JsxClosingElement */) { + if (parent.kind === 256 /* JsxOpeningElement */ || + parent.kind === 255 /* JsxSelfClosingElement */ || + parent.kind === 257 /* JsxClosingElement */) { return parent.tagName === node; } return false; @@ -9580,37 +9616,37 @@ var ts; case 101 /* TrueKeyword */: case 86 /* FalseKeyword */: case 12 /* RegularExpressionLiteral */: - case 181 /* ArrayLiteralExpression */: - case 182 /* ObjectLiteralExpression */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 187 /* TaggedTemplateExpression */: - case 206 /* AsExpression */: - case 188 /* TypeAssertionExpression */: - case 207 /* NonNullExpression */: - case 189 /* ParenthesizedExpression */: - case 190 /* FunctionExpression */: - case 203 /* ClassExpression */: - case 191 /* ArrowFunction */: - case 194 /* VoidExpression */: - case 192 /* DeleteExpression */: - case 193 /* TypeOfExpression */: - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: - case 198 /* BinaryExpression */: - case 199 /* ConditionalExpression */: - case 202 /* SpreadElement */: - case 200 /* TemplateExpression */: + case 182 /* ArrayLiteralExpression */: + case 183 /* ObjectLiteralExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 188 /* TaggedTemplateExpression */: + case 207 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 208 /* NonNullExpression */: + case 190 /* ParenthesizedExpression */: + case 191 /* FunctionExpression */: + case 204 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 195 /* VoidExpression */: + case 193 /* DeleteExpression */: + case 194 /* TypeOfExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 199 /* BinaryExpression */: + case 200 /* ConditionalExpression */: + case 203 /* SpreadElement */: + case 201 /* TemplateExpression */: case 13 /* NoSubstitutionTemplateLiteral */: - case 204 /* OmittedExpression */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 257 /* JsxFragment */: - case 201 /* YieldExpression */: - case 195 /* AwaitExpression */: - case 208 /* MetaProperty */: + case 205 /* OmittedExpression */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 258 /* JsxFragment */: + case 202 /* YieldExpression */: + case 196 /* AwaitExpression */: + case 209 /* MetaProperty */: return true; case 145 /* QualifiedName */: while (node.parent.kind === 145 /* QualifiedName */) { @@ -9634,47 +9670,47 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 271 /* EnumMember */: - case 268 /* PropertyAssignment */: - case 180 /* BindingElement */: + case 272 /* EnumMember */: + case 269 /* PropertyAssignment */: + case 181 /* BindingElement */: return parent.initializer === node; - case 214 /* ExpressionStatement */: - case 215 /* IfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 223 /* ReturnStatement */: - case 224 /* WithStatement */: - case 225 /* SwitchStatement */: - case 264 /* CaseClause */: - case 227 /* ThrowStatement */: + case 215 /* ExpressionStatement */: + case 216 /* IfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 224 /* ReturnStatement */: + case 225 /* WithStatement */: + case 226 /* SwitchStatement */: + case 265 /* CaseClause */: + case 228 /* ThrowStatement */: return parent.expression === node; - case 218 /* ForStatement */: + case 219 /* ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 231 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 232 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 231 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 232 /* VariableDeclarationList */) || forInStatement.expression === node; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: return node === parent.expression; - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return node === parent.expression; case 146 /* ComputedPropertyName */: return node === parent.expression; case 149 /* Decorator */: - case 263 /* JsxExpression */: - case 262 /* JsxSpreadAttribute */: - case 270 /* SpreadAssignment */: + case 264 /* JsxExpression */: + case 263 /* JsxSpreadAttribute */: + case 271 /* SpreadAssignment */: return true; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: return isExpressionNode(parent); @@ -9682,7 +9718,7 @@ var ts; } ts.isInExpressionContext = isInExpressionContext; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 252 /* ExternalModuleReference */; + return node.kind === 242 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 253 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -9691,7 +9727,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 252 /* ExternalModuleReference */; + return node.kind === 242 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 253 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -9719,7 +9755,7 @@ var ts; } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) { - if (callExpression.kind !== 185 /* CallExpression */) { + if (callExpression.kind !== 186 /* CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -9790,9 +9826,11 @@ var ts; function getJavascriptInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 190 /* FunctionExpression */ || e.kind === 191 /* ArrowFunction */ ? initializer : undefined; + return e.kind === 191 /* FunctionExpression */ || e.kind === 192 /* ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 190 /* FunctionExpression */ || initializer.kind === 203 /* ClassExpression */) { + if (initializer.kind === 191 /* FunctionExpression */ || + initializer.kind === 204 /* ClassExpression */ || + initializer.kind === 192 /* ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -9885,7 +9923,7 @@ var ts; return 2 /* ModuleExports */; } else if (isEntityNameExpression(lhs.expression)) { - if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(expr.right)) { + if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) { // F.prototype = { ... } return 6 /* Prototype */; } @@ -9910,24 +9948,31 @@ var ts; return 0 /* None */; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; + function getInitializerOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.right)) { + expr = expr.right; + } + return expr.right; + } + ts.getInitializerOfBinaryExpression = getInitializerOfBinaryExpression; function isPrototypePropertyAssignment(node) { return ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === 3 /* PrototypeProperty */; } ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJavaScriptFile(expr) && - expr.parent && expr.parent.kind === 214 /* ExpressionStatement */ && + expr.parent && expr.parent.kind === 215 /* ExpressionStatement */ && !!ts.getJSDocTypeTag(expr.parent); } ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration; function importFromModuleSpecifier(node) { switch (node.parent.kind) { - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return node.parent; - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return node.parent.parent; - case 185 /* CallExpression */: + case 186 /* CallExpression */: return node.parent; default: return ts.Debug.fail(ts.Debug.showSyntaxKind(node)); @@ -9936,11 +9981,13 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return node.moduleSpecifier; - case 241 /* ImportEqualsDeclaration */: - return node.moduleReference.kind === 252 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 242 /* ImportEqualsDeclaration */: + return node.moduleReference.kind === 253 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 178 /* ImportType */: + return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; default: return ts.Debug.assertNever(node); } @@ -9948,11 +9995,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return node; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return undefined; default: return ts.Debug.assertNever(node); @@ -9960,7 +10007,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 242 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 243 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function hasQuestionToken(node) { @@ -9969,8 +10016,8 @@ var ts; case 148 /* Parameter */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: - case 269 /* ShorthandPropertyAssignment */: - case 268 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return node.questionToken !== undefined; @@ -9980,7 +10027,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 280 /* JSDocFunctionType */ && + return node.kind === 281 /* JSDocFunctionType */ && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -10002,7 +10049,7 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; case 151 /* PropertyDeclaration */: @@ -10015,9 +10062,9 @@ var ts; node.declarationList.declarations[0]; } function getNestedModuleDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */ && + return node.kind === 238 /* ModuleDeclaration */ && node.body && - node.body.kind === 237 /* ModuleDeclaration */ && + node.body.kind === 238 /* ModuleDeclaration */ && node.body; } function getJSDocCommentsAndTags(node) { @@ -10026,7 +10073,10 @@ var ts; return result || ts.emptyArray; function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; - if (parent && (parent.kind === 268 /* PropertyAssignment */ || parent.kind === 151 /* PropertyDeclaration */ || getNestedModuleDeclaration(parent))) { + if (parent && + (parent.kind === 269 /* PropertyAssignment */ || + parent.kind === 151 /* PropertyDeclaration */ || + getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement. @@ -10044,7 +10094,8 @@ var ts; getJSDocCommentsAndTagsWorker(parent.parent.parent); } if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 /* None */ || - node.kind === 183 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 214 /* ExpressionStatement */) { + parent && ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 /* None */ || + node.kind === 184 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 215 /* ExpressionStatement */) { getJSDocCommentsAndTagsWorker(parent); } // Pull parameter comments from declaring function as well @@ -10089,7 +10140,7 @@ var ts; } ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 282 /* JSDocComment */); + ts.Debug.assert(node.parent.kind === 283 /* JSDocComment */); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -10105,7 +10156,7 @@ var ts; } ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { - return node.dotDotDotToken !== undefined || node.type && node.type.kind === 281 /* JSDocVariadicType */; + return node.dotDotDotToken !== undefined || node.type && node.type.kind === 282 /* JSDocVariadicType */; } ts.isRestParameter = isRestParameter; var AssignmentKind; @@ -10118,31 +10169,31 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 58 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 43 /* PlusPlusToken */ || unaryOperator === 44 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; - case 189 /* ParenthesizedExpression */: - case 181 /* ArrayLiteralExpression */: - case 202 /* SpreadElement */: - case 207 /* NonNullExpression */: + case 190 /* ParenthesizedExpression */: + case 182 /* ArrayLiteralExpression */: + case 203 /* SpreadElement */: + case 208 /* NonNullExpression */: node = parent; break; - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } node = parent.parent; break; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: if (parent.name === node) { return 0 /* None */; } @@ -10169,22 +10220,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 211 /* Block */: - case 212 /* VariableStatement */: - case 224 /* WithStatement */: - case 215 /* IfStatement */: - case 225 /* SwitchStatement */: - case 239 /* CaseBlock */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: - case 226 /* LabeledStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 228 /* TryStatement */: - case 267 /* CatchClause */: + case 212 /* Block */: + case 213 /* VariableStatement */: + case 225 /* WithStatement */: + case 216 /* IfStatement */: + case 226 /* SwitchStatement */: + case 240 /* CaseBlock */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: + case 227 /* LabeledStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 229 /* TryStatement */: + case 268 /* CatchClause */: return true; } return false; @@ -10205,11 +10256,11 @@ var ts; } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 189 /* ParenthesizedExpression */); + return walkUp(node, 190 /* ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; function skipParentheses(node) { - while (node.kind === 189 /* ParenthesizedExpression */) { + while (node.kind === 190 /* ParenthesizedExpression */) { node = node.expression; } return node; @@ -10217,11 +10268,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 !== 183 /* PropertyAccessExpression */ && node.kind !== 184 /* ElementAccessExpression */) { + if (node.kind !== 184 /* PropertyAccessExpression */ && node.kind !== 185 /* ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 192 /* DeleteExpression */; + return node && node.kind === 193 /* DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -10270,26 +10321,26 @@ var ts; case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 271 /* EnumMember */: - case 268 /* PropertyAssignment */: - case 183 /* PropertyAccessExpression */: + case 272 /* EnumMember */: + case 269 /* PropertyAssignment */: + case 184 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; case 145 /* QualifiedName */: - // Name on right hand side of dot in a type query + // Name on right hand side of dot in a type query or type reference if (parent.right === node) { while (parent.kind === 145 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 164 /* TypeQuery */; + return parent.kind === 164 /* TypeQuery */ || parent.kind === 161 /* TypeReference */; } return false; - case 180 /* BindingElement */: - case 246 /* ImportSpecifier */: + case 181 /* BindingElement */: + case 247 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 250 /* ExportSpecifier */: - case 260 /* JsxAttribute */: + case 251 /* ExportSpecifier */: + case 261 /* JsxAttribute */: // Any name in an export specifier or JSX Attribute return true; } @@ -10305,13 +10356,13 @@ var ts; // export = // export default function isAliasSymbolDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */ || - node.kind === 240 /* NamespaceExportDeclaration */ || - node.kind === 243 /* ImportClause */ && !!node.name || - node.kind === 244 /* NamespaceImport */ || - node.kind === 246 /* ImportSpecifier */ || - node.kind === 250 /* ExportSpecifier */ || - node.kind === 247 /* ExportAssignment */ && exportAssignmentIsAlias(node); + return node.kind === 242 /* ImportEqualsDeclaration */ || + node.kind === 241 /* NamespaceExportDeclaration */ || + node.kind === 244 /* ImportClause */ && !!node.name || + node.kind === 245 /* NamespaceImport */ || + node.kind === 247 /* ImportSpecifier */ || + node.kind === 251 /* ExportSpecifier */ || + node.kind === 248 /* ExportAssignment */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -10404,14 +10455,14 @@ var ts; } var flags = 0 /* Normal */; switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* Generator */; } // falls through - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (hasModifier(node, 256 /* Async */)) { flags |= 2 /* Async */; } @@ -10425,9 +10476,9 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined @@ -10533,7 +10584,7 @@ var ts; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 180 /* BindingElement */) { + while (node.kind === 181 /* BindingElement */) { node = node.parent.parent; } return node; @@ -10542,14 +10593,14 @@ var ts; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; return kind === 154 /* Constructor */ - || kind === 190 /* FunctionExpression */ - || kind === 232 /* FunctionDeclaration */ - || kind === 191 /* ArrowFunction */ + || kind === 191 /* FunctionExpression */ + || kind === 233 /* FunctionDeclaration */ + || kind === 192 /* ArrowFunction */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ || kind === 156 /* SetAccessor */ - || kind === 237 /* ModuleDeclaration */ - || kind === 272 /* SourceFile */; + || kind === 238 /* ModuleDeclaration */ + || kind === 273 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -10568,23 +10619,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 /* NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 186 /* NewExpression */: + case 187 /* NewExpression */: return hasArguments ? 0 /* Left */ : 1 /* Right */; - case 196 /* PrefixUnaryExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 192 /* DeleteExpression */: - case 195 /* AwaitExpression */: - case 199 /* ConditionalExpression */: - case 201 /* YieldExpression */: + case 197 /* PrefixUnaryExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 193 /* DeleteExpression */: + case 196 /* AwaitExpression */: + case 200 /* ConditionalExpression */: + case 202 /* YieldExpression */: return 1 /* Right */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (operator) { case 40 /* AsteriskAsteriskToken */: case 58 /* EqualsToken */: @@ -10608,15 +10659,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 /* NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 198 /* BinaryExpression */) { + if (expression.kind === 199 /* BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 196 /* PrefixUnaryExpression */ || expression.kind === 197 /* PostfixUnaryExpression */) { + else if (expression.kind === 197 /* PrefixUnaryExpression */ || expression.kind === 198 /* PostfixUnaryExpression */) { return expression.operator; } else { @@ -10626,15 +10677,15 @@ var ts; ts.getOperator = getOperator; function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return 0; - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return 1; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return 2; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return 4; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (operatorKind) { case 26 /* CommaToken */: return 0; @@ -10655,21 +10706,21 @@ var ts; default: return getBinaryOperatorPrecedence(operatorKind); } - case 196 /* PrefixUnaryExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 192 /* DeleteExpression */: - case 195 /* AwaitExpression */: + case 197 /* PrefixUnaryExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 193 /* DeleteExpression */: + case 196 /* AwaitExpression */: return 16; - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return 17; - case 185 /* CallExpression */: + case 186 /* CallExpression */: return 18; - case 186 /* NewExpression */: + case 187 /* NewExpression */: return hasArguments ? 19 : 18; - case 187 /* TaggedTemplateExpression */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 188 /* TaggedTemplateExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: return 19; case 99 /* ThisKeyword */: case 97 /* SuperKeyword */: @@ -10679,19 +10730,19 @@ var ts; case 86 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - case 181 /* ArrayLiteralExpression */: - case 182 /* ObjectLiteralExpression */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 203 /* ClassExpression */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 257 /* JsxFragment */: + case 182 /* ArrayLiteralExpression */: + case 183 /* ObjectLiteralExpression */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 204 /* ClassExpression */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 258 /* JsxFragment */: case 12 /* RegularExpressionLiteral */: case 13 /* NoSubstitutionTemplateLiteral */: - case 200 /* TemplateExpression */: - case 189 /* ParenthesizedExpression */: - case 204 /* OmittedExpression */: + case 201 /* TemplateExpression */: + case 190 /* ParenthesizedExpression */: + case 205 /* OmittedExpression */: return 20; default: return -1; @@ -10748,17 +10799,12 @@ var ts; var filesWithDiagnostics = []; var fileDiagnostics = ts.createMap(); var hasReadNonFileDiagnostics = false; - var modificationCount = 0; return { add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount, reattachFileDiagnostics: reattachFileDiagnostics }; - function getModificationCount() { - return modificationCount; - } function reattachFileDiagnostics(newFile) { ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } @@ -10781,7 +10827,6 @@ var ts; diagnostics = nonFileDiagnostics; } ts.insertSorted(diagnostics, diagnostic, ts.compareDiagnostics); - modificationCount++; } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -11449,7 +11494,7 @@ var ts; ts.isAssignmentOperator = isAssignmentOperator; /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */ function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 205 /* ExpressionWithTypeArguments */ && + if (node.kind === 206 /* ExpressionWithTypeArguments */ && node.parent.token === 85 /* ExtendsKeyword */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; @@ -11467,8 +11512,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 182 /* ObjectLiteralExpression */ - || kind === 181 /* ArrayLiteralExpression */; + return kind === 183 /* ObjectLiteralExpression */ + || kind === 182 /* ArrayLiteralExpression */; } return false; } @@ -11478,7 +11523,7 @@ var ts; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isExpressionWithTypeArgumentsInClassImplementsClause(node) { - return node.kind === 205 /* ExpressionWithTypeArguments */ + return node.kind === 206 /* ExpressionWithTypeArguments */ && isEntityNameExpression(node.expression) && node.parent && node.parent.token === 108 /* ImplementsKeyword */ @@ -11500,16 +11545,16 @@ var ts; ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { return (node.parent.kind === 145 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node); + (node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteral(expression) { - return expression.kind === 182 /* ObjectLiteralExpression */ && + return expression.kind === 183 /* ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 181 /* ArrayLiteralExpression */ && + return expression.kind === 182 /* ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -11850,8 +11895,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 236 /* EnumDeclaration */: - case 237 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -11924,21 +11969,21 @@ var ts; if (!parent) return 0 /* Read */; switch (parent.kind) { - case 197 /* PostfixUnaryExpression */: - case 196 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: var operator = parent.operator; return operator === 43 /* PlusPlusToken */ || operator === 44 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? writeOrReadWrite() : 0 /* Read */; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return parent.name !== node ? 0 /* Read */ : accessKind(parent); default: return 0 /* 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 && parent.parent.kind === 214 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */; + return parent.parent && parent.parent.kind === 215 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */; } } function compareDataObjects(dst, src) { @@ -12302,7 +12347,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 147 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 234 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 235 /* InterfaceDeclaration */) { return current; } } @@ -12328,7 +12373,7 @@ var ts; } ts.isEmptyBindingElement = isEmptyBindingElement; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 180 /* BindingElement */ || ts.isBindingPattern(node))) { + while (node && (node.kind === 181 /* BindingElement */ || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -12336,14 +12381,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 230 /* VariableDeclaration */) { + if (node.kind === 231 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 231 /* VariableDeclarationList */) { + if (node && node.kind === 232 /* VariableDeclarationList */) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 212 /* VariableStatement */) { + if (node && node.kind === 213 /* VariableStatement */) { flags |= ts.getModifierFlags(node); } return flags; @@ -12359,14 +12404,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 230 /* VariableDeclaration */) { + if (node.kind === 231 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 231 /* VariableDeclarationList */) { + if (node && node.kind === 232 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 212 /* VariableStatement */) { + if (node && node.kind === 213 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -12503,17 +12548,17 @@ var ts; } // Covers remaining cases switch (hostNode.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } return undefined; - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: var expr = hostNode.expression; switch (expr.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return expr.name; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; @@ -12522,10 +12567,10 @@ var ts; return undefined; case 1 /* EndOfFileToken */: return undefined; - case 189 /* ParenthesizedExpression */: { + case 190 /* ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 226 /* LabeledStatement */: { + case 227 /* LabeledStatement */: { if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -12555,15 +12600,15 @@ var ts; switch (declaration.kind) { case 71 /* Identifier */: return declaration; - case 292 /* JSDocPropertyTag */: - case 287 /* JSDocParameterTag */: { + case 293 /* JSDocPropertyTag */: + case 288 /* JSDocParameterTag */: { var name = declaration.name; if (name.kind === 145 /* QualifiedName */) { return name.right; } break; } - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var expr = declaration; switch (ts.getSpecialPropertyAssignmentKind(expr)) { case 1 /* ExportsProperty */: @@ -12575,9 +12620,9 @@ var ts; return undefined; } } - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 247 /* ExportAssignment */: { + case 248 /* ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } @@ -12875,484 +12920,484 @@ var ts; ts.isLiteralTypeNode = isLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 178 /* ObjectBindingPattern */; + return node.kind === 179 /* ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 179 /* ArrayBindingPattern */; + return node.kind === 180 /* ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 180 /* BindingElement */; + return node.kind === 181 /* BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 181 /* ArrayLiteralExpression */; + return node.kind === 182 /* ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 182 /* ObjectLiteralExpression */; + return node.kind === 183 /* ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 183 /* PropertyAccessExpression */; + return node.kind === 184 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 184 /* ElementAccessExpression */; + return node.kind === 185 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 185 /* CallExpression */; + return node.kind === 186 /* CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 186 /* NewExpression */; + return node.kind === 187 /* NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 187 /* TaggedTemplateExpression */; + return node.kind === 188 /* TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertion(node) { - return node.kind === 188 /* TypeAssertionExpression */; + return node.kind === 189 /* TypeAssertionExpression */; } ts.isTypeAssertion = isTypeAssertion; function isParenthesizedExpression(node) { - return node.kind === 189 /* ParenthesizedExpression */; + return node.kind === 190 /* ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295 /* PartiallyEmittedExpression */) { + while (node.kind === 296 /* PartiallyEmittedExpression */) { node = node.expression; } return node; } ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; function isFunctionExpression(node) { - return node.kind === 190 /* FunctionExpression */; + return node.kind === 191 /* FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 191 /* ArrowFunction */; + return node.kind === 192 /* ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 192 /* DeleteExpression */; + return node.kind === 193 /* DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 193 /* TypeOfExpression */; + return node.kind === 194 /* TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 194 /* VoidExpression */; + return node.kind === 195 /* VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 195 /* AwaitExpression */; + return node.kind === 196 /* AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 196 /* PrefixUnaryExpression */; + return node.kind === 197 /* PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 197 /* PostfixUnaryExpression */; + return node.kind === 198 /* PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 198 /* BinaryExpression */; + return node.kind === 199 /* BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 199 /* ConditionalExpression */; + return node.kind === 200 /* ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 200 /* TemplateExpression */; + return node.kind === 201 /* TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 201 /* YieldExpression */; + return node.kind === 202 /* YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 202 /* SpreadElement */; + return node.kind === 203 /* SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 203 /* ClassExpression */; + return node.kind === 204 /* ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 204 /* OmittedExpression */; + return node.kind === 205 /* OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 205 /* ExpressionWithTypeArguments */; + return node.kind === 206 /* ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 206 /* AsExpression */; + return node.kind === 207 /* AsExpression */; } ts.isAsExpression = isAsExpression; function isNonNullExpression(node) { - return node.kind === 207 /* NonNullExpression */; + return node.kind === 208 /* NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 208 /* MetaProperty */; + return node.kind === 209 /* MetaProperty */; } ts.isMetaProperty = isMetaProperty; // Misc function isTemplateSpan(node) { - return node.kind === 209 /* TemplateSpan */; + return node.kind === 210 /* TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 210 /* SemicolonClassElement */; + return node.kind === 211 /* SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Block function isBlock(node) { - return node.kind === 211 /* Block */; + return node.kind === 212 /* Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 212 /* VariableStatement */; + return node.kind === 213 /* VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 213 /* EmptyStatement */; + return node.kind === 214 /* EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 214 /* ExpressionStatement */; + return node.kind === 215 /* ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 215 /* IfStatement */; + return node.kind === 216 /* IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 216 /* DoStatement */; + return node.kind === 217 /* DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 217 /* WhileStatement */; + return node.kind === 218 /* WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 218 /* ForStatement */; + return node.kind === 219 /* ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 219 /* ForInStatement */; + return node.kind === 220 /* ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 220 /* ForOfStatement */; + return node.kind === 221 /* ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 221 /* ContinueStatement */; + return node.kind === 222 /* ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 222 /* BreakStatement */; + return node.kind === 223 /* BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isBreakOrContinueStatement(node) { - return node.kind === 222 /* BreakStatement */ || node.kind === 221 /* ContinueStatement */; + return node.kind === 223 /* BreakStatement */ || node.kind === 222 /* ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isReturnStatement(node) { - return node.kind === 223 /* ReturnStatement */; + return node.kind === 224 /* ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 224 /* WithStatement */; + return node.kind === 225 /* WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 225 /* SwitchStatement */; + return node.kind === 226 /* SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 226 /* LabeledStatement */; + return node.kind === 227 /* LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 227 /* ThrowStatement */; + return node.kind === 228 /* ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 228 /* TryStatement */; + return node.kind === 229 /* TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 229 /* DebuggerStatement */; + return node.kind === 230 /* DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 230 /* VariableDeclaration */; + return node.kind === 231 /* VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 231 /* VariableDeclarationList */; + return node.kind === 232 /* VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 232 /* FunctionDeclaration */; + return node.kind === 233 /* FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 233 /* ClassDeclaration */; + return node.kind === 234 /* ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 234 /* InterfaceDeclaration */; + return node.kind === 235 /* InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 235 /* TypeAliasDeclaration */; + return node.kind === 236 /* TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 236 /* EnumDeclaration */; + return node.kind === 237 /* EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */; + return node.kind === 238 /* ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 238 /* ModuleBlock */; + return node.kind === 239 /* ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 239 /* CaseBlock */; + return node.kind === 240 /* CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 240 /* NamespaceExportDeclaration */; + return node.kind === 241 /* NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 241 /* ImportEqualsDeclaration */; + return node.kind === 242 /* ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 242 /* ImportDeclaration */; + return node.kind === 243 /* ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 243 /* ImportClause */; + return node.kind === 244 /* ImportClause */; } ts.isImportClause = isImportClause; function isNamespaceImport(node) { - return node.kind === 244 /* NamespaceImport */; + return node.kind === 245 /* NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamedImports(node) { - return node.kind === 245 /* NamedImports */; + return node.kind === 246 /* NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 246 /* ImportSpecifier */; + return node.kind === 247 /* ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 247 /* ExportAssignment */; + return node.kind === 248 /* ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 248 /* ExportDeclaration */; + return node.kind === 249 /* ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 249 /* NamedExports */; + return node.kind === 250 /* NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 250 /* ExportSpecifier */; + return node.kind === 251 /* ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 251 /* MissingDeclaration */; + return node.kind === 252 /* MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; // Module References function isExternalModuleReference(node) { - return node.kind === 252 /* ExternalModuleReference */; + return node.kind === 253 /* ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 253 /* JsxElement */; + return node.kind === 254 /* JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 254 /* JsxSelfClosingElement */; + return node.kind === 255 /* JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 255 /* JsxOpeningElement */; + return node.kind === 256 /* JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 256 /* JsxClosingElement */; + return node.kind === 257 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 257 /* JsxFragment */; + return node.kind === 258 /* JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 258 /* JsxOpeningFragment */; + return node.kind === 259 /* JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 259 /* JsxClosingFragment */; + return node.kind === 260 /* JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 260 /* JsxAttribute */; + return node.kind === 261 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 261 /* JsxAttributes */; + return node.kind === 262 /* JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 262 /* JsxSpreadAttribute */; + return node.kind === 263 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 263 /* JsxExpression */; + return node.kind === 264 /* JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 264 /* CaseClause */; + return node.kind === 265 /* CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 265 /* DefaultClause */; + return node.kind === 266 /* DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 266 /* HeritageClause */; + return node.kind === 267 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 267 /* CatchClause */; + return node.kind === 268 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 268 /* PropertyAssignment */; + return node.kind === 269 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 269 /* ShorthandPropertyAssignment */; + return node.kind === 270 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 270 /* SpreadAssignment */; + return node.kind === 271 /* SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 271 /* EnumMember */; + return node.kind === 272 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 272 /* SourceFile */; + return node.kind === 273 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 273 /* Bundle */; + return node.kind === 274 /* Bundle */; } ts.isBundle = isBundle; // JSDoc function isJSDocTypeExpression(node) { - return node.kind === 274 /* JSDocTypeExpression */; + return node.kind === 275 /* JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 275 /* JSDocAllType */; + return node.kind === 276 /* JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 276 /* JSDocUnknownType */; + return node.kind === 277 /* JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 277 /* JSDocNullableType */; + return node.kind === 278 /* JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 278 /* JSDocNonNullableType */; + return node.kind === 279 /* JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 279 /* JSDocOptionalType */; + return node.kind === 280 /* JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 280 /* JSDocFunctionType */; + return node.kind === 281 /* JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 281 /* JSDocVariadicType */; + return node.kind === 282 /* JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 282 /* JSDocComment */; + return node.kind === 283 /* JSDocComment */; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 285 /* JSDocAugmentsTag */; + return node.kind === 286 /* JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocClassTag(node) { - return node.kind === 286 /* JSDocClassTag */; + return node.kind === 287 /* JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocParameterTag(node) { - return node.kind === 287 /* JSDocParameterTag */; + return node.kind === 288 /* JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 288 /* JSDocReturnTag */; + return node.kind === 289 /* JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 289 /* JSDocTypeTag */; + return node.kind === 290 /* JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 290 /* JSDocTemplateTag */; + return node.kind === 291 /* JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 291 /* JSDocTypedefTag */; + return node.kind === 292 /* JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 292 /* JSDocPropertyTag */; + return node.kind === 293 /* JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 292 /* JSDocPropertyTag */ || node.kind === 287 /* JSDocParameterTag */; + return node.kind === 293 /* JSDocPropertyTag */ || node.kind === 288 /* JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 283 /* JSDocTypeLiteral */; + return node.kind === 284 /* JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); @@ -13363,7 +13408,7 @@ var ts; (function (ts) { /* @internal */ function isSyntaxList(n) { - return n.kind === 293 /* SyntaxList */; + return n.kind === 294 /* SyntaxList */; } ts.isSyntaxList = isSyntaxList; /* @internal */ @@ -13475,8 +13520,8 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 71 /* Identifier */ - || kind === 178 /* ObjectBindingPattern */ - || kind === 179 /* ArrayBindingPattern */; + || kind === 179 /* ObjectBindingPattern */ + || kind === 180 /* ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13491,13 +13536,13 @@ var ts; ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; default: return false; @@ -13511,7 +13556,7 @@ var ts; case 158 /* ConstructSignature */: case 159 /* IndexSignature */: case 162 /* FunctionType */: - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: case 163 /* ConstructorType */: return true; default: @@ -13533,12 +13578,12 @@ var ts; || kind === 155 /* GetAccessor */ || kind === 156 /* SetAccessor */ || kind === 159 /* IndexSignature */ - || kind === 210 /* SemicolonClassElement */ - || kind === 251 /* MissingDeclaration */; + || kind === 211 /* SemicolonClassElement */ + || kind === 252 /* MissingDeclaration */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 233 /* ClassDeclaration */ || node.kind === 203 /* ClassExpression */); + return node && (node.kind === 234 /* ClassDeclaration */ || node.kind === 204 /* ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { @@ -13565,23 +13610,23 @@ var ts; || kind === 150 /* PropertySignature */ || kind === 152 /* MethodSignature */ || kind === 159 /* IndexSignature */ - || kind === 251 /* MissingDeclaration */; + || kind === 252 /* MissingDeclaration */; } ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 268 /* PropertyAssignment */ - || kind === 269 /* ShorthandPropertyAssignment */ - || kind === 270 /* SpreadAssignment */ + return kind === 269 /* PropertyAssignment */ + || kind === 270 /* ShorthandPropertyAssignment */ + || kind === 271 /* SpreadAssignment */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ || kind === 156 /* SetAccessor */ - || kind === 251 /* MissingDeclaration */; + || kind === 252 /* MissingDeclaration */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type function isTypeNodeKind(kind) { - return (kind >= 160 /* FirstTypeNode */ && kind <= 177 /* LastTypeNode */) + return (kind >= 160 /* FirstTypeNode */ && kind <= 178 /* LastTypeNode */) || kind === 119 /* AnyKeyword */ || kind === 134 /* NumberKeyword */ || kind === 135 /* ObjectKeyword */ @@ -13593,14 +13638,14 @@ var ts; || kind === 140 /* UndefinedKeyword */ || kind === 95 /* NullKeyword */ || kind === 131 /* NeverKeyword */ - || kind === 205 /* ExpressionWithTypeArguments */ - || kind === 275 /* JSDocAllType */ - || kind === 276 /* JSDocUnknownType */ - || kind === 277 /* JSDocNullableType */ - || kind === 278 /* JSDocNonNullableType */ - || kind === 279 /* JSDocOptionalType */ - || kind === 280 /* JSDocFunctionType */ - || kind === 281 /* JSDocVariadicType */; + || kind === 206 /* ExpressionWithTypeArguments */ + || kind === 276 /* JSDocAllType */ + || kind === 277 /* JSDocUnknownType */ + || kind === 278 /* JSDocNullableType */ + || kind === 279 /* JSDocNonNullableType */ + || kind === 280 /* JSDocOptionalType */ + || kind === 281 /* JSDocFunctionType */ + || kind === 282 /* JSDocVariadicType */; } /** * Node test that determines whether a node is a valid type node. @@ -13625,8 +13670,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 179 /* ArrayBindingPattern */ - || kind === 178 /* ObjectBindingPattern */; + return kind === 180 /* ArrayBindingPattern */ + || kind === 179 /* ObjectBindingPattern */; } return false; } @@ -13634,15 +13679,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 181 /* ArrayLiteralExpression */ - || kind === 182 /* ObjectLiteralExpression */; + return kind === 182 /* ArrayLiteralExpression */ + || kind === 183 /* ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 180 /* BindingElement */ - || kind === 204 /* OmittedExpression */; + return kind === 181 /* BindingElement */ + || kind === 205 /* OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13651,9 +13696,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: - case 180 /* BindingElement */: + case 181 /* BindingElement */: return true; } return false; @@ -13674,8 +13719,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 178 /* ObjectBindingPattern */: - case 182 /* ObjectLiteralExpression */: + case 179 /* ObjectBindingPattern */: + case 183 /* ObjectLiteralExpression */: return true; } return false; @@ -13687,27 +13732,35 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 179 /* ArrayBindingPattern */: - case 181 /* ArrayLiteralExpression */: + case 180 /* ArrayBindingPattern */: + case 182 /* ArrayLiteralExpression */: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; + /* @internal */ + function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { + var kind = node.kind; + return kind === 184 /* PropertyAccessExpression */ + || kind === 145 /* QualifiedName */ + || kind === 178 /* ImportType */; + } + ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 183 /* PropertyAccessExpression */ + return kind === 184 /* PropertyAccessExpression */ || kind === 145 /* QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 187 /* TaggedTemplateExpression */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 188 /* TaggedTemplateExpression */: case 149 /* Decorator */: return true; default: @@ -13716,12 +13769,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 185 /* CallExpression */ || node.kind === 186 /* NewExpression */; + return node.kind === 186 /* CallExpression */ || node.kind === 187 /* NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 200 /* TemplateExpression */ + return kind === 201 /* TemplateExpression */ || kind === 13 /* NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -13732,32 +13785,32 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: - case 186 /* NewExpression */: - case 185 /* CallExpression */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 257 /* JsxFragment */: - case 187 /* TaggedTemplateExpression */: - case 181 /* ArrayLiteralExpression */: - case 189 /* ParenthesizedExpression */: - case 182 /* ObjectLiteralExpression */: - case 203 /* ClassExpression */: - case 190 /* FunctionExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 187 /* NewExpression */: + case 186 /* CallExpression */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 258 /* JsxFragment */: + case 188 /* TaggedTemplateExpression */: + case 182 /* ArrayLiteralExpression */: + case 190 /* ParenthesizedExpression */: + case 183 /* ObjectLiteralExpression */: + case 204 /* ClassExpression */: + case 191 /* FunctionExpression */: case 71 /* Identifier */: case 12 /* RegularExpressionLiteral */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 13 /* NoSubstitutionTemplateLiteral */: - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: case 86 /* FalseKeyword */: case 95 /* NullKeyword */: case 99 /* ThisKeyword */: case 101 /* TrueKeyword */: case 97 /* SuperKeyword */: - case 207 /* NonNullExpression */: - case 208 /* MetaProperty */: + case 208 /* NonNullExpression */: + case 209 /* MetaProperty */: case 91 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -13771,13 +13824,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: - case 192 /* DeleteExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 195 /* AwaitExpression */: - case 188 /* TypeAssertionExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 193 /* DeleteExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 196 /* AwaitExpression */: + case 189 /* TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -13786,9 +13839,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return true; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return expr.operator === 43 /* PlusPlusToken */ || expr.operator === 44 /* MinusMinusToken */; default: @@ -13807,15 +13860,15 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 199 /* ConditionalExpression */: - case 201 /* YieldExpression */: - case 191 /* ArrowFunction */: - case 198 /* BinaryExpression */: - case 202 /* SpreadElement */: - case 206 /* AsExpression */: - case 204 /* OmittedExpression */: - case 296 /* CommaListExpression */: - case 295 /* PartiallyEmittedExpression */: + case 200 /* ConditionalExpression */: + case 202 /* YieldExpression */: + case 192 /* ArrowFunction */: + case 199 /* BinaryExpression */: + case 203 /* SpreadElement */: + case 207 /* AsExpression */: + case 205 /* OmittedExpression */: + case 297 /* CommaListExpression */: + case 296 /* PartiallyEmittedExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -13823,18 +13876,18 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 188 /* TypeAssertionExpression */ - || kind === 206 /* AsExpression */; + return kind === 189 /* TypeAssertionExpression */ + || kind === 207 /* AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ function isPartiallyEmittedExpression(node) { - return node.kind === 295 /* PartiallyEmittedExpression */; + return node.kind === 296 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; /* @internal */ function isNotEmittedStatement(node) { - return node.kind === 294 /* NotEmittedStatement */; + return node.kind === 295 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ @@ -13845,13 +13898,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return true; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -13859,7 +13912,7 @@ var ts; ts.isIterationStatement = isIterationStatement; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 219 /* ForInStatement */ || node.kind === 220 /* ForOfStatement */; + return node.kind === 220 /* ForInStatement */ || node.kind === 221 /* ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -13883,111 +13936,111 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 238 /* ModuleBlock */ - || kind === 237 /* ModuleDeclaration */ + return kind === 239 /* ModuleBlock */ + || kind === 238 /* ModuleDeclaration */ || kind === 71 /* Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 238 /* ModuleBlock */ - || kind === 237 /* ModuleDeclaration */; + return kind === 239 /* ModuleBlock */ + || kind === 238 /* ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 71 /* Identifier */ - || kind === 237 /* ModuleDeclaration */; + || kind === 238 /* ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 245 /* NamedImports */ - || kind === 244 /* NamespaceImport */; + return kind === 246 /* NamedImports */ + || kind === 245 /* NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */ || node.kind === 236 /* EnumDeclaration */; + return node.kind === 238 /* ModuleDeclaration */ || node.kind === 237 /* EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 191 /* ArrowFunction */ - || kind === 180 /* BindingElement */ - || kind === 233 /* ClassDeclaration */ - || kind === 203 /* ClassExpression */ + return kind === 192 /* ArrowFunction */ + || kind === 181 /* BindingElement */ + || kind === 234 /* ClassDeclaration */ + || kind === 204 /* ClassExpression */ || kind === 154 /* Constructor */ - || kind === 236 /* EnumDeclaration */ - || kind === 271 /* EnumMember */ - || kind === 250 /* ExportSpecifier */ - || kind === 232 /* FunctionDeclaration */ - || kind === 190 /* FunctionExpression */ + || kind === 237 /* EnumDeclaration */ + || kind === 272 /* EnumMember */ + || kind === 251 /* ExportSpecifier */ + || kind === 233 /* FunctionDeclaration */ + || kind === 191 /* FunctionExpression */ || kind === 155 /* GetAccessor */ - || kind === 243 /* ImportClause */ - || kind === 241 /* ImportEqualsDeclaration */ - || kind === 246 /* ImportSpecifier */ - || kind === 234 /* InterfaceDeclaration */ - || kind === 260 /* JsxAttribute */ + || kind === 244 /* ImportClause */ + || kind === 242 /* ImportEqualsDeclaration */ + || kind === 247 /* ImportSpecifier */ + || kind === 235 /* InterfaceDeclaration */ + || kind === 261 /* JsxAttribute */ || kind === 153 /* MethodDeclaration */ || kind === 152 /* MethodSignature */ - || kind === 237 /* ModuleDeclaration */ - || kind === 240 /* NamespaceExportDeclaration */ - || kind === 244 /* NamespaceImport */ + || kind === 238 /* ModuleDeclaration */ + || kind === 241 /* NamespaceExportDeclaration */ + || kind === 245 /* NamespaceImport */ || kind === 148 /* Parameter */ - || kind === 268 /* PropertyAssignment */ + || kind === 269 /* PropertyAssignment */ || kind === 151 /* PropertyDeclaration */ || kind === 150 /* PropertySignature */ || kind === 156 /* SetAccessor */ - || kind === 269 /* ShorthandPropertyAssignment */ - || kind === 235 /* TypeAliasDeclaration */ + || kind === 270 /* ShorthandPropertyAssignment */ + || kind === 236 /* TypeAliasDeclaration */ || kind === 147 /* TypeParameter */ - || kind === 230 /* VariableDeclaration */ - || kind === 291 /* JSDocTypedefTag */; + || kind === 231 /* VariableDeclaration */ + || kind === 292 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { - return kind === 232 /* FunctionDeclaration */ - || kind === 251 /* MissingDeclaration */ - || kind === 233 /* ClassDeclaration */ - || kind === 234 /* InterfaceDeclaration */ - || kind === 235 /* TypeAliasDeclaration */ - || kind === 236 /* EnumDeclaration */ - || kind === 237 /* ModuleDeclaration */ - || kind === 242 /* ImportDeclaration */ - || kind === 241 /* ImportEqualsDeclaration */ - || kind === 248 /* ExportDeclaration */ - || kind === 247 /* ExportAssignment */ - || kind === 240 /* NamespaceExportDeclaration */; + return kind === 233 /* FunctionDeclaration */ + || kind === 252 /* MissingDeclaration */ + || kind === 234 /* ClassDeclaration */ + || kind === 235 /* InterfaceDeclaration */ + || kind === 236 /* TypeAliasDeclaration */ + || kind === 237 /* EnumDeclaration */ + || kind === 238 /* ModuleDeclaration */ + || kind === 243 /* ImportDeclaration */ + || kind === 242 /* ImportEqualsDeclaration */ + || kind === 249 /* ExportDeclaration */ + || kind === 248 /* ExportAssignment */ + || kind === 241 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 222 /* BreakStatement */ - || kind === 221 /* ContinueStatement */ - || kind === 229 /* DebuggerStatement */ - || kind === 216 /* DoStatement */ - || kind === 214 /* ExpressionStatement */ - || kind === 213 /* EmptyStatement */ - || kind === 219 /* ForInStatement */ - || kind === 220 /* ForOfStatement */ - || kind === 218 /* ForStatement */ - || kind === 215 /* IfStatement */ - || kind === 226 /* LabeledStatement */ - || kind === 223 /* ReturnStatement */ - || kind === 225 /* SwitchStatement */ - || kind === 227 /* ThrowStatement */ - || kind === 228 /* TryStatement */ - || kind === 212 /* VariableStatement */ - || kind === 217 /* WhileStatement */ - || kind === 224 /* WithStatement */ - || kind === 294 /* NotEmittedStatement */ - || kind === 298 /* EndOfDeclarationMarker */ - || kind === 297 /* MergeDeclarationMarker */; + return kind === 223 /* BreakStatement */ + || kind === 222 /* ContinueStatement */ + || kind === 230 /* DebuggerStatement */ + || kind === 217 /* DoStatement */ + || kind === 215 /* ExpressionStatement */ + || kind === 214 /* EmptyStatement */ + || kind === 220 /* ForInStatement */ + || kind === 221 /* ForOfStatement */ + || kind === 219 /* ForStatement */ + || kind === 216 /* IfStatement */ + || kind === 227 /* LabeledStatement */ + || kind === 224 /* ReturnStatement */ + || kind === 226 /* SwitchStatement */ + || kind === 228 /* ThrowStatement */ + || kind === 229 /* TryStatement */ + || kind === 213 /* VariableStatement */ + || kind === 218 /* WhileStatement */ + || kind === 225 /* WithStatement */ + || kind === 295 /* NotEmittedStatement */ + || kind === 299 /* EndOfDeclarationMarker */ + || kind === 298 /* MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { if (node.kind === 147 /* TypeParameter */) { - return node.parent.kind !== 290 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); + return node.parent.kind !== 291 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -14014,10 +14067,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 211 /* Block */) + if (node.kind !== 212 /* Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 228 /* TryStatement */ || node.parent.kind === 267 /* CatchClause */) { + if (node.parent.kind === 229 /* TryStatement */ || node.parent.kind === 268 /* CatchClause */) { return false; } } @@ -14027,7 +14080,7 @@ var ts; /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 252 /* ExternalModuleReference */ + return kind === 253 /* ExternalModuleReference */ || kind === 145 /* QualifiedName */ || kind === 71 /* Identifier */; } @@ -14038,62 +14091,62 @@ var ts; var kind = node.kind; return kind === 99 /* ThisKeyword */ || kind === 71 /* Identifier */ - || kind === 183 /* PropertyAccessExpression */; + || kind === 184 /* PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 253 /* JsxElement */ - || kind === 263 /* JsxExpression */ - || kind === 254 /* JsxSelfClosingElement */ + return kind === 254 /* JsxElement */ + || kind === 264 /* JsxExpression */ + || kind === 255 /* JsxSelfClosingElement */ || kind === 10 /* JsxText */ - || kind === 257 /* JsxFragment */; + || kind === 258 /* JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 260 /* JsxAttribute */ - || kind === 262 /* JsxSpreadAttribute */; + return kind === 261 /* JsxAttribute */ + || kind === 263 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 263 /* JsxExpression */; + || kind === 264 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 255 /* JsxOpeningElement */ - || kind === 254 /* JsxSelfClosingElement */; + return kind === 256 /* JsxOpeningElement */ + || kind === 255 /* JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 264 /* CaseClause */ - || kind === 265 /* DefaultClause */; + return kind === 265 /* CaseClause */ + || kind === 266 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 274 /* FirstJSDocNode */ && node.kind <= 292 /* LastJSDocNode */; + return node.kind >= 275 /* FirstJSDocNode */ && node.kind <= 293 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 282 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); + return node.kind === 283 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 284 /* FirstJSDocTagNode */ && node.kind <= 292 /* LastJSDocTagNode */; + return node.kind >= 285 /* FirstJSDocTagNode */ && node.kind <= 293 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -14137,19 +14190,19 @@ var ts; case 172 /* ParenthesizedType */: case 174 /* TypeOperator */: case 176 /* MappedType */: - case 188 /* TypeAssertionExpression */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 206 /* AsExpression */: - case 230 /* VariableDeclaration */: - case 232 /* FunctionDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 274 /* JSDocTypeExpression */: - case 277 /* JSDocNullableType */: - case 278 /* JSDocNonNullableType */: - case 279 /* JSDocOptionalType */: - case 280 /* JSDocFunctionType */: - case 281 /* JSDocVariadicType */: + case 189 /* TypeAssertionExpression */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 207 /* AsExpression */: + case 231 /* VariableDeclaration */: + case 233 /* FunctionDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 275 /* JSDocTypeExpression */: + case 278 /* JSDocNullableType */: + case 279 /* JSDocNonNullableType */: + case 280 /* JSDocOptionalType */: + case 281 /* JSDocFunctionType */: + case 282 /* JSDocVariadicType */: return true; } return false; @@ -14169,10 +14222,10 @@ var ts; ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { switch (node.kind) { - case 260 /* JsxAttribute */: - case 262 /* JsxSpreadAttribute */: - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 261 /* JsxAttribute */: + case 263 /* JsxSpreadAttribute */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: @@ -14184,7 +14237,7 @@ var ts; ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 161 /* TypeReference */ || node.kind === 205 /* ExpressionWithTypeArguments */; + return node.kind === 161 /* TypeReference */ || node.kind === 206 /* ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14238,7 +14291,7 @@ var ts; var SourceFileConstructor; // tslint:enable variable-name function createNode(kind, pos, end) { - if (kind === 272 /* SourceFile */) { + if (kind === 273 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71 /* Identifier */) { @@ -14302,14 +14355,14 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return visitNode(cbNode, node.expression); case 148 /* Parameter */: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -14334,20 +14387,20 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.initializer); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || @@ -14369,9 +14422,9 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -14406,6 +14459,10 @@ var ts; visitNode(cbNode, node.falseType); case 171 /* InferType */: return visitNode(cbNode, node.typeParameter); + case 178 /* ImportType */: + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); case 172 /* ParenthesizedType */: case 174 /* TypeOperator */: return visitNode(cbNode, node.type); @@ -14419,262 +14476,262 @@ var ts; visitNode(cbNode, node.type); case 177 /* LiteralType */: return visitNode(cbNode, node.literal); - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: return visitNodes(cbNode, cbNodes, node.elements); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return visitNodes(cbNode, cbNodes, node.elements); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitNodes(cbNode, cbNodes, node.properties); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNodes(cbNode, cbNodes, node.arguments); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 206 /* AsExpression */: + case 207 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return visitNode(cbNode, node.expression); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return visitNode(cbNode, node.name); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 211 /* Block */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 239 /* ModuleBlock */: return visitNodes(cbNode, cbNodes, node.statements); - case 272 /* SourceFile */: + case 273 /* SourceFile */: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return visitNodes(cbNode, cbNodes, node.declarations); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitNode(cbNode, node.awaitModifier) || visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: return visitNode(cbNode, node.label); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return visitNodes(cbNode, cbNodes, node.clauses); - case 264 /* CaseClause */: + case 265 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return visitNodes(cbNode, cbNodes, node.statements); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 149 /* Decorator */: return visitNode(cbNode, node.expression); - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return visitNodes(cbNode, cbNodes, node.decorators) || 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 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || 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 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); - case 271 /* EnumMember */: + case 272 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return visitNodes(cbNode, cbNodes, node.elements); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 146 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return visitNodes(cbNode, cbNodes, node.types); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 251 /* MissingDeclaration */: + case 252 /* MissingDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators); - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); - case 253 /* JsxElement */: + case 254 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return visitNode(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingFragment); - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.attributes); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return visitNodes(cbNode, cbNodes, node.properties); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 274 /* JSDocTypeExpression */: + case 275 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 278 /* JSDocNonNullableType */: + case 279 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 282 /* JSDocComment */: + case 283 /* JSDocComment */: return visitNodes(cbNode, cbNodes, node.tags); - case 287 /* JSDocParameterTag */: - case 292 /* JSDocPropertyTag */: + case 288 /* JSDocParameterTag */: + case 293 /* JSDocPropertyTag */: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -14683,17 +14740,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 288 /* JSDocReturnTag */: + case 289 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 289 /* JSDocTypeTag */: + case 290 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 285 /* JSDocAugmentsTag */: + case 286 /* JSDocAugmentsTag */: return visitNode(cbNode, node.class); - case 290 /* JSDocTemplateTag */: + case 291 /* JSDocTemplateTag */: return visitNodes(cbNode, cbNodes, node.typeParameters); - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: if (node.typeExpression && - node.typeExpression.kind === 274 /* JSDocTypeExpression */) { + node.typeExpression.kind === 275 /* JSDocTypeExpression */) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -14701,7 +14758,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 283 /* JSDocTypeLiteral */: + case 284 /* JSDocTypeLiteral */: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -14709,7 +14766,7 @@ var ts; } } return; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); } } @@ -15032,7 +15089,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(272 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(273 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -15836,7 +15893,7 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 151 /* PropertyDeclaration */: - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: return true; case 153 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal @@ -15853,8 +15910,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: return true; } } @@ -15863,42 +15920,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 212 /* VariableStatement */: - case 211 /* Block */: - case 215 /* IfStatement */: - case 214 /* ExpressionStatement */: - case 227 /* ThrowStatement */: - case 223 /* ReturnStatement */: - case 225 /* SwitchStatement */: - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 218 /* ForStatement */: - case 217 /* WhileStatement */: - case 224 /* WithStatement */: - case 213 /* EmptyStatement */: - case 228 /* TryStatement */: - case 226 /* LabeledStatement */: - case 216 /* DoStatement */: - case 229 /* DebuggerStatement */: - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: - case 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 233 /* FunctionDeclaration */: + case 213 /* VariableStatement */: + case 212 /* Block */: + case 216 /* IfStatement */: + case 215 /* ExpressionStatement */: + case 228 /* ThrowStatement */: + case 224 /* ReturnStatement */: + case 226 /* SwitchStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 219 /* ForStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: + case 214 /* EmptyStatement */: + case 229 /* TryStatement */: + case 227 /* LabeledStatement */: + case 217 /* DoStatement */: + case 230 /* DebuggerStatement */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 236 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 271 /* EnumMember */; + return node.kind === 272 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { @@ -15914,7 +15971,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 230 /* VariableDeclaration */) { + if (node.kind !== 231 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -16101,7 +16158,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(200 /* TemplateExpression */); + var template = createNode(201 /* TemplateExpression */); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 14 /* TemplateHead */, "Template head has wrong token kind"); var list = []; @@ -16113,7 +16170,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(209 /* TemplateSpan */); + var span = createNode(210 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token() === 18 /* CloseBraceToken */) { @@ -16184,9 +16241,9 @@ var ts; return finishNode(node); } function parseJSDocAllType(postFixEquals) { - var result = createNode(275 /* JSDocAllType */); + var result = createNode(276 /* JSDocAllType */); if (postFixEquals) { - return createJSDocPostfixType(279 /* JSDocOptionalType */, result); + return createJSDocPostfixType(280 /* JSDocOptionalType */, result); } else { nextToken(); @@ -16194,7 +16251,7 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(278 /* JSDocNonNullableType */); + var result = createNode(279 /* JSDocNonNullableType */); nextToken(); result.type = parseNonArrayType(); return finishNode(result); @@ -16218,18 +16275,18 @@ var ts; token() === 29 /* GreaterThanToken */ || token() === 58 /* EqualsToken */ || token() === 49 /* BarToken */) { - var result = createNode(276 /* JSDocUnknownType */, pos); + var result = createNode(277 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(277 /* JSDocNullableType */, pos); + var result = createNode(278 /* JSDocNullableType */, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNodeWithJSDoc(280 /* JSDocFunctionType */); + var result = createNodeWithJSDoc(281 /* JSDocFunctionType */); nextToken(); fillSignature(56 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result); return finishNode(result); @@ -16251,12 +16308,12 @@ var ts; var dotdotdot = parseOptionalToken(24 /* DotDotDotToken */); var type = parseType(); if (dotdotdot) { - var variadic = createNode(281 /* JSDocVariadicType */, dotdotdot.pos); + var variadic = createNode(282 /* JSDocVariadicType */, dotdotdot.pos); variadic.type = type; type = finishNode(variadic); } if (token() === 58 /* EqualsToken */) { - return createJSDocPostfixType(279 /* JSDocOptionalType */, type); + return createJSDocPostfixType(280 /* JSDocOptionalType */, type); } return type; } @@ -16634,7 +16691,7 @@ var ts; var node = createNode(177 /* LiteralType */); var unaryMinusExpression; if (negative) { - unaryMinusExpression = createNode(196 /* PrefixUnaryExpression */); + unaryMinusExpression = createNode(197 /* PrefixUnaryExpression */); unaryMinusExpression.operator = 38 /* MinusToken */; nextToken(); } @@ -16649,6 +16706,26 @@ var ts; node.literal = expression; return finishNode(node); } + function isStartOfTypeOfImportType() { + nextToken(); + return token() === 91 /* ImportKeyword */; + } + function parseImportType() { + sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */; + var node = createNode(178 /* ImportType */); + if (parseOptional(103 /* TypeOfKeyword */)) { + node.isTypeOf = true; + } + parseExpected(91 /* ImportKeyword */); + parseExpected(19 /* OpenParenToken */); + node.argument = parseType(); + parseExpected(20 /* CloseParenToken */); + if (parseOptional(23 /* DotToken */)) { + node.qualifier = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected); + } + node.typeArguments = tryParseTypeArguments(); + return finishNode(node); + } function nextTokenIsNumericLiteral() { return nextToken() === 8 /* NumericLiteral */; } @@ -16695,13 +16772,15 @@ var ts; } } case 103 /* TypeOfKeyword */: - return parseTypeQuery(); + return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); case 17 /* OpenBraceToken */: return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); case 21 /* OpenBracketToken */: return parseTupleType(); case 19 /* OpenParenToken */: return parseParenthesizedType(); + case 91 /* ImportKeyword */: + return parseImportType(); default: return parseTypeReference(); } @@ -16736,6 +16815,7 @@ var ts; case 51 /* ExclamationToken */: case 24 /* DotDotDotToken */: case 126 /* InferKeyword */: + case 91 /* ImportKeyword */: return true; case 38 /* MinusToken */: return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral); @@ -16756,14 +16836,14 @@ var ts; while (!scanner.hasPrecedingLineBreak()) { switch (token()) { case 51 /* ExclamationToken */: - type = createJSDocPostfixType(278 /* JSDocNonNullableType */, type); + type = createJSDocPostfixType(279 /* JSDocNonNullableType */, type); break; case 55 /* QuestionToken */: // If not in JSDoc and next token is start of a type we have a conditional type if (!(contextFlags & 1048576 /* JSDoc */) && lookAhead(nextTokenIsStartOfType)) { return type; } - type = createJSDocPostfixType(277 /* JSDocNullableType */, type); + type = createJSDocPostfixType(278 /* JSDocNullableType */, type); break; case 21 /* OpenBracketToken */: parseExpected(21 /* OpenBracketToken */); @@ -17117,7 +17197,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(201 /* YieldExpression */); + var node = createNode(202 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -17139,11 +17219,11 @@ var ts; ts.Debug.assert(token() === 36 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(191 /* ArrowFunction */, asyncModifier.pos); + node = createNode(192 /* ArrowFunction */, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(191 /* ArrowFunction */, identifier.pos); + node = createNode(192 /* ArrowFunction */, identifier.pos); } var parameter = createNode(148 /* Parameter */, identifier.pos); parameter.name = identifier; @@ -17341,7 +17421,7 @@ var ts; return 0 /* False */; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNodeWithJSDoc(191 /* ArrowFunction */); + var node = createNodeWithJSDoc(192 /* ArrowFunction */); node.modifiers = parseModifiersForArrowFunction(); var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */; // Arrow functions are never generators. @@ -17407,7 +17487,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(199 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(200 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -17487,39 +17567,39 @@ var ts; return ts.getBinaryOperatorPrecedence(token()) > 0; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(198 /* BinaryExpression */, left.pos); + var node = createNode(199 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(206 /* AsExpression */, left.pos); + var node = createNode(207 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(196 /* PrefixUnaryExpression */); + var node = createNode(197 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(192 /* DeleteExpression */); + var node = createNode(193 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(193 /* TypeOfExpression */); + var node = createNode(194 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(194 /* VoidExpression */); + var node = createNode(195 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -17535,7 +17615,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(195 /* AwaitExpression */); + var node = createNode(196 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -17579,7 +17659,7 @@ var ts; if (token() === 40 /* AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 188 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 189 /* 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 { @@ -17676,7 +17756,7 @@ var ts; */ function parseUpdateExpression() { if (token() === 43 /* PlusPlusToken */ || token() === 44 /* MinusMinusToken */) { - var node = createNode(196 /* PrefixUnaryExpression */); + var node = createNode(197 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -17689,7 +17769,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 43 /* PlusPlusToken */ || token() === 44 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(197 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(198 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -17804,7 +17884,7 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(183 /* PropertyAccessExpression */, expression.pos); + var node = createNode(184 /* PropertyAccessExpression */, expression.pos); node.expression = expression; parseExpectedToken(23 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -17829,8 +17909,8 @@ var ts; function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 255 /* JsxOpeningElement */) { - var node = createNode(253 /* JsxElement */, opening.pos); + if (opening.kind === 256 /* JsxOpeningElement */) { + var node = createNode(254 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -17839,15 +17919,15 @@ var ts; } result = finishNode(node); } - else if (opening.kind === 258 /* JsxOpeningFragment */) { - var node = createNode(257 /* JsxFragment */, opening.pos); + else if (opening.kind === 259 /* JsxOpeningFragment */) { + var node = createNode(258 /* JsxFragment */, opening.pos); node.openingFragment = opening; node.children = parseJsxChildren(node.openingFragment); node.closingFragment = parseJsxClosingFragment(inExpressionContext); result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 254 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 255 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -17862,7 +17942,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(198 /* BinaryExpression */, result.pos); + var badNode = createNode(199 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -17920,7 +18000,7 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(261 /* JsxAttributes */); + var jsxAttributes = createNode(262 /* JsxAttributes */); jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute); return finishNode(jsxAttributes); } @@ -17929,7 +18009,7 @@ var ts; parseExpected(27 /* LessThanToken */); if (token() === 29 /* GreaterThanToken */) { // See below for explanation of scanJsxText - var node_1 = createNode(258 /* JsxOpeningFragment */, fullStart); + var node_1 = createNode(259 /* JsxOpeningFragment */, fullStart); scanJsxText(); return finishNode(node_1); } @@ -17941,7 +18021,7 @@ var ts; // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(255 /* JsxOpeningElement */, fullStart); + node = createNode(256 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -17953,7 +18033,7 @@ var ts; parseExpected(29 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(254 /* JsxSelfClosingElement */, fullStart); + node = createNode(255 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.typeArguments = typeArguments; @@ -17970,7 +18050,7 @@ var ts; var expression = token() === 99 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName(); while (parseOptional(23 /* DotToken */)) { - var propertyAccess = createNode(183 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(184 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17978,7 +18058,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(263 /* JsxExpression */); + var node = createNode(264 /* JsxExpression */); if (!parseExpected(17 /* OpenBraceToken */)) { return undefined; } @@ -18000,7 +18080,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(260 /* JsxAttribute */); + var node = createNode(261 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 58 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -18015,7 +18095,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(262 /* JsxSpreadAttribute */); + var node = createNode(263 /* JsxSpreadAttribute */); parseExpected(17 /* OpenBraceToken */); parseExpected(24 /* DotDotDotToken */); node.expression = parseExpression(); @@ -18023,7 +18103,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(256 /* JsxClosingElement */); + var node = createNode(257 /* JsxClosingElement */); parseExpected(28 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -18036,7 +18116,7 @@ var ts; return finishNode(node); } function parseJsxClosingFragment(inExpressionContext) { - var node = createNode(259 /* JsxClosingFragment */); + var node = createNode(260 /* JsxClosingFragment */); parseExpected(28 /* LessThanSlashToken */); if (ts.tokenIsIdentifierOrKeyword(token())) { parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); @@ -18051,7 +18131,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(188 /* TypeAssertionExpression */); + var node = createNode(189 /* TypeAssertionExpression */); parseExpected(27 /* LessThanToken */); node.type = parseType(); parseExpected(29 /* GreaterThanToken */); @@ -18062,7 +18142,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(23 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(183 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(184 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -18070,14 +18150,14 @@ var ts; } if (token() === 51 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(207 /* NonNullExpression */, expression.pos); + var nonNullExpression = createNode(208 /* NonNullExpression */, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(21 /* OpenBracketToken */)) { - var indexedAccess = createNode(184 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(185 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -18093,7 +18173,7 @@ var ts; continue; } if (token() === 13 /* NoSubstitutionTemplateLiteral */ || token() === 14 /* TemplateHead */) { - var tagExpression = createNode(187 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(188 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 13 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -18116,7 +18196,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(185 /* CallExpression */, expression.pos); + var callExpr = createNode(186 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -18124,7 +18204,7 @@ var ts; continue; } else if (token() === 19 /* OpenParenToken */) { - var callExpr = createNode(185 /* CallExpression */, expression.pos); + var callExpr = createNode(186 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -18234,28 +18314,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNodeWithJSDoc(189 /* ParenthesizedExpression */); + var node = createNodeWithJSDoc(190 /* ParenthesizedExpression */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(20 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(202 /* SpreadElement */); + var node = createNode(203 /* SpreadElement */); parseExpected(24 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 24 /* DotDotDotToken */ ? parseSpreadElement() : - token() === 26 /* CommaToken */ ? createNode(204 /* OmittedExpression */) : + token() === 26 /* CommaToken */ ? createNode(205 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(181 /* ArrayLiteralExpression */); + var node = createNode(182 /* ArrayLiteralExpression */); parseExpected(21 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -18267,7 +18347,7 @@ var ts; function parseObjectLiteralElement() { var node = createNodeWithJSDoc(0 /* Unknown */); if (parseOptionalToken(24 /* DotDotDotToken */)) { - node.kind = 270 /* SpreadAssignment */; + node.kind = 271 /* SpreadAssignment */; node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -18294,7 +18374,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 /* CommaToken */ || token() === 18 /* CloseBraceToken */ || token() === 58 /* EqualsToken */); if (isShorthandPropertyAssignment) { - node.kind = 269 /* ShorthandPropertyAssignment */; + node.kind = 270 /* ShorthandPropertyAssignment */; var equalsToken = parseOptionalToken(58 /* EqualsToken */); if (equalsToken) { node.equalsToken = equalsToken; @@ -18302,14 +18382,14 @@ var ts; } } else { - node.kind = 268 /* PropertyAssignment */; + node.kind = 269 /* PropertyAssignment */; parseExpected(56 /* ColonToken */); node.initializer = allowInAnd(parseAssignmentExpressionOrHigher); } return finishNode(node); } function parseObjectLiteralExpression() { - var node = createNode(182 /* ObjectLiteralExpression */); + var node = createNode(183 /* ObjectLiteralExpression */); parseExpected(17 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -18328,7 +18408,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNodeWithJSDoc(190 /* FunctionExpression */); + var node = createNodeWithJSDoc(191 /* FunctionExpression */); node.modifiers = parseModifiers(); parseExpected(89 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(39 /* AsteriskToken */); @@ -18353,12 +18433,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94 /* NewKeyword */); if (parseOptional(23 /* DotToken */)) { - var node_2 = createNode(208 /* MetaProperty */, fullStart); + var node_2 = createNode(209 /* MetaProperty */, fullStart); node_2.keywordToken = 94 /* NewKeyword */; node_2.name = parseIdentifierName(); return finishNode(node_2); } - var node = createNode(186 /* NewExpression */, fullStart); + var node = createNode(187 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 19 /* OpenParenToken */) { @@ -18368,7 +18448,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(211 /* Block */); + var node = createNode(212 /* Block */); if (parseExpected(17 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -18401,12 +18481,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(213 /* EmptyStatement */); + var node = createNode(214 /* EmptyStatement */); parseExpected(25 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(215 /* IfStatement */); + var node = createNode(216 /* IfStatement */); parseExpected(90 /* IfKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -18416,7 +18496,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(216 /* DoStatement */); + var node = createNode(217 /* DoStatement */); parseExpected(81 /* DoKeyword */); node.statement = parseStatement(); parseExpected(106 /* WhileKeyword */); @@ -18431,7 +18511,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(217 /* WhileStatement */); + var node = createNode(218 /* WhileStatement */); parseExpected(106 /* WhileKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -18455,7 +18535,7 @@ var ts; } var forOrForInOrForOfStatement; if (awaitToken ? parseExpected(144 /* OfKeyword */) : parseOptional(144 /* OfKeyword */)) { - var forOfStatement = createNode(220 /* ForOfStatement */, pos); + var forOfStatement = createNode(221 /* ForOfStatement */, pos); forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); @@ -18463,14 +18543,14 @@ var ts; forOrForInOrForOfStatement = forOfStatement; } else if (parseOptional(92 /* InKeyword */)) { - var forInStatement = createNode(219 /* ForInStatement */, pos); + var forInStatement = createNode(220 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(20 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } else { - var forStatement = createNode(218 /* ForStatement */, pos); + var forStatement = createNode(219 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(25 /* SemicolonToken */); if (token() !== 25 /* SemicolonToken */ && token() !== 20 /* CloseParenToken */) { @@ -18488,7 +18568,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 222 /* BreakStatement */ ? 72 /* BreakKeyword */ : 77 /* ContinueKeyword */); + parseExpected(kind === 223 /* BreakStatement */ ? 72 /* BreakKeyword */ : 77 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -18496,7 +18576,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(223 /* ReturnStatement */); + var node = createNode(224 /* ReturnStatement */); parseExpected(96 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -18505,7 +18585,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(224 /* WithStatement */); + var node = createNode(225 /* WithStatement */); parseExpected(107 /* WithKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -18514,7 +18594,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(264 /* CaseClause */); + var node = createNode(265 /* CaseClause */); parseExpected(73 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(56 /* ColonToken */); @@ -18522,7 +18602,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(265 /* DefaultClause */); + var node = createNode(266 /* DefaultClause */); parseExpected(79 /* DefaultKeyword */); parseExpected(56 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -18532,12 +18612,12 @@ var ts; return token() === 73 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(225 /* SwitchStatement */); + var node = createNode(226 /* SwitchStatement */); parseExpected(98 /* SwitchKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(20 /* CloseParenToken */); - var caseBlock = createNode(239 /* CaseBlock */); + var caseBlock = createNode(240 /* CaseBlock */); parseExpected(17 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(18 /* CloseBraceToken */); @@ -18552,7 +18632,7 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(227 /* ThrowStatement */); + var node = createNode(228 /* ThrowStatement */); parseExpected(100 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -18560,7 +18640,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(228 /* TryStatement */); + var node = createNode(229 /* TryStatement */); parseExpected(102 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token() === 74 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -18573,7 +18653,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(267 /* CatchClause */); + var result = createNode(268 /* CatchClause */); parseExpected(74 /* CatchKeyword */); if (parseOptional(19 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -18587,7 +18667,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(229 /* DebuggerStatement */); + var node = createNode(230 /* DebuggerStatement */); parseExpected(78 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -18599,12 +18679,12 @@ var ts; var node = createNodeWithJSDoc(0 /* Unknown */); var expression = allowInAnd(parseExpression); if (expression.kind === 71 /* Identifier */ && parseOptional(56 /* ColonToken */)) { - node.kind = 226 /* LabeledStatement */; + node.kind = 227 /* LabeledStatement */; node.label = expression; node.statement = parseStatement(); } else { - node.kind = 214 /* ExpressionStatement */; + node.kind = 215 /* ExpressionStatement */; node.expression = expression; parseSemicolon(); } @@ -18771,16 +18851,16 @@ var ts; case 17 /* OpenBraceToken */: return parseBlock(/*ignoreMissingOpenBrace*/ false); case 104 /* VarKeyword */: - return parseVariableStatement(createNodeWithJSDoc(230 /* VariableDeclaration */)); + return parseVariableStatement(createNodeWithJSDoc(231 /* VariableDeclaration */)); case 110 /* LetKeyword */: if (isLetDeclaration()) { - return parseVariableStatement(createNodeWithJSDoc(230 /* VariableDeclaration */)); + return parseVariableStatement(createNodeWithJSDoc(231 /* VariableDeclaration */)); } break; case 89 /* FunctionKeyword */: - return parseFunctionDeclaration(createNodeWithJSDoc(232 /* FunctionDeclaration */)); + return parseFunctionDeclaration(createNodeWithJSDoc(233 /* FunctionDeclaration */)); case 75 /* ClassKeyword */: - return parseClassDeclaration(createNodeWithJSDoc(233 /* ClassDeclaration */)); + return parseClassDeclaration(createNodeWithJSDoc(234 /* ClassDeclaration */)); case 90 /* IfKeyword */: return parseIfStatement(); case 81 /* DoKeyword */: @@ -18790,9 +18870,9 @@ var ts; case 88 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 77 /* ContinueKeyword */: - return parseBreakOrContinueStatement(221 /* ContinueStatement */); + return parseBreakOrContinueStatement(222 /* ContinueStatement */); case 72 /* BreakKeyword */: - return parseBreakOrContinueStatement(222 /* BreakStatement */); + return parseBreakOrContinueStatement(223 /* BreakStatement */); case 96 /* ReturnKeyword */: return parseReturnStatement(); case 107 /* WithKeyword */: @@ -18889,7 +18969,7 @@ var ts; if (node.decorators || node.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(251 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(252 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); missing.pos = node.pos; missing.decorators = node.decorators; missing.modifiers = node.modifiers; @@ -18911,16 +18991,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token() === 26 /* CommaToken */) { - return createNode(204 /* OmittedExpression */); + return createNode(205 /* OmittedExpression */); } - var node = createNode(180 /* BindingElement */); + var node = createNode(181 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(180 /* BindingElement */); + var node = createNode(181 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -18936,14 +19016,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(178 /* ObjectBindingPattern */); + var node = createNode(179 /* ObjectBindingPattern */); parseExpected(17 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(18 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(179 /* ArrayBindingPattern */); + var node = createNode(180 /* ArrayBindingPattern */); parseExpected(21 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(22 /* CloseBracketToken */); @@ -18965,7 +19045,7 @@ var ts; return parseVariableDeclaration(/*allowExclamation*/ true); } function parseVariableDeclaration(allowExclamation) { - var node = createNode(230 /* VariableDeclaration */); + var node = createNode(231 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); if (allowExclamation && node.name.kind === 71 /* Identifier */ && token() === 51 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { @@ -18978,7 +19058,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(231 /* VariableDeclarationList */); + var node = createNode(232 /* VariableDeclarationList */); switch (token()) { case 104 /* VarKeyword */: break; @@ -19016,13 +19096,13 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 20 /* CloseParenToken */; } function parseVariableStatement(node) { - node.kind = 212 /* VariableStatement */; + node.kind = 213 /* VariableStatement */; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(node) { - node.kind = 232 /* FunctionDeclaration */; + node.kind = 233 /* FunctionDeclaration */; parseExpected(89 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(39 /* AsteriskToken */); node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier(); @@ -19204,7 +19284,7 @@ var ts; } function parseClassElement() { if (token() === 25 /* SemicolonToken */) { - var result = createNode(210 /* SemicolonClassElement */); + var result = createNode(211 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -19241,10 +19321,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 203 /* ClassExpression */); + return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 204 /* ClassExpression */); } function parseClassDeclaration(node) { - return parseClassDeclarationOrExpression(node, 233 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(node, 234 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(node, kind) { node.kind = kind; @@ -19287,7 +19367,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 /* ExtendsKeyword */ || tok === 108 /* ImplementsKeyword */) { - var node = createNode(266 /* HeritageClause */); + var node = createNode(267 /* HeritageClause */); node.token = tok; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -19296,7 +19376,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(205 /* ExpressionWithTypeArguments */); + var node = createNode(206 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); node.typeArguments = tryParseTypeArguments(); return finishNode(node); @@ -19313,7 +19393,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(node) { - node.kind = 234 /* InterfaceDeclaration */; + node.kind = 235 /* InterfaceDeclaration */; parseExpected(109 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -19322,7 +19402,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(node) { - node.kind = 235 /* TypeAliasDeclaration */; + node.kind = 236 /* TypeAliasDeclaration */; parseExpected(139 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -19336,13 +19416,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNodeWithJSDoc(271 /* EnumMember */); + var node = createNodeWithJSDoc(272 /* EnumMember */); node.name = parsePropertyName(); node.initializer = allowInAnd(parseInitializer); return finishNode(node); } function parseEnumDeclaration(node) { - node.kind = 236 /* EnumDeclaration */; + node.kind = 237 /* EnumDeclaration */; parseExpected(83 /* EnumKeyword */); node.name = parseIdentifier(); if (parseExpected(17 /* OpenBraceToken */)) { @@ -19355,7 +19435,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(238 /* ModuleBlock */); + var node = createNode(239 /* ModuleBlock */); if (parseExpected(17 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(18 /* CloseBraceToken */); @@ -19366,7 +19446,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(node, flags) { - node.kind = 237 /* ModuleDeclaration */; + node.kind = 238 /* ModuleDeclaration */; // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 16 /* Namespace */; @@ -19378,7 +19458,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(node) { - node.kind = 237 /* ModuleDeclaration */; + node.kind = 238 /* ModuleDeclaration */; if (token() === 143 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); @@ -19424,7 +19504,7 @@ var ts; return nextToken() === 41 /* SlashToken */; } function parseNamespaceExportDeclaration(node) { - node.kind = 240 /* NamespaceExportDeclaration */; + node.kind = 241 /* NamespaceExportDeclaration */; parseExpected(118 /* AsKeyword */); parseExpected(130 /* NamespaceKeyword */); node.name = parseIdentifier(); @@ -19442,7 +19522,7 @@ var ts; } } // Import statement - node.kind = 242 /* ImportDeclaration */; + node.kind = 243 /* ImportDeclaration */; // ImportDeclaration: // import ImportClause from ModuleSpecifier ; // import ModuleSpecifier; @@ -19457,7 +19537,7 @@ var ts; return finishNode(node); } function parseImportEqualsDeclaration(node, identifier) { - node.kind = 241 /* ImportEqualsDeclaration */; + node.kind = 242 /* ImportEqualsDeclaration */; node.name = identifier; parseExpected(58 /* EqualsToken */); node.moduleReference = parseModuleReference(); @@ -19471,7 +19551,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(243 /* ImportClause */, fullStart); + var importClause = createNode(244 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -19481,7 +19561,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(26 /* CommaToken */)) { - importClause.namedBindings = token() === 39 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(245 /* NamedImports */); + importClause.namedBindings = token() === 39 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(246 /* NamedImports */); } return finishNode(importClause); } @@ -19491,7 +19571,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(252 /* ExternalModuleReference */); + var node = createNode(253 /* ExternalModuleReference */); parseExpected(133 /* RequireKeyword */); parseExpected(19 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -19514,7 +19594,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(244 /* NamespaceImport */); + var namespaceImport = createNode(245 /* NamespaceImport */); parseExpected(39 /* AsteriskToken */); parseExpected(118 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -19529,14 +19609,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 245 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 17 /* OpenBraceToken */, 18 /* CloseBraceToken */); + node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 246 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 17 /* OpenBraceToken */, 18 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(250 /* ExportSpecifier */); + return parseImportOrExportSpecifier(251 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(246 /* ImportSpecifier */); + return parseImportOrExportSpecifier(247 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -19561,19 +19641,19 @@ var ts; else { node.name = identifierName; } - if (kind === 246 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 247 /* ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(node) { - node.kind = 248 /* ExportDeclaration */; + node.kind = 249 /* ExportDeclaration */; if (parseOptional(39 /* AsteriskToken */)) { parseExpected(142 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(249 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(250 /* 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. @@ -19586,7 +19666,7 @@ var ts; return finishNode(node); } function parseExportAssignment(node) { - node.kind = 247 /* ExportAssignment */; + node.kind = 248 /* ExportAssignment */; if (parseOptional(58 /* EqualsToken */)) { node.isExportEquals = true; } @@ -19600,10 +19680,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1 /* Export */) - || node.kind === 241 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 252 /* ExternalModuleReference */ - || node.kind === 242 /* ImportDeclaration */ - || node.kind === 247 /* ExportAssignment */ - || node.kind === 248 /* ExportDeclaration */ + || node.kind === 242 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 253 /* ExternalModuleReference */ + || node.kind === 243 /* ImportDeclaration */ + || node.kind === 248 /* ExportAssignment */ + || node.kind === 249 /* ExportDeclaration */ ? node : undefined; }); @@ -19656,7 +19736,7 @@ var ts; JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; // Parses out a JSDoc type expression. function parseJSDocTypeExpression(mayOmitBraces) { - var result = createNode(274 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(275 /* JSDocTypeExpression */, scanner.getTokenPos()); var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(17 /* OpenBraceToken */); result.type = doInsideOfContext(1048576 /* JSDoc */, parseJSDocType); if (!mayOmitBraces || hasBrace) { @@ -19827,7 +19907,7 @@ var ts; } } function createJSDocComment() { - var result = createNode(282 /* JSDocComment */, start); + var result = createNode(283 /* JSDocComment */, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -19952,7 +20032,7 @@ var ts; return comments.length === 0 ? undefined : comments.join(""); } function parseUnknownTag(atToken, tagName) { - var result = createNode(284 /* JSDocTag */, atToken.pos); + var result = createNode(285 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -20009,9 +20089,9 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 /* Parameter */ ? - createNode(287 /* JSDocParameterTag */, atToken.pos) : - createNode(292 /* JSDocPropertyTag */, atToken.pos); - var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); + createNode(288 /* JSDocParameterTag */, atToken.pos) : + createNode(293 /* JSDocPropertyTag */, atToken.pos); + var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; isNameFirst = true; @@ -20024,18 +20104,20 @@ var ts; result.isBracketed = isBracketed; return finishNode(result); } - function parseNestedTypeLiteral(typeExpression, name) { + function parseNestedTypeLiteral(typeExpression, name, target) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(274 /* JSDocTypeExpression */, scanner.getTokenPos()); + var typeLiteralExpression = createNode(275 /* JSDocTypeExpression */, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); var children = void 0; - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(1 /* Parameter */, name); })) { - children = ts.append(children, child); + while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, name); })) { + if (child.kind === 288 /* JSDocParameterTag */ || child.kind === 293 /* JSDocPropertyTag */) { + children = ts.append(children, child); + } } if (children) { - jsdocTypeLiteral = createNode(283 /* JSDocTypeLiteral */, start_2); + jsdocTypeLiteral = createNode(284 /* JSDocTypeLiteral */, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 166 /* ArrayType */) { jsdocTypeLiteral.isArrayType = true; @@ -20046,27 +20128,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 288 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 289 /* JSDocReturnTag */; })) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(288 /* JSDocReturnTag */, atToken.pos); + var result = createNode(289 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 289 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 290 /* JSDocTypeTag */; })) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(289 /* JSDocTypeTag */, atToken.pos); + var result = createNode(290 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(285 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(286 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -20074,7 +20156,7 @@ var ts; } function parseExpressionWithTypeArgumentsForAugments() { var usedBrace = parseOptional(17 /* OpenBraceToken */); - var node = createNode(205 /* ExpressionWithTypeArguments */); + var node = createNode(206 /* ExpressionWithTypeArguments */); node.expression = parsePropertyAccessEntityNameExpression(); node.typeArguments = tryParseTypeArguments(); var res = finishNode(node); @@ -20086,7 +20168,7 @@ var ts; function parsePropertyAccessEntityNameExpression() { var node = parseJSDocIdentifierName(/*createIfMissing*/ true); while (parseOptional(23 /* DotToken */)) { - var prop = createNode(183 /* PropertyAccessExpression */, node.pos); + var prop = createNode(184 /* PropertyAccessExpression */, node.pos); prop.expression = node; prop.name = parseJSDocIdentifierName(); node = finishNode(prop); @@ -20094,7 +20176,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(286 /* JSDocClassTag */, atToken.pos); + var tag = createNode(287 /* JSDocClassTag */, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -20102,7 +20184,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(291 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(292 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); @@ -20125,11 +20207,11 @@ var ts; var jsdocTypeLiteral = void 0; var childTypeTag = void 0; var start_3 = scanner.getStartPos(); - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0 /* Property */); })) { + while (child = tryParse(function () { return parseChildPropertyTag(); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(283 /* JSDocTypeLiteral */, start_3); + jsdocTypeLiteral = createNode(284 /* JSDocTypeLiteral */, start_3); } - if (child.kind === 289 /* JSDocTypeTag */) { + if (child.kind === 290 /* JSDocTypeTag */) { if (childTypeTag) { break; } @@ -20155,7 +20237,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(23 /* DotToken */)) { - var jsDocNamespaceNode = createNode(237 /* ModuleDeclaration */, pos); + var jsDocNamespaceNode = createNode(238 /* ModuleDeclaration */, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */); @@ -20179,6 +20261,9 @@ var ts; } return a.escapedText === b.escapedText; } + function parseChildPropertyTag() { + return parseChildParameterOrPropertyTag(0 /* Property */); + } function parseChildParameterOrPropertyTag(target, name) { var canParseTag = true; var seenAsterisk = false; @@ -20187,7 +20272,7 @@ var ts; case 57 /* AtToken */: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 287 /* JSDocParameterTag */ && + if (child && child.kind === 288 /* JSDocParameterTag */ && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -20272,7 +20357,7 @@ var ts; break; } } - var result = createNode(290 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(291 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -21034,24 +21119,24 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: return 0 /* NonInstantiated */; // 2. const enum declarations - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: if (ts.isConst(node)) { return 2 /* ConstEnumOnly */; } break; // 3. non-exported import declarations - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: if (!(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } break; // 4. other uninstantiated module declarations. - case 238 /* ModuleBlock */: { + case 239 /* ModuleBlock */: { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateWorker(n); @@ -21073,7 +21158,7 @@ var ts; }); return state_1; } - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return getModuleInstanceState(node); case 71 /* Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -21220,7 +21305,7 @@ var ts; if (symbolFlags & 67216319 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 237 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 238 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -21229,7 +21314,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 === 247 /* ExportAssignment */) { + if (node.kind === 248 /* ExportAssignment */) { return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */; } var name = ts.getNameOfDeclaration(node); @@ -21260,28 +21345,28 @@ var ts; return "__new" /* New */; case 159 /* IndexSignature */: return "__index" /* Index */; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return "__export" /* ExportStar */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (ts.getSpecialPropertyAssignmentKind(node) === 2 /* ModuleExports */) { // module.exports = ... return "export=" /* ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: return (ts.hasModifier(node, 512 /* Default */) ? "default" /* Default */ : undefined); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */); case 148 /* 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 === 280 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); + ts.Debug.assert(node.parent.kind === 281 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: var name_2 = ts.getNameOfJSDocTypedef(node); return typeof name_2 !== "undefined" ? name_2.escapedText : undefined; } @@ -21374,7 +21459,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 && - (isDefaultExport || (node.kind === 247 /* ExportAssignment */ && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 248 /* ExportAssignment */ && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -21399,7 +21484,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 2097152 /* Alias */) { - if (node.kind === 250 /* ExportSpecifier */ || (node.kind === 241 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 251 /* ExportSpecifier */ || (node.kind === 242 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -21421,7 +21506,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - if (node.kind === 291 /* JSDocTypedefTag */) + if (node.kind === 292 /* JSDocTypedefTag */) ts.Debug.assert(ts.isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. var isJSDocTypedefInJSDocNamespace = ts.isJSDocTypedefTag(node) && node.name && node.name.kind === 71 /* Identifier */ && node.name.isInJSDocNamespace; if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32 /* ExportContext */)) || isJSDocTypedefInJSDocNamespace) { @@ -21464,7 +21549,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 /* IsContainer */) { - if (node.kind !== 191 /* ArrowFunction */) { + if (node.kind !== 192 /* ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -21508,7 +21593,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { node.flags |= emitFlags; } if (currentReturnTarget) { @@ -21557,8 +21642,8 @@ var ts; } } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 232 /* FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 232 /* FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 233 /* FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 233 /* FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -21607,79 +21692,79 @@ var ts; return; } switch (node.kind) { - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: bindWhileStatement(node); break; - case 216 /* DoStatement */: + case 217 /* DoStatement */: bindDoStatement(node); break; - case 218 /* ForStatement */: + case 219 /* ForStatement */: bindForStatement(node); break; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 215 /* IfStatement */: + case 216 /* IfStatement */: bindIfStatement(node); break; - case 223 /* ReturnStatement */: - case 227 /* ThrowStatement */: + case 224 /* ReturnStatement */: + case 228 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 228 /* TryStatement */: + case 229 /* TryStatement */: bindTryStatement(node); break; - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: bindSwitchStatement(node); break; - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: bindCaseBlock(node); break; - case 264 /* CaseClause */: + case 265 /* CaseClause */: bindCaseClause(node); break; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: bindLabeledStatement(node); break; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: bindBinaryExpressionFlow(node); break; - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 185 /* CallExpression */: + case 186 /* CallExpression */: bindCallExpressionFlow(node); break; - case 282 /* JSDocComment */: + case 283 /* JSDocComment */: bindJSDocComment(node); break; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: bindJSDocTypedefTag(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 272 /* SourceFile */: + case 273 /* SourceFile */: bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; - case 211 /* Block */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 239 /* ModuleBlock */: bindEachFunctionsFirst(node.statements); break; default: @@ -21691,15 +21776,15 @@ var ts; switch (expr.kind) { case 71 /* Identifier */: case 99 /* ThisKeyword */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return isNarrowableReference(expr); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return hasNarrowableArgument(expr); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isNarrowingExpression(expr.expression); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return expr.operator === 51 /* ExclamationToken */ && isNarrowingExpression(expr.operand); } return false; @@ -21708,7 +21793,7 @@ var ts; return expr.kind === 71 /* Identifier */ || expr.kind === 99 /* ThisKeyword */ || expr.kind === 97 /* SuperKeyword */ || - expr.kind === 183 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); + expr.kind === 184 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -21719,7 +21804,7 @@ var ts; } } } - if (expr.expression.kind === 183 /* PropertyAccessExpression */ && + if (expr.expression.kind === 184 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression.expression)) { return true; } @@ -21752,9 +21837,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (expr.operatorToken.kind) { case 58 /* EqualsToken */: return isNarrowableOperand(expr.left); @@ -21832,33 +21917,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 215 /* IfStatement */: - case 217 /* WhileStatement */: - case 216 /* DoStatement */: + case 216 /* IfStatement */: + case 218 /* WhileStatement */: + case 217 /* DoStatement */: return parent.expression === node; - case 218 /* ForStatement */: - case 199 /* ConditionalExpression */: + case 219 /* ForStatement */: + case 200 /* ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 189 /* ParenthesizedExpression */) { + if (node.kind === 190 /* ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 196 /* PrefixUnaryExpression */ && node.operator === 51 /* ExclamationToken */) { + else if (node.kind === 197 /* PrefixUnaryExpression */ && node.operator === 51 /* ExclamationToken */) { node = node.operand; } else { - return node.kind === 198 /* BinaryExpression */ && (node.operatorToken.kind === 53 /* AmpersandAmpersandToken */ || + return node.kind === 199 /* BinaryExpression */ && (node.operatorToken.kind === 53 /* AmpersandAmpersandToken */ || node.operatorToken.kind === 54 /* BarBarToken */); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 189 /* ParenthesizedExpression */ || - node.parent.kind === 196 /* PrefixUnaryExpression */ && + while (node.parent.kind === 190 /* ParenthesizedExpression */ || + node.parent.kind === 197 /* PrefixUnaryExpression */ && node.parent.operator === 51 /* ExclamationToken */) { node = node.parent; } @@ -21900,7 +21985,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 226 /* LabeledStatement */ + var enclosingLabeledStatement = node.parent.kind === 227 /* LabeledStatement */ ? ts.lastOrUndefined(activeLabels) : undefined; // if do statement is wrapped in labeled statement then target labels for break/continue with or without @@ -21934,13 +22019,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 220 /* ForOfStatement */) { + if (node.kind === 221 /* ForOfStatement */) { bind(node.awaitModifier); } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 231 /* VariableDeclarationList */) { + if (node.initializer.kind !== 232 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -21962,7 +22047,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 223 /* ReturnStatement */) { + if (node.kind === 224 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -21982,7 +22067,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 222 /* BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 223 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -22078,7 +22163,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 265 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 266 /* 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). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -22145,14 +22230,14 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 216 /* DoStatement */) { + if (!node.statement || node.statement.kind !== 217 /* DoStatement */) { // do statement sets current flow inside bindDoStatement addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 198 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */) { + if (node.kind === 199 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -22163,10 +22248,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 181 /* ArrayLiteralExpression */) { + else if (node.kind === 182 /* ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 202 /* SpreadElement */) { + if (e.kind === 203 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -22174,16 +22259,16 @@ var ts; } } } - else if (node.kind === 182 /* ObjectLiteralExpression */) { + else if (node.kind === 183 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 268 /* PropertyAssignment */) { + if (p.kind === 269 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 269 /* ShorthandPropertyAssignment */) { + else if (p.kind === 270 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 270 /* SpreadAssignment */) { + else if (p.kind === 271 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -22239,7 +22324,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 58 /* EqualsToken */ && node.left.kind === 184 /* ElementAccessExpression */) { + if (operator === 58 /* EqualsToken */ && node.left.kind === 185 /* ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -22250,7 +22335,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 183 /* PropertyAccessExpression */) { + if (node.expression.kind === 184 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -22289,7 +22374,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 291 /* JSDocTypedefTag */) { + if (n.kind !== 292 /* JSDocTypedefTag */) { bind(n); } }); @@ -22310,10 +22395,10 @@ 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 = node.expression; - while (expr.kind === 189 /* ParenthesizedExpression */) { + while (expr.kind === 190 /* ParenthesizedExpression */) { expr = expr.expression; } - if (expr.kind === 190 /* FunctionExpression */ || expr.kind === 191 /* ArrowFunction */) { + if (expr.kind === 191 /* FunctionExpression */ || expr.kind === 192 /* ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -22321,7 +22406,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 183 /* PropertyAccessExpression */) { + if (node.expression.kind === 184 /* PropertyAccessExpression */) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -22330,21 +22415,21 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 182 /* ObjectLiteralExpression */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 183 /* ObjectLiteralExpression */: case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: - case 261 /* JsxAttributes */: + case 284 /* JSDocTypeLiteral */: + case 262 /* JsxAttributes */: return 1 /* IsContainer */; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 237 /* ModuleDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 238 /* ModuleDeclaration */: + case 236 /* TypeAliasDeclaration */: case 176 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 272 /* SourceFile */: + case 273 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; case 153 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -22352,31 +22437,31 @@ var ts; } // falls through case 154 /* Constructor */: - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 157 /* CallSignature */: - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: case 162 /* FunctionType */: case 158 /* ConstructSignature */: case 159 /* IndexSignature */: case 163 /* ConstructorType */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; case 151 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 267 /* CatchClause */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 239 /* CaseBlock */: + case 268 /* CatchClause */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 240 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 211 /* Block */: + case 212 /* 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 @@ -22409,20 +22494,20 @@ 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 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 272 /* SourceFile */: + case 273 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: - case 182 /* ObjectLiteralExpression */: - case 234 /* InterfaceDeclaration */: - case 261 /* JsxAttributes */: + case 284 /* JSDocTypeLiteral */: + case 183 /* ObjectLiteralExpression */: + case 235 /* InterfaceDeclaration */: + case 262 /* 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 @@ -22439,11 +22524,11 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 280 /* JSDocFunctionType */: - case 235 /* TypeAliasDeclaration */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 281 /* JSDocFunctionType */: + case 236 /* TypeAliasDeclaration */: case 176 /* MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, @@ -22465,11 +22550,11 @@ var ts; : declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 272 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 272 /* SourceFile */ || body.kind === 238 /* ModuleBlock */)) { + var body = node.kind === 273 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 273 /* SourceFile */ || body.kind === 239 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 248 /* ExportDeclaration */ || stat.kind === 247 /* ExportAssignment */) { + if (stat.kind === 249 /* ExportDeclaration */ || stat.kind === 248 /* ExportAssignment */) { return true; } } @@ -22553,7 +22638,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 270 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { + if (prop.kind === 271 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { continue; } var identifier = prop.name; @@ -22565,7 +22650,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 268 /* PropertyAssignment */ || prop.kind === 269 /* ShorthandPropertyAssignment */ || prop.kind === 153 /* MethodDeclaration */ + var currentKind = prop.kind === 269 /* PropertyAssignment */ || prop.kind === 270 /* ShorthandPropertyAssignment */ || prop.kind === 153 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); @@ -22596,10 +22681,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -22709,8 +22794,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 272 /* SourceFile */ && - blockScopeContainer.kind !== 237 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 273 /* SourceFile */ && + blockScopeContainer.kind !== 238 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -22812,7 +22897,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 291 /* JSDocTypedefTag */) { + if (tag.kind === 292 /* JSDocTypedefTag */) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -22851,7 +22936,7 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 291 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 292 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 67901928 /* TypeAliasExcludes */); @@ -22859,11 +22944,11 @@ var ts; } // falls through case 99 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 269 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 270 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } @@ -22871,7 +22956,7 @@ var ts; bindSpecialPropertyDeclaration(node); } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { case 1 /* ExportsProperty */: @@ -22899,17 +22984,17 @@ var ts; ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return checkStrictModeCatchClause(node); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return checkStrictModeWithStatement(node); case 173 /* ThisType */: seenThisKeyword = true; @@ -22920,18 +23005,18 @@ var ts; return bindTypeParameter(node); case 148 /* Parameter */: return bindParameter(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return bindPropertyWorker(node); - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 271 /* EnumMember */: + case 272 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */); case 157 /* CallSignature */: case 158 /* ConstructSignature */: @@ -22944,7 +23029,7 @@ var ts; // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67208127 /* MethodExcludes */); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return bindFunctionDeclaration(node); case 154 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); @@ -22953,78 +23038,78 @@ var ts; case 156 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67183551 /* SetAccessorExcludes */); case 162 /* FunctionType */: - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: case 163 /* ConstructorType */: return bindFunctionOrConstructorType(node); case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: + case 284 /* JSDocTypeLiteral */: case 176 /* MappedType */: return bindAnonymousTypeWorker(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return bindFunctionExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 67901832 /* InterfaceExcludes */); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67901928 /* TypeAliasExcludes */); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return bindJsxAttributes(node); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); // Imports and exports - case 241 /* ImportEqualsDeclaration */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 242 /* ImportEqualsDeclaration */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return bindImportClause(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return bindExportDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return bindExportAssignment(node); - case 272 /* SourceFile */: + case 273 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 211 /* Block */: + case 212 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } // falls through - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 287 /* JSDocParameterTag */: - if (node.parent.kind !== 283 /* JSDocTypeLiteral */) { + case 288 /* JSDocParameterTag */: + if (node.parent.kind !== 284 /* JSDocTypeLiteral */) { break; } // falls through - case 292 /* JSDocPropertyTag */: + case 293 /* JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 279 /* JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 280 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); - case 291 /* JSDocTypedefTag */: { + case 292 /* JSDocTypedefTag */: { var fullName = node.fullName; if (!fullName || fullName.kind === 71 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67901928 /* TypeAliasExcludes */); @@ -23054,7 +23139,7 @@ var ts; bindAnonymousDeclaration(node, 2097152 /* Alias */, getDeclarationName(node)); } else { - var flags = node.kind === 247 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 248 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) // An export default clause with an EntityNameExpression exports all meanings of that identifier ? 2097152 /* Alias */ // An export default clause with any other expression exports a value @@ -23068,7 +23153,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 272 /* SourceFile */) { + if (node.parent.kind !== 273 /* SourceFile */) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -23145,8 +23230,8 @@ var ts; ts.Debug.assert(ts.isInJavaScriptFile(node)); var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* 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 === 58 /* EqualsToken */) { @@ -23173,7 +23258,7 @@ var ts; var symbolTable = ts.hasModifier(thisContainer, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* Property */, 0 /* None */, /*isReplaceableByMethod*/ true); break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: // this.foo assignment in a source file // Do not bind. It would be nice to support this someday though. break; @@ -23185,7 +23270,7 @@ var ts; if (node.expression.kind === 99 /* ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 272 /* SourceFile */) { + else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 273 /* SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -23245,9 +23330,9 @@ var ts; function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) { var symbol = getJSInitializerSymbolFromName(name); var isToplevelNamespaceableInitializer = ts.isBinaryExpression(propertyAccess.parent) - ? propertyAccess.parent.parent.parent.kind === 272 /* SourceFile */ && - !!ts.getJavascriptInitializer(propertyAccess.parent.right, ts.isPrototypeAccess(propertyAccess.parent.left)) - : propertyAccess.parent.parent.kind === 272 /* SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 273 /* SourceFile */ && + !!ts.getJavascriptInitializer(ts.getInitializerOfBinaryExpression(propertyAccess.parent), ts.isPrototypeAccess(propertyAccess.parent.left)) + : propertyAccess.parent.parent.kind === 273 /* SourceFile */; if (!isPrototypeProperty && (!symbol || !(symbol.flags & 1920 /* Namespace */)) && isToplevelNamespaceableInitializer) { // make symbols or add declarations for intermediate containers var flags_1 = 1536 /* Module */ | 67108864 /* JSContainer */; @@ -23271,10 +23356,18 @@ var ts; (symbol.members || (symbol.members = ts.createSymbolTable())) : (symbol.exports || (symbol.exports = ts.createSymbolTable())); // Declare the method/property - var symbolFlags = 4 /* Property */ | (isToplevelNamespaceableInitializer ? 67108864 /* JSContainer */ : 0); - var symbolExcludes = 0 /* PropertyExcludes */ & ~(isToplevelNamespaceableInitializer ? 67108864 /* JSContainer */ : 0); + var jsContainerFlag = isToplevelNamespaceableInitializer ? 67108864 /* JSContainer */ : 0; + var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(propertyAccess)); + var symbolFlags = (isMethod ? 8192 /* Method */ : 4 /* Property */) | jsContainerFlag; + var symbolExcludes = (isMethod ? 67208127 /* MethodExcludes */ : 0 /* PropertyExcludes */) & ~jsContainerFlag; declareSymbol(symbolTable, symbol, propertyAccess, symbolFlags, symbolExcludes); } + function getParentOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.parent)) { + expr = expr.parent; + } + return expr.parent; + } function lookupSymbolForPropertyAccess(node, lookupContainer) { if (lookupContainer === void 0) { lookupContainer = container; } if (ts.isIdentifier(node)) { @@ -23306,7 +23399,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */); } else { @@ -23465,13 +23558,13 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 213 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 214 /* EmptyStatement */) || // report error on class declarations - node.kind === 233 /* ClassDeclaration */ || + node.kind === 234 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 237 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 238 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 236 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 237 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; // unreachable code is reported if @@ -23485,7 +23578,7 @@ var ts; // On the other side we do want to report errors on non-initialized 'lets' because of TDZ var reportUnreachableCode = !options.allowUnreachableCode && !(node.flags & 2097152 /* Ambient */) && - (node.kind !== 212 /* VariableStatement */ || + (node.kind !== 213 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -23528,43 +23621,43 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: return computeCallExpression(node, subtreeFlags); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return computeNewExpression(node, subtreeFlags); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return computeModuleDeclaration(node, subtreeFlags); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return computeParenthesizedExpression(node, subtreeFlags); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return computeBinaryExpression(node, subtreeFlags); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return computeExpressionStatement(node, subtreeFlags); case 148 /* Parameter */: return computeParameter(node, subtreeFlags); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return computeArrowFunction(node, subtreeFlags); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return computeFunctionExpression(node, subtreeFlags); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return computeFunctionDeclaration(node, subtreeFlags); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return computeVariableDeclaration(node, subtreeFlags); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return computeVariableDeclarationList(node, subtreeFlags); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return computeVariableStatement(node, subtreeFlags); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return computeLabeledStatement(node, subtreeFlags); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return computeClassDeclaration(node, subtreeFlags); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return computeCatchClause(node, subtreeFlags); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); case 154 /* Constructor */: return computeConstructor(node, subtreeFlags); @@ -23575,11 +23668,11 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: return computeAccessor(node, subtreeFlags); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return computeImportEquals(node, subtreeFlags); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return computePropertyAccess(node, subtreeFlags); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return computeElementAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -23631,12 +23724,12 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 182 /* ObjectLiteralExpression */) { + if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 183 /* ObjectLiteralExpression */) { // Destructuring object assignments with are ES2015 syntax // and possibly ESNext if they contain rest transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } - else if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 181 /* ArrayLiteralExpression */) { + else if (operatorTokenKind === 58 /* EqualsToken */ && leftKind === 182 /* ArrayLiteralExpression */) { // Destructuring assignments are ES2015 syntax. transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } @@ -23685,8 +23778,8 @@ var ts; // If the node is synthesized, it means the emitter put the parentheses there, // not the user. If we didn't want them, the emitter would not have put them // there. - if (expressionKind === 206 /* AsExpression */ - || expressionKind === 188 /* TypeAssertionExpression */) { + if (expressionKind === 207 /* AsExpression */ + || expressionKind === 189 /* TypeAssertionExpression */) { transformFlags |= 3 /* AssertTypeScript */; } // If the expression of a ParenthesizedExpression is a destructuring assignment, @@ -24063,13 +24156,13 @@ var ts; var excludeFlags = 939525441 /* NodeExcludes */; switch (kind) { case 120 /* AsyncKeyword */: - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: // async/await is ES2017 syntax, but may be ESNext syntax (for async generators) transformFlags |= 8 /* AssertESNext */ | 16 /* AssertES2017 */; break; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: - case 295 /* PartiallyEmittedExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: + case 296 /* PartiallyEmittedExpression */: // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; excludeFlags = 536872257 /* OuterExpressionExcludes */; @@ -24080,25 +24173,25 @@ var ts; case 117 /* AbstractKeyword */: case 124 /* DeclareKeyword */: case 76 /* ConstKeyword */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 207 /* NonNullExpression */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 208 /* NonNullExpression */: case 132 /* ReadonlyKeyword */: // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; break; - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: case 10 /* JsxText */: - case 256 /* JsxClosingElement */: - case 257 /* JsxFragment */: - case 258 /* JsxOpeningFragment */: - case 259 /* JsxClosingFragment */: - case 260 /* JsxAttribute */: - case 261 /* JsxAttributes */: - case 262 /* JsxSpreadAttribute */: - case 263 /* JsxExpression */: + case 257 /* JsxClosingElement */: + case 258 /* JsxFragment */: + case 259 /* JsxOpeningFragment */: + case 260 /* JsxClosingFragment */: + case 261 /* JsxAttribute */: + case 262 /* JsxAttributes */: + case 263 /* JsxSpreadAttribute */: + case 264 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; @@ -24106,11 +24199,11 @@ var ts; case 14 /* TemplateHead */: case 15 /* TemplateMiddle */: case 16 /* TemplateTail */: - case 200 /* TemplateExpression */: - case 187 /* TaggedTemplateExpression */: - case 269 /* ShorthandPropertyAssignment */: + case 201 /* TemplateExpression */: + case 188 /* TaggedTemplateExpression */: + case 270 /* ShorthandPropertyAssignment */: case 115 /* StaticKeyword */: - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: // These nodes are ES6 syntax. transformFlags |= 192 /* AssertES2015 */; break; @@ -24124,14 +24217,14 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: // This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of). if (node.awaitModifier) { transformFlags |= 8 /* AssertESNext */; } transformFlags |= 192 /* AssertES2015 */; break; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: // This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async // generator). transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; @@ -24163,14 +24256,14 @@ var ts; case 170 /* ConditionalType */: case 171 /* InferType */: case 172 /* ParenthesizedType */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: case 173 /* ThisType */: case 174 /* TypeOperator */: case 175 /* IndexedAccessType */: case 176 /* MappedType */: case 177 /* LiteralType */: - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: // Types and signatures are TypeScript syntax, and exclude all other facts. transformFlags = 3 /* AssertTypeScript */; excludeFlags = -3 /* TypeExcludes */; @@ -24192,10 +24285,10 @@ var ts; transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */; } break; - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 97 /* SuperKeyword */: @@ -24207,18 +24300,18 @@ var ts; // Mark this node and its ancestors as containing a lexical `this` keyword. transformFlags |= 16384 /* ContainsLexicalThis */; break; - case 178 /* ObjectBindingPattern */: + case 179 /* ObjectBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; if (subtreeFlags & 524288 /* ContainsRest */) { transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */; } excludeFlags = 940049729 /* BindingPatternExcludes */; break; - case 179 /* ArrayBindingPattern */: + case 180 /* ArrayBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; excludeFlags = 940049729 /* BindingPatternExcludes */; break; - case 180 /* BindingElement */: + case 181 /* BindingElement */: transformFlags |= 192 /* AssertES2015 */; if (node.dotDotDotToken) { transformFlags |= 524288 /* ContainsRest */; @@ -24228,7 +24321,7 @@ var ts; // This node is TypeScript syntax, and marks its container as also being TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */; break; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: excludeFlags = 942740801 /* ObjectLiteralExcludes */; if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) { // If an ObjectLiteralExpression contains a ComputedPropertyName, then it @@ -24246,8 +24339,8 @@ var ts; transformFlags |= 8 /* AssertESNext */; } break; - case 181 /* ArrayLiteralExpression */: - case 186 /* NewExpression */: + case 182 /* ArrayLiteralExpression */: + case 187 /* NewExpression */: excludeFlags = 940049729 /* ArrayLiteralOrCallOrNewExcludes */; if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadExpression, then it is an ES6 @@ -24255,23 +24348,23 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 223 /* ReturnStatement */: - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 224 /* ReturnStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } @@ -24287,27 +24380,27 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 160 /* FirstTypeNode */ && kind <= 177 /* LastTypeNode */) { + if (kind >= 160 /* FirstTypeNode */ && kind <= 178 /* LastTypeNode */) { return -3 /* TypeExcludes */; } switch (kind) { - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 181 /* ArrayLiteralExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 182 /* ArrayLiteralExpression */: return 940049729 /* ArrayLiteralOrCallOrNewExcludes */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return 977327425 /* ModuleExcludes */; case 148 /* Parameter */: return 939525441 /* ParameterExcludes */; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return 1003902273 /* ArrowFunctionExcludes */; - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: return 1003935041 /* FunctionExcludes */; - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return 948962625 /* VariableDeclarationListExcludes */; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return 942011713 /* ClassExcludes */; case 154 /* Constructor */: return 1003668801 /* ConstructorExcludes */; @@ -24329,24 +24422,24 @@ var ts; case 157 /* CallSignature */: case 158 /* ConstructSignature */: case 159 /* IndexSignature */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return 942740801 /* ObjectLiteralExcludes */; - case 267 /* CatchClause */: + case 268 /* CatchClause */: return 940574017 /* CatchClauseExcludes */; - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: return 940049729 /* BindingPatternExcludes */; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: - case 295 /* PartiallyEmittedExpression */: - case 189 /* ParenthesizedExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: + case 296 /* PartiallyEmittedExpression */: + case 190 /* ParenthesizedExpression */: case 97 /* SuperKeyword */: return 536872257 /* OuterExpressionExcludes */; - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: return 671089985 /* PropertyAccessExcludes */; default: return 939525441 /* NodeExcludes */; @@ -25174,6 +25267,7 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); } + ts.Debug.assert(host.fileExists(real), path + " linked to nonexistent file " + real); // tslint:disable-line return real; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { @@ -25819,7 +25913,7 @@ var ts; return node ? getConstantValue(node) : undefined; }, isValidPropertyAccess: function (node, propertyName) { - node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); + node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedNameOrImportTypeNode); return !!node && isValidPropertyAccess(node, ts.escapeLeadingUnderscores(propertyName)); }, isValidPropertyAccessForCompletions: function (node, type, property) { @@ -25888,6 +25982,7 @@ var ts; getAllPossiblePropertiesOfTypes: getAllPossiblePropertiesOfTypes, getSuggestionForNonexistentProperty: function (node, type) { return getSuggestionForNonexistentProperty(node, type); }, getSuggestionForNonexistentSymbol: function (location, name, meaning) { return getSuggestionForNonexistentSymbol(location, ts.escapeLeadingUnderscores(name), meaning); }, + getSuggestionForNonexistentModule: function (node, target) { return getSuggestionForNonexistentModule(node, target); }, getBaseConstraintOfType: getBaseConstraintOfType, getDefaultFromTypeParameter: function (type) { return type && type.flags & 32768 /* TypeParameter */ ? getDefaultFromTypeParameter(type) : undefined; }, resolveName: function (name, location, meaning, excludeGlobals) { @@ -26451,7 +26546,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 237 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 237 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 238 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 238 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } @@ -26581,7 +26676,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 }); } function isGlobalSourceFile(node) { - return node.kind === 272 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 273 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -26639,17 +26734,17 @@ var ts; } if (declaration.pos <= usage.pos) { // declaration is before usage - if (declaration.kind === 180 /* BindingElement */) { + if (declaration.kind === 181 /* 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, 180 /* BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 181 /* 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, 230 /* VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 231 /* VariableDeclaration */), usage); } - else if (declaration.kind === 230 /* VariableDeclaration */) { + else if (declaration.kind === 231 /* VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -26663,12 +26758,12 @@ var ts; // 5. inside a TS export= declaration (since we will move the export statement during emit to avoid TDZ) // or if usage is in a type context: // 1. inside a type query (typeof in type position) - if (usage.parent.kind === 250 /* ExportSpecifier */ || (usage.parent.kind === 247 /* ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 251 /* ExportSpecifier */ || (usage.parent.kind === 248 /* 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 === 247 /* ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 248 /* ExportAssignment */ && usage.isExportEquals) { return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -26676,9 +26771,9 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 212 /* VariableStatement */: - case 218 /* ForStatement */: - case 220 /* ForOfStatement */: + case 213 /* VariableStatement */: + case 219 /* ForStatement */: + case 221 /* 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, container)) { @@ -26748,7 +26843,7 @@ 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 & 67901928 /* Type */ && lastLocation.kind !== 282 /* JSDocComment */) { + if (meaning & result.flags & 67901928 /* Type */ && lastLocation.kind !== 283 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || @@ -26782,14 +26877,14 @@ var ts; } } switch (location.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 272 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 273 /* SourceFile */ || ts.isAmbientModule(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" /* Default */)) { @@ -26813,7 +26908,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && - ts.getDeclarationOfKind(moduleExport, 250 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExport, 251 /* ExportSpecifier */)) { break; } } @@ -26821,7 +26916,7 @@ var ts; break loop; } break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } @@ -26844,9 +26939,9 @@ var ts; } } break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: if (result = lookup(getMembersOfSymbol(getSymbolOfNode(location)), name, meaning & 67901928 /* Type */)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { // ignore type parameters not declared in this container @@ -26862,7 +26957,7 @@ var ts; } break loop; } - if (location.kind === 203 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 204 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -26870,7 +26965,7 @@ var ts; } } break; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 85 /* ExtendsKeyword */) { var container = location.parent.parent; @@ -26892,7 +26987,7 @@ var ts; // case 146 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 234 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 235 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67901928 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -26905,14 +27000,14 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -26957,12 +27052,12 @@ var ts; // We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`. // If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself. // That means that this is a self-reference of `lastLocation`, and shouldn't count this when considering whether `lastLocation` is used. - if (isUse && result && nameNotFoundMessage && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { + if (isUse && result && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { result.isReferenced |= meaning; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 272 /* SourceFile */); + ts.Debug.assert(lastLocation.kind === 273 /* SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports") { return lastLocation.symbol; } @@ -27023,9 +27118,9 @@ var ts; } } // If we're in an external module, we can't reference value symbols created from UMD export declarations - if (result && isInExternalModule && (meaning & 67216319 /* Value */) === 67216319 /* Value */) { + if (result && isInExternalModule && (meaning & 67216319 /* Value */) === 67216319 /* Value */ && !(originalLocation.flags & 1048576 /* JSDoc */)) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 240 /* NamespaceExportDeclaration */) { + if (decls && decls.length === 1 && decls[0].kind === 241 /* NamespaceExportDeclaration */) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); } } @@ -27034,12 +27129,12 @@ var ts; } function isSelfReferenceLocation(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 237 /* ModuleDeclaration */: // For `namespace N { N; }` + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 238 /* ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -27104,9 +27199,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 71 /* Identifier */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -27170,7 +27265,7 @@ var ts; function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */)); // Block-scoped variables cannot be used before their definition - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 236 /* EnumDeclaration */) ? d : undefined; }); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 237 /* EnumDeclaration */) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); if (!(declaration.flags & 2097152 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { if (result.flags & 2 /* BlockScopedVariable */) { @@ -27193,13 +27288,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return node; - case 243 /* ImportClause */: + case 244 /* ImportClause */: return node.parent; - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return node.parent.parent; - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -27209,7 +27304,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { - if (node.moduleReference.kind === 252 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 253 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); @@ -27230,8 +27325,8 @@ var ts; // Declaration files (and ambient modules) if (!file || file.isDeclarationFile) { // Definitely cannot have a synthetic default if they have a syntactic default member specified - var defaultExportSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, dontResolveAlias); - if (defaultExportSymbol && defaultExportSymbol.valueDeclaration && isSyntacticDefault(defaultExportSymbol.valueDeclaration)) { + var defaultExportSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, /*dontResolveAlias*/ true); // Dont resolve alias because we want the immediately exported symbol's declaration + if (defaultExportSymbol && ts.some(defaultExportSymbol.declarations, isSyntacticDefault)) { return false; } // It _might_ still be incorrect to assume there is no __esModule marker on the import at runtime, even if there is no `default` member @@ -27382,32 +27477,40 @@ var ts; resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias); } function getTargetOfExportAssignment(node, dontResolveAlias) { - return resolveEntityName(node.expression, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); + var aliasLike = resolveEntityName(node.expression, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias); + if (aliasLike) { + return aliasLike; + } + checkExpression(node.expression); + return getNodeLinks(node.expression).resolvedSymbol; } function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 250 /* ExportSpecifier */: + case 251 /* ExportSpecifier */: return getTargetOfExportSpecifier(node, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); } } /** * Indicates that a symbol is an alias that does not merge with a local declaration. + * OR Is a JSContainer which may merge an alias with a local declaration */ function isNonLocalAlias(symbol, excludes) { if (excludes === void 0) { excludes = 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */; } - return symbol && (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */; + if (!symbol) + return false; + return (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */ || (symbol.flags & 2097152 /* Alias */ && symbol.flags & 67108864 /* JSContainer */); } function resolveSymbol(symbol, dontResolveAlias) { var shouldResolve = !dontResolveAlias && isNonLocalAlias(symbol); @@ -27453,11 +27556,11 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 247 /* ExportAssignment */) { + if (node.kind === 248 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 250 /* ExportSpecifier */) { + else if (node.kind === 251 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -27485,7 +27588,7 @@ var ts; else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 241 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 242 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } @@ -27508,7 +27611,7 @@ var ts; return undefined; } } - else if (name.kind === 145 /* QualifiedName */ || name.kind === 183 /* PropertyAccessExpression */) { + else if (name.kind === 145 /* QualifiedName */ || name.kind === 184 /* PropertyAccessExpression */) { var left = name.kind === 145 /* QualifiedName */ ? name.left : name.expression; var right = name.kind === 145 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); @@ -27574,7 +27677,8 @@ var ts; if (ambientModule) { return ambientModule; } - var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference); + var currentSourceFile = ts.getSourceFileOfNode(location); + var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference); var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule); var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { @@ -27641,15 +27745,15 @@ var ts; // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may // combine other declarations with the module or variable (e.g. a class/module, function/module, interface/variable). - function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression, dontResolveAlias) { + function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) { var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) { - error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); + error(referencingLocation, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); return symbol; } if (compilerOptions.esModuleInterop) { - var referenceParent = moduleReferenceExpression.parent; + var referenceParent = referencingLocation.parent; if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) || ts.isImportCall(referenceParent)) { var type = getTypeOfSymbol(symbol); @@ -27892,12 +27996,12 @@ var ts; } } switch (location.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location).exports)) { return result; } @@ -27916,11 +28020,8 @@ var ts; return undefined; } var id = "" + getSymbolId(symbol); - var visitedSymbolTables; - if (visitedSymbolTablesMap.has(id)) { - visitedSymbolTables = visitedSymbolTablesMap.get(id); - } - else { + var visitedSymbolTables = visitedSymbolTablesMap.get(id); + if (!visitedSymbolTables) { visitedSymbolTablesMap.set(id, visitedSymbolTables = []); } return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); @@ -27992,7 +28093,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 250 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 251 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -28096,7 +28197,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 272 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 273 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -28136,8 +28237,8 @@ var ts; // Typeof value meaning = 67216319 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 145 /* QualifiedName */ || entityName.kind === 183 /* PropertyAccessExpression */ || - entityName.parent.kind === 241 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 145 /* QualifiedName */ || entityName.kind === 184 /* PropertyAccessExpression */ || + entityName.parent.kind === 242 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -28323,7 +28424,7 @@ var ts; if (type.flags & 1024 /* UniqueESSymbol */) { if (!(context.flags & 1048576 /* AllowUniqueESSymbolType */)) { if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) { - return ts.createTypeQueryNode(symbolToName(type.symbol, context, 67216319 /* Value */, /*expectsIdentifier*/ false)); + return symbolToTypeNode(type.symbol, context, 67216319 /* Value */); } if (context.tracker.reportInaccessibleUniqueSymbolError) { context.tracker.reportInaccessibleUniqueSymbolError(); @@ -28434,18 +28535,17 @@ var ts; var symbol = type.symbol; if (symbol) { // Always use 'typeof T' for type of class, enum, and module objects - if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 203 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) || + if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 204 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol()) { - return createTypeQueryNodeFromSymbol(symbol, 67216319 /* Value */); + return symbolToTypeNode(symbol, context, 67216319 /* Value */); } else if (ts.contains(context.symbolStack, symbol)) { // If type is an anonymous type literal in a type alias declaration, use type alias name var typeAlias = getTypeAliasForTypeLiteral(type); if (typeAlias) { // The specified symbol flags need to be reinterpreted as type flags - var entityName = symbolToName(typeAlias, context, 67901928 /* Type */, /*expectsIdentifier*/ false); - return ts.createTypeReferenceNode(entityName, /*typeArguments*/ undefined); + return symbolToTypeNode(typeAlias, context, 67901928 /* Type */); } else { return ts.createKeywordTypeNode(119 /* AnyKeyword */); @@ -28479,7 +28579,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 272 /* SourceFile */ || declaration.parent.kind === 238 /* ModuleBlock */; + return declaration.parent.kind === 273 /* SourceFile */ || declaration.parent.kind === 239 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -28515,10 +28615,6 @@ var ts; var typeLiteralNode = ts.createTypeLiteralNode(members); return ts.setEmitFlags(typeLiteralNode, (context.flags & 1024 /* MultilineObjectLiterals */) ? 0 : 1 /* SingleLine */); } - function createTypeQueryNodeFromSymbol(symbol, symbolFlags) { - var entityName = symbolToName(symbol, context, symbolFlags, /*expectsIdentifier*/ false); - return ts.createTypeQueryNode(entityName); - } function symbolToTypeReferenceName(symbol) { // Unnamed function expressions and arrow functions have reserved names that we don't want to display var entityName = symbol.flags & 32 /* Class */ || !isReservedMemberName(symbol.escapedName) ? symbolToName(symbol, context, 67901928 /* Type */, /*expectsIdentifier*/ false) : ts.createIdentifier(""); @@ -28674,6 +28770,10 @@ var ts; var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 152 /* MethodSignature */, context); methodDeclaration.name = propertyName; methodDeclaration.questionToken = optionalToken; + if (propertySymbol.valueDeclaration) { + // Copy comments to node for declaration emit + ts.setCommentRange(methodDeclaration, propertySymbol.valueDeclaration); + } typeElements.push(methodDeclaration); } } @@ -28685,6 +28785,10 @@ var ts; var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(132 /* ReadonlyKeyword */)] : undefined; var propertySignature = ts.createPropertySignature(modifiers, propertyName, optionalToken, propertyTypeNode, /*initializer*/ undefined); + if (propertySymbol.valueDeclaration) { + // Copy comments to node for declaration emit + ts.setCommentRange(propertySignature, propertySymbol.valueDeclaration); + } typeElements.push(propertySignature); } } @@ -28729,7 +28833,7 @@ var ts; else { typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); }); } - var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context); }); + var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 154 /* Constructor */); }); if (signature.thisParameter) { var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context); parameters.unshift(thisParameter); @@ -28768,7 +28872,7 @@ var ts; context.flags = savedContextFlags; return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); } - function symbolToParameterDeclaration(parameterSymbol, context) { + function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) { var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 148 /* Parameter */); ts.Debug.assert(!!parameterDeclaration || isTransientSymbol(parameterSymbol) && !!parameterSymbol.isRestParameter); var parameterType = getTypeOfSymbol(parameterSymbol); @@ -28776,7 +28880,7 @@ var ts; parameterType = getOptionalType(parameterType); } var parameterTypeNode = typeToTypeNodeHelper(parameterType, context); - var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone); + var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone); var dotDotDotToken = !parameterDeclaration || ts.isRestParameter(parameterDeclaration) ? ts.createToken(24 /* DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? @@ -28795,7 +28899,7 @@ var ts; function elideInitializerAndSetEmitFlags(node) { var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags); var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited); - if (clone.kind === 180 /* BindingElement */) { + if (clone.kind === 181 /* BindingElement */) { clone.initializer = undefined; } return ts.setEmitFlags(clone, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */); @@ -28870,6 +28974,35 @@ var ts; } return typeParameterNodes; } + function symbolToTypeNode(symbol, context, meaning) { + var chain = lookupSymbolChain(symbol, context, meaning); + context.flags |= 16777216 /* InInitialEntityName */; + var rootName = getNameOfSymbolAsWritten(chain[0], context); + context.flags ^= 16777216 /* InInitialEntityName */; + var isTypeOf = meaning === 67216319 /* Value */; + if (ambientModuleSymbolRegex.test(rootName)) { + // module is root, must use `ImportTypeNode` + var nonRootParts = chain.length > 1 ? createEntityNameFromSymbolChain(chain, chain.length - 1, 1) : undefined; + var typeParameterNodes = lookupTypeParameterNodes(chain, 0, context); + return ts.createImportTypeNode(ts.createLiteralTypeNode(ts.createLiteral(rootName.substring(1, rootName.length - 1))), nonRootParts, typeParameterNodes, isTypeOf); + } + var entityName = createEntityNameFromSymbolChain(chain, chain.length - 1, 0); + return isTypeOf ? ts.createTypeQueryNode(entityName) : ts.createTypeReferenceNode(entityName, /*typeArguments*/ undefined); + function createEntityNameFromSymbolChain(chain, index, stopper) { + var typeParameterNodes = lookupTypeParameterNodes(chain, index, context); + var symbol = chain[index]; + if (index === 0) { + context.flags |= 16777216 /* InInitialEntityName */; + } + var symbolName = getNameOfSymbolAsWritten(symbol, context); + if (index === 0) { + context.flags ^= 16777216 /* InInitialEntityName */; + } + var identifier = ts.setEmitFlags(ts.createIdentifier(symbolName, typeParameterNodes), 16777216 /* NoAsciiEscaping */); + identifier.symbol = symbol; + return index > stopper ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1, stopper), identifier) : identifier; + } + } function symbolToName(symbol, context, meaning, expectsIdentifier) { var chain = lookupSymbolChain(symbol, context, meaning); if (expectsIdentifier && chain.length !== 1 @@ -28984,7 +29117,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 172 /* ParenthesizedType */; }); - if (node.kind === 235 /* TypeAliasDeclaration */) { + if (node.kind === 236 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -28992,11 +29125,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 238 /* ModuleBlock */ && + node.parent.kind === 239 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 272 /* SourceFile */ || ts.isAmbientModule(location); + return location.kind === 273 /* SourceFile */ || ts.isAmbientModule(location); } /** * Gets a human-readable name for a symbol. @@ -29021,17 +29154,17 @@ var ts; if (name) { return ts.declarationNameToString(name); } - if (declaration.parent && declaration.parent.kind === 230 /* VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 231 /* VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) { context.encounteredError = true; } switch (declaration.kind) { - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return "(Anonymous class)"; - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -29054,22 +29187,22 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 180 /* BindingElement */: + case 181 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 230 /* VariableDeclaration */: + case 231 /* 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 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 232 /* FunctionDeclaration */: - case 236 /* EnumDeclaration */: - case 241 /* ImportEqualsDeclaration */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 233 /* FunctionDeclaration */: + case 237 /* EnumDeclaration */: + case 242 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -29077,7 +29210,7 @@ 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 /* Export */) && - !(node.kind !== 241 /* ImportEqualsDeclaration */ && parent.kind !== 272 /* SourceFile */ && parent.flags & 2097152 /* Ambient */)) { + !(node.kind !== 242 /* ImportEqualsDeclaration */ && parent.kind !== 273 /* SourceFile */ && parent.flags & 2097152 /* Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible @@ -29099,7 +29232,7 @@ var ts; case 157 /* CallSignature */: case 159 /* IndexSignature */: case 148 /* Parameter */: - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: case 162 /* FunctionType */: case 163 /* ConstructorType */: case 165 /* TypeLiteral */: @@ -29112,18 +29245,18 @@ var ts; return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: return false; // Type parameters are always visible case 147 /* TypeParameter */: // Source file and namespace export are always visible - case 272 /* SourceFile */: - case 240 /* NamespaceExportDeclaration */: + case 273 /* SourceFile */: + case 241 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return false; default: return false; @@ -29132,10 +29265,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 247 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 248 /* ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 250 /* ExportSpecifier */) { + else if (node.parent.kind === 251 /* ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */); } var result; @@ -29231,12 +29364,12 @@ var ts; function getDeclarationContainer(node) { node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 230 /* VariableDeclaration */: - case 231 /* VariableDeclarationList */: - case 246 /* ImportSpecifier */: - case 245 /* NamedImports */: - case 244 /* NamespaceImport */: - case 243 /* ImportClause */: + case 231 /* VariableDeclaration */: + case 232 /* VariableDeclarationList */: + case 247 /* ImportSpecifier */: + case 246 /* NamedImports */: + case 245 /* NamespaceImport */: + case 244 /* ImportClause */: return false; default: return true; @@ -29314,7 +29447,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 178 /* ObjectBindingPattern */) { + if (pattern.kind === 179 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -29401,7 +29534,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 181 /* ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 182 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, optional) { if (optional === void 0) { optional = true; } @@ -29411,11 +29544,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { // 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 === 219 /* ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 220 /* ForInStatement */) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (32768 /* TypeParameter */ | 524288 /* Index */) ? indexType : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 220 /* ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 221 /* 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, @@ -29434,7 +29567,7 @@ var ts; return addOptionality(declaredType, isOptional); } if ((noImplicitAny || ts.isInJavaScriptFile(declaration)) && - declaration.kind === 230 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + declaration.kind === 231 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 2097152 /* Ambient */)) { // If --noImplicitAny is on or the declaration is in a Javascript file, // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no @@ -29507,8 +29640,8 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var declarationInConstructor = false; - var expression = declaration.kind === 198 /* BinaryExpression */ ? declaration : - declaration.kind === 183 /* PropertyAccessExpression */ ? ts.getAncestor(declaration, 198 /* BinaryExpression */) : + var expression = declaration.kind === 199 /* BinaryExpression */ ? declaration : + declaration.kind === 184 /* PropertyAccessExpression */ ? ts.getAncestor(declaration, 199 /* BinaryExpression */) : undefined; if (!expression) { return unknownType; @@ -29518,8 +29651,8 @@ var ts; // Properties defined in a constructor (or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. declarationInConstructor = thisContainer.kind === 154 /* Constructor */ || - thisContainer.kind === 232 /* FunctionDeclaration */ || - (thisContainer.kind === 190 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + thisContainer.kind === 233 /* FunctionDeclaration */ || + (thisContainer.kind === 191 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); if (declarationInConstructor) { definedInConstructor = true; } @@ -29641,7 +29774,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 178 /* ObjectBindingPattern */ + return pattern.kind === 179 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -29700,7 +29833,7 @@ var ts; return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 247 /* ExportAssignment */) { + if (declaration.kind === 248 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } if (ts.isInJavaScriptFile(declaration) && ts.isJSDocPropertyLikeTag(declaration) && declaration.typeExpression) { @@ -29716,8 +29849,8 @@ var ts; // * exports.p = expr // * this.p = expr // * className.prototype.method = expr - if (declaration.kind === 198 /* BinaryExpression */ || - declaration.kind === 183 /* PropertyAccessExpression */ && declaration.parent.kind === 198 /* BinaryExpression */) { + if (declaration.kind === 199 /* BinaryExpression */ || + declaration.kind === 184 /* PropertyAccessExpression */ && declaration.parent.kind === 199 /* BinaryExpression */) { type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } else if (ts.isJSDocPropertyTag(declaration) @@ -29847,6 +29980,10 @@ var ts; if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { links.type = anyType; } + else if (symbol.valueDeclaration.kind === 199 /* BinaryExpression */ || + symbol.valueDeclaration.kind === 184 /* PropertyAccessExpression */ && symbol.valueDeclaration.parent.kind === 199 /* BinaryExpression */) { + links.type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); + } else { var type = createObjectType(16 /* Anonymous */, symbol); if (symbol.flags & 32 /* Class */) { @@ -29980,21 +30117,21 @@ var ts; return undefined; } switch (node.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: case 152 /* MethodSignature */: case 162 /* FunctionType */: case 163 /* ConstructorType */: - case 280 /* JSDocFunctionType */: - case 232 /* FunctionDeclaration */: + case 281 /* JSDocFunctionType */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 235 /* TypeAliasDeclaration */: - case 290 /* JSDocTemplateTag */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 236 /* TypeAliasDeclaration */: + case 291 /* JSDocTemplateTag */: case 176 /* MappedType */: case 170 /* ConditionalType */: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); @@ -30006,7 +30143,7 @@ var ts; } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node) || ts.emptyArray); var thisType = includeThisTypes && - (node.kind === 233 /* ClassDeclaration */ || node.kind === 203 /* ClassExpression */ || node.kind === 234 /* InterfaceDeclaration */) && + (node.kind === 234 /* ClassDeclaration */ || node.kind === 204 /* ClassExpression */ || node.kind === 235 /* InterfaceDeclaration */) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } @@ -30014,7 +30151,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 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 234 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 235 /* InterfaceDeclaration */); return getOuterTypeParameters(declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -30023,8 +30160,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 234 /* InterfaceDeclaration */ || node.kind === 233 /* ClassDeclaration */ || - node.kind === 203 /* ClassExpression */ || node.kind === 235 /* TypeAliasDeclaration */) { + if (node.kind === 235 /* InterfaceDeclaration */ || node.kind === 234 /* ClassDeclaration */ || + node.kind === 204 /* ClassExpression */ || node.kind === 236 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -30211,7 +30348,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 234 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 235 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -30247,7 +30384,7 @@ var ts; function isThislessInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 234 /* InterfaceDeclaration */) { + if (declaration.kind === 235 /* InterfaceDeclaration */) { if (declaration.flags & 64 /* ContainsThis */) { return false; } @@ -30305,9 +30442,9 @@ var ts; return unknownType; } var declaration = ts.find(symbol.declarations, function (d) { - return d.kind === 291 /* JSDocTypedefTag */ || d.kind === 235 /* TypeAliasDeclaration */; + return d.kind === 292 /* JSDocTypedefTag */ || d.kind === 236 /* TypeAliasDeclaration */; }); - var typeNode = declaration.kind === 291 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; + var typeNode = declaration.kind === 292 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; // If typeNode is missing, we will error in checkJSDocTypedefTag. var type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { @@ -30337,7 +30474,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return true; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return expr.operator === 38 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; case 71 /* Identifier */: @@ -30354,7 +30491,7 @@ var ts; var hasNonLiteralMember = false; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 236 /* EnumDeclaration */) { + if (declaration.kind === 237 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && member.initializer.kind === 9 /* StringLiteral */) { @@ -30381,7 +30518,7 @@ var ts; var memberTypeList = []; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 236 /* EnumDeclaration */) { + if (declaration.kind === 237 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var memberType = getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member)); @@ -31350,7 +31487,12 @@ var ts; return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; } function getDefaultConstraintOfConditionalType(type) { - return getUnionType([getInferredTrueTypeFromConditionalType(type), getFalseTypeFromConditionalType(type)]); + if (!type.resolvedDefaultConstraint) { + var rootTrueType = type.root.trueType; + var rootTrueConstraint = rootTrueType.flags & 4194304 /* Substitution */ ? rootTrueType.substitute : rootTrueType; + type.resolvedDefaultConstraint = getUnionType([instantiateType(rootTrueConstraint, type.combinedMapper || type.mapper), getFalseTypeFromConditionalType(type)]); + } + return type.resolvedDefaultConstraint; } function getConstraintOfDistributiveConditionalType(type) { // Check if we have a conditional type of the form 'T extends U ? X : Y', where T is a constrained @@ -31362,7 +31504,10 @@ var ts; var constraint = getConstraintOfType(type.checkType); if (constraint) { var mapper = createTypeMapper([type.root.checkType], [constraint]); - return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + var instantiated = getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + if (!(instantiated.flags & 16384 /* Never */)) { + return instantiated; + } } } return undefined; @@ -31549,7 +31694,7 @@ var ts; (modifiers & 16 /* Protected */ ? 128 /* ContainsProtected */ : 0) | (modifiers & 8 /* Private */ ? 256 /* ContainsPrivate */ : 0) | (modifiers & 32 /* Static */ ? 512 /* ContainsStatic */ : 0); - if (!isMethodLike(prop)) { + if (!isPrototypeProperty(prop)) { syntheticFlag = 2 /* SyntheticProperty */; } } @@ -31708,10 +31853,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJavaScriptFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 279 /* JSDocOptionalType */ + node.type && node.type.kind === 280 /* JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 279 /* JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 280 /* JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -31951,7 +32096,8 @@ var ts; return ts.emptyArray; var result = []; for (var i = 0; i < symbol.declarations.length; i++) { - var node = symbol.declarations[i]; + var decl = symbol.declarations[i]; + var node = ts.isPropertyAccessExpression(decl) ? ts.getAssignedJavascriptInitializer(decl) : decl; if (!ts.isFunctionLike(node)) continue; // Don't include signature if node is the implementation of an overloaded function. A node is considered @@ -32270,7 +32416,7 @@ var ts; var isJs = ts.isInJavaScriptFile(node); var isJsImplicitAny = !noImplicitAny && isJs; if (!isJsImplicitAny && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { - var missingAugmentsTag = isJs && node.parent.kind !== 285 /* JSDocAugmentsTag */; + var missingAugmentsTag = isJs && node.parent.kind !== 286 /* JSDocAugmentsTag */; var diag = minTypeArgumentCount === typeParameters.length ? missingAugmentsTag ? ts.Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag @@ -32329,7 +32475,7 @@ var ts; switch (node.kind) { case 161 /* TypeReference */: return node.typeName; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -32407,7 +32553,7 @@ var ts; } function getConstrainedTypeVariable(typeVariable, node) { var constraints; - while (ts.isPartOfTypeNode(node)) { + while (node && !ts.isStatement(node)) { var parent = node.parent; if (parent.kind === 170 /* ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType); @@ -32424,7 +32570,7 @@ var ts; } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : ts.declarationNameToString(node.typeName)); + error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? ts.declarationNameToString(node.typeName) : "(anonymous)"); return false; } return true; @@ -32521,9 +32667,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: return declaration; } } @@ -33071,7 +33217,7 @@ var ts; return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 184 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 185 /* ElementAccessExpression */ ? accessNode : undefined; var propName = isTypeUsableAsLateBoundName(indexType) ? getLateBoundNameFromType(indexType) : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ? ts.getPropertyNameForKnownSymbolName(ts.idText(accessExpression.argumentExpression.name)) : @@ -33121,7 +33267,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 184 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 185 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)); } @@ -33218,7 +33364,7 @@ var ts; // object type. Note that 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 === 184 /* ElementAccessExpression */) && isGenericObjectType(objectType)) { + if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind === 185 /* ElementAccessExpression */) && isGenericObjectType(objectType)) { if (objectType.flags & 1 /* Any */) { return objectType; } @@ -33339,11 +33485,6 @@ var ts; function getFalseTypeFromConditionalType(type) { return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper)); } - function getInferredTrueTypeFromConditionalType(type) { - return type.combinedMapper ? - type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper)) : - getTrueTypeFromConditionalType(type); - } function getInferTypeParameters(node) { var result; if (node.locals) { @@ -33355,13 +33496,27 @@ var ts; } return result; } + function isPossiblyReferencedInConditionalType(tp, node) { + if (isTypeParameterPossiblyReferenced(tp, node)) { + return true; + } + while (node) { + if (node.kind === 170 /* ConditionalType */) { + if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) { + return true; + } + } + node = node.parent; + } + return false; + } function getTypeFromConditionalTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var checkType = getTypeFromTypeNode(node.checkType); var aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true); - var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); }); + var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); }); var root = { node: node, checkType: checkType, @@ -33390,6 +33545,76 @@ var ts; } return links.resolvedType; } + function getIdentifierChain(node) { + if (ts.isIdentifier(node)) { + return [node]; + } + else { + return ts.append(getIdentifierChain(node.left), node.right); + } + } + function getTypeFromImportTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + if (node.isTypeOf && node.typeArguments) { // Only the non-typeof form can make use of type arguments + error(node, ts.Diagnostics.Type_arguments_cannot_be_used_here); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + if (!ts.isLiteralImportTypeNode(node)) { + error(node.argument, ts.Diagnostics.String_literal_expected); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + var argumentType = getTypeFromTypeNode(node.argument); + var targetMeaning = node.isTypeOf ? 67216319 /* Value */ : 67901928 /* Type */; + // TODO: Future work: support unions/generics/whatever via a deferred import-type + var moduleName = argumentType.value; + var innerModuleSymbol = resolveExternalModule(node, moduleName, ts.Diagnostics.Cannot_find_module_0, node, /*isForAugmentation*/ false); + if (!innerModuleSymbol) { + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = unknownType; + } + var moduleSymbol = resolveExternalModuleSymbol(innerModuleSymbol, /*dontResolveAlias*/ false); + if (!ts.nodeIsMissing(node.qualifier)) { + var nameStack = getIdentifierChain(node.qualifier); + var currentNamespace = moduleSymbol; + var current = void 0; + while (current = nameStack.shift()) { + var meaning = nameStack.length ? 1920 /* Namespace */ : targetMeaning; + var next = getSymbol(getExportsOfSymbol(getMergedSymbol(resolveSymbol(currentNamespace))), current.escapedText, meaning); + if (!next) { + error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current)); + return links.resolvedType = unknownType; + } + getNodeLinks(current).resolvedSymbol = next; + getNodeLinks(current.parent).resolvedSymbol = next; + currentNamespace = next; + } + resolveImportSymbolType(node, links, currentNamespace, targetMeaning); + } + else { + if (moduleSymbol.flags & targetMeaning) { + resolveImportSymbolType(node, links, moduleSymbol, targetMeaning); + } + else { + error(node, targetMeaning === 67216319 /* Value */ ? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here, moduleName); + links.resolvedSymbol = unknownSymbol; + links.resolvedType = unknownType; + } + } + } + return links.resolvedType; + } + function resolveImportSymbolType(node, links, symbol, meaning) { + links.resolvedSymbol = symbol; + if (meaning === 67216319 /* Value */) { + return links.resolvedType = getTypeOfSymbol(symbol); + } + else { + return links.resolvedType = getTypeReferenceType(node, symbol); + } + } function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -33411,7 +33636,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 235 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 236 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -33572,7 +33797,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 === 234 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 235 /* InterfaceDeclaration */)) { if (!ts.hasModifier(container, 32 /* Static */) && (container.kind !== 154 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -33591,8 +33816,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 119 /* AnyKeyword */: - case 275 /* JSDocAllType */: - case 276 /* JSDocUnknownType */: + case 276 /* JSDocAllType */: + case 277 /* JSDocUnknownType */: return anyType; case 137 /* StringKeyword */: return stringType; @@ -33621,7 +33846,7 @@ var ts; return getTypeFromTypeReference(node); case 160 /* TypePredicate */: return booleanType; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); case 164 /* TypeQuery */: return getTypeFromTypeQueryNode(node); @@ -33633,21 +33858,21 @@ var ts; return getTypeFromUnionTypeNode(node); case 169 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); case 172 /* ParenthesizedType */: - case 278 /* JSDocNonNullableType */: - case 274 /* JSDocTypeExpression */: + case 279 /* JSDocNonNullableType */: + case 275 /* JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); case 162 /* FunctionType */: case 163 /* ConstructorType */: case 165 /* TypeLiteral */: - case 283 /* JSDocTypeLiteral */: - case 280 /* JSDocFunctionType */: + case 284 /* JSDocTypeLiteral */: + case 281 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 174 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); @@ -33659,6 +33884,8 @@ var ts; return getTypeFromConditionalTypeNode(node); case 171 /* InferType */: return getTypeFromInferTypeNode(node); + case 178 /* ImportType */: + return getTypeFromImportTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 71 /* Identifier */: @@ -33806,7 +34033,7 @@ var ts; } // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and // also transient so that we can just store data on it directly. - var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */); + var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | (ts.getCheckFlags(symbol) & 1024 /* Late */)); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -33857,13 +34084,17 @@ var ts; } return type; } + function maybeTypeParameterReference(node) { + return !(node.kind === 145 /* QualifiedName */ || + node.parent.kind === 161 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName); + } function isTypeParameterPossiblyReferenced(tp, node) { // If the type parameter doesn't have exactly one declaration, if there are invening 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. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container_2 = tp.symbol.declarations[0].parent; - if (ts.findAncestor(node, function (n) { return n.kind === 211 /* Block */ ? "quit" : n === container_2; })) { + if (ts.findAncestor(node, function (n) { return n.kind === 212 /* Block */ ? "quit" : n === container_2; })) { return ts.forEachChild(node, containsReference); } } @@ -33873,7 +34104,8 @@ var ts; case 173 /* ThisType */: return tp.isThisType; case 71 /* Identifier */: - return !tp.isThisType && ts.isPartOfTypeNode(node) && getTypeFromTypeNode(node) === tp; + return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && + getTypeFromTypeNode(node) === tp; case 164 /* TypeQuery */: return true; } @@ -34007,30 +34239,30 @@ var ts; function isContextSensitive(node) { ts.Debug.assert(node.kind !== 153 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: return isContextSensitiveFunctionLikeDeclaration(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return node.operatorToken.kind === 54 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isContextSensitive(node.expression); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return ts.forEach(node.properties, isContextSensitive); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. return node.initializer && isContextSensitive(node.initializer); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: // It is possible to that node.expression is undefined (e.g
) return node.expression && isContextSensitive(node.expression); } @@ -34045,7 +34277,7 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 191 /* ArrowFunction */) { + if (node.kind !== 192 /* 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); @@ -34054,7 +34286,7 @@ var ts; } } // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return node.body.kind === 211 /* Block */ ? false : isContextSensitive(node.body); + return node.body.kind === 212 /* Block */ ? false : isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (ts.isInJavaScriptFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && @@ -36171,7 +36403,7 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; @@ -36181,16 +36413,16 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 180 /* BindingElement */: + case 181 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -36862,13 +37094,13 @@ var ts; if (node.kind === 99 /* ThisKeyword */) { return "0"; } - if (node.kind === 183 /* PropertyAccessExpression */) { + if (node.kind === 184 /* PropertyAccessExpression */) { var key = getFlowCacheKey(node.expression); return key && key + "." + ts.idText(node.name); } - if (node.kind === 180 /* BindingElement */) { + if (node.kind === 181 /* BindingElement */) { var container = node.parent.parent; - var key = container.kind === 180 /* BindingElement */ ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); + var key = container.kind === 181 /* BindingElement */ ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); var text = getBindingElementNameText(node); var result = key && text && (key + "." + text); return result; @@ -36876,7 +37108,7 @@ var ts; return undefined; } function getBindingElementNameText(element) { - if (element.parent.kind === 178 /* ObjectBindingPattern */) { + if (element.parent.kind === 179 /* ObjectBindingPattern */) { var name = element.propertyName || element.name; switch (name.kind) { case 71 /* Identifier */: @@ -36899,26 +37131,26 @@ var ts; switch (source.kind) { case 71 /* Identifier */: return target.kind === 71 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 230 /* VariableDeclaration */ || target.kind === 180 /* BindingElement */) && + (target.kind === 231 /* VariableDeclaration */ || target.kind === 181 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 99 /* ThisKeyword */: return target.kind === 99 /* ThisKeyword */; case 97 /* SuperKeyword */: return target.kind === 97 /* SuperKeyword */; - case 183 /* PropertyAccessExpression */: - return target.kind === 183 /* PropertyAccessExpression */ && + case 184 /* PropertyAccessExpression */: + return target.kind === 184 /* PropertyAccessExpression */ && source.name.escapedText === target.name.escapedText && isMatchingReference(source.expression, target.expression); - case 180 /* BindingElement */: - if (target.kind !== 183 /* PropertyAccessExpression */) + case 181 /* BindingElement */: + if (target.kind !== 184 /* PropertyAccessExpression */) return false; var t = target; if (t.name.escapedText !== getBindingElementNameText(source)) return false; - if (source.parent.parent.kind === 180 /* BindingElement */ && isMatchingReference(source.parent.parent, t.expression)) { + if (source.parent.parent.kind === 181 /* BindingElement */ && isMatchingReference(source.parent.parent, t.expression)) { return true; } - if (source.parent.parent.kind === 230 /* VariableDeclaration */) { + if (source.parent.parent.kind === 231 /* VariableDeclaration */) { var maybeId = source.parent.parent.initializer; return maybeId && isMatchingReference(maybeId, t.expression); } @@ -36926,7 +37158,7 @@ var ts; return false; } function containsMatchingReference(source, target) { - while (source.kind === 183 /* PropertyAccessExpression */) { + while (source.kind === 184 /* PropertyAccessExpression */) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -36939,7 +37171,7 @@ var ts; // a possible discriminant if its type differs in the constituents of containing union type, and if every // choice is a unit type or a union of unit types. function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 183 /* PropertyAccessExpression */ && + return target.kind === 184 /* PropertyAccessExpression */ && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.escapedText); } @@ -36947,7 +37179,7 @@ var ts; if (expr.kind === 71 /* Identifier */) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 183 /* PropertyAccessExpression */) { + if (expr.kind === 184 /* PropertyAccessExpression */) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.escapedText); } @@ -36991,7 +37223,7 @@ var ts; } } } - if (callExpression.expression.kind === 183 /* PropertyAccessExpression */ && + if (callExpression.expression.kind === 184 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -37125,15 +37357,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 181 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 268 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 182 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 269 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 198 /* BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 220 /* ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 199 /* BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 221 /* ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -37150,21 +37382,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return stringType; - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return undefinedType; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -37172,7 +37404,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 178 /* ObjectBindingPattern */ ? + var type = pattern.kind === 179 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -37190,35 +37422,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 219 /* ForInStatement */) { + if (node.parent.parent.kind === 220 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 220 /* ForOfStatement */) { + if (node.parent.parent.kind === 221 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 230 /* VariableDeclaration */ ? + return node.kind === 231 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */ ? + return node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */ ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 230 /* VariableDeclaration */ && node.initializer && + return node.kind === 231 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 180 /* BindingElement */ && node.parent.kind === 198 /* BinaryExpression */ && + node.kind !== 181 /* BindingElement */ && node.parent.kind === 199 /* BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: switch (node.operatorToken.kind) { case 58 /* EqualsToken */: return getReferenceCandidate(node.left); @@ -37230,13 +37462,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 189 /* ParenthesizedExpression */ || - parent.kind === 198 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */ && parent.left === node || - parent.kind === 198 /* BinaryExpression */ && parent.operatorToken.kind === 26 /* CommaToken */ && parent.right === node ? + return parent.kind === 190 /* ParenthesizedExpression */ || + parent.kind === 199 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */ && parent.left === node || + parent.kind === 199 /* BinaryExpression */ && parent.operatorToken.kind === 26 /* CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 264 /* CaseClause */) { + if (clause.kind === 265 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -37409,11 +37641,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 183 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" || - parent.parent.kind === 185 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 184 /* ElementAccessExpression */ && + var isLengthPushOrUnshift = parent.kind === 184 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" || + parent.parent.kind === 186 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 185 /* ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 198 /* BinaryExpression */ && + parent.parent.kind === 199 /* BinaryExpression */ && parent.parent.operatorToken.kind === 58 /* EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -37461,7 +37693,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 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent && reference.parent.kind === 207 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 16384 /* Never */) { + if (reference.parent && reference.parent.kind === 208 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 16384 /* Never */) { return declaredType; } return resultType; @@ -37532,7 +37764,7 @@ var ts; else if (flags & 2 /* Start */) { // Check if we should continue with the control flow of the containing function. var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 183 /* PropertyAccessExpression */ && reference.kind !== 99 /* ThisKeyword */) { + if (container && container !== flowContainer && reference.kind !== 184 /* PropertyAccessExpression */ && reference.kind !== 99 /* ThisKeyword */) { flow = container.flowNode; continue; } @@ -37588,7 +37820,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 185 /* CallExpression */ ? + var expr = node.kind === 186 /* CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -37596,7 +37828,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 185 /* CallExpression */) { + if (node.kind === 186 /* CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -37761,7 +37993,7 @@ var ts; return result; } function isMatchingReferenceDiscriminant(expr, computedType) { - return expr.kind === 183 /* PropertyAccessExpression */ && + return expr.kind === 184 /* PropertyAccessExpression */ && computedType.flags & 131072 /* Union */ && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(computedType, expr.name.escapedText); @@ -37812,10 +38044,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 193 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) { + if (left_1.kind === 194 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 193 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) { + if (right_1.kind === 194 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -38027,7 +38259,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 184 /* ElementAccessExpression */ || invokedExpression.kind === 183 /* PropertyAccessExpression */) { + if (invokedExpression.kind === 185 /* ElementAccessExpression */ || invokedExpression.kind === 184 /* PropertyAccessExpression */) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -38047,15 +38279,15 @@ var ts; case 71 /* Identifier */: case 99 /* ThisKeyword */: case 97 /* SuperKeyword */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: if (expr.operator === 51 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -38091,8 +38323,8 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 238 /* ModuleBlock */ || - node.kind === 272 /* SourceFile */ || + node.kind === 239 /* ModuleBlock */ || + node.kind === 273 /* SourceFile */ || node.kind === 151 /* PropertyDeclaration */; }); } @@ -38138,10 +38370,10 @@ var ts; } function isConstraintPosition(node) { var parent = node.parent; - return parent.kind === 183 /* PropertyAccessExpression */ || - parent.kind === 185 /* CallExpression */ && parent.expression === node || - parent.kind === 184 /* ElementAccessExpression */ && parent.expression === node || - parent.kind === 180 /* BindingElement */ && parent.name === node && !!parent.initializer; + return parent.kind === 184 /* PropertyAccessExpression */ || + parent.kind === 186 /* CallExpression */ && parent.expression === node || + parent.kind === 185 /* ElementAccessExpression */ && parent.expression === node || + parent.kind === 181 /* BindingElement */ && parent.name === node && !!parent.initializer; } function typeHasNullableConstraint(type) { return type.flags & 7372800 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 12288 /* Nullable */); @@ -38175,7 +38407,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ES2015 */) { - if (container.kind === 191 /* ArrowFunction */) { + if (container.kind === 192 /* 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.hasModifier(container, 256 /* Async */)) { @@ -38196,7 +38428,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 === 233 /* ClassDeclaration */ + if (declaration.kind === 234 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -38208,7 +38440,7 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 203 /* ClassExpression */) { + else if (declaration.kind === 204 /* 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. @@ -38225,9 +38457,6 @@ var ts; } } } - checkCollisionWithCapturedSuperVariable(node, node); - checkCollisionWithCapturedThisVariable(node, node); - checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getConstraintForLocation(getTypeOfSymbol(localOrExportSymbol), node); var assignmentKind = ts.getAssignmentTargetKind(node); @@ -38269,8 +38498,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 === 190 /* FunctionExpression */ || - flowContainer.kind === 191 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 191 /* FunctionExpression */ || + flowContainer.kind === 192 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -38279,9 +38508,9 @@ var ts; // declaration container are the same). var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAsignmentTarget || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0 || - isInTypeQuery(node) || node.parent.kind === 250 /* ExportSpecifier */) || - node.parent.kind === 207 /* NonNullExpression */ || - declaration.kind === 230 /* VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 251 /* ExportSpecifier */) || + node.parent.kind === 208 /* NonNullExpression */ || + declaration.kind === 231 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 2097152 /* Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -38312,7 +38541,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 267 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 268 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -38337,8 +38566,8 @@ 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 (container.kind === 218 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 231 /* VariableDeclarationList */).parent === container && + if (container.kind === 219 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 232 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -38352,7 +38581,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 189 /* ParenthesizedExpression */) { + while (current.parent.kind === 190 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -38360,7 +38589,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 196 /* PrefixUnaryExpression */ || current.parent.kind === 197 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 197 /* PrefixUnaryExpression */ || current.parent.kind === 198 /* PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 43 /* PlusPlusToken */ || expr.operator === 44 /* MinusMinusToken */; } @@ -38445,17 +38674,17 @@ var ts; 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 === 191 /* ArrowFunction */) { + if (container.kind === 192 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES2015 */); } switch (container.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* 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 236 /* EnumDeclaration */: + case 237 /* 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; @@ -38493,8 +38722,8 @@ var ts; // Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated. // If this is a function in a JS file, it might be a class method. Check if it's the RHS // of a x.prototype.y = function [name]() { .... } - if (container.kind === 190 /* FunctionExpression */ && - container.parent.kind === 198 /* BinaryExpression */ && + if (container.kind === 191 /* FunctionExpression */ && + container.parent.kind === 199 /* BinaryExpression */ && ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') var className = container.parent // x.prototype.y = f @@ -38525,7 +38754,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 280 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 281 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -38538,12 +38767,12 @@ var ts; return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 148 /* Parameter */; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 185 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 186 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); 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 === 191 /* ArrowFunction */) { + while (container && container.kind === 192 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */; } @@ -38563,7 +38792,7 @@ var ts; 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 === 182 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 183 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -38651,7 +38880,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 182 /* ObjectLiteralExpression */) { + if (container.parent.kind === 183 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -38695,7 +38924,7 @@ 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 === 182 /* ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 183 /* ObjectLiteralExpression */) { if (ts.hasModifier(container, 32 /* Static */)) { return container.kind === 153 /* MethodDeclaration */ || container.kind === 152 /* MethodSignature */ || @@ -38719,8 +38948,8 @@ var ts; function getContainingObjectLiteral(func) { return (func.kind === 153 /* MethodDeclaration */ || func.kind === 155 /* GetAccessor */ || - func.kind === 156 /* SetAccessor */) && func.parent.kind === 182 /* ObjectLiteralExpression */ ? func.parent : - func.kind === 190 /* FunctionExpression */ && func.parent.kind === 268 /* PropertyAssignment */ ? func.parent.parent : + func.kind === 156 /* SetAccessor */) && func.parent.kind === 183 /* ObjectLiteralExpression */ ? func.parent : + func.kind === 191 /* FunctionExpression */ && func.parent.kind === 269 /* PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -38732,7 +38961,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 191 /* ArrowFunction */) { + if (func.kind === 192 /* ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -38759,7 +38988,7 @@ var ts; if (thisType) { return instantiateType(thisType, getContextualMapper(containingLiteral)); } - if (literal.parent.kind !== 268 /* PropertyAssignment */) { + if (literal.parent.kind !== 269 /* PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -38773,9 +39002,9 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = func.parent; - if (parent.kind === 198 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */) { + if (parent.kind === 199 /* BinaryExpression */ && parent.operatorToken.kind === 58 /* EqualsToken */) { var target = parent.left; - if (target.kind === 183 /* PropertyAccessExpression */ || target.kind === 184 /* ElementAccessExpression */) { + if (target.kind === 184 /* PropertyAccessExpression */ || target.kind === 185 /* ElementAccessExpression */) { var expression = target.expression; // Don't contextually type `this` as `exports` in `exports.Point = function(x, y) { this.x = x; this.y = y; }` if (inJs && ts.isIdentifier(expression)) { @@ -38862,7 +39091,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; var name = declaration.propertyName || declaration.name; - if (parentDeclaration.kind !== 180 /* BindingElement */) { + if (parentDeclaration.kind !== 181 /* BindingElement */) { var parentTypeNode = ts.getEffectiveTypeAnnotationNode(parentDeclaration); if (parentTypeNode && !ts.isBindingPattern(name)) { var text = ts.getTextOfPropertyName(name); @@ -38944,7 +39173,7 @@ var ts; return getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 187 /* TaggedTemplateExpression */) { + if (template.parent.kind === 188 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -39090,7 +39319,7 @@ var ts; var prop = _a[_i]; if (!prop.symbol) continue; - if (prop.kind !== 268 /* PropertyAssignment */) + if (prop.kind !== 269 /* PropertyAssignment */) continue; if (isDiscriminantProperty(contextualType, prop.symbol.escapedName)) { var discriminatingType = getTypeOfNode(prop.initializer); @@ -39138,52 +39367,52 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 180 /* BindingElement */: + case 181 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 191 /* ArrowFunction */: - case 223 /* ReturnStatement */: + case 192 /* ArrowFunction */: + case 224 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return getApparentTypeOfContextualType(parent.parent); - case 181 /* ArrayLiteralExpression */: { + case 182 /* ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 209 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 200 /* TemplateExpression */); + case 210 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 201 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 189 /* ParenthesizedExpression */: { + case 190 /* ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); } - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return getContextualTypeForJsxExpression(parent); - case 260 /* JsxAttribute */: - case 262 /* JsxSpreadAttribute */: + case 261 /* JsxAttribute */: + case 263 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent); } return undefined; @@ -39243,64 +39472,59 @@ var ts; if (context.typeArguments) { signatures = ts.mapDefined(signatures, function (s) { return getJsxSignatureTypeArgumentInstantiation(s, context, isJs); }); } - return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromConstructSignature(t, isJs, context); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0 /* None */); + return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, /*reportErrors*/ false); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0 /* None */); } function getJsxPropsTypeFromCallSignature(sig, context) { - var propsType = getTypeOfFirstParameterOfSignature(sig); + var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType); var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (intrinsicAttribs !== unknownType) { propsType = intersectTypes(intrinsicAttribs, propsType); } return propsType; } - function getJsxPropsTypeFromClassType(hostClassType, isJs, context) { - if (isTypeAny(hostClassType)) { - return hostClassType; + function getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation) { + var instanceType = getReturnTypeOfSignature(sig); + return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation); + } + function getJsxPropsTypeFromClassType(sig, isJs, context, reportErrors) { + var forcedLookupLocation = getJsxElementPropertiesName(getJsxNamespaceAt(context)); + var attributesType = forcedLookupLocation === undefined + // If there is no type ElementAttributesProperty, return the type of the first parameter of the signature, which should be the props type + ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType) + : forcedLookupLocation === "" + // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead + ? getReturnTypeOfSignature(sig) + // Otherwise get the type of the property on the signature return type + : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation); + if (!attributesType) { + // There is no property named 'props' on this instance type + if (reportErrors && !!forcedLookupLocation && !!ts.length(context.attributes.properties)) { + error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation)); + } + return emptyObjectType; } - var propsName = getJsxElementPropertiesName(getJsxNamespaceAt(context)); - if (propsName === undefined) { - // There is no type ElementAttributesProperty, return 'any' - return anyType; - } - else if (propsName === "") { - // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead - return hostClassType; + else if (isTypeAny(attributesType)) { + // Props is of type 'any' or unknown + return attributesType; } else { - var attributesType = getTypeOfPropertyOfType(hostClassType, propsName); - if (!attributesType) { - // There is no property named 'props' on this instance type - return emptyObjectType; + // Normal case -- add in IntrinsicClassElements and IntrinsicElements + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); + if (intrinsicClassAttribs !== unknownType) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + var hostClassType = getReturnTypeOfSignature(sig); + apparentAttributesType = intersectTypes(typeParams + ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) + : intrinsicClassAttribs, apparentAttributesType); } - else if (isTypeAny(attributesType)) { - // Props is of type 'any' or unknown - return attributesType; - } - else { - // Normal case -- add in IntrinsicClassElements and IntrinsicElements - var apparentAttributesType = attributesType; - var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); - if (intrinsicClassAttribs !== unknownType) { - var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) - : intrinsicClassAttribs, apparentAttributesType); - } - var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); - if (intrinsicAttribs !== unknownType) { - apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); - } - return apparentAttributesType; + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); } + return apparentAttributesType; } } - function getJsxPropsTypeFromConstructSignature(sig, isJs, context) { - var hostClassType = getReturnTypeOfSignature(sig); - if (hostClassType) { - return getJsxPropsTypeFromClassType(hostClassType, isJs, context); - } - return getJsxPropsTypeFromCallSignature(sig, context); - } // If the given type is an object or union type with a single signature, and if that signature has at // least as many parameters as the given function, return the signature. Otherwise return undefined. function getContextualCallSignature(type, node) { @@ -39328,7 +39552,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 190 /* FunctionExpression */ || node.kind === 191 /* ArrowFunction */; + return node.kind === 191 /* FunctionExpression */ || node.kind === 192 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -39400,8 +39624,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterables*/ false); } function hasDefaultValue(node) { - return (node.kind === 180 /* BindingElement */ && !!node.initializer) || - (node.kind === 198 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */); + return (node.kind === 181 /* BindingElement */ && !!node.initializer) || + (node.kind === 199 /* BinaryExpression */ && node.operatorToken.kind === 58 /* EqualsToken */); } function checkArrayLiteral(node, checkMode) { var elements = node.elements; @@ -39411,7 +39635,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); for (var index = 0; index < elements.length; index++) { var e = elements[index]; - if (inDestructuringPattern && e.kind === 202 /* SpreadElement */) { + if (inDestructuringPattern && e.kind === 203 /* SpreadElement */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -39436,7 +39660,7 @@ var ts; var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 202 /* SpreadElement */; + hasSpreadElement = hasSpreadElement || e.kind === 203 /* SpreadElement */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -39450,7 +39674,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 179 /* ArrayBindingPattern */ || pattern.kind === 181 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 180 /* ArrayBindingPattern */ || pattern.kind === 182 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -39458,7 +39682,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 204 /* OmittedExpression */) { + if (patternElement.kind !== 205 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType); @@ -39556,7 +39780,7 @@ var ts; var propagatedFlags = 8388608 /* FreshLiteral */; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 178 /* ObjectBindingPattern */ || contextualType.pattern.kind === 182 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 179 /* ObjectBindingPattern */ || contextualType.pattern.kind === 183 /* ObjectLiteralExpression */); var isInJSFile = ts.isInJavaScriptFile(node); var isJSObjectLiteral = !contextualType && isInJSFile; var typeFlags = 0; @@ -39578,15 +39802,15 @@ var ts; var memberDecl = node.properties[i]; var member = getSymbolOfNode(memberDecl); var literalName = void 0; - if (memberDecl.kind === 268 /* PropertyAssignment */ || - memberDecl.kind === 269 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 269 /* PropertyAssignment */ || + memberDecl.kind === 270 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var jsdocType = void 0; if (isInJSFile) { jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); } var type = void 0; - if (memberDecl.kind === 268 /* PropertyAssignment */) { + if (memberDecl.kind === 269 /* PropertyAssignment */) { if (memberDecl.name.kind === 146 /* ComputedPropertyName */) { var t = checkComputedPropertyName(memberDecl.name); if (t.flags & 224 /* Literal */) { @@ -39599,7 +39823,7 @@ var ts; type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 269 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 270 /* ShorthandPropertyAssignment */); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } if (jsdocType) { @@ -39618,8 +39842,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 === 268 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 269 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 269 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 270 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* Optional */; } @@ -39647,7 +39871,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 270 /* SpreadAssignment */) { + else if (memberDecl.kind === 271 /* SpreadAssignment */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -39774,7 +39998,7 @@ var ts; function isJsxIntrinsicIdentifier(tagName) { // TODO (yuisu): comment switch (tagName.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 99 /* ThisKeyword */: return false; case 71 /* Identifier */: @@ -39824,7 +40048,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 262 /* JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 263 /* JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, /*typeFlags*/ 0, 4096 /* JsxAttributes */); attributesTable = ts.createSymbolTable(); @@ -39847,7 +40071,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 253 /* JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 254 /* 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); @@ -39956,29 +40180,7 @@ var ts; } return links.resolvedSymbol; } - /** - * Given a JSX element that is a class element, finds the Element Instance Type. If the - * element is not a class element, or the class element type cannot be determined, returns 'undefined'. - * For example, in the element , the element instance type is `MyClass` (not `typeof MyClass`). - */ - function getJsxElementInstanceType(node, valueType) { - ts.Debug.assert(!(valueType.flags & 131072 /* Union */)); - if (isTypeAny(valueType)) { - // Short-circuit if the class tag is using an element type 'any' - return anyType; - } - // Resolve the signatures, preferring constructor - var signatures = getSignaturesOfType(valueType, 1 /* Construct */); - if (signatures.length === 0) { - // No construct signatures, try call signatures - signatures = getSignaturesOfType(valueType, 0 /* Call */); - if (signatures.length === 0) { - // We found no signatures at all, which is an error - error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName)); - return unknownType; - } - } - // Instantiate in context of source type + function instantiateJsxSignatures(node, signatures) { var instantiatedSignatures = []; var candidateForTypeArgumentError; var hasTypeArgumentError = !!node.typeArguments; @@ -40013,7 +40215,7 @@ var ts; diagnostics.add(getTypeArgumentArityError(node, signatures, node.typeArguments)); } } - return getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2 /* Subtype */); + return instantiatedSignatures; } function getJsxSignatureTypeArgumentInstantiation(signature, node, isJavascript, reportErrors) { if (!node.typeArguments) { @@ -40212,8 +40414,12 @@ var ts; return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType); }), 2 /* Subtype */); } + // Shortcircuit any + if (isTypeAny(elementType)) { + return elementType; + } // If the elemType is a string type, we have to return anyType to prevent an error downstream as we will try to find construct or call signature of the type - if (elementType.flags & 2 /* String */) { + else if (elementType.flags & 2 /* String */) { return anyType; } else if (elementType.flags & 32 /* StringLiteral */) { @@ -40238,7 +40444,20 @@ var ts; return anyType; } // Get the element instance type (the result of newing or invoking this tag) - var elemInstanceType = getJsxElementInstanceType(openingLikeElement, elementType); + // Resolve the signatures, preferring constructor + var signatures = getSignaturesOfType(elementType, 1 /* Construct */); + if (signatures.length === 0) { + // No construct signatures, try call signatures + signatures = getSignaturesOfType(elementType, 0 /* Call */); + if (signatures.length === 0) { + // We found no signatures at all, which is an error + error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName)); + return unknownType; + } + } + // Instantiate in context of source type + var instantiatedSignatures = instantiateJsxSignatures(openingLikeElement, signatures); + var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2 /* Subtype */); // If we should include all stateless attributes type, then get all attributes type from all stateless function signature. // Otherwise get only attributes type from the signature picked by choose-overload logic. var statelessAttributesType = shouldIncludeAllStatelessAttributesType ? @@ -40251,7 +40470,8 @@ var ts; if (elementClassType) { checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); } - return getJsxPropsTypeFromClassType(elemInstanceType, ts.isInJavaScriptFile(openingLikeElement), openingLikeElement); + var isJs = ts.isInJavaScriptFile(openingLikeElement); + return getUnionType(ts.map(instantiatedSignatures, function (sig) { return getJsxPropsTypeFromClassType(sig, isJs, openingLikeElement, /*reportErrors*/ true); })); } /** * Get attributes type of the given intrinsic opening-like Jsx element by resolving the tag name. @@ -40437,29 +40657,22 @@ var ts; // i.e
// attr1 and attr2 are treated as JSXAttributes attached in the JsxOpeningLikeElement as "attributes". var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode); - // If the targetAttributesType is an emptyObjectType, indicating that there is no property named 'props' on this instance type. - // but there exists a sourceAttributesType, we need to explicitly give an error as normal assignability check allow excess properties and will pass. - if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || getPropertiesOfType(sourceAttributesType).length > 0)) { - error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(getJsxElementPropertiesName(getJsxNamespaceAt(openingLikeElement)))); - } - else { - // Check if sourceAttributesType assignable to targetAttributesType though this check will allow excess properties - var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); - // After we check for assignability, we will do another pass to check that all explicitly specified attributes have correct name corresponding in targetAttributeType. - // This will allow excess properties in spread type as it is very common pattern to spread outer attributes into React component in its render method. - if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { - for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { - var attribute = _a[_i]; - if (!ts.isJsxAttribute(attribute)) { - continue; - } - var attrName = attribute.name; - var isNotIgnoredJsxProperty = (isUnhyphenatedJsxName(ts.idText(attrName)) || !!(getPropertyOfType(targetAttributesType, attrName.escapedText))); - if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, /*isComparingJsxAttributes*/ true)) { - error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); - // We break here so that errors won't be cascading - break; - } + // Check if sourceAttributesType assignable to targetAttributesType though this check will allow excess properties + var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); + // After we check for assignability, we will do another pass to check that all explicitly specified attributes have correct name corresponding in targetAttributeType. + // This will allow excess properties in spread type as it is very common pattern to spread outer attributes into React component in its render method. + if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { + for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { + var attribute = _a[_i]; + if (!ts.isJsxAttribute(attribute)) { + continue; + } + var attrName = attribute.name; + var isNotIgnoredJsxProperty = (isUnhyphenatedJsxName(ts.idText(attrName)) || !!(getPropertyOfType(targetAttributesType, attrName.escapedText))); + if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, /*isComparingJsxAttributes*/ true)) { + error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); + // We break here so that errors won't be cascading + break; } } } @@ -40484,10 +40697,19 @@ var ts; function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } - function isMethodLike(symbol) { - return !!(symbol.flags & 8192 /* Method */ || - ts.getCheckFlags(symbol) & 4 /* SyntheticMethod */ || - ts.isInJavaScriptFile(symbol.valueDeclaration) && ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(symbol.valueDeclaration))); + /** + * Return whether this symbol is a member of a prototype somewhere + * Note that this is not tracked well within the compiler, so the answer may be incorrect. + */ + function isPrototypeProperty(symbol) { + if (symbol.flags & 8192 /* Method */ || ts.getCheckFlags(symbol) & 4 /* SyntheticMethod */) { + return true; + } + if (ts.isInJavaScriptFile(symbol.valueDeclaration)) { + var parent = symbol.valueDeclaration.parent; + return parent && ts.isBinaryExpression(parent) && + ts.getSpecialPropertyAssignmentKind(parent) === 3 /* PrototypeProperty */; + } } /** * Check whether the requested property access is valid. @@ -40499,9 +40721,11 @@ var ts; */ function checkPropertyAccessibility(node, left, type, prop) { var flags = ts.getDeclarationModifierFlagsFromSymbol(prop); - var errorNode = node.kind === 183 /* PropertyAccessExpression */ || node.kind === 230 /* VariableDeclaration */ ? + var errorNode = node.kind === 184 /* PropertyAccessExpression */ || node.kind === 231 /* VariableDeclaration */ ? node.name : - node.right; + node.kind === 178 /* ImportType */ ? + node : + node.right; if (ts.getCheckFlags(prop) & 256 /* ContainsPrivate */) { // Synthetic property with private constituent property error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); @@ -40654,7 +40878,7 @@ var ts; // Only compute control flow type if this is a property access expression that isn't an // assignment target, and the referenced property was declared as a variable, property, // accessor, or optional method. - if (node.kind !== 183 /* PropertyAccessExpression */ || + if (node.kind !== 184 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 131072 /* Union */)) { return propType; @@ -40691,7 +40915,7 @@ var ts; && !isPropertyDeclaredInAncestorClass(prop)) { error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.idText(right)); } - else if (valueDeclaration.kind === 233 /* ClassDeclaration */ && + else if (valueDeclaration.kind === 234 /* ClassDeclaration */ && node.parent.kind !== 161 /* TypeReference */ && !(valueDeclaration.flags & 2097152 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { @@ -40703,7 +40927,7 @@ var ts; switch (node.kind) { case 151 /* PropertyDeclaration */: return true; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: // We might be in `a = { b: this.b }`, so keep looking. See `tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts`. return false; default: @@ -40721,11 +40945,11 @@ var ts; } var classType = getTypeOfSymbol(prop.parent); while (true) { - classType = getSuperClass(classType); + classType = classType.symbol && getSuperClass(classType); if (!classType) { return false; } - var superProperty = getPropertyOfObjectType(classType, prop.escapedName); + var superProperty = getPropertyOfType(classType, prop.escapedName); if (superProperty && superProperty.valueDeclaration) { return true; } @@ -40736,8 +40960,7 @@ var ts; if (x.length === 0) { return undefined; } - ts.Debug.assert(x.length === 1); - return x[0]; + return getIntersectionType(x); } function reportNonexistentProperty(propNode, containingType) { var errorInfo; @@ -40891,11 +41114,17 @@ var ts; (ts.getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = 67108863 /* All */; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 183 /* PropertyAccessExpression */ ? node.expression : node.left; - return isValidPropertyAccessWithType(node, left, propertyName, getWidenedType(checkExpression(left))); + switch (node.kind) { + case 184 /* PropertyAccessExpression */: + return isValidPropertyAccessWithType(node, node.expression, propertyName, getWidenedType(checkExpression(node.expression))); + case 145 /* QualifiedName */: + return isValidPropertyAccessWithType(node, node.left, propertyName, getWidenedType(checkExpression(node.left))); + case 178 /* ImportType */: + return isValidPropertyAccessWithType(node, node, propertyName, getTypeFromTypeNode(node)); + } } function isValidPropertyAccessForCompletions(node, type, property) { - return isValidPropertyAccessWithType(node, node.expression, property.escapedName, type) + return isValidPropertyAccessWithType(node, node.kind === 178 /* ImportType */ ? node : node.expression, property.escapedName, type) && (!(property.flags & 8192 /* Method */) || isValidMethodAccess(property, type)); } function isValidMethodAccess(method, actualThisType) { @@ -40929,7 +41158,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 231 /* VariableDeclarationList */) { + if (initializer.kind === 232 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -40958,7 +41187,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 219 /* ForInStatement */ && + if (node.kind === 220 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -40976,7 +41205,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 186 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 187 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -41043,7 +41272,7 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 187 /* TaggedTemplateExpression */) { + if (node.kind === 188 /* TaggedTemplateExpression */) { checkExpression(node.template); } else if (node.kind !== 149 /* Decorator */) { @@ -41112,7 +41341,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 202 /* SpreadElement */) { + if (arg && arg.kind === 203 /* SpreadElement */) { return i; } } @@ -41128,12 +41357,12 @@ var ts; // The arity check will be done in "checkApplicableSignatureForJsxOpeningLikeElement". return true; } - if (node.kind === 187 /* TaggedTemplateExpression */) { + if (node.kind === 188 /* TaggedTemplateExpression */) { // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length argCount = args.length; typeArguments = undefined; - if (node.template.kind === 200 /* TemplateExpression */) { + if (node.template.kind === 201 /* 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.lastOrUndefined(node.template.templateSpans); @@ -41156,7 +41385,7 @@ var ts; else { if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 186 /* NewExpression */); + ts.Debug.assert(node.kind === 187 /* NewExpression */); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -41274,7 +41503,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 204 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 205 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); // If the effective argument type is 'undefined', there is no synthetic type @@ -41364,7 +41593,7 @@ var ts; return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 186 /* NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 187 /* 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. @@ -41381,7 +41610,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 204 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 205 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); // If the effective argument type is undefined, there is no synthetic type for the argument. @@ -41405,12 +41634,9 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - if (node.kind === 185 /* CallExpression */) { - var callee = node.expression; - if (callee.kind === 183 /* PropertyAccessExpression */) { - return callee.expression; - } - else if (callee.kind === 184 /* ElementAccessExpression */) { + if (node.kind === 186 /* CallExpression */) { + var callee = ts.skipOuterExpressions(node.expression); + if (callee.kind === 184 /* PropertyAccessExpression */ || callee.kind === 185 /* ElementAccessExpression */) { return callee.expression; } } @@ -41425,10 +41651,10 @@ var ts; * will be supplied from calls to `getEffectiveArgumentCount` and `getEffectiveArgumentType`. */ function getEffectiveCallArguments(node) { - if (node.kind === 187 /* TaggedTemplateExpression */) { + if (node.kind === 188 /* TaggedTemplateExpression */) { var template = node.template; var args_4 = [undefined]; - if (template.kind === 200 /* TemplateExpression */) { + if (template.kind === 201 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_4.push(span.expression); }); @@ -41464,8 +41690,8 @@ var ts; function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 149 /* Decorator */) { switch (node.parent.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; case 151 /* PropertyDeclaration */: @@ -41508,7 +41734,7 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); @@ -41553,7 +41779,7 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } @@ -41607,7 +41833,7 @@ var ts; function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a parameter decorator - if (node.kind === 233 /* ClassDeclaration */) { + if (node.kind === 234 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } @@ -41656,7 +41882,7 @@ var ts; if (node.kind === 149 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 187 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 188 /* TaggedTemplateExpression */) { return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' @@ -41669,7 +41895,7 @@ var ts; function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. if (node.kind === 149 /* Decorator */ || - (argIndex === 0 && node.kind === 187 /* TaggedTemplateExpression */)) { + (argIndex === 0 && node.kind === 188 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -41682,7 +41908,7 @@ var ts; // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 187 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 188 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -41702,7 +41928,7 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, paramCount, typeArguments.length); } function resolveCall(node, signatures, candidatesOutArray, fallbackError) { - var isTaggedTemplate = node.kind === 187 /* TaggedTemplateExpression */; + var isTaggedTemplate = node.kind === 188 /* TaggedTemplateExpression */; var isDecorator = node.kind === 149 /* Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var typeArguments; @@ -41777,7 +42003,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 = candidatesOutArray && node.kind === 185 /* CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 186 /* 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 @@ -42164,8 +42390,8 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 148 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; @@ -42261,16 +42487,16 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray); case 149 /* Decorator */: return resolveDecorator(node, candidatesOutArray); - case 255 /* JsxOpeningElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: // This code-path is called by language service return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray) || unknownSignature; } @@ -42353,14 +42579,13 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 183 /* PropertyAccessExpression */) { + while (parent && parent.kind === 184 /* PropertyAccessExpression */) { parent = parent.parent; } - return parent && ts.isBinaryExpression(parent) && - ts.isPrototypeAccess(parent.left) && - parent.operatorToken.kind === 58 /* EqualsToken */ && - ts.isObjectLiteralExpression(parent.right) && - parent.right; + if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 58 /* EqualsToken */) { + var right = ts.getInitializerOfBinaryExpression(parent); + return ts.isObjectLiteralExpression(right) && right; + } } function getInferredClassType(symbol) { var links = getSymbolLinks(symbol); @@ -42386,7 +42611,7 @@ var ts; if (node.expression.kind === 97 /* SuperKeyword */) { return voidType; } - if (node.kind === 186 /* NewExpression */) { + if (node.kind === 187 /* NewExpression */) { var declaration = signature.declaration; if (declaration && declaration.kind !== 154 /* Constructor */ && @@ -42508,9 +42733,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 232 /* FunctionDeclaration */ + ? 233 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 230 /* VariableDeclaration */ + ? 231 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -42575,7 +42800,10 @@ var ts; pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function getTypeOfFirstParameterOfSignature(signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType); + } + function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType; } function inferFromAnnotatedParameters(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -42677,7 +42905,7 @@ var ts; } var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 211 /* Block */) { + if (func.body.kind !== 212 /* Block */) { type = checkExpressionCached(func.body, checkMode); if (functionFlags & 2 /* Async */) { // From within an async function you can return either a non-promise value or a promise. Any @@ -42791,7 +43019,7 @@ var ts; if (!(func.flags & 128 /* HasImplicitReturn */)) { return false; } - if (ts.some(func.body.statements, function (statement) { return statement.kind === 225 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) { + if (ts.some(func.body.statements, function (statement) { return statement.kind === 226 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) { return false; } return true; @@ -42834,11 +43062,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return true; case 153 /* MethodDeclaration */: - return func.parent.kind === 182 /* ObjectLiteralExpression */; + return func.parent.kind === 183 /* ObjectLiteralExpression */; default: return false; } @@ -42862,7 +43090,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 === 152 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 211 /* Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 152 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 212 /* Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; @@ -42902,7 +43130,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 190 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 191 /* FunctionExpression */) { checkGrammarForGenerator(node); } var links = getNodeLinks(node); @@ -42937,11 +43165,6 @@ var ts; checkNodeDeferred(node); } } - if (produceDiagnostics && node.kind !== 153 /* MethodDeclaration */) { - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); - } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { @@ -42965,7 +43188,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 211 /* Block */) { + if (node.body.kind === 212 /* Block */) { checkSourceElement(node.body); } else { @@ -43012,7 +43235,7 @@ var ts; if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 183 /* PropertyAccessExpression */ || expr.kind === 184 /* ElementAccessExpression */) && + (expr.kind === 184 /* PropertyAccessExpression */ || expr.kind === 185 /* ElementAccessExpression */) && expr.expression.kind === 99 /* ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var func = ts.getContainingFunction(expr); @@ -43029,13 +43252,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 183 /* PropertyAccessExpression */ || expr.kind === 184 /* ElementAccessExpression */) { + if (expr.kind === 184 /* PropertyAccessExpression */ || expr.kind === 185 /* ElementAccessExpression */) { var node = ts.skipParentheses(expr.expression); if (node.kind === 71 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 2097152 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 244 /* NamespaceImport */; + return declaration && declaration.kind === 245 /* NamespaceImport */; } } } @@ -43044,7 +43267,7 @@ var ts; function checkReferenceExpression(expr, invalidReferenceMessage) { // References are combinations of identifiers, parentheses, and property accesses. var node = ts.skipOuterExpressions(expr, 2 /* Assertions */ | 1 /* Parentheses */); - if (node.kind !== 71 /* Identifier */ && node.kind !== 183 /* PropertyAccessExpression */ && node.kind !== 184 /* ElementAccessExpression */) { + if (node.kind !== 71 /* Identifier */ && node.kind !== 184 /* PropertyAccessExpression */ && node.kind !== 185 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } @@ -43053,7 +43276,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 183 /* PropertyAccessExpression */ && expr.kind !== 184 /* ElementAccessExpression */) { + if (expr.kind !== 184 /* PropertyAccessExpression */ && expr.kind !== 185 /* ElementAccessExpression */) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -43219,6 +43442,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; + checkGrammarForDisallowedTrailingComma(properties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); if (strictNullChecks && properties.length === 0) { return checkNonNullType(sourceType, node); } @@ -43230,7 +43454,7 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 268 /* PropertyAssignment */ || property.kind === 269 /* ShorthandPropertyAssignment */) { + if (property.kind === 269 /* PropertyAssignment */ || property.kind === 270 /* ShorthandPropertyAssignment */) { var name = property.name; if (name.kind === 146 /* ComputedPropertyName */) { checkComputedPropertyName(name); @@ -43245,7 +43469,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 269 /* ShorthandPropertyAssignment */) { + if (property.kind === 270 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -43257,7 +43481,7 @@ var ts; error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 270 /* SpreadAssignment */) { + else if (property.kind === 271 /* SpreadAssignment */) { if (languageVersion < 6 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); } @@ -43275,6 +43499,8 @@ var ts; } } function checkArrayLiteralAssignment(node, sourceType, checkMode) { + var elements = node.elements; + checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* Read */); } @@ -43282,7 +43508,6 @@ var ts; // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType; - var elements = node.elements; for (var i = 0; i < elements.length; i++) { checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); } @@ -43291,8 +43516,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 204 /* OmittedExpression */) { - if (element.kind !== 202 /* SpreadElement */) { + if (element.kind !== 205 /* OmittedExpression */) { + if (element.kind !== 203 /* SpreadElement */) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -43320,7 +43545,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 198 /* BinaryExpression */ && restExpression.operatorToken.kind === 58 /* EqualsToken */) { + if (restExpression.kind === 199 /* BinaryExpression */ && restExpression.operatorToken.kind === 58 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -43333,7 +43558,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 269 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 270 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -43349,21 +43574,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 198 /* BinaryExpression */ && target.operatorToken.kind === 58 /* EqualsToken */) { + if (target.kind === 199 /* BinaryExpression */ && target.operatorToken.kind === 58 /* EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 182 /* ObjectLiteralExpression */) { + if (target.kind === 183 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 181 /* ArrayLiteralExpression */) { + if (target.kind === 182 /* 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 === 270 /* SpreadAssignment */ ? + var error = target.parent.kind === 271 /* 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; if (checkReferenceExpression(target, error)) { @@ -43385,35 +43610,35 @@ var ts; case 71 /* Identifier */: case 9 /* StringLiteral */: case 12 /* RegularExpressionLiteral */: - case 187 /* TaggedTemplateExpression */: - case 200 /* TemplateExpression */: + case 188 /* TaggedTemplateExpression */: + case 201 /* TemplateExpression */: case 13 /* NoSubstitutionTemplateLiteral */: case 8 /* NumericLiteral */: case 101 /* TrueKeyword */: case 86 /* FalseKeyword */: case 95 /* NullKeyword */: case 140 /* UndefinedKeyword */: - case 190 /* FunctionExpression */: - case 203 /* ClassExpression */: - case 191 /* ArrowFunction */: - case 181 /* ArrayLiteralExpression */: - case 182 /* ObjectLiteralExpression */: - case 193 /* TypeOfExpression */: - case 207 /* NonNullExpression */: - case 254 /* JsxSelfClosingElement */: - case 253 /* JsxElement */: + case 191 /* FunctionExpression */: + case 204 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 182 /* ArrayLiteralExpression */: + case 183 /* ObjectLiteralExpression */: + case 194 /* TypeOfExpression */: + case 208 /* NonNullExpression */: + case 255 /* JsxSelfClosingElement */: + case 254 /* JsxElement */: return true; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -43425,9 +43650,9 @@ var ts; } return false; // Some forms listed here for clarity - case 194 /* VoidExpression */: // Explicit opt-out - case 188 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 206 /* AsExpression */: // Not SEF, but can produce useful type warnings + case 195 /* VoidExpression */: // Explicit opt-out + case 189 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 207 /* AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -43443,7 +43668,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 58 /* EqualsToken */ && (left.kind === 182 /* ObjectLiteralExpression */ || left.kind === 181 /* ArrayLiteralExpression */)) { + if (operator === 58 /* EqualsToken */ && (left.kind === 183 /* ObjectLiteralExpression */ || left.kind === 182 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); } var leftType = checkExpression(left, checkMode); @@ -43693,12 +43918,14 @@ var ts; // A place where we actually *are* concerned with the expressions' types are // in tagged templates. ts.forEach(node.templateSpans, function (templateSpan) { - checkExpression(templateSpan.expression); + if (maybeTypeOfKind(checkExpression(templateSpan.expression), 1536 /* ESSymbolLike */)) { + error(templateSpan.expression, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1, typeToString(esSymbolType), typeToString(stringType)); + } }); return stringType; } function getContextNode(node) { - if (node.kind === 261 /* JsxAttributes */) { + if (node.kind === 262 /* JsxAttributes */) { 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; @@ -43734,7 +43961,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 188 /* TypeAssertionExpression */ || node.kind === 206 /* AsExpression */; + return node.kind === 189 /* TypeAssertionExpression */ || node.kind === 207 /* AsExpression */; } function checkDeclarationInitializer(declaration) { var inJs = ts.isInJavaScriptFile(declaration); @@ -43838,7 +44065,7 @@ var ts; function getTypeOfExpression(node, cache) { // Optimize for the common case of a call to a function with a single non-generic call // signature where we can just fetch the return type without checking the arguments. - if (node.kind === 185 /* CallExpression */ && node.expression.kind !== 97 /* SuperKeyword */ && !ts.isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(node)) { + if (node.kind === 186 /* CallExpression */ && node.expression.kind !== 97 /* SuperKeyword */ && !ts.isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(node)) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -43885,8 +44112,8 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 184 /* ElementAccessExpression */ && node.parent.expression === node) || + var ok = (node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 185 /* ElementAccessExpression */ && node.parent.expression === node) || ((node.kind === 71 /* Identifier */ || node.kind === 145 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || (node.parent.kind === 164 /* TypeQuery */ && node.parent.exprName === node)); if (!ok) { @@ -43922,74 +44149,74 @@ var ts; return trueType; case 86 /* FalseKeyword */: return falseType; - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return checkTemplateExpression(node); case 12 /* RegularExpressionLiteral */: return globalRegExpType; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (node.expression.kind === 91 /* ImportKeyword */) { return checkImportCallExpression(node); } /* falls through */ - case 186 /* NewExpression */: + case 187 /* NewExpression */: return checkCallExpression(node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return checkClassExpression(node); - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: return checkAssertion(node); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return checkNonNullAssertion(node); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return checkMetaProperty(node); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return checkDeleteExpression(node); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return checkVoidExpression(node); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return checkAwaitExpression(node); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return checkSpreadExpression(node, checkMode); - case 204 /* OmittedExpression */: + case 205 /* OmittedExpression */: return undefinedWideningType; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return checkYieldExpression(node); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return checkJsxExpression(node, checkMode); - case 253 /* JsxElement */: + case 254 /* JsxElement */: return checkJsxElement(node, checkMode); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return checkJsxFragment(node, checkMode); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 255 /* JsxOpeningElement */: + case 256 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -44104,10 +44331,10 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: case 157 /* CallSignature */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 162 /* FunctionType */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: @@ -44128,7 +44355,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 === 179 /* ArrayBindingPattern */ || name.kind === 178 /* ObjectBindingPattern */) { + else if (name.kind === 180 /* ArrayBindingPattern */ || name.kind === 179 /* ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -44141,7 +44368,7 @@ var ts; checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 162 /* FunctionType */ || node.kind === 232 /* FunctionDeclaration */ || node.kind === 163 /* ConstructorType */ || + else if (node.kind === 162 /* FunctionType */ || node.kind === 233 /* FunctionDeclaration */ || node.kind === 163 /* ConstructorType */ || node.kind === 157 /* CallSignature */ || node.kind === 154 /* Constructor */ || node.kind === 158 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); @@ -44333,7 +44560,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 234 /* InterfaceDeclaration */) { + if (node.kind === 235 /* 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 @@ -44444,7 +44671,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 214 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 215 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -44614,7 +44841,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType))) { - if (accessNode.kind === 184 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 185 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -44656,6 +44883,10 @@ var ts; } checkSourceElement(node.typeParameter); } + function checkImportType(node) { + checkSourceElement(node.argument); + getTypeFromTypeNode(node); + } function isPrivateWithinAmbient(node) { return ts.hasModifier(node, 8 /* Private */) && !!(node.flags & 2097152 /* Ambient */); } @@ -44663,9 +44894,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 !== 234 /* InterfaceDeclaration */ && - n.parent.kind !== 233 /* ClassDeclaration */ && - n.parent.kind !== 203 /* ClassExpression */ && + if (n.parent.kind !== 235 /* InterfaceDeclaration */ && + n.parent.kind !== 234 /* ClassDeclaration */ && + n.parent.kind !== 204 /* ClassExpression */ && n.flags & 2097152 /* Ambient */) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported @@ -44795,7 +45026,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = node.flags & 2097152 /* Ambient */; - var inAmbientContextOrInterface = node.parent.kind === 234 /* InterfaceDeclaration */ || node.parent.kind === 165 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 235 /* InterfaceDeclaration */ || node.parent.kind === 165 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -44806,7 +45037,7 @@ 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 === 232 /* FunctionDeclaration */ || node.kind === 153 /* MethodDeclaration */ || node.kind === 152 /* MethodSignature */ || node.kind === 154 /* Constructor */) { + if (node.kind === 233 /* FunctionDeclaration */ || node.kind === 153 /* MethodDeclaration */ || node.kind === 152 /* MethodSignature */ || node.kind === 154 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -44934,32 +45165,32 @@ var ts; })(DeclarationSpaces || (DeclarationSpaces = {})); function getDeclarationSpaces(d) { switch (d.kind) { - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: // A jsdoc typedef is, by definition, a type alias - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return 2 /* ExportType */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4 /* ExportNamespace */ | 1 /* ExportValue */ : 4 /* ExportNamespace */; - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: return 2 /* ExportType */ | 1 /* ExportValue */; - case 272 /* SourceFile */: + case 273 /* SourceFile */: return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */; // The below options all declare an Alias, which is allowed to merge with other values within the importing module - case 241 /* ImportEqualsDeclaration */: - case 244 /* NamespaceImport */: - case 243 /* ImportClause */: + case 242 /* ImportEqualsDeclaration */: + case 245 /* NamespaceImport */: + case 244 /* ImportClause */: var result_2 = 0 /* None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); }); return result_2; - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: - case 232 /* FunctionDeclaration */: - case 246 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 233 /* FunctionDeclaration */: + case 247 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 return 1 /* ExportValue */; default: ts.Debug.fail(ts.Debug.showSyntaxKind(d)); @@ -45229,7 +45460,7 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); @@ -45358,7 +45589,7 @@ var ts; checkExternalEmitHelpers(firstDecorator, 16 /* 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 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -45395,9 +45626,6 @@ var ts; if (produceDiagnostics) { checkFunctionOrMethodDeclaration(node); checkGrammarForGenerator(node); - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -45451,7 +45679,7 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return node; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return node.name; default: return undefined; @@ -45529,29 +45757,29 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 272 /* SourceFile */: - case 237 /* ModuleDeclaration */: + case 273 /* SourceFile */: + case 238 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: checkUnusedTypeParameters(node); break; - case 211 /* Block */: - case 239 /* CaseBlock */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 212 /* Block */: + case 240 /* CaseBlock */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: checkUnusedLocalsAndParameters(node); break; case 154 /* Constructor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: @@ -45565,7 +45793,7 @@ var ts; case 158 /* ConstructSignature */: case 162 /* FunctionType */: case 163 /* ConstructorType */: - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: checkUnusedTypeParameters(node); break; default: @@ -45608,7 +45836,7 @@ var ts; var node = ts.getNameOfDeclaration(declaration) || declaration; if (isIdentifierThatStartsWithUnderScore(node)) { var declaration_2 = ts.getRootDeclaration(node.parent); - if ((declaration_2.kind === 230 /* VariableDeclaration */ && ts.isForInOrOfStatement(declaration_2.parent.parent)) || + if ((declaration_2.kind === 231 /* VariableDeclaration */ && ts.isForInOrOfStatement(declaration_2.parent.parent)) || declaration_2.kind === 147 /* TypeParameter */) { return; } @@ -45650,7 +45878,7 @@ var ts; } break; case 159 /* IndexSignature */: - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: // Can't be private break; default: @@ -45724,19 +45952,19 @@ var ts; } } function isImportedDeclaration(node) { - return node.kind === 243 /* ImportClause */ || node.kind === 246 /* ImportSpecifier */ || node.kind === 244 /* NamespaceImport */; + return node.kind === 244 /* ImportClause */ || node.kind === 247 /* ImportSpecifier */ || node.kind === 245 /* NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 243 /* ImportClause */ ? decl : decl.kind === 244 /* NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 244 /* ImportClause */ ? decl : decl.kind === 245 /* NamespaceImport */ ? decl.parent : decl.parent.parent; } function forEachImportedDeclaration(importClause, cb) { var defaultName = importClause.name, namedBindings = importClause.namedBindings; return (defaultName && cb(importClause)) || - namedBindings && (namedBindings.kind === 244 /* NamespaceImport */ ? cb(namedBindings) : ts.forEach(namedBindings.elements, cb)); + namedBindings && (namedBindings.kind === 245 /* NamespaceImport */ ? cb(namedBindings) : ts.forEach(namedBindings.elements, cb)); } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 211 /* Block */) { + if (node.kind === 212 /* Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -45786,16 +46014,6 @@ var ts; } return true; } - function checkCollisionWithCapturedThisVariable(node, name) { - if (languageVersion <= 1 /* ES5 */ && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_this")) { - potentialThisCollisions.push(node); - } - } - function checkCollisionWithCapturedNewTargetVariable(node, name) { - if (languageVersion <= 1 /* ES5 */ && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_newTarget")) { - potentialNewTargetCollisions.push(node); - } - } // this function will run after checking the source file so 'CaptureThis' is correct for all nodes function checkIfThisIsCapturedInEnclosingScope(node) { ts.findAncestor(node, function (current) { @@ -45825,29 +46043,6 @@ var ts; } }); } - function checkCollisionWithCapturedSuperVariable(node, name) { - if (languageVersion >= 2 /* ES2015 */ || compilerOptions.noEmit) { - return; - } - if (!needCollisionCheckForIdentifier(node, name, "_super")) { - return; - } - // bubble up and find containing type - var enclosingClass = ts.getContainingClass(node); - // if containing type was not found or it is ambient - exit (no codegen) - if (!enclosingClass || enclosingClass.flags & 2097152 /* Ambient */) { - return; - } - if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_3 = node.kind !== 71 /* Identifier */; - if (isDeclaration_3) { - error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); - } - else { - error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference); - } - } - } function checkCollisionWithRequireExportsInGeneratedCode(node, name) { // No need to check for require or exports for ES6 modules and later if (modulekind >= ts.ModuleKind.ES2015 || compilerOptions.noEmit) { @@ -45862,7 +46057,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 === 272 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 273 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -45877,7 +46072,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 === 272 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 273 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(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)); } @@ -45912,7 +46107,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 === 230 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 231 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -45924,17 +46119,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 231 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 212 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 232 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 213 /* 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 === 211 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 238 /* ModuleBlock */ || - container.kind === 237 /* ModuleDeclaration */ || - container.kind === 272 /* SourceFile */); + (container.kind === 212 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 239 /* ModuleBlock */ || + container.kind === 238 /* ModuleDeclaration */ || + container.kind === 273 /* 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 @@ -45960,7 +46155,7 @@ var ts; // skip declaration names (i.e. in object literal expressions) return; } - if (n.kind === 183 /* PropertyAccessExpression */) { + if (n.kind === 184 /* PropertyAccessExpression */) { // skip property names in property access expression return visit(n.expression); } @@ -45980,7 +46175,7 @@ var ts; var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { if (symbol.valueDeclaration.kind === 148 /* Parameter */ || - symbol.valueDeclaration.kind === 180 /* BindingElement */) { + symbol.valueDeclaration.kind === 181 /* BindingElement */) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { @@ -46033,8 +46228,8 @@ var ts; checkExpressionCached(node.initializer); } } - if (node.kind === 180 /* BindingElement */) { - if (node.parent.kind === 178 /* ObjectBindingPattern */ && languageVersion < 6 /* ESNext */) { + if (node.kind === 181 /* BindingElement */) { + if (node.parent.kind === 179 /* ObjectBindingPattern */ && languageVersion < 6 /* ESNext */) { checkExternalEmitHelpers(node, 4 /* Rest */); } // check computed properties inside property names of binding elements @@ -46055,7 +46250,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 179 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 180 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -46068,7 +46263,7 @@ var ts; // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 219 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 220 /* ForInStatement */) { var initializerType = checkExpressionCached(node.initializer); if (strictNullChecks && node.name.elements.length === 0) { checkNonNullType(initializerType, node); @@ -46085,7 +46280,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 219 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 220 /* ForInStatement */) { var initializer = ts.isInJavaScriptFile(node) && ts.getDeclaredJavascriptInitializer(node) || node.initializer; checkTypeAssignableTo(checkExpressionCached(initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); @@ -46111,12 +46306,9 @@ var ts; if (node.kind !== 151 /* PropertyDeclaration */ && node.kind !== 150 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */) { + if (node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } - checkCollisionWithCapturedSuperVariable(node, node.name); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -46129,8 +46321,8 @@ var ts; error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType)); } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 148 /* Parameter */ && right.kind === 230 /* VariableDeclaration */) || - (left.kind === 230 /* VariableDeclaration */ && right.kind === 148 /* Parameter */)) { + if ((left.kind === 148 /* Parameter */ && right.kind === 231 /* VariableDeclaration */) || + (left.kind === 231 /* VariableDeclaration */ && right.kind === 148 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -46169,7 +46361,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 213 /* EmptyStatement */) { + if (node.thenStatement.kind === 214 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -46189,12 +46381,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 231 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 232 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 231 /* VariableDeclarationList */) { + if (node.initializer.kind === 232 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -46212,32 +46404,30 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.kind === 220 /* ForOfStatement */) { - if (node.awaitModifier) { - var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); - if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 6 /* ESNext */) { - // for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper - checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */); - } - } - else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ES2015 */) { - // for..of prior to ES2015 requires the __values helper when downlevelIteration is enabled - checkExternalEmitHelpers(node, 256 /* ForOfIncludes */); + if (node.awaitModifier) { + var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); + if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 6 /* ESNext */) { + // for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper + checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */); } } + else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ES2015 */) { + // for..of prior to ES2015 requires the __values helper when downlevelIteration is enabled + checkExternalEmitHelpers(node, 256 /* ForOfIncludes */); + } // Check the LHS and RHS // If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS // 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 === 231 /* VariableDeclarationList */) { + if (node.initializer.kind === 232 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); // There may be a destructuring assignment on the left side - if (varExpr.kind === 181 /* ArrayLiteralExpression */ || varExpr.kind === 182 /* ObjectLiteralExpression */) { + if (varExpr.kind === 182 /* ArrayLiteralExpression */ || varExpr.kind === 183 /* 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. @@ -46269,7 +46459,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 === 231 /* VariableDeclarationList */) { + if (node.initializer.kind === 232 /* 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); @@ -46283,7 +46473,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 === 181 /* ArrayLiteralExpression */ || varExpr.kind === 182 /* ObjectLiteralExpression */) { + if (varExpr.kind === 182 /* ArrayLiteralExpression */ || varExpr.kind === 183 /* 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)) { @@ -46296,8 +46486,8 @@ var ts; } // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeAssignableToKind(rightType, 134217728 /* NonPrimitive */ | 7372800 /* InstantiableNonPrimitive */)) { - error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); + if (rightType === neverType || !isTypeAssignableToKind(rightType, 134217728 /* NonPrimitive */ | 7372800 /* InstantiableNonPrimitive */)) { + error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)); } checkSourceElement(node.statement); if (node.locals) { @@ -46328,6 +46518,10 @@ var ts; * of a iterable (if defined globally) or element type of an array like for ES2015 or earlier. */ function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables, checkAssignability) { + if (inputType === neverType) { + reportTypeNotIterableError(errorNode, inputType, allowAsyncIterables); + return undefined; + } var uplevelIteration = languageVersion >= 2 /* ES2015 */; var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; // Get the iterated type of an `Iterable` or `IterableIterator` only in ES2015 @@ -46381,13 +46575,18 @@ var ts; // want to say that number is not an array type. But if the input was just // number and string input is allowed, we want to say that number is not an // array type or a string type. + var isIterable = !!getIteratedTypeOfIterable(inputType, /* errorNode */ undefined, allowAsyncIterables, /*allowSyncIterables*/ true, checkAssignability); var diagnostic = !allowStringInput || hasStringConstituent ? downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator - : ts.Diagnostics.Type_0_is_not_an_array_type + : isIterable + ? ts.Diagnostics.Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators + : ts.Diagnostics.Type_0_is_not_an_array_type : downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + : isIterable + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(errorNode, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : undefined; @@ -46477,10 +46676,8 @@ var ts; var signatures = methodType && getSignaturesOfType(methodType, 0 /* Call */); if (!ts.some(signatures)) { if (errorNode) { - error(errorNode, allowAsyncIterables - ? ts.Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator - : ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); // only report on the first error + reportTypeNotIterableError(errorNode, type, allowAsyncIterables); errorNode = undefined; } return undefined; @@ -46500,6 +46697,11 @@ var ts; : typeAsIterable.iteratedTypeOfIterable = iteratedType; } } + function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) { + error(errorNode, allowAsyncIterables + ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator, typeToString(type)); + } /** * This function has very similar logic as getIteratedTypeOfIterable, except that it operates on * Iterators instead of Iterables. Here is the structure: @@ -46684,7 +46886,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 === 265 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 266 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -46696,7 +46898,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 264 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 265 /* CaseClause */) { // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable // to or from the type of the 'switch' expression. @@ -46725,7 +46927,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 226 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 227 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -46830,7 +47032,7 @@ var ts; // this allows us to rule out cases when both property and indexer are inherited from the base class var errorNode; if (propDeclaration && - (propDeclaration.kind === 198 /* BinaryExpression */ || + (propDeclaration.kind === 199 /* BinaryExpression */ || ts.getNameOfDeclaration(propDeclaration).kind === 146 /* ComputedPropertyName */ || prop.parent === containingType.symbol)) { errorNode = propDeclaration; @@ -46976,8 +47178,6 @@ var ts; checkDecorators(node); if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -47116,7 +47316,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 233 /* ClassDeclaration */ || d.kind === 234 /* InterfaceDeclaration */; + return d.kind === 234 /* ClassDeclaration */ || d.kind === 235 /* InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -47155,7 +47355,7 @@ var ts; // 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 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) { - if (derivedClassDecl.kind === 203 /* ClassExpression */) { + if (derivedClassDecl.kind === 204 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -47170,12 +47370,12 @@ var ts; // either base or derived property is private - not override, skip it continue; } - if (isMethodLike(base) && isMethodLike(derived) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) { + if (isPrototypeProperty(base) && isPrototypeProperty(derived) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) { // method is overridden with method or property/accessor is overridden with property/accessor - correct case continue; } var errorMessage = void 0; - if (isMethodLike(base)) { + if (isPrototypeProperty(base)) { if (derived.flags & 98304 /* Accessor */) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } @@ -47183,11 +47383,11 @@ var ts; errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } - else if (base.flags & 4 /* Property */) { - errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + else if (base.flags & 98304 /* Accessor */) { + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } @@ -47269,7 +47469,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 234 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 235 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -47374,7 +47574,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -47384,7 +47584,7 @@ var ts; } } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -47409,18 +47609,18 @@ var ts; case 8 /* NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return evaluate(expr.expression); case 71 /* Identifier */: return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), expr.escapedText); - case 184 /* ElementAccessExpression */: - case 183 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 184 /* PropertyAccessExpression */: var ex = expr; if (isConstantMemberAccess(ex)) { var type = getTypeOfExpression(ex.expression); if (type.symbol && type.symbol.flags & 384 /* Enum */) { var name = void 0; - if (ex.kind === 183 /* PropertyAccessExpression */) { + if (ex.kind === 184 /* PropertyAccessExpression */) { name = ex.name.escapedText; } else { @@ -47452,8 +47652,8 @@ var ts; } function isConstantMemberAccess(node) { return node.kind === 71 /* Identifier */ || - node.kind === 183 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 184 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 184 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 185 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) && node.argumentExpression.kind === 9 /* StringLiteral */; } function checkEnumDeclaration(node) { @@ -47463,8 +47663,6 @@ var ts; // Grammar checking checkGrammarDecoratorsAndModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -47493,7 +47691,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 !== 236 /* EnumDeclaration */) { + if (declaration.kind !== 237 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -47516,8 +47714,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { var declaration = declarations_7[_i]; - if ((declaration.kind === 233 /* ClassDeclaration */ || - (declaration.kind === 232 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 234 /* ClassDeclaration */ || + (declaration.kind === 233 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 2097152 /* Ambient */)) { return declaration; } @@ -47559,7 +47757,6 @@ var ts; } } if (ts.isIdentifier(node.name)) { - checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -47581,7 +47778,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, 233 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 234 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -47631,23 +47828,23 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 247 /* ExportAssignment */: - case 248 /* ExportDeclaration */: + case 248 /* ExportAssignment */: + case 249 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 180 /* BindingElement */: - case 230 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 231 /* VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { @@ -47658,12 +47855,12 @@ var ts; break; } // falls through - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 232 /* FunctionDeclaration */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 233 /* FunctionDeclaration */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 236 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -47691,7 +47888,7 @@ var ts; node = node.left; } while (node.kind !== 71 /* Identifier */); return node; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 71 /* Identifier */); @@ -47708,9 +47905,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 238 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 272 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 248 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 239 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 273 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 249 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -47743,14 +47940,14 @@ var ts; (symbol.flags & 67901928 /* Type */ ? 67901928 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 250 /* ExportSpecifier */ ? + var message = node.kind === 251 /* 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)); } // Don't allow to re-export something with no value side when `--isolatedModules` is set. if (compilerOptions.isolatedModules - && node.kind === 250 /* ExportSpecifier */ + && node.kind === 251 /* ExportSpecifier */ && !(target.flags & 67216319 /* Value */) && !(node.flags & 2097152 /* Ambient */)) { error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided); @@ -47758,7 +47955,6 @@ var ts; } } function checkImportBinding(node) { - checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkAliasSymbol(node); @@ -47778,7 +47974,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 244 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 245 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -47799,7 +47995,7 @@ var ts; if (ts.hasModifier(node, 1 /* Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 252 /* ExternalModuleReference */) { + if (node.moduleReference.kind !== 253 /* ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 67216319 /* Value */) { @@ -47835,10 +48031,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 238 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 238 /* ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 239 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 239 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 2097152 /* Ambient */; - if (node.parent.kind !== 272 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 273 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -47855,7 +48051,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 272 /* SourceFile */ || node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 237 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 273 /* SourceFile */ || node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 238 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -47884,8 +48080,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 === 272 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 237 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 273 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 238 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -47973,7 +48169,7 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 232 /* FunctionDeclaration */ && declaration.kind !== 153 /* MethodDeclaration */) || + return (declaration.kind !== 233 /* FunctionDeclaration */ && declaration.kind !== 153 /* MethodDeclaration */) || !!declaration.body; } function checkSourceElement(node) { @@ -47991,10 +48187,10 @@ 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 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 232 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 233 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -48044,96 +48240,98 @@ var ts; return checkConditionalType(node); case 171 /* InferType */: return checkInferType(node); - case 285 /* JSDocAugmentsTag */: + case 178 /* ImportType */: + return checkImportType(node); + case 286 /* JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return checkJSDocTypedefTag(node); - case 287 /* JSDocParameterTag */: + case 288 /* JSDocParameterTag */: return checkJSDocParameterTag(node); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: checkSignatureDeclaration(node); // falls through - case 278 /* JSDocNonNullableType */: - case 277 /* JSDocNullableType */: - case 275 /* JSDocAllType */: - case 276 /* JSDocUnknownType */: + case 279 /* JSDocNonNullableType */: + case 278 /* JSDocNullableType */: + case 276 /* JSDocAllType */: + case 277 /* JSDocUnknownType */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 274 /* JSDocTypeExpression */: + case 275 /* JSDocTypeExpression */: return checkSourceElement(node.type); case 175 /* IndexedAccessType */: return checkIndexedAccessType(node); case 176 /* MappedType */: return checkMappedType(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 211 /* Block */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 239 /* ModuleBlock */: return checkBlock(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return checkVariableStatement(node); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return checkExpressionStatement(node); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return checkIfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return checkDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return checkWhileStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return checkForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return checkForInStatement(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return checkForOfStatement(node); - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return checkReturnStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return checkWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return checkSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return checkLabeledStatement(node); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return checkThrowStatement(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return checkTryStatement(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return checkBindingElement(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return checkClassDeclaration(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return checkImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return checkExportDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return checkExportAssignment(node); - case 213 /* EmptyStatement */: + case 214 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 229 /* DebuggerStatement */: + case 230 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 251 /* MissingDeclaration */: + case 252 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -48217,8 +48415,8 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); @@ -48227,7 +48425,7 @@ var ts; case 156 /* SetAccessor */: checkAccessorDeclaration(node); break; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: checkClassExpressionDeferred(node); break; } @@ -48347,13 +48545,13 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* ModuleMember */); break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -48361,8 +48559,8 @@ var ts; // falls through // 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 - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* 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. @@ -48371,7 +48569,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67901928 /* Type */); } break; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -48420,10 +48618,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 147 /* TypeParameter */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: return true; } } @@ -48437,10 +48635,10 @@ var ts; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 183 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 184 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 205 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 206 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -48471,10 +48669,10 @@ var ts; while (nodeOnRightSide.parent.kind === 145 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 241 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 242 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 247 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 248 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -48494,12 +48692,23 @@ var ts; return getSymbolOfNode(entityName.parent.parent); } } + function isImportTypeQualifierPart(node) { + var parent = node.parent; + while (ts.isQualifiedName(parent)) { + node = parent; + parent = parent.parent; + } + if (parent && parent.kind === 178 /* ImportType */ && parent.qualifier === node) { + return parent; + } + return undefined; + } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } if (ts.isInJavaScriptFile(entityName) && - entityName.parent.kind === 183 /* PropertyAccessExpression */ && + entityName.parent.kind === 184 /* PropertyAccessExpression */ && entityName.parent === entityName.parent.parent.left) { // Check if this is a special property assignment var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); @@ -48507,23 +48716,35 @@ var ts; return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 247 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { - return resolveEntityName(entityName, - /*all meanings*/ 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */); + if (entityName.parent.kind === 248 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression + var success = resolveEntityName(entityName, + /*all meanings*/ 67216319 /* Value */ | 67901928 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true); + if (success && success !== unknownSymbol) { + return success; + } } - if (entityName.kind !== 183 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { + else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 241 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 242 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } - if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (!ts.isPropertyAccessExpression(entityName)) { + var possibleImportNode = isImportTypeQualifierPart(entityName); + if (possibleImportNode) { + getTypeFromTypeNode(possibleImportNode); + var sym = getNodeLinks(entityName).resolvedSymbol; + return sym === unknownSymbol ? undefined : sym; + } + } + while (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 205 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 206 /* ExpressionWithTypeArguments */) { meaning = 67901928 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -48539,10 +48760,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 287 /* JSDocParameterTag */) { + if (entityName.parent.kind === 288 /* JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 147 /* TypeParameter */ && entityName.parent.parent.kind === 290 /* JSDocTemplateTag */) { + if (entityName.parent.kind === 147 /* TypeParameter */ && entityName.parent.parent.kind === 291 /* JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -48559,12 +48780,12 @@ var ts; } return resolveEntityName(entityName, 67216319 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.kind === 183 /* PropertyAccessExpression */ || entityName.kind === 145 /* QualifiedName */) { + else if (entityName.kind === 184 /* PropertyAccessExpression */ || entityName.kind === 145 /* QualifiedName */) { var links = getNodeLinks(entityName); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (entityName.kind === 183 /* PropertyAccessExpression */) { + if (entityName.kind === 184 /* PropertyAccessExpression */) { checkPropertyAccessExpression(entityName); } else { @@ -48577,7 +48798,7 @@ var ts; var meaning = entityName.parent.kind === 161 /* TypeReference */ ? 67901928 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 260 /* JsxAttribute */) { + else if (entityName.parent.kind === 261 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 160 /* TypePredicate */) { @@ -48587,7 +48808,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (node.flags & 4194304 /* InWithStatement */) { @@ -48605,8 +48826,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 180 /* BindingElement */ && - node.parent.parent.kind === 178 /* ObjectBindingPattern */ && + else if (node.parent.kind === 181 /* BindingElement */ && + node.parent.parent.kind === 179 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.escapedText); @@ -48617,7 +48838,7 @@ var ts; } switch (node.kind) { case 71 /* Identifier */: - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 145 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 99 /* ThisKeyword */: @@ -48648,9 +48869,11 @@ var ts; // 1). import x = require("./mo/*gotToDefinitionHere*/d") // 2). External module name in an import declaration // 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 === 242 /* ImportDeclaration */ || node.parent.kind === 248 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) || - ((ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent))) { + ((node.parent.kind === 243 /* ImportDeclaration */ || node.parent.kind === 249 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((ts.isInJavaScriptFile(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); } // falls through @@ -48666,6 +48889,8 @@ var ts; case 89 /* FunctionKeyword */: case 36 /* EqualsGreaterThanToken */: return getSymbolOfNode(node.parent); + case 178 /* ImportType */: + return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined; default: return undefined; } @@ -48674,7 +48899,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 269 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 270 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 67216319 /* Value */ | 2097152 /* Alias */); } return undefined; @@ -48747,28 +48972,28 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 182 /* ObjectLiteralExpression */ || expr.kind === 181 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 183 /* ObjectLiteralExpression */ || expr.kind === 182 /* ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 220 /* ForOfStatement */) { + if (expr.parent.kind === 221 /* ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 198 /* BinaryExpression */) { + if (expr.parent.kind === 199 /* BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 268 /* PropertyAssignment */) { + if (expr.parent.kind === 269 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } // Array literal assignment - array destructuring pattern - ts.Debug.assert(expr.parent.kind === 181 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.parent.kind === 182 /* ArrayLiteralExpression */); // [{ property1: p1, property2 }] = elems; var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType; @@ -48847,7 +49072,7 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - var isPropertyName_1 = node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node; + var isPropertyName_1 = node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.name === node; return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } @@ -48904,7 +49129,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 272 /* SourceFile */) { + if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 273 /* 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. @@ -48959,7 +49184,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 211 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 212 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -49000,16 +49225,16 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 242 /* ImportEqualsDeclaration */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return node.expression && node.expression.kind === 71 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -49019,7 +49244,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 272 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 273 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -49099,15 +49324,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 271 /* EnumMember */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 272 /* EnumMember */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 271 /* EnumMember */) { + if (node.kind === 272 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -49274,7 +49499,7 @@ var ts; // populate reverse mapping: file path -> type reference directive that was resolved to this file fileToDirective = ts.createMap(); resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { - if (!resolvedDirective) { + if (!resolvedDirective || !resolvedDirective.resolvedFileName) { return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); @@ -49333,18 +49558,22 @@ var ts; }, getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; } }; + function isInHeritageClause(node) { + return node.parent && node.parent.kind === 206 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 267 /* HeritageClause */; + } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { // program does not have any files with type reference directives - bail out if (!fileToDirective) { return undefined; } - // property access can only be used as values + // property access can only be used as values, or types when within an expression with type arguments inside a heritage clause // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries - var meaning = (node.kind === 183 /* PropertyAccessExpression */) || (node.kind === 71 /* Identifier */ && isInTypeQuery(node)) - ? 67216319 /* Value */ | 1048576 /* ExportValue */ - : 67901928 /* Type */ | 1920 /* Namespace */; + var meaning = 67901928 /* Type */ | 1920 /* Namespace */; + if ((node.kind === 71 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 184 /* PropertyAccessExpression */ && !isInHeritageClause(node))) { + meaning = 67216319 /* Value */ | 1048576 /* ExportValue */; + } var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; } @@ -49393,7 +49622,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 272 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 273 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -49408,12 +49637,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 237 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 238 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 272 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 273 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -49591,7 +49820,7 @@ var ts; } switch (modifier.kind) { case 76 /* ConstKeyword */: - if (node.kind !== 236 /* EnumDeclaration */ && node.parent.kind === 233 /* ClassDeclaration */) { + if (node.kind !== 237 /* EnumDeclaration */ && node.parent.kind === 234 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(76 /* ConstKeyword */)); } break; @@ -49611,7 +49840,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + else if (node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -49634,7 +49863,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + else if (node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 148 /* Parameter */) { @@ -49670,7 +49899,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 148 /* Parameter */) { @@ -49679,8 +49908,8 @@ var ts; flags |= 1 /* Export */; break; case 79 /* DefaultKeyword */: - var container = node.parent.kind === 272 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 237 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 273 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 238 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } flags |= 512 /* Default */; @@ -49692,13 +49921,13 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 148 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 2097152 /* Ambient */) && node.parent.kind === 238 /* ModuleBlock */) { + else if ((node.parent.flags & 2097152 /* Ambient */) && node.parent.kind === 239 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -49708,14 +49937,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 233 /* ClassDeclaration */) { + if (node.kind !== 234 /* ClassDeclaration */) { if (node.kind !== 153 /* MethodDeclaration */ && node.kind !== 151 /* PropertyDeclaration */ && node.kind !== 155 /* GetAccessor */ && node.kind !== 156 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 233 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) { + if (!(node.parent.kind === 234 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -49757,7 +49986,7 @@ var ts; } return; } - else if ((node.kind === 242 /* ImportDeclaration */ || node.kind === 241 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 243 /* ImportDeclaration */ || node.kind === 242 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 148 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { @@ -49791,29 +50020,29 @@ var ts; case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 159 /* IndexSignature */: - case 237 /* ModuleDeclaration */: - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 238 /* ModuleDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 148 /* Parameter */: return false; default: - if (node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + if (node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { return false; } switch (node.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return nodeHasAnyModifiersExcept(node, 120 /* AsyncKeyword */); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return nodeHasAnyModifiersExcept(node, 117 /* AbstractKeyword */); - case 234 /* InterfaceDeclaration */: - case 212 /* VariableStatement */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 213 /* VariableStatement */: + case 236 /* TypeAliasDeclaration */: return true; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 76 /* ConstKeyword */); default: ts.Debug.fail(); @@ -49827,18 +50056,17 @@ var ts; function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 153 /* MethodDeclaration */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } - function checkGrammarForDisallowedTrailingComma(list) { + function checkGrammarForDisallowedTrailingComma(list, diag) { + if (diag === void 0) { diag = ts.Diagnostics.Trailing_comma_not_allowed; } if (list && list.hasTrailingComma) { - var start = list.end - ",".length; - var end = list.end; - return grammarErrorAtPos(list[0], start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); + return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag); } } function checkGrammarTypeParameterList(typeParameters, file) { @@ -49857,6 +50085,9 @@ var ts; if (i !== (parameterCount - 1)) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); } + if (!(parameter.flags & 2097152 /* Ambient */)) { // Allow `...foo,` in ambient declarations; see GH#23070 + checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + } if (ts.isBindingPattern(parameter.name)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } @@ -49927,7 +50158,7 @@ var ts; if (type.flags & 2 /* String */ || type.flags & 4 /* Number */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type))); } - if (allTypesAssignableToKind(type, 32 /* StringLiteral */, /*strict*/ true)) { + if (type.flags & 131072 /* Union */ && allTypesAssignableToKind(type, 32 /* StringLiteral */, /*strict*/ true)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead); } return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); @@ -49956,7 +50187,7 @@ var ts; if (args) { for (var _i = 0, args_5 = args; _i < args_5.length; _i++) { var arg = args_5[_i]; - if (arg.kind === 204 /* OmittedExpression */) { + if (arg.kind === 205 /* OmittedExpression */) { return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -50036,14 +50267,14 @@ var ts; return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 198 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 26 /* CommaToken */) { + if (computedPropertyName.expression.kind === 199 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 26 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 232 /* FunctionDeclaration */ || - node.kind === 190 /* FunctionExpression */ || + ts.Debug.assert(node.kind === 233 /* FunctionDeclaration */ || + node.kind === 191 /* FunctionExpression */ || node.kind === 153 /* MethodDeclaration */); if (node.flags & 2097152 /* Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); @@ -50069,7 +50300,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 270 /* SpreadAssignment */) { + if (prop.kind === 271 /* SpreadAssignment */) { continue; } var name = prop.name; @@ -50077,7 +50308,7 @@ var ts; // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 269 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 270 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -50101,8 +50332,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 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8 /* NumericLiteral */) { @@ -50152,7 +50383,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 262 /* JsxSpreadAttribute */) { + if (attr.kind === 263 /* JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -50162,7 +50393,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 263 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 264 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -50171,12 +50402,12 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 220 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 221 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) { return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); } } - if (forInOrOfStatement.initializer.kind === 231 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 232 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -50191,20 +50422,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 219 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 220 /* 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 === 219 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 220 /* 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 === 219 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 220 /* 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); @@ -50272,7 +50503,7 @@ var ts; } var parent = ts.walkUpParenthesizedTypes(node.parent); switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: var decl = parent; if (decl.name.kind !== 71 /* Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -50310,7 +50541,7 @@ var ts; return true; } if (node.kind === 153 /* MethodDeclaration */) { - if (node.parent.kind === 182 /* ObjectLiteralExpression */) { + if (node.parent.kind === 183 /* 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 === 120 /* AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -50339,7 +50570,7 @@ var ts; 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 === 234 /* InterfaceDeclaration */) { + else if (node.parent.kind === 235 /* 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 === 165 /* TypeLiteral */) { @@ -50353,11 +50584,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 226 /* LabeledStatement */: + case 227 /* 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 === 221 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 222 /* 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); @@ -50365,8 +50596,8 @@ var ts; return false; } break; - case 225 /* SwitchStatement */: - if (node.kind === 222 /* BreakStatement */ && !node.label) { + case 226 /* SwitchStatement */: + if (node.kind === 223 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -50381,13 +50612,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 222 /* BreakStatement */ + var message = node.kind === 223 /* 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 === 222 /* BreakStatement */ + var message = node.kind === 223 /* 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); @@ -50399,7 +50630,8 @@ var ts; if (node !== ts.last(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 179 /* ArrayBindingPattern */ || node.name.kind === 178 /* ObjectBindingPattern */) { + checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + if (node.name.kind === 180 /* ArrayBindingPattern */ || node.name.kind === 179 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.propertyName) { @@ -50413,11 +50645,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ || - expr.kind === 196 /* PrefixUnaryExpression */ && expr.operator === 38 /* MinusToken */ && + expr.kind === 197 /* PrefixUnaryExpression */ && expr.operator === 38 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 219 /* ForInStatement */ && node.parent.parent.kind !== 220 /* ForOfStatement */) { + if (node.parent.parent.kind !== 220 /* ForInStatement */ && node.parent.parent.kind !== 221 /* ForOfStatement */) { if (node.flags & 2097152 /* Ambient */) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -50446,7 +50678,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 212 /* VariableStatement */ || !node.type || node.initializer || node.flags & 2097152 /* Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 213 /* VariableStatement */ || !node.type || node.initializer || node.flags & 2097152 /* Ambient */)) { return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); } if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && @@ -50505,15 +50737,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 215 /* IfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 224 /* WithStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 216 /* IfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: return false; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -50579,7 +50811,7 @@ var ts; return true; } } - else if (node.parent.kind === 234 /* InterfaceDeclaration */) { + else if (node.parent.kind === 235 /* 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; } @@ -50616,13 +50848,13 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 234 /* InterfaceDeclaration */ || - node.kind === 235 /* TypeAliasDeclaration */ || - node.kind === 242 /* ImportDeclaration */ || - node.kind === 241 /* ImportEqualsDeclaration */ || - node.kind === 248 /* ExportDeclaration */ || - node.kind === 247 /* ExportAssignment */ || - node.kind === 240 /* NamespaceExportDeclaration */ || + if (node.kind === 235 /* InterfaceDeclaration */ || + node.kind === 236 /* TypeAliasDeclaration */ || + node.kind === 243 /* ImportDeclaration */ || + node.kind === 242 /* ImportEqualsDeclaration */ || + node.kind === 249 /* ExportDeclaration */ || + node.kind === 248 /* ExportAssignment */ || + node.kind === 241 /* NamespaceExportDeclaration */ || ts.hasModifier(node, 2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } @@ -50631,7 +50863,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 === 212 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 213 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -50657,7 +50889,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 === 211 /* Block */ || node.parent.kind === 238 /* ModuleBlock */ || node.parent.kind === 272 /* SourceFile */) { + if (node.parent.kind === 212 /* Block */ || node.parent.kind === 239 /* ModuleBlock */ || node.parent.kind === 273 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -50681,7 +50913,7 @@ var ts; else if (ts.isChildOfNodeWithKind(node, 177 /* LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 271 /* EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 272 /* EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -50733,8 +50965,8 @@ var ts; /** 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 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -50742,14 +50974,14 @@ var ts; } function isSomeImportDeclaration(decl) { switch (decl.kind) { - case 243 /* ImportClause */: // For default import - case 241 /* ImportEqualsDeclaration */: - case 244 /* NamespaceImport */: - case 246 /* ImportSpecifier */: // For rename import `x as y` + case 244 /* ImportClause */: // For default import + case 242 /* ImportEqualsDeclaration */: + case 245 /* NamespaceImport */: + case 247 /* ImportSpecifier */: // For rename import `x as y` return true; case 71 /* Identifier */: // For regular import, `decl` is an Identifier under the ImportSpecifier. - return decl.parent.kind === 246 /* ImportSpecifier */; + return decl.parent.kind === 247 /* ImportSpecifier */; default: return false; } @@ -50760,7 +50992,7 @@ var ts; JsxNames.JSX = "JSX"; JsxNames.IntrinsicElements = "IntrinsicElements"; JsxNames.ElementClass = "ElementClass"; - JsxNames.ElementAttributesPropertyNameContainer = "ElementAttributesProperty"; + JsxNames.ElementAttributesPropertyNameContainer = "ElementAttributesProperty"; // TODO: Deprecate and remove support JsxNames.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute"; JsxNames.Element = "Element"; JsxNames.IntrinsicAttributes = "IntrinsicAttributes"; @@ -50916,12 +51148,19 @@ var ts; /** Create a unique name based on the supplied text. */ function createOptimisticUniqueName(text) { var name = createIdentifier(text); - name.autoGenerateFlags = 5 /* OptimisticUnique */; + name.autoGenerateFlags = 3 /* Unique */ | 32 /* Optimistic */; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createOptimisticUniqueName = createOptimisticUniqueName; + /** Create a unique name based on the supplied text. This does not consider names injected by the transformer. */ + function createFileLevelUniqueName(text) { + var name = createOptimisticUniqueName(text); + name.autoGenerateFlags |= 64 /* FileLevel */; + return name; + } + ts.createFileLevelUniqueName = createFileLevelUniqueName; function getGeneratedNameForNode(node, shouldSkipNameGenerationScope) { var name = createIdentifier(""); name.autoGenerateFlags = 4 /* Node */; @@ -51020,7 +51259,7 @@ var ts; ts.updateQualifiedName = updateQualifiedName; function parenthesizeForComputedName(expression) { return (ts.isBinaryExpression(expression) && expression.operatorToken.kind === 26 /* CommaToken */) || - expression.kind === 296 /* CommaListExpression */ ? + expression.kind === 297 /* CommaListExpression */ ? createParen(expression) : expression; } @@ -51448,6 +51687,24 @@ var ts; : node; } ts.updateInferTypeNode = updateInferTypeNode; + function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) { + var node = createSynthesizedNode(178 /* ImportType */); + node.argument = argument; + node.qualifier = qualifier; + node.typeArguments = asNodeArray(typeArguments); + node.isTypeOf = isTypeOf; + return node; + } + ts.createImportTypeNode = createImportTypeNode; + function updateImportTypeNode(node, argument, qualifier, typeArguments, isTypeOf) { + return node.argument !== argument + || node.qualifier !== qualifier + || node.typeArguments !== typeArguments + || node.isTypeOf !== isTypeOf + ? updateNode(createImportTypeNode(argument, qualifier, typeArguments, isTypeOf), node) + : node; + } + ts.updateImportTypeNode = updateImportTypeNode; function createParenthesizedType(type) { var node = createSynthesizedNode(172 /* ParenthesizedType */); node.type = type; @@ -51521,7 +51778,7 @@ var ts; ts.updateLiteralTypeNode = updateLiteralTypeNode; // Binding Patterns function createObjectBindingPattern(elements) { - var node = createSynthesizedNode(178 /* ObjectBindingPattern */); + var node = createSynthesizedNode(179 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); return node; } @@ -51533,7 +51790,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements) { - var node = createSynthesizedNode(179 /* ArrayBindingPattern */); + var node = createSynthesizedNode(180 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); return node; } @@ -51545,7 +51802,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createSynthesizedNode(180 /* BindingElement */); + var node = createSynthesizedNode(181 /* BindingElement */); node.dotDotDotToken = dotDotDotToken; node.propertyName = asName(propertyName); node.name = asName(name); @@ -51564,7 +51821,7 @@ var ts; ts.updateBindingElement = updateBindingElement; // Expression function createArrayLiteral(elements, multiLine) { - var node = createSynthesizedNode(181 /* ArrayLiteralExpression */); + var node = createSynthesizedNode(182 /* ArrayLiteralExpression */); node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) node.multiLine = true; @@ -51578,7 +51835,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, multiLine) { - var node = createSynthesizedNode(182 /* ObjectLiteralExpression */); + var node = createSynthesizedNode(183 /* ObjectLiteralExpression */); node.properties = createNodeArray(properties); if (multiLine) node.multiLine = true; @@ -51592,7 +51849,7 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name) { - var node = createSynthesizedNode(183 /* PropertyAccessExpression */); + var node = createSynthesizedNode(184 /* PropertyAccessExpression */); node.expression = ts.parenthesizeForAccess(expression); node.name = asName(name); setEmitFlags(node, 131072 /* NoIndentation */); @@ -51609,7 +51866,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index) { - var node = createSynthesizedNode(184 /* ElementAccessExpression */); + var node = createSynthesizedNode(185 /* ElementAccessExpression */); node.expression = ts.parenthesizeForAccess(expression); node.argumentExpression = asExpression(index); return node; @@ -51623,7 +51880,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(185 /* CallExpression */); + var node = createSynthesizedNode(186 /* CallExpression */); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); @@ -51639,7 +51896,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(186 /* NewExpression */); + var node = createSynthesizedNode(187 /* NewExpression */); node.expression = ts.parenthesizeForNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -51655,7 +51912,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, template) { - var node = createSynthesizedNode(187 /* TaggedTemplateExpression */); + var node = createSynthesizedNode(188 /* TaggedTemplateExpression */); node.tag = ts.parenthesizeForAccess(tag); node.template = template; return node; @@ -51669,7 +51926,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createTypeAssertion(type, expression) { - var node = createSynthesizedNode(188 /* TypeAssertionExpression */); + var node = createSynthesizedNode(189 /* TypeAssertionExpression */); node.type = type; node.expression = ts.parenthesizePrefixOperand(expression); return node; @@ -51683,7 +51940,7 @@ var ts; } ts.updateTypeAssertion = updateTypeAssertion; function createParen(expression) { - var node = createSynthesizedNode(189 /* ParenthesizedExpression */); + var node = createSynthesizedNode(190 /* ParenthesizedExpression */); node.expression = expression; return node; } @@ -51695,7 +51952,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(190 /* FunctionExpression */); + var node = createSynthesizedNode(191 /* FunctionExpression */); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -51719,7 +51976,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createSynthesizedNode(191 /* ArrowFunction */); + var node = createSynthesizedNode(192 /* ArrowFunction */); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); @@ -51753,7 +52010,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression) { - var node = createSynthesizedNode(192 /* DeleteExpression */); + var node = createSynthesizedNode(193 /* DeleteExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -51765,7 +52022,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression) { - var node = createSynthesizedNode(193 /* TypeOfExpression */); + var node = createSynthesizedNode(194 /* TypeOfExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -51777,7 +52034,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression) { - var node = createSynthesizedNode(194 /* VoidExpression */); + var node = createSynthesizedNode(195 /* VoidExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -51789,7 +52046,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression) { - var node = createSynthesizedNode(195 /* AwaitExpression */); + var node = createSynthesizedNode(196 /* AwaitExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -51801,7 +52058,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand) { - var node = createSynthesizedNode(196 /* PrefixUnaryExpression */); + var node = createSynthesizedNode(197 /* PrefixUnaryExpression */); node.operator = operator; node.operand = ts.parenthesizePrefixOperand(operand); return node; @@ -51814,7 +52071,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator) { - var node = createSynthesizedNode(197 /* PostfixUnaryExpression */); + var node = createSynthesizedNode(198 /* PostfixUnaryExpression */); node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -51827,7 +52084,7 @@ var ts; } ts.updatePostfix = updatePostfix; function createBinary(left, operator, right) { - var node = createSynthesizedNode(198 /* BinaryExpression */); + var node = createSynthesizedNode(199 /* BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); @@ -51844,7 +52101,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { - var node = createSynthesizedNode(199 /* ConditionalExpression */); + var node = createSynthesizedNode(200 /* ConditionalExpression */); node.condition = ts.parenthesizeForConditionalHead(condition); node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(55 /* QuestionToken */); node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); @@ -51874,7 +52131,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans) { - var node = createSynthesizedNode(200 /* TemplateExpression */); + var node = createSynthesizedNode(201 /* TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -51912,7 +52169,7 @@ var ts; } ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral; function createYield(asteriskTokenOrExpression, expression) { - var node = createSynthesizedNode(201 /* YieldExpression */); + var node = createSynthesizedNode(202 /* YieldExpression */); node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 39 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined; node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 39 /* AsteriskToken */ ? asteriskTokenOrExpression : expression; return node; @@ -51926,7 +52183,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression) { - var node = createSynthesizedNode(202 /* SpreadElement */); + var node = createSynthesizedNode(203 /* SpreadElement */); node.expression = ts.parenthesizeExpressionForList(expression); return node; } @@ -51938,7 +52195,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(203 /* ClassExpression */); + var node = createSynthesizedNode(204 /* ClassExpression */); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -51959,11 +52216,11 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression() { - return createSynthesizedNode(204 /* OmittedExpression */); + return createSynthesizedNode(205 /* OmittedExpression */); } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression) { - var node = createSynthesizedNode(205 /* ExpressionWithTypeArguments */); + var node = createSynthesizedNode(206 /* ExpressionWithTypeArguments */); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); return node; @@ -51977,7 +52234,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createAsExpression(expression, type) { - var node = createSynthesizedNode(206 /* AsExpression */); + var node = createSynthesizedNode(207 /* AsExpression */); node.expression = expression; node.type = type; return node; @@ -51991,7 +52248,7 @@ var ts; } ts.updateAsExpression = updateAsExpression; function createNonNullExpression(expression) { - var node = createSynthesizedNode(207 /* NonNullExpression */); + var node = createSynthesizedNode(208 /* NonNullExpression */); node.expression = ts.parenthesizeForAccess(expression); return node; } @@ -52003,7 +52260,7 @@ var ts; } ts.updateNonNullExpression = updateNonNullExpression; function createMetaProperty(keywordToken, name) { - var node = createSynthesizedNode(208 /* MetaProperty */); + var node = createSynthesizedNode(209 /* MetaProperty */); node.keywordToken = keywordToken; node.name = name; return node; @@ -52017,7 +52274,7 @@ var ts; ts.updateMetaProperty = updateMetaProperty; // Misc function createTemplateSpan(expression, literal) { - var node = createSynthesizedNode(209 /* TemplateSpan */); + var node = createSynthesizedNode(210 /* TemplateSpan */); node.expression = expression; node.literal = literal; return node; @@ -52031,12 +52288,12 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createSemicolonClassElement() { - return createSynthesizedNode(210 /* SemicolonClassElement */); + return createSynthesizedNode(211 /* SemicolonClassElement */); } ts.createSemicolonClassElement = createSemicolonClassElement; // Element function createBlock(statements, multiLine) { - var block = createSynthesizedNode(211 /* Block */); + var block = createSynthesizedNode(212 /* Block */); block.statements = createNodeArray(statements); if (multiLine) block.multiLine = multiLine; @@ -52050,7 +52307,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList) { - var node = createSynthesizedNode(212 /* VariableStatement */); + var node = createSynthesizedNode(213 /* VariableStatement */); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -52065,11 +52322,11 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createEmptyStatement() { - return createSynthesizedNode(213 /* EmptyStatement */); + return createSynthesizedNode(214 /* EmptyStatement */); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression) { - var node = createSynthesizedNode(214 /* ExpressionStatement */); + var node = createSynthesizedNode(215 /* ExpressionStatement */); node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -52081,7 +52338,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement) { - var node = createSynthesizedNode(215 /* IfStatement */); + var node = createSynthesizedNode(216 /* IfStatement */); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -52097,7 +52354,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression) { - var node = createSynthesizedNode(216 /* DoStatement */); + var node = createSynthesizedNode(217 /* DoStatement */); node.statement = statement; node.expression = expression; return node; @@ -52111,7 +52368,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement) { - var node = createSynthesizedNode(217 /* WhileStatement */); + var node = createSynthesizedNode(218 /* WhileStatement */); node.expression = expression; node.statement = statement; return node; @@ -52125,7 +52382,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement) { - var node = createSynthesizedNode(218 /* ForStatement */); + var node = createSynthesizedNode(219 /* ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -52143,7 +52400,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement) { - var node = createSynthesizedNode(219 /* ForInStatement */); + var node = createSynthesizedNode(220 /* ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -52159,7 +52416,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(awaitModifier, initializer, expression, statement) { - var node = createSynthesizedNode(220 /* ForOfStatement */); + var node = createSynthesizedNode(221 /* ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; @@ -52177,7 +52434,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label) { - var node = createSynthesizedNode(221 /* ContinueStatement */); + var node = createSynthesizedNode(222 /* ContinueStatement */); node.label = asName(label); return node; } @@ -52189,7 +52446,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label) { - var node = createSynthesizedNode(222 /* BreakStatement */); + var node = createSynthesizedNode(223 /* BreakStatement */); node.label = asName(label); return node; } @@ -52201,7 +52458,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression) { - var node = createSynthesizedNode(223 /* ReturnStatement */); + var node = createSynthesizedNode(224 /* ReturnStatement */); node.expression = expression; return node; } @@ -52213,7 +52470,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement) { - var node = createSynthesizedNode(224 /* WithStatement */); + var node = createSynthesizedNode(225 /* WithStatement */); node.expression = expression; node.statement = statement; return node; @@ -52227,7 +52484,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock) { - var node = createSynthesizedNode(225 /* SwitchStatement */); + var node = createSynthesizedNode(226 /* SwitchStatement */); node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -52241,7 +52498,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement) { - var node = createSynthesizedNode(226 /* LabeledStatement */); + var node = createSynthesizedNode(227 /* LabeledStatement */); node.label = asName(label); node.statement = statement; return node; @@ -52255,7 +52512,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression) { - var node = createSynthesizedNode(227 /* ThrowStatement */); + var node = createSynthesizedNode(228 /* ThrowStatement */); node.expression = expression; return node; } @@ -52267,7 +52524,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock) { - var node = createSynthesizedNode(228 /* TryStatement */); + var node = createSynthesizedNode(229 /* TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -52283,11 +52540,11 @@ var ts; } ts.updateTry = updateTry; function createDebuggerStatement() { - return createSynthesizedNode(229 /* DebuggerStatement */); + return createSynthesizedNode(230 /* DebuggerStatement */); } ts.createDebuggerStatement = createDebuggerStatement; function createVariableDeclaration(name, type, initializer) { - var node = createSynthesizedNode(230 /* VariableDeclaration */); + var node = createSynthesizedNode(231 /* VariableDeclaration */); node.name = asName(name); node.type = type; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -52303,7 +52560,7 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createVariableDeclarationList(declarations, flags) { - var node = createSynthesizedNode(231 /* VariableDeclarationList */); + var node = createSynthesizedNode(232 /* VariableDeclarationList */); node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); return node; @@ -52316,7 +52573,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(232 /* FunctionDeclaration */); + var node = createSynthesizedNode(233 /* FunctionDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; @@ -52342,7 +52599,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(233 /* ClassDeclaration */); + var node = createSynthesizedNode(234 /* ClassDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -52364,7 +52621,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(234 /* InterfaceDeclaration */); + var node = createSynthesizedNode(235 /* InterfaceDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -52386,7 +52643,7 @@ var ts; } ts.updateInterfaceDeclaration = updateInterfaceDeclaration; function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) { - var node = createSynthesizedNode(235 /* TypeAliasDeclaration */); + var node = createSynthesizedNode(236 /* TypeAliasDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -52406,7 +52663,7 @@ var ts; } ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration; function createEnumDeclaration(decorators, modifiers, name, members) { - var node = createSynthesizedNode(236 /* EnumDeclaration */); + var node = createSynthesizedNode(237 /* EnumDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -52424,7 +52681,7 @@ var ts; } ts.updateEnumDeclaration = updateEnumDeclaration; function createModuleDeclaration(decorators, modifiers, name, body, flags) { - var node = createSynthesizedNode(237 /* ModuleDeclaration */); + var node = createSynthesizedNode(238 /* ModuleDeclaration */); node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 512 /* GlobalAugmentation */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -52443,7 +52700,7 @@ var ts; } ts.updateModuleDeclaration = updateModuleDeclaration; function createModuleBlock(statements) { - var node = createSynthesizedNode(238 /* ModuleBlock */); + var node = createSynthesizedNode(239 /* ModuleBlock */); node.statements = createNodeArray(statements); return node; } @@ -52455,7 +52712,7 @@ var ts; } ts.updateModuleBlock = updateModuleBlock; function createCaseBlock(clauses) { - var node = createSynthesizedNode(239 /* CaseBlock */); + var node = createSynthesizedNode(240 /* CaseBlock */); node.clauses = createNodeArray(clauses); return node; } @@ -52467,7 +52724,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createNamespaceExportDeclaration(name) { - var node = createSynthesizedNode(240 /* NamespaceExportDeclaration */); + var node = createSynthesizedNode(241 /* NamespaceExportDeclaration */); node.name = asName(name); return node; } @@ -52479,7 +52736,7 @@ var ts; } ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration; function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { - var node = createSynthesizedNode(241 /* ImportEqualsDeclaration */); + var node = createSynthesizedNode(242 /* ImportEqualsDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -52497,7 +52754,7 @@ var ts; } ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { - var node = createSynthesizedNode(242 /* ImportDeclaration */); + var node = createSynthesizedNode(243 /* ImportDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; @@ -52515,7 +52772,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings) { - var node = createSynthesizedNode(243 /* ImportClause */); + var node = createSynthesizedNode(244 /* ImportClause */); node.name = name; node.namedBindings = namedBindings; return node; @@ -52529,7 +52786,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name) { - var node = createSynthesizedNode(244 /* NamespaceImport */); + var node = createSynthesizedNode(245 /* NamespaceImport */); node.name = name; return node; } @@ -52541,7 +52798,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements) { - var node = createSynthesizedNode(245 /* NamedImports */); + var node = createSynthesizedNode(246 /* NamedImports */); node.elements = createNodeArray(elements); return node; } @@ -52553,7 +52810,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name) { - var node = createSynthesizedNode(246 /* ImportSpecifier */); + var node = createSynthesizedNode(247 /* ImportSpecifier */); node.propertyName = propertyName; node.name = name; return node; @@ -52567,7 +52824,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression) { - var node = createSynthesizedNode(247 /* ExportAssignment */); + var node = createSynthesizedNode(248 /* ExportAssignment */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; @@ -52584,7 +52841,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { - var node = createSynthesizedNode(248 /* ExportDeclaration */); + var node = createSynthesizedNode(249 /* ExportDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; @@ -52602,7 +52859,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements) { - var node = createSynthesizedNode(249 /* NamedExports */); + var node = createSynthesizedNode(250 /* NamedExports */); node.elements = createNodeArray(elements); return node; } @@ -52614,7 +52871,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(propertyName, name) { - var node = createSynthesizedNode(250 /* ExportSpecifier */); + var node = createSynthesizedNode(251 /* ExportSpecifier */); node.propertyName = asName(propertyName); node.name = asName(name); return node; @@ -52629,7 +52886,7 @@ var ts; ts.updateExportSpecifier = updateExportSpecifier; // Module references function createExternalModuleReference(expression) { - var node = createSynthesizedNode(252 /* ExternalModuleReference */); + var node = createSynthesizedNode(253 /* ExternalModuleReference */); node.expression = expression; return node; } @@ -52642,7 +52899,7 @@ var ts; ts.updateExternalModuleReference = updateExternalModuleReference; // JSX function createJsxElement(openingElement, children, closingElement) { - var node = createSynthesizedNode(253 /* JsxElement */); + var node = createSynthesizedNode(254 /* JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -52658,7 +52915,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(254 /* JsxSelfClosingElement */); + var node = createSynthesizedNode(255 /* JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = typeArguments && createNodeArray(typeArguments); node.attributes = attributes; @@ -52674,7 +52931,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(255 /* JsxOpeningElement */); + var node = createSynthesizedNode(256 /* JsxOpeningElement */); node.tagName = tagName; node.typeArguments = typeArguments && createNodeArray(typeArguments); node.attributes = attributes; @@ -52690,7 +52947,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName) { - var node = createSynthesizedNode(256 /* JsxClosingElement */); + var node = createSynthesizedNode(257 /* JsxClosingElement */); node.tagName = tagName; return node; } @@ -52702,7 +52959,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxFragment(openingFragment, children, closingFragment) { - var node = createSynthesizedNode(257 /* JsxFragment */); + var node = createSynthesizedNode(258 /* JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -52718,7 +52975,7 @@ var ts; } ts.updateJsxFragment = updateJsxFragment; function createJsxAttribute(name, initializer) { - var node = createSynthesizedNode(260 /* JsxAttribute */); + var node = createSynthesizedNode(261 /* JsxAttribute */); node.name = name; node.initializer = initializer; return node; @@ -52732,7 +52989,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(261 /* JsxAttributes */); + var node = createSynthesizedNode(262 /* JsxAttributes */); node.properties = createNodeArray(properties); return node; } @@ -52744,7 +53001,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(262 /* JsxSpreadAttribute */); + var node = createSynthesizedNode(263 /* JsxSpreadAttribute */); node.expression = expression; return node; } @@ -52756,7 +53013,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(263 /* JsxExpression */); + var node = createSynthesizedNode(264 /* JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -52770,7 +53027,7 @@ var ts; ts.updateJsxExpression = updateJsxExpression; // Clauses function createCaseClause(expression, statements) { - var node = createSynthesizedNode(264 /* CaseClause */); + var node = createSynthesizedNode(265 /* CaseClause */); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -52784,7 +53041,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(265 /* DefaultClause */); + var node = createSynthesizedNode(266 /* DefaultClause */); node.statements = createNodeArray(statements); return node; } @@ -52796,7 +53053,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(266 /* HeritageClause */); + var node = createSynthesizedNode(267 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); return node; @@ -52809,7 +53066,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(267 /* CatchClause */); + var node = createSynthesizedNode(268 /* CatchClause */); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -52824,7 +53081,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(268 /* PropertyAssignment */); + var node = createSynthesizedNode(269 /* PropertyAssignment */); node.name = asName(name); node.questionToken = undefined; node.initializer = ts.parenthesizeExpressionForList(initializer); @@ -52839,7 +53096,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(269 /* ShorthandPropertyAssignment */); + var node = createSynthesizedNode(270 /* ShorthandPropertyAssignment */); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -52853,7 +53110,7 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(270 /* SpreadAssignment */); + var node = createSynthesizedNode(271 /* SpreadAssignment */); node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; return node; } @@ -52866,7 +53123,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; // Enum function createEnumMember(name, initializer) { - var node = createSynthesizedNode(271 /* EnumMember */); + var node = createSynthesizedNode(272 /* EnumMember */); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -52880,12 +53137,13 @@ var ts; } ts.updateEnumMember = updateEnumMember; // Top-level nodes - function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences) { + function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib) { if (node.statements !== statements || (isDeclarationFile !== undefined && node.isDeclarationFile !== isDeclarationFile) || (referencedFiles !== undefined && node.referencedFiles !== referencedFiles) || - (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences)) { - var updated = createSynthesizedNode(272 /* SourceFile */); + (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) || + (hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) { + var updated = createSynthesizedNode(273 /* SourceFile */); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -52895,6 +53153,7 @@ var ts; updated.isDeclarationFile = isDeclarationFile === undefined ? node.isDeclarationFile : isDeclarationFile; updated.referencedFiles = referencedFiles === undefined ? node.referencedFiles : referencedFiles; updated.typeReferenceDirectives = typeReferences === undefined ? node.typeReferenceDirectives : typeReferences; + updated.hasNoDefaultLib = hasNoDefaultLib === undefined ? node.hasNoDefaultLib : hasNoDefaultLib; if (node.amdDependencies !== undefined) updated.amdDependencies = node.amdDependencies; if (node.moduleName !== undefined) @@ -52903,8 +53162,6 @@ var ts; updated.languageVariant = node.languageVariant; if (node.renamedDependencies !== undefined) updated.renamedDependencies = node.renamedDependencies; - if (node.hasNoDefaultLib !== undefined) - updated.hasNoDefaultLib = node.hasNoDefaultLib; if (node.languageVersion !== undefined) updated.languageVersion = node.languageVersion; if (node.scriptKind !== undefined) @@ -52967,7 +53224,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createSynthesizedNode(294 /* NotEmittedStatement */); + var node = createSynthesizedNode(295 /* NotEmittedStatement */); node.original = original; setTextRange(node, original); return node; @@ -52979,7 +53236,7 @@ var ts; */ /* @internal */ function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(298 /* EndOfDeclarationMarker */); + var node = createSynthesizedNode(299 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -52991,7 +53248,7 @@ var ts; */ /* @internal */ function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(297 /* MergeDeclarationMarker */); + var node = createSynthesizedNode(298 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -53006,7 +53263,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(295 /* PartiallyEmittedExpression */); + var node = createSynthesizedNode(296 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; setTextRange(node, original); @@ -53022,7 +53279,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 296 /* CommaListExpression */) { + if (node.kind === 297 /* CommaListExpression */) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26 /* CommaToken */) { @@ -53032,7 +53289,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(296 /* CommaListExpression */); + var node = createSynthesizedNode(297 /* CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -53044,7 +53301,7 @@ var ts; } ts.updateCommaList = updateCommaList; function createBundle(sourceFiles) { - var node = ts.createNode(273 /* Bundle */); + var node = ts.createNode(274 /* Bundle */); node.sourceFiles = sourceFiles; return node; } @@ -53180,7 +53437,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 === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -53682,7 +53939,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 226 /* LabeledStatement */ + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 227 /* LabeledStatement */ ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -53700,13 +53957,13 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return false; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -53732,7 +53989,7 @@ var ts; } else { switch (callee.kind) { - case 183 /* PropertyAccessExpression */: { + case 184 /* PropertyAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a.b()` target is `(_a = a).b` and thisArg is `_a` thisArg = ts.createTempVariable(recordTempVariable); @@ -53745,7 +54002,7 @@ var ts; } break; } - case 184 /* ElementAccessExpression */: { + case 185 /* ElementAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a` thisArg = ts.createTempVariable(recordTempVariable); @@ -53805,9 +54062,9 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); case 153 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); @@ -54133,7 +54390,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 === 189 /* ParenthesizedExpression */) { + if (skipped.kind === 190 /* ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -54167,8 +54424,8 @@ 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(198 /* BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(198 /* BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(199 /* BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(199 /* BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { @@ -54177,7 +54434,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ - && operand.kind === 201 /* YieldExpression */) { + && operand.kind === 202 /* YieldExpression */) { return false; } return true; @@ -54265,7 +54522,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 198 /* BinaryExpression */ && node.operatorToken.kind === 37 /* PlusToken */) { + if (node.kind === 199 /* BinaryExpression */ && node.operatorToken.kind === 37 /* PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -54280,7 +54537,7 @@ var ts; return 0 /* Unknown */; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(199 /* ConditionalExpression */, 55 /* QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(200 /* ConditionalExpression */, 55 /* QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { @@ -54294,8 +54551,8 @@ var ts; // so in case when comma expression is introduced as a part of previous transformations // if should be wrapped in parens since comma operator has the lowest precedence var emittedExpression = ts.skipPartiallyEmittedExpressions(e); - return emittedExpression.kind === 198 /* BinaryExpression */ && emittedExpression.operatorToken.kind === 26 /* CommaToken */ || - emittedExpression.kind === 296 /* CommaListExpression */ + return emittedExpression.kind === 199 /* BinaryExpression */ && emittedExpression.operatorToken.kind === 26 /* CommaToken */ || + emittedExpression.kind === 297 /* CommaListExpression */ ? ts.createParen(e) : e; } @@ -54313,9 +54570,9 @@ var ts; */ function parenthesizeDefaultExpression(e) { var check = ts.skipPartiallyEmittedExpressions(e); - return (check.kind === 203 /* ClassExpression */ || - check.kind === 190 /* FunctionExpression */ || - check.kind === 296 /* CommaListExpression */ || + return (check.kind === 204 /* ClassExpression */ || + check.kind === 191 /* FunctionExpression */ || + check.kind === 297 /* CommaListExpression */ || ts.isBinaryExpression(check) && check.operatorToken.kind === 26 /* CommaToken */) ? ts.createParen(e) : e; @@ -54330,9 +54587,9 @@ var ts; function parenthesizeForNew(expression) { var leftmostExpr = getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: return ts.createParen(expression); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return !leftmostExpr.arguments ? ts.createParen(expression) : expression; @@ -54355,7 +54612,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 186 /* NewExpression */ || emittedExpression.arguments)) { + && (emittedExpression.kind !== 187 /* NewExpression */ || emittedExpression.arguments)) { return expression; } return ts.setTextRange(ts.createParen(expression), expression); @@ -54393,7 +54650,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(198 /* BinaryExpression */, 26 /* CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(199 /* BinaryExpression */, 26 /* CommaToken */); return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(ts.createParen(expression), expression); @@ -54404,14 +54661,14 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 190 /* FunctionExpression */ || kind === 191 /* ArrowFunction */) { + if (kind === 191 /* FunctionExpression */ || kind === 192 /* ArrowFunction */) { var mutableCall = ts.getMutableClone(emittedExpression); mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreateOuterExpressions(expression, mutableCall, 4 /* PartiallyEmittedExpressions */); } } var leftmostExpressionKind = getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 182 /* ObjectLiteralExpression */ || leftmostExpressionKind === 190 /* FunctionExpression */) { + if (leftmostExpressionKind === 183 /* ObjectLiteralExpression */ || leftmostExpressionKind === 191 /* FunctionExpression */) { return ts.setTextRange(ts.createParen(expression), expression); } return expression; @@ -54461,25 +54718,25 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: node = node.operand; continue; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: node = node.left; continue; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: node = node.condition; continue; - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 184 /* ElementAccessExpression */: - case 183 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: + case 184 /* PropertyAccessExpression */: node = node.expression; continue; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -54487,7 +54744,7 @@ var ts; } } function parenthesizeConciseBody(body) { - if (!ts.isBlock(body) && getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 182 /* ObjectLiteralExpression */) { + if (!ts.isBlock(body) && getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 183 /* ObjectLiteralExpression */) { return ts.setTextRange(ts.createParen(body), body); } return body; @@ -54503,13 +54760,13 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 7 /* All */; } switch (node.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return (kinds & 1 /* Parentheses */) !== 0; - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: - case 207 /* NonNullExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: + case 208 /* NonNullExpression */: return (kinds & 2 /* Assertions */) !== 0; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0; } return false; @@ -54534,7 +54791,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipAssertions(node) { - while (ts.isAssertionExpression(node) || node.kind === 207 /* NonNullExpression */) { + while (ts.isAssertionExpression(node) || node.kind === 208 /* NonNullExpression */) { node = node.expression; } return node; @@ -54542,11 +54799,11 @@ var ts; ts.skipAssertions = skipAssertions; function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 189 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression); - case 188 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 206 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); - case 207 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); - case 295 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 190 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression); + case 189 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 207 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); + case 208 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); + case 296 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -54564,7 +54821,7 @@ var ts; * the containing expression is created/updated. */ function isIgnorableParen(node) { - return node.kind === 189 /* ParenthesizedExpression */ + return node.kind === 190 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node) && ts.nodeIsSynthesized(ts.getSourceMapRange(node)) && ts.nodeIsSynthesized(ts.getCommentRange(node)) @@ -54629,10 +54886,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 242 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 243 /* ImportDeclaration */ && node.importClause) { return ts.getGeneratedNameForNode(node); } - if (node.kind === 248 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 249 /* ExportDeclaration */ && node.moduleSpecifier) { return ts.getGeneratedNameForNode(node); } return undefined; @@ -54750,7 +55007,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -54762,11 +55019,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -54799,11 +55056,11 @@ var ts; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { case 148 /* Parameter */: - case 180 /* BindingElement */: + case 181 /* BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 202 /* SpreadElement */: - case 270 /* SpreadAssignment */: + case 203 /* SpreadElement */: + case 271 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -54815,7 +55072,7 @@ var ts; */ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 180 /* BindingElement */: + case 181 /* BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -54827,7 +55084,7 @@ var ts; : propertyName; } break; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -54839,7 +55096,7 @@ var ts; : propertyName; } break; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -54857,13 +55114,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: - case 181 /* ArrayLiteralExpression */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: + case 182 /* ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -54903,11 +55160,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 179 /* ArrayBindingPattern */: - case 181 /* ArrayLiteralExpression */: + case 180 /* ArrayBindingPattern */: + case 182 /* ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 178 /* ObjectBindingPattern */: - case 182 /* ObjectLiteralExpression */: + case 179 /* ObjectBindingPattern */: + case 183 /* ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -55135,6 +55392,8 @@ var ts; return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode)); case 171 /* InferType */: return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + case 178 /* ImportType */: + return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); case 172 /* ParenthesizedType */: return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode)); case 174 /* TypeOperator */: @@ -55146,195 +55405,195 @@ var ts; case 177 /* LiteralType */: return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); // Binding patterns - case 178 /* ObjectBindingPattern */: + case 179 /* ObjectBindingPattern */: return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 179 /* ArrayBindingPattern */: + case 180 /* ArrayBindingPattern */: return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); // Expression - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context)); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken)); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression)); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 206 /* AsExpression */: + case 207 /* AsExpression */: return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier)); // Misc - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); // Element - case 211 /* Block */: + case 212 /* Block */: return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 245 /* NamedImports */: + case 246 /* NamedImports */: return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 249 /* NamedExports */: + case 250 /* NamedExports */: return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 250 /* ExportSpecifier */: + case 251 /* ExportSpecifier */: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); // Module references - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); // JSX - case 253 /* JsxElement */: + case 254 /* JsxElement */: return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); - case 255 /* JsxOpeningElement */: + case 256 /* JsxOpeningElement */: return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 264 /* CaseClause */: + case 265 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Enum - case 271 /* EnumMember */: + case 272 /* EnumMember */: return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); // Top-level nodes - case 272 /* SourceFile */: + case 273 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: // No need to visit nodes with no children. @@ -55386,11 +55645,11 @@ var ts; var result = initial; switch (node.kind) { // Leaf nodes - case 210 /* SemicolonClassElement */: - case 213 /* EmptyStatement */: - case 204 /* OmittedExpression */: - case 229 /* DebuggerStatement */: - case 294 /* NotEmittedStatement */: + case 211 /* SemicolonClassElement */: + case 214 /* EmptyStatement */: + case 205 /* OmittedExpression */: + case 230 /* DebuggerStatement */: + case 295 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names @@ -55457,49 +55716,49 @@ var ts; result = reduceNode(node.body, cbNode, result); break; // Binding patterns - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: result = reduceNodes(node.elements, cbNodes, result); break; - case 180 /* BindingElement */: + case 181 /* BindingElement */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Expression - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: result = reduceNodes(node.elements, cbNodes, result); break; - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: result = reduceNodes(node.properties, cbNodes, result); break; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 185 /* CallExpression */: + case 186 /* CallExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 186 /* NewExpression */: + case 187 /* NewExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: result = reduceNode(node.type, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -55507,123 +55766,123 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 189 /* ParenthesizedExpression */: - case 192 /* DeleteExpression */: - case 193 /* TypeOfExpression */: - case 194 /* VoidExpression */: - case 195 /* AwaitExpression */: - case 201 /* YieldExpression */: - case 202 /* SpreadElement */: - case 207 /* NonNullExpression */: + case 190 /* ParenthesizedExpression */: + case 193 /* DeleteExpression */: + case 194 /* TypeOfExpression */: + case 195 /* VoidExpression */: + case 196 /* AwaitExpression */: + case 202 /* YieldExpression */: + case 203 /* SpreadElement */: + case 208 /* NonNullExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: result = reduceNode(node.operand, cbNode, result); break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 206 /* AsExpression */: + case 207 /* AsExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.type, cbNode, result); break; // Misc - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; // Element - case 211 /* Block */: + case 212 /* Block */: result = reduceNodes(node.statements, cbNodes, result); break; - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 215 /* IfStatement */: + case 216 /* IfStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 216 /* DoStatement */: + case 217 /* DoStatement */: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 217 /* WhileStatement */: - case 224 /* WithStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 218 /* ForStatement */: + case 219 /* ForStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 223 /* ReturnStatement */: - case 227 /* ThrowStatement */: + case 224 /* ReturnStatement */: + case 228 /* ThrowStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 228 /* TryStatement */: + case 229 /* TryStatement */: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: result = reduceNodes(node.declarations, cbNodes, result); break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -55632,7 +55891,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -55640,139 +55899,139 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.members, cbNodes, result); break; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: result = reduceNodes(node.statements, cbNodes, result); break; - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: result = reduceNodes(node.clauses, cbNodes, result); break; - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.moduleReference, cbNode, result); break; - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 243 /* ImportClause */: + case 244 /* ImportClause */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: result = reduceNode(node.name, cbNode, result); break; - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: result = reduceNodes(node.elements, cbNodes, result); break; - case 246 /* ImportSpecifier */: - case 250 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 251 /* ExportSpecifier */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; // Module references - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: result = reduceNode(node.expression, cbNode, result); break; // JSX - case 253 /* JsxElement */: + case 254 /* JsxElement */: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: result = reduceNode(node.openingFragment, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingFragment, cbNode, result); break; - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: result = reduceNodes(node.properties, cbNodes, result); break; - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 264 /* CaseClause */: + case 265 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // falls through - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 267 /* CatchClause */: + case 268 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Enum - case 271 /* EnumMember */: + case 272 /* EnumMember */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Top-level nodes - case 272 /* SourceFile */: + case 273 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -55845,7 +56104,7 @@ var ts; function aggregateTransformFlagsForSubtree(node) { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 205 /* ExpressionWithTypeArguments */)) { + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 206 /* ExpressionWithTypeArguments */)) { return 0 /* None */; } // Aggregate the transform flags of each child. @@ -55978,21 +56237,21 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" // import { x, y } from "mod" externalImports.push(node); - hasImportStarOrImportDefault = getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); + hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); break; - case 241 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 252 /* ExternalModuleReference */) { + case 242 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 253 /* ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -56022,13 +56281,13 @@ var ts; } } break; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: if (ts.hasModifier(node, 1 /* Export */)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -56036,7 +56295,7 @@ var ts; } } break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default function() { } @@ -56056,7 +56315,7 @@ var ts; } } break; - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default class { } @@ -56130,6 +56389,26 @@ var ts; ts.isIdentifier(expression); } ts.isSimpleCopiableExpression = isSimpleCopiableExpression; + /** + * @param input Template string input strings + * @param args Names which need to be made file-level unique + */ + function helperString(input) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return function (uniqueName) { + var result = ""; + for (var i = 0; i < args.length; i++) { + result += input[i]; + result += uniqueName(args[i]); + } + result += input[input.length - 1]; + return result; + }; + } + ts.helperString = helperString; })(ts || (ts = {})); /// /// @@ -56656,8 +56935,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(184 /* ElementAccessExpression */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(185 /* ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -56726,15 +57005,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 272 /* SourceFile */: - case 239 /* CaseBlock */: - case 238 /* ModuleBlock */: - case 211 /* Block */: + case 273 /* SourceFile */: + case 240 /* CaseBlock */: + case 239 /* ModuleBlock */: + case 212 /* Block */: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 233 /* ClassDeclaration */: - case 232 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: + case 233 /* FunctionDeclaration */: if (ts.hasModifier(node, 2 /* Ambient */)) { break; } @@ -56746,7 +57025,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 === 233 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */)); + ts.Debug.assert(node.kind === 234 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */)); } break; } @@ -56790,10 +57069,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 247 /* ExportAssignment */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 248 /* ExportAssignment */: + case 249 /* ExportDeclaration */: return visitEllidableStatement(node); default: return visitorWorker(node); @@ -56814,13 +57093,13 @@ var ts; return node; } switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -56840,11 +57119,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 248 /* ExportDeclaration */ || - node.kind === 242 /* ImportDeclaration */ || - node.kind === 243 /* ImportClause */ || - (node.kind === 241 /* ImportEqualsDeclaration */ && - node.moduleReference.kind === 252 /* ExternalModuleReference */)) { + if (node.kind === 249 /* ExportDeclaration */ || + node.kind === 243 /* ImportDeclaration */ || + node.kind === 244 /* ImportClause */ || + (node.kind === 242 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 253 /* ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -56886,7 +57165,7 @@ var ts; case 153 /* MethodDeclaration */: // Fallback to the default visit behavior. return visitorWorker(node); - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: return node; default: return ts.Debug.failBadSyntaxKind(node); @@ -56955,22 +57234,22 @@ var ts; // TypeScript index signatures are elided. case 149 /* Decorator */: // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return undefined; case 151 /* PropertyDeclaration */: // TypeScript property declarations are elided. However their names are still visited, and can potentially be retained if they could have sideeffects return visitPropertyDeclaration(node); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; case 154 /* Constructor */: return visitConstructor(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return ts.createNotEmittedStatement(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: // This is a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -56981,7 +57260,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: // This is a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -56992,13 +57271,13 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); case 153 /* MethodDeclaration */: @@ -57011,13 +57290,13 @@ var ts; case 156 /* SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); case 148 /* Parameter */: @@ -57030,33 +57309,33 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 188 /* TypeAssertionExpression */: - case 206 /* AsExpression */: + case 189 /* TypeAssertionExpression */: + case 207 /* AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return visitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return visitNewExpression(node); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); default: @@ -57537,7 +57816,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 214 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 215 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -58051,8 +58330,8 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: @@ -58074,8 +58353,8 @@ var ts; return serializeTypeNode(node.type); case 156 /* SetAccessor */: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: case 153 /* MethodDeclaration */: return ts.createIdentifier("Function"); default: @@ -58884,12 +59163,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentScope.kind === 272 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); + ], currentScope.kind === 273 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 236 /* EnumDeclaration */) { + if (node.kind === 237 /* EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -59008,7 +59287,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 238 /* ModuleBlock */) { + if (body.kind === 239 /* ModuleBlock */) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -59054,13 +59333,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 (body.kind !== 238 /* ModuleBlock */) { + if (body.kind !== 239 /* ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 237 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 238 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -59101,7 +59380,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 244 /* NamespaceImport */) { + if (node.kind === 245 /* NamespaceImport */) { // Elide a namespace import if it is not referenced. return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } @@ -59333,16 +59612,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(71 /* Identifier */); - context.enableSubstitution(269 /* ShorthandPropertyAssignment */); + context.enableSubstitution(270 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(237 /* ModuleDeclaration */); + context.enableEmitNotification(238 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 237 /* ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 238 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 236 /* EnumDeclaration */; + return ts.getOriginalNode(node).kind === 237 /* EnumDeclaration */; } /** * Hook for node emit. @@ -59403,9 +59682,9 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return substituteExpressionIdentifier(node); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -59443,9 +59722,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 !== 272 /* SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 237 /* ModuleDeclaration */) || - (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 236 /* EnumDeclaration */); + if (container && container.kind !== 273 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 238 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 237 /* EnumDeclaration */); if (substitute) { return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), /*location*/ node); @@ -59582,15 +59861,15 @@ var ts; case 120 /* AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return visitAwaitExpression(node); case 153 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return visitArrowFunction(node); default: return ts.visitEachChild(node, visitor, context); @@ -59599,27 +59878,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatementInAsyncBody(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatementInAsyncBody(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClauseInAsyncBody(node); - case 211 /* Block */: - case 225 /* SwitchStatement */: - case 239 /* CaseBlock */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: - case 228 /* TryStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 215 /* IfStatement */: - case 224 /* WithStatement */: - case 226 /* LabeledStatement */: + case 212 /* Block */: + case 226 /* SwitchStatement */: + case 240 /* CaseBlock */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: + case 229 /* TryStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 216 /* IfStatement */: + case 225 /* WithStatement */: + case 227 /* LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -59819,7 +60098,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 191 /* ArrowFunction */; + var isArrowFunction = node.kind === 192 /* ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* 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 @@ -59892,11 +60171,11 @@ var ts; enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(185 /* CallExpression */); - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(184 /* ElementAccessExpression */); + context.enableSubstitution(186 /* CallExpression */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(185 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(233 /* ClassDeclaration */); + context.enableEmitNotification(234 /* ClassDeclaration */); context.enableEmitNotification(153 /* MethodDeclaration */); context.enableEmitNotification(155 /* GetAccessor */); context.enableEmitNotification(156 /* SetAccessor */); @@ -59940,11 +60219,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return substituteCallExpression(node); } return node; @@ -59976,7 +60255,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 233 /* ClassDeclaration */ + return kind === 234 /* ClassDeclaration */ || kind === 154 /* Constructor */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ @@ -59984,11 +60263,11 @@ var ts; } function createSuperAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) { - return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createFileLevelUniqueName("_super"), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } else { - return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), + return ts.setTextRange(ts.createCall(ts.createFileLevelUniqueName("_super"), /*typeArguments*/ undefined, [argumentExpression]), location); } } @@ -60021,12 +60300,12 @@ var ts; ts.asyncSuperHelper = { name: "typescript:async-super", scoped: true, - text: "\n const _super = name => super[name];" + text: ts.helperString(__makeTemplateObject(["\n const ", " = name => super[name];"], ["\n const ", " = name => super[name];"]), "_super") }; ts.advancedAsyncSuperHelper = { name: "typescript:advanced-async-super", scoped: true, - text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" + text: ts.helperString(__makeTemplateObject(["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"], ["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"]), "_super") }; })(ts || (ts = {})); /// @@ -60078,23 +60357,23 @@ var ts; return node; } switch (node.kind) { - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return visitAwaitExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitYieldExpression(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node, noDestructuringValue); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return visitVoidExpression(node); case 154 /* Constructor */: return visitConstructorDeclaration(node); @@ -60104,19 +60383,19 @@ var ts; return visitGetAccessorDeclaration(node); case 156 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return visitArrowFunction(node); case 148 /* Parameter */: return visitParameter(node); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return visitExpressionStatement(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -60139,7 +60418,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 220 /* ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 221 /* ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node); @@ -60151,7 +60430,7 @@ var ts; var objects = []; for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { var e = elements_4[_i]; - if (e.kind === 270 /* SpreadAssignment */) { + if (e.kind === 271 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -60160,7 +60439,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 268 /* PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 269 /* PropertyAssignment */ ? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -60178,7 +60457,7 @@ var ts; // If the first element is a spread element, then the first argument to __assign is {}: // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 182 /* ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 183 /* ObjectLiteralExpression */) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -60257,6 +60536,11 @@ var ts; bodyLocation = node.statement; statementsLocation = node.statement.statements; } + else if (node.statement) { + ts.append(statements, node.statement); + bodyLocation = node.statement; + statementsLocation = node.statement; + } return ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer) ], 1 /* Let */), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), @@ -60486,11 +60770,11 @@ var ts; enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(185 /* CallExpression */); - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(184 /* ElementAccessExpression */); + context.enableSubstitution(186 /* CallExpression */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(185 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(233 /* ClassDeclaration */); + context.enableEmitNotification(234 /* ClassDeclaration */); context.enableEmitNotification(153 /* MethodDeclaration */); context.enableEmitNotification(155 /* GetAccessor */); context.enableEmitNotification(156 /* SetAccessor */); @@ -60534,11 +60818,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return substituteCallExpression(node); } return node; @@ -60570,7 +60854,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 233 /* ClassDeclaration */ + return kind === 234 /* ClassDeclaration */ || kind === 154 /* Constructor */ || kind === 153 /* MethodDeclaration */ || kind === 155 /* GetAccessor */ @@ -60686,13 +60970,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 253 /* JsxElement */: + case 254 /* JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -60702,13 +60986,13 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return visitJsxExpression(node); - case 253 /* JsxElement */: + case 254 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -60781,7 +61065,7 @@ var ts; literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile); return ts.setTextRange(literal, node); } - else if (node.kind === 263 /* JsxExpression */) { + else if (node.kind === 264 /* JsxExpression */) { if (node.expression === undefined) { return ts.createTrue(); } @@ -60875,7 +61159,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 253 /* JsxElement */) { + if (node.kind === 254 /* JsxElement */) { return getTagName(node.openingElement); } else { @@ -61183,7 +61467,7 @@ var ts; return node; } switch (node.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -61419,13 +61703,13 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ - && node.kind === 223 /* ReturnStatement */ + && node.kind === 224 /* ReturnStatement */ && !node.expression; } function shouldVisitNode(node) { return (node.transformFlags & 128 /* ContainsES2015 */) !== 0 || convertedLoopState !== undefined - || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 211 /* Block */))) + || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 212 /* Block */))) || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)) || (ts.getEmitFlags(node) & 33554432 /* TypeScriptClassWrapper */) !== 0; } @@ -61453,63 +61737,63 @@ var ts; switch (node.kind) { case 115 /* StaticKeyword */: return undefined; // elide static keyword - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return visitClassDeclaration(node); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return visitClassExpression(node); case 148 /* Parameter */: return visitParameter(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return visitArrowFunction(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return visitVariableDeclaration(node); case 71 /* Identifier */: return visitIdentifier(node); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitSwitchStatement(node); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return visitCaseBlock(node); - case 211 /* Block */: + case 212 /* Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: return visitBreakOrContinueStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return visitExpressionStatement(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClause(node); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); case 146 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return visitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return visitNewExpression(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node, /*needsDestructuringValue*/ true); case 13 /* NoSubstitutionTemplateLiteral */: case 14 /* TemplateHead */: @@ -61520,28 +61804,28 @@ var ts; return visitStringLiteral(node); case 8 /* NumericLiteral */: return visitNumericLiteral(node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return visitTemplateExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitYieldExpression(node); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return visitSpreadElement(node); case 97 /* SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 99 /* ThisKeyword */: return visitThisKeyword(node); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return visitMetaProperty(node); case 153 /* MethodDeclaration */: return visitMethodDeclaration(node); case 155 /* GetAccessor */: case 156 /* SetAccessor */: return visitAccessorDeclaration(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); @@ -61580,7 +61864,7 @@ var ts; return updated; } function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + return ts.setOriginalNode(ts.createReturn(ts.createFileLevelUniqueName("_this")), node); } function visitReturnStatement(node) { if (convertedLoopState) { @@ -61628,13 +61912,13 @@ 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 === 222 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var jump = node.kind === 223 /* BreakStatement */ ? 2 /* Break */ : 4 /* 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; if (!node.label) { - if (node.kind === 222 /* BreakStatement */) { + if (node.kind === 223 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } @@ -61645,7 +61929,7 @@ var ts; } } else { - if (node.kind === 222 /* BreakStatement */) { + if (node.kind === 223 /* BreakStatement */) { labelMarker = "break-" + node.label.escapedText; setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(node.label), labelMarker); } @@ -61767,7 +62051,7 @@ var ts; /*modifiers*/ undefined, /*asteriskToken*/ undefined, /*name*/ undefined, - /*typeParameters*/ undefined, extendsClauseElement ? [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "_super")] : [], + /*typeParameters*/ undefined, extendsClauseElement ? [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, ts.createFileLevelUniqueName("_super"))] : [], /*type*/ undefined, transformClassBody(node, extendsClauseElement)); // To preserve the behavior of the old emitter, we explicitly indent // the body of the function here if it was requested in an earlier @@ -61923,7 +62207,7 @@ var ts; if (isDerivedClass && superCaptureStatus !== 2 /* ReplaceWithReturn */ && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { - statements.push(ts.createReturn(ts.createIdentifier("_this"))); + statements.push(ts.createReturn(ts.createFileLevelUniqueName("_this"))); } ts.addRange(statements, endLexicalEnvironment()); if (constructor) { @@ -61945,11 +62229,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 223 /* ReturnStatement */) { + if (statement.kind === 224 /* ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 215 /* IfStatement */) { + else if (statement.kind === 216 /* IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -61957,7 +62241,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 211 /* Block */) { + else if (statement.kind === 212 /* Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -62015,7 +62299,7 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 214 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { + if (firstStatement.kind === 215 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } @@ -62025,8 +62309,8 @@ var ts; && statementOffset === ctorStatements.length - 1 && !(ctor.transformFlags & (16384 /* ContainsLexicalThis */ | 32768 /* ContainsCapturedLexicalThis */))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 198 /* BinaryExpression */ - || superCallExpression.left.kind !== 185 /* CallExpression */) { + if (superCallExpression.kind !== 199 /* BinaryExpression */ + || superCallExpression.left.kind !== 186 /* CallExpression */) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } // Shift comments from the original super call to the return statement. @@ -62046,7 +62330,7 @@ var ts; return ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */); } function createDefaultSuperCallOrThis() { - return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createFileLevelUniqueName("_super"), ts.createNull()), ts.createFunctionApply(ts.createFileLevelUniqueName("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } /** * Visits a parameter declaration. @@ -62223,7 +62507,7 @@ var ts; * @param node A node. */ function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 191 /* ArrowFunction */) { + if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 192 /* ArrowFunction */) { captureThisForNode(statements, node, ts.createThis()); } } @@ -62231,7 +62515,7 @@ var ts; enableSubstitutionsForCapturedThis(); var captureThisStatement = ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("_this", + ts.createVariableDeclaration(ts.createFileLevelUniqueName("_this"), /*type*/ undefined, initializer) ])); ts.setEmitFlags(captureThisStatement, 1536 /* NoComments */ | 1048576 /* CustomPrologue */); @@ -62243,7 +62527,7 @@ var ts; if (hierarchyFacts & 16384 /* NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return statements; case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: @@ -62257,8 +62541,8 @@ var ts; // should be relatively safe to use. newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"); break; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* 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 = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 93 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); @@ -62268,7 +62552,7 @@ var ts; } var captureNewTargetStatement = ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("_newTarget", + ts.createVariableDeclaration(ts.createFileLevelUniqueName("_newTarget"), /*type*/ undefined, newTarget) ])); if (copyOnWrite) { @@ -62289,7 +62573,7 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; case 153 /* MethodDeclaration */: @@ -62494,7 +62778,7 @@ var ts; : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 232 /* FunctionDeclaration */ || node.kind === 190 /* FunctionExpression */)) { + if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 233 /* FunctionDeclaration */ || node.kind === 191 /* FunctionExpression */)) { name = ts.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); @@ -62542,7 +62826,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 191 /* ArrowFunction */); + ts.Debug.assert(node.kind === 192 /* 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 @@ -62609,9 +62893,9 @@ var ts; function visitExpressionStatement(node) { // If we are here it is most likely because our expression is a destructuring assignment. switch (node.expression.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } return ts.visitEachChild(node, visitor, context); @@ -62630,9 +62914,9 @@ var ts; // expression. If we are in a state where we do not need the destructuring value, // we pass that information along to the children that care about it. switch (node.expression.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } } @@ -62834,14 +63118,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -63098,11 +63382,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 231 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 232 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -63392,10 +63676,10 @@ var ts; case 153 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -63722,7 +64006,7 @@ var ts; ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var initializer = ts.createLogicalOr(resultingCall, actualThis); resultingCall = assignToCapturedThis - ? ts.createAssignment(ts.createIdentifier("_this"), initializer) + ? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer) : initializer; } return ts.setOriginalNode(resultingCall, node); @@ -63782,7 +64066,7 @@ var ts; else { if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 181 /* ArrayLiteralExpression */ + return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 182 /* ArrayLiteralExpression */ ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -63993,8 +64277,8 @@ var ts; function visitSuperKeyword(isExpressionOfCall) { return hierarchyFacts & 8 /* NonStaticClassElement */ && !isExpressionOfCall - ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") - : ts.createIdentifier("_super"); + ? ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), "prototype") + : ts.createFileLevelUniqueName("_super"); } function visitMetaProperty(node) { if (node.keywordToken === 94 /* NewKeyword */ && node.name.escapedText === "target") { @@ -64004,7 +64288,7 @@ var ts; else { hierarchyFacts |= 16384 /* NewTarget */; } - return ts.createIdentifier("_newTarget"); + return ts.createFileLevelUniqueName("_newTarget"); } return node; } @@ -64049,9 +64333,9 @@ var ts; context.enableEmitNotification(153 /* MethodDeclaration */); context.enableEmitNotification(155 /* GetAccessor */); context.enableEmitNotification(156 /* SetAccessor */); - context.enableEmitNotification(191 /* ArrowFunction */); - context.enableEmitNotification(190 /* FunctionExpression */); - context.enableEmitNotification(232 /* FunctionDeclaration */); + context.enableEmitNotification(192 /* ArrowFunction */); + context.enableEmitNotification(191 /* FunctionExpression */); + context.enableEmitNotification(233 /* FunctionDeclaration */); } } /** @@ -64093,10 +64377,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 180 /* BindingElement */: - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 230 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 231 /* VariableDeclaration */: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -64161,7 +64445,7 @@ var ts; function substituteThisKeyword(node) { if (enabledSubstitutions & 1 /* CapturedThis */ && hierarchyFacts & 16 /* CapturesThis */) { - return ts.setTextRange(ts.createIdentifier("_this"), node); + return ts.setTextRange(ts.createFileLevelUniqueName("_this"), node); } return node; } @@ -64178,11 +64462,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 214 /* ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 215 /* ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 185 /* CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 186 /* CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -64190,7 +64474,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 202 /* SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 203 /* SpreadElement */) { return false; } var expression = callArgument.expression; @@ -64203,7 +64487,7 @@ var ts; return ts.createCall(ts.getHelperName("__extends"), /*typeArguments*/ undefined, [ name, - ts.createIdentifier("_super") + ts.createFileLevelUniqueName("_super") ]); } function createTemplateObjectHelper(context, cooked, raw) { @@ -64245,15 +64529,15 @@ var ts; if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(255 /* JsxOpeningElement */); - context.enableEmitNotification(256 /* JsxClosingElement */); - context.enableEmitNotification(254 /* JsxSelfClosingElement */); + context.enableEmitNotification(256 /* JsxOpeningElement */); + context.enableEmitNotification(257 /* JsxClosingElement */); + context.enableEmitNotification(255 /* JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(183 /* PropertyAccessExpression */); - context.enableSubstitution(268 /* PropertyAssignment */); + context.enableSubstitution(184 /* PropertyAccessExpression */); + context.enableSubstitution(269 /* PropertyAssignment */); return transformSourceFile; /** * Transforms an ES5 source file to ES3. @@ -64272,9 +64556,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 255 /* JsxOpeningElement */: - case 256 /* JsxClosingElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 257 /* JsxClosingElement */: + case 255 /* JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -64607,13 +64891,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 216 /* DoStatement */: + case 217 /* DoStatement */: return visitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return visitWhileStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -64626,24 +64910,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); case 155 /* GetAccessor */: case 156 /* SetAccessor */: return visitAccessorDeclaration(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return visitBreakStatement(node); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return visitContinueStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 16777216 /* ContainsYield */) { @@ -64664,21 +64948,21 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return visitBinaryExpression(node); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return visitConditionalExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return visitYieldExpression(node); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return visitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -64691,9 +64975,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -64920,7 +65204,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: // [source] // a.b = yield; // @@ -64932,7 +65216,7 @@ var ts; // _a.b = %sent%; target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: // [source] // a[b] = yield; // @@ -65308,35 +65592,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 211 /* Block */: + case 212 /* Block */: return transformAndEmitBlock(node); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return transformAndEmitIfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return transformAndEmitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return transformAndEmitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return transformAndEmitWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -65766,7 +66050,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 265 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 266 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -65779,7 +66063,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 264 /* CaseClause */) { + if (clause.kind === 265 /* CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -67010,11 +67294,11 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(71 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(198 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(196 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(197 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(269 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(272 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(199 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(197 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(198 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(270 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(273 /* 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. @@ -67336,23 +67620,23 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return visitExportDeclaration(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return visitClassDeclaration(node); - case 297 /* MergeDeclarationMarker */: + case 298 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 298 /* EndOfDeclarationMarker */: + case 299 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -67801,7 +68085,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 212 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 213 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -67856,10 +68140,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 245 /* NamedImports */: + case 246 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -68058,7 +68342,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -68122,10 +68406,10 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return substituteExpressionIdentifier(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return substituteBinaryExpression(node); - case 197 /* PostfixUnaryExpression */: - case 196 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -68146,7 +68430,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 272 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 273 /* SourceFile */) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), /*location*/ node); } @@ -68221,7 +68505,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 197 /* PostfixUnaryExpression */ + var expression = node.kind === 198 /* PostfixUnaryExpression */ ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 43 /* PlusPlusToken */ ? 59 /* PlusEqualsToken */ : 60 /* MinusEqualsToken */), ts.createLiteral(1)), /*location*/ node) : node; @@ -68300,11 +68584,11 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(71 /* Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(269 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(198 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(196 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(197 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(272 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(270 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(199 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(197 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(198 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableEmitNotification(273 /* 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. @@ -68525,7 +68809,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 248 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 249 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -68550,7 +68834,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 248 /* ExportDeclaration */) { + if (externalImport.kind !== 249 /* ExportDeclaration */) { continue; } if (!externalImport.exportClause) { @@ -68628,19 +68912,19 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -68690,15 +68974,15 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return visitImportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: // ExportDeclarations are elided as they are handled via // `appendExportsOfDeclaration`. return undefined; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -68874,7 +69158,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 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 272 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 273 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -68938,7 +69222,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 === 212 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 213 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -68969,6 +69253,12 @@ var ts; delete deferredExports[id]; return ts.append(statements, node); } + else { + var original = ts.getOriginalNode(node); + if (ts.isModuleOrEnumDeclaration(original)) { + return ts.append(appendExportsOfDeclaration(statements, original), node); + } + } return node; } /** @@ -68994,10 +69284,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 245 /* NamedImports */: + case 246 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -69177,43 +69467,43 @@ var ts; */ function nestedElementVisitor(node) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return visitVariableStatement(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return visitClassDeclaration(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return visitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return visitForInStatement(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return visitForOfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return visitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return visitWhileStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return visitLabeledStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return visitWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return visitSwitchStatement(node); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return visitCaseBlock(node); - case 264 /* CaseClause */: + case 265 /* CaseClause */: return visitCaseClause(node); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return visitDefaultClause(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return visitTryStatement(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return visitCatchClause(node); - case 211 /* Block */: + case 212 /* Block */: return visitBlock(node); - case 297 /* MergeDeclarationMarker */: + case 298 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 298 /* EndOfDeclarationMarker */: + case 299 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -69399,7 +69689,7 @@ var ts; */ function destructuringAndImportCallVisitor(node) { if (node.transformFlags & 1024 /* DestructuringAssignment */ - && node.kind === 198 /* BinaryExpression */) { + && node.kind === 199 /* BinaryExpression */) { return visitDestructuringAssignment(node); } else if (ts.isImportCall(node)) { @@ -69464,7 +69754,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 272 /* SourceFile */; + return container !== undefined && container.kind === 273 /* SourceFile */; } else { return false; @@ -69497,7 +69787,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -69545,7 +69835,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -69581,10 +69871,10 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return substituteExpressionIdentifier(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return substituteBinaryExpression(node); - case 196 /* PrefixUnaryExpression */: - case 197 /* PostfixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -69677,14 +69967,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 197 /* PostfixUnaryExpression */ + var expression = node.kind === 198 /* PostfixUnaryExpression */ ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 197 /* PostfixUnaryExpression */) { + if (node.kind === 198 /* PostfixUnaryExpression */) { expression = node.operator === 43 /* PlusPlusToken */ ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -69706,7 +69996,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 272 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 273 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -69747,7 +70037,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(272 /* SourceFile */); + context.enableEmitNotification(273 /* SourceFile */); context.enableSubstitution(71 /* Identifier */); var currentSourceFile; return transformSourceFile; @@ -69776,10 +70066,10 @@ var ts; } function visitor(node) { switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // Elide `import=` as it is not legal with --module ES6 return undefined; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return visitExportAssignment(node); } return node; @@ -69886,7 +70176,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 === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -69915,7 +70205,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 === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -69962,7 +70252,7 @@ var ts; ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */) { + if (node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -69981,7 +70271,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 === 233 /* ClassDeclaration */ || node.kind === 148 /* Parameter */) { + else if (node.parent.kind === 234 /* ClassDeclaration */ || node.kind === 148 /* Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -70072,7 +70362,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 === 233 /* ClassDeclaration */) { + else if (node.parent.kind === 234 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* 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 : @@ -70086,7 +70376,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -70142,7 +70432,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 === 233 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 234 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* 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 : @@ -70155,7 +70445,7 @@ 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 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 162 /* FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -70170,10 +70460,10 @@ 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 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 158 /* ConstructSignature */: @@ -70187,17 +70477,17 @@ var ts; if (ts.hasModifier(node.parent, 32 /* Static */)) { 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 === 233 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 234 /* 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 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -70212,7 +70502,7 @@ var ts; function getHeritageClauseVisibilityError() { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 233 /* ClassDeclaration */) { + if (node.parent.parent.kind === 234 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = node.parent.token === 108 /* ImplementsKeyword */ ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -70351,15 +70641,17 @@ var ts; } } function transformRoot(node) { - if (node.kind === 272 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) { + if (node.kind === 273 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) { return node; } - if (node.kind === 273 /* Bundle */) { + if (node.kind === 274 /* Bundle */) { isBundledEmit = true; var refs_1 = ts.createMap(); + var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) return; // Omit declaration files from bundle results, too + hasNoDefaultLib_1 = hasNoDefaultLib_1 || sourceFile.hasNoDefaultLib; currentSourceFile = sourceFile; enclosingDeclaration = sourceFile; possibleImports = undefined; @@ -70371,15 +70663,16 @@ 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_5 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements_5)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ []); + var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements_5)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false); return newFile; } needsDeclare = true; var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - return ts.updateSourceFileNode(sourceFile, updated, /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ []); + return ts.updateSourceFileNode(sourceFile, updated, /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false); })); bundle.syntheticFileReferences = []; bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences(); + bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, /*forceDtsPaths*/ true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); refs_1.forEach(referenceVisitor_1); @@ -70403,15 +70696,29 @@ var ts; refs.forEach(referenceVisitor); var statements = ts.visitNodes(node.statements, visitDeclarationStatements); var combinedStatements = ts.setTextRange(ts.createNodeArray(filterCandidateImports(statements)), node.statements); + var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax); if (ts.isExternalModule(node) && !resultHasExternalModuleIndicator) { combinedStatements = ts.setTextRange(ts.createNodeArray(combinedStatements.concat([ts.createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createNamedExports([]), /*moduleSpecifier*/ undefined)])), combinedStatements); } - var updated = ts.updateSourceFileNode(node, combinedStatements, /*isDeclarationFile*/ true, references, getFileReferencesForUsedTypeReferences()); + var updated = ts.updateSourceFileNode(node, combinedStatements, /*isDeclarationFile*/ true, references, getFileReferencesForUsedTypeReferences(), node.hasNoDefaultLib); return updated; function getFileReferencesForUsedTypeReferences() { - return necessaryTypeRefernces ? ts.map(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : []; + return necessaryTypeRefernces ? ts.mapDefined(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : []; } function getFileReferenceForTypeName(typeName) { + // Elide type references for which we have imports + for (var _i = 0, emittedImports_1 = emittedImports; _i < emittedImports_1.length; _i++) { + var importStatement = emittedImports_1[_i]; + if (ts.isImportEqualsDeclaration(importStatement) && ts.isExternalModuleReference(importStatement.moduleReference)) { + var expr = importStatement.moduleReference.expression; + if (ts.isStringLiteralLike(expr) && expr.text === typeName) { + return undefined; + } + } + else if (ts.isImportDeclaration(importStatement) && ts.isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) { + return undefined; + } + } return { fileName: typeName, pos: -1, end: -1 }; } function mapReferencesIntoArray(references, outputFilePath) { @@ -70453,7 +70760,7 @@ var ts; return name; } else { - if (name.kind === 179 /* ArrayBindingPattern */) { + if (name.kind === 180 /* ArrayBindingPattern */) { return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -70461,7 +70768,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 204 /* OmittedExpression */) { + if (elem.kind === 205 /* OmittedExpression */) { return elem; } return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined); @@ -70519,7 +70826,7 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 230 /* VariableDeclaration */ || node.kind === 180 /* BindingElement */) { + if (node.kind === 231 /* VariableDeclaration */ || node.kind === 181 /* BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } if (node.kind === 148 /* Parameter */ @@ -70541,20 +70848,20 @@ var ts; function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 237 /* ModuleDeclaration */: - case 234 /* InterfaceDeclaration */: - case 233 /* ClassDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: + case 233 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 235 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return !getBindingNameVisible(node); - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: return false; } return false; @@ -70608,7 +70915,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return; - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 237 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 238 /* ModuleDeclaration */ && parent.kind !== 178 /* ImportType */); if (input.kind === 9 /* StringLiteral */ && isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); if (newName) { @@ -70620,7 +70927,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 252 /* ExternalModuleReference */) { + if (decl.moduleReference.kind === 253 /* ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return ts.updateImportEqualsDeclaration(decl, @@ -70647,7 +70954,7 @@ var ts; return visibleDefaultBinding && ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier)); } - if (decl.importClause.namedBindings.kind === 244 /* NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 245 /* NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined; @@ -70683,7 +70990,7 @@ var ts; continue; } // Eagerly transform import equals - if they're not visible, we'll get nothing, if they are, we'll immediately add them since it's complete - if (i.kind === 241 /* ImportEqualsDeclaration */) { + if (i.kind === 242 /* ImportEqualsDeclaration */) { var result_3 = transformImportEqualsDeclaration(i); importDeclarationMap.set("" + ts.getNodeId(i), result_3); continue; @@ -70742,7 +71049,7 @@ var ts; if (ts.hasModifier(input, 8 /* Private */)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) return; // Elide all but the first overload - return cleanup(ts.createProperty(/*decorators*/ undefined, input.modifiers, input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined)); + return cleanup(ts.createProperty(/*decorators*/ undefined, ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined)); } } var canProdiceDiagnostic = ts.canProduceDiagnostics(input); @@ -70753,14 +71060,14 @@ var ts; checkEntityNameVisibility(input.exprName, enclosingDeclaration); } var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 165 /* TypeLiteral */ || input.kind === 176 /* MappedType */) && input.parent.kind !== 235 /* TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 165 /* TypeLiteral */ || input.kind === 176 /* MappedType */) && input.parent.kind !== 236 /* TypeAliasDeclaration */); if (shouldEnterSuppressNewDiagnosticsContextContext) { // We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do. suppressNewDiagnosticContexts = true; } if (isProcessedComponent(input)) { switch (input.kind) { - case 205 /* ExpressionWithTypeArguments */: { + case 206 /* ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } @@ -70812,7 +71119,7 @@ var ts; return cleanup(ts.updateIndexSignature(input, /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(119 /* AnyKeyword */))); } - case 230 /* VariableDeclaration */: { + case 231 /* VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -70844,6 +71151,11 @@ var ts; case 163 /* ConstructorType */: { return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } + case 178 /* ImportType */: { + if (!ts.isLiteralImportTypeNode(input)) + return cleanup(input); + return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); + } default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]); } } @@ -70878,7 +71190,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 248 /* ExportDeclaration */: { + case 249 /* ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -70886,7 +71198,7 @@ var ts; // Rewrite external module names if necessary return ts.updateExportDeclaration(input, /*decorators*/ undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier)); } - case 247 /* ExportAssignment */: { + case 248 /* ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -70905,8 +71217,8 @@ var ts; return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)]; } } - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: { + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: { // Different parts of the import may be marked visible at different times (via visibility checking), so we defer our first look until later // to reduce the likelihood we need to rewrite it possibleImports = possibleImports || []; @@ -70932,27 +71244,27 @@ var ts; } var oldPossibleImports; switch (input.kind) { - case 235 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all + case 236 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all return cleanup(ts.updateTypeAliasDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 234 /* InterfaceDeclaration */: { + case 235 /* InterfaceDeclaration */: { return cleanup(ts.updateInterfaceDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 232 /* FunctionDeclaration */: { + case 233 /* FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type return cleanup(ts.updateFunctionDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), /*body*/ undefined)); } - case 237 /* ModuleDeclaration */: { + case 238 /* ModuleDeclaration */: { previousNeedsDeclare = needsDeclare; needsDeclare = false; oldPossibleImports = possibleImports; possibleImports = undefined; var inner = input.body; - if (inner && inner.kind === 238 /* ModuleBlock */) { + if (inner && inner.kind === 239 /* ModuleBlock */) { var statements = ts.visitNodes(inner.statements, visitDeclarationStatements); var body = ts.updateModuleBlock(inner, filterCandidateImports(statements)); needsDeclare = previousNeedsDeclare; @@ -70968,7 +71280,7 @@ var ts; /*decorators*/ undefined, mods, input.name, ts.visitNode(inner, visitDeclarationStatements))); } } - case 233 /* ClassDeclaration */: { + case 234 /* ClassDeclaration */: { var modifiers = ts.createNodeArray(ensureModifiers(input)); var typeParameters = ensureTypeParams(input, input.typeParameters); var ctor = ts.getFirstConstructorWithBody(input); @@ -71038,7 +71350,7 @@ var ts; /*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 212 /* VariableStatement */: { + case 213 /* VariableStatement */: { if (!ts.forEach(input.declarationList.declarations, getBindingNameVisible)) return; var nodes = ts.visitNodes(input.declarationList.declarations, visitDeclarationSubtree); @@ -71046,7 +71358,7 @@ var ts; return; return cleanup(ts.updateVariableStatement(input, ts.createNodeArray(ensureModifiers(input)), ts.updateVariableDeclarationList(input.declarationList, nodes))); } - case 236 /* EnumDeclaration */: { + case 237 /* EnumDeclaration */: { return cleanup(ts.updateEnumDeclaration(input, /*decorators*/ undefined, ts.createNodeArray(ensureModifiers(input)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -71062,7 +71374,7 @@ var ts; if (isEnclosingDeclaration(input)) { enclosingDeclaration = previousEnclosingDeclaration; } - if (input.kind === 237 /* ModuleDeclaration */) { + if (input.kind === 238 /* ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; possibleImports = ts.concatenate(oldPossibleImports, possibleImports); } @@ -71085,7 +71397,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 204 /* OmittedExpression */) { + if (e.kind === 205 /* OmittedExpression */) { return; } if (e.name) { @@ -71139,7 +71451,7 @@ var ts; function ensureModifierFlags(node) { var mask = 3071 /* All */ ^ (4 /* Public */ | 256 /* Async */); // No async modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */; - var parentIsFile = node.parent.kind === 272 /* SourceFile */; + var parentIsFile = node.parent.kind === 273 /* SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= ((isBundledEmit && parentIsFile ? 0 : 1 /* Export */) | 512 /* Default */ | 2 /* Ambient */); additions = 0 /* None */; @@ -71187,7 +71499,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 234 /* InterfaceDeclaration */) { + if (node.kind === 235 /* InterfaceDeclaration */) { return true; } return false; @@ -71216,7 +71528,7 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 148 /* Parameter */: @@ -71226,17 +71538,17 @@ var ts; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 237 /* ModuleDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 234 /* InterfaceDeclaration */: - case 233 /* ClassDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: - case 212 /* VariableStatement */: - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: - case 247 /* ExportAssignment */: + case 233 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 235 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: + case 213 /* VariableStatement */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 248 /* ExportAssignment */: return true; } return false; @@ -71253,13 +71565,14 @@ var ts; case 152 /* MethodSignature */: case 157 /* CallSignature */: case 159 /* IndexSignature */: - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 147 /* TypeParameter */: - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: case 161 /* TypeReference */: case 170 /* ConditionalType */: case 162 /* FunctionType */: case 163 /* ConstructorType */: + case 178 /* ImportType */: return true; } return false; @@ -71349,7 +71662,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(299 /* Count */); + var enabledSyntaxKindFeatures = new Array(300 /* Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -71695,7 +72008,7 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (sourceFileOrBundle.kind === 272 /* SourceFile */) { // emitting single module file + if (sourceFileOrBundle.kind === 273 /* SourceFile */) { // emitting single module file // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); @@ -71845,7 +72158,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 294 /* NotEmittedStatement */ + if (node.kind !== 295 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -71862,7 +72175,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 294 /* NotEmittedStatement */ + if (node.kind !== 295 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -72039,7 +72352,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 294 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 295 /* NotEmittedStatement */; // We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation. // It is expensive to walk entire tree just to set one kind of node to have no comments. var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 10 /* JsxText */; @@ -72060,7 +72373,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 === 231 /* VariableDeclarationList */) { + if (node.kind === 232 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -72404,7 +72717,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 273 /* Bundle */) { + if (sourceFile.kind === 274 /* Bundle */) { var jsFilePath = options.outFile || options.out; var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); var declarationFilePath = (forceDtsPaths || options.declaration) ? ts.removeFileExtension(jsFilePath) + ".d.ts" /* Dts */ : undefined; @@ -72446,7 +72759,6 @@ var ts; // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); - var moduleKind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); @@ -72459,9 +72771,6 @@ var ts; mapRoot: compilerOptions.mapRoot, extendedDiagnostics: compilerOptions.extendedDiagnostics, }); - var currentSourceFile; - var bundledHelpers; - var isOwnFileEmit; var emitSkipped = false; // Emit each output file ts.performance.mark("beforePrint"); @@ -72502,7 +72811,7 @@ var ts; // Transform the source files var transform = ts.transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, /*allowDtsFiles*/ false); // Create a printer to print the nodes - var printer = createPrinter(compilerOptions, { + var printer = createPrinter(__assign({}, compilerOptions, { noEmitHelpers: compilerOptions.noEmitHelpers }), { // resolver hooks hasGlobalName: resolver.hasGlobalName, // transform hooks @@ -72513,7 +72822,6 @@ var ts; onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, onEmitSourceMapOfPosition: sourceMap.emitPos, // emitter hooks - onEmitHelpers: emitHelpers, onSetSourceFile: setSourceFile, }); printSourceFileOrBundle(jsFilePath, sourceMapFilePath, ts.isSourceFile(sourceFileOrBundle) ? transform.transformed[0] : ts.createBundle(transform.transformed), printer, sourceMap); @@ -72535,7 +72843,7 @@ var ts; emitterDiagnostics.add(diagnostic); } } - var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: true }), { + var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: true, noEmitHelpers: true }), { // resolver hooks hasGlobalName: resolver.hasGlobalName, // sourcemap hooks @@ -72555,17 +72863,14 @@ var ts; declarationTransform.dispose(); } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapRecorder) { - var bundle = sourceFileOrBundle.kind === 273 /* Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 272 /* SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 274 /* Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 273 /* SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; mapRecorder.initialize(jsFilePath, sourceMapFilePath || "", sourceFileOrBundle, sourceMapDataList); if (bundle) { - bundledHelpers = ts.createMap(); - isOwnFileEmit = false; printer.writeBundle(bundle, writer); } else { - isOwnFileEmit = true; printer.writeFile(sourceFile, writer); } writer.writeLine(); @@ -72582,66 +72887,19 @@ var ts; // Reset state mapRecorder.reset(); writer.clear(); - currentSourceFile = undefined; - bundledHelpers = undefined; - isOwnFileEmit = false; } function setSourceFile(node) { - currentSourceFile = node; sourceMap.setSourceFile(node); } function setSourceFileForDeclarationSourceMaps(node) { - currentSourceFile = node; declarationSourceMap.setSourceFile(node); } - function emitHelpers(node, writeLines) { - var helpersEmitted = false; - var bundle = node.kind === 273 /* Bundle */ ? node : undefined; - if (bundle && moduleKind === ts.ModuleKind.None) { - return; - } - var numNodes = bundle ? bundle.sourceFiles.length : 1; - for (var i = 0; i < numNodes; i++) { - var currentNode = bundle ? bundle.sourceFiles[i] : node; - var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; - var shouldSkip = compilerOptions.noEmitHelpers || ts.getExternalHelpersModuleName(sourceFile) !== undefined; - var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; - var helpers = ts.getEmitHelpers(currentNode); - if (helpers) { - for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { - var helper = _b[_a]; - if (!helper.scoped) { - // Skip the helper if it can be skipped and the noEmitHelpers compiler - // option is set, or if it can be imported and the importHelpers compiler - // option is set. - if (shouldSkip) - continue; - // Skip the helper if it can be bundled but hasn't already been emitted and we - // are emitting a bundled module. - if (shouldBundle) { - if (bundledHelpers.get(helper.name)) { - continue; - } - bundledHelpers.set(helper.name, true); - } - } - else if (bundle) { - // Skip the helper if it is scoped and we are emitting bundled helpers - continue; - } - writeLines(helper.text); - helpersEmitted = true; - } - } - } - return helpersEmitted; - } } ts.emitFiles = emitFiles; function createPrinter(printerOptions, handlers) { if (printerOptions === void 0) { printerOptions = {}; } if (handlers === void 0) { handlers = {}; } - var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onEmitHelpers = handlers.onEmitHelpers, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; + var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; var newLine = ts.getNewLineCharacter(printerOptions); var comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition); var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition; @@ -72664,6 +72922,9 @@ var ts; writeSemicolon = deferWriteSemicolon; } var syntheticParent = { pos: -1, end: -1 }; + var moduleKind = ts.getEmitModuleKind(printerOptions); + var bundledHelpers = ts.createMap(); + var isOwnFileEmit; reset(); return { // public API @@ -72690,8 +72951,8 @@ var ts; break; } switch (node.kind) { - case 272 /* SourceFile */: return printFile(node); - case 273 /* Bundle */: return printBundle(node); + case 273 /* SourceFile */: return printFile(node); + case 274 /* Bundle */: return printBundle(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -72726,11 +72987,12 @@ var ts; writer = previousWriter; } function writeBundle(bundle, output) { + isOwnFileEmit = false; var previousWriter = writer; setWriter(output); emitShebangIfNeeded(bundle); emitPrologueDirectivesIfNeeded(bundle); - emitHelpersIndirect(bundle); + emitHelpers(bundle); emitSyntheticTripleSlashReferencesIfNeeded(bundle); for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) { var sourceFile = _b[_a]; @@ -72740,6 +73002,7 @@ var ts; writer = previousWriter; } function writeFile(sourceFile, output) { + isOwnFileEmit = true; var previousWriter = writer; setWriter(output); emitShebangIfNeeded(sourceFile); @@ -72846,7 +73109,7 @@ var ts; writeSpace(); writeKeyword("in"); writeSpace(); - emit(node.constraint); + emitIfPresent(node.constraint); } function pipelineEmitUnspecified(node) { var kind = node.kind; @@ -72906,7 +73169,7 @@ var ts; return emitTypeReference(node); case 162 /* FunctionType */: return emitFunctionType(node); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return emitJSDocFunctionType(node); case 163 /* ConstructorType */: return emitConstructorType(node); @@ -72928,7 +73191,7 @@ var ts; return emitInferType(node); case 172 /* ParenthesizedType */: return emitParenthesizedType(node); - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); case 173 /* ThisType */: return emitThisType(); @@ -72940,154 +73203,156 @@ var ts; return emitMappedType(node); case 177 /* LiteralType */: return emitLiteralType(node); - case 275 /* JSDocAllType */: + case 178 /* ImportType */: + return emitImportTypeNode(node); + case 276 /* JSDocAllType */: write("*"); return; - case 276 /* JSDocUnknownType */: + case 277 /* JSDocUnknownType */: write("?"); return; - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return emitJSDocNullableType(node); - case 278 /* JSDocNonNullableType */: + case 279 /* JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return emitJSDocOptionalType(node); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return emitJSDocVariadicType(node); // Binding patterns - case 178 /* ObjectBindingPattern */: + case 179 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 179 /* ArrayBindingPattern */: + case 180 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return emitBindingElement(node); // Misc - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return emitTemplateSpan(node); - case 210 /* SemicolonClassElement */: + case 211 /* SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 211 /* Block */: + case 212 /* Block */: return emitBlock(node); - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: return emitVariableStatement(node); - case 213 /* EmptyStatement */: + case 214 /* EmptyStatement */: return emitEmptyStatement(); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return emitExpressionStatement(node); - case 215 /* IfStatement */: + case 216 /* IfStatement */: return emitIfStatement(node); - case 216 /* DoStatement */: + case 217 /* DoStatement */: return emitDoStatement(node); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: return emitWhileStatement(node); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return emitForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: return emitForInStatement(node); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return emitForOfStatement(node); - case 221 /* ContinueStatement */: + case 222 /* ContinueStatement */: return emitContinueStatement(node); - case 222 /* BreakStatement */: + case 223 /* BreakStatement */: return emitBreakStatement(node); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: return emitReturnStatement(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: return emitWithStatement(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return emitSwitchStatement(node); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: return emitLabeledStatement(node); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: return emitThrowStatement(node); - case 228 /* TryStatement */: + case 229 /* TryStatement */: return emitTryStatement(node); - case 229 /* DebuggerStatement */: + case 230 /* DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return emitClassDeclaration(node); - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return emitModuleBlock(node); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return emitCaseBlock(node); - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: return emitImportDeclaration(node); - case 243 /* ImportClause */: + case 244 /* ImportClause */: return emitImportClause(node); - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: return emitNamespaceImport(node); - case 245 /* NamedImports */: + case 246 /* NamedImports */: return emitNamedImports(node); - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: return emitImportSpecifier(node); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: return emitExportAssignment(node); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: return emitExportDeclaration(node); - case 249 /* NamedExports */: + case 250 /* NamedExports */: return emitNamedExports(node); - case 250 /* ExportSpecifier */: + case 251 /* ExportSpecifier */: return emitExportSpecifier(node); - case 251 /* MissingDeclaration */: + case 252 /* MissingDeclaration */: return; // Module references - case 252 /* ExternalModuleReference */: + case 253 /* ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 10 /* JsxText */: return emitJsxText(node); - case 255 /* JsxOpeningElement */: - case 258 /* JsxOpeningFragment */: + case 256 /* JsxOpeningElement */: + case 259 /* JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 256 /* JsxClosingElement */: - case 259 /* JsxClosingFragment */: + case 257 /* JsxClosingElement */: + case 260 /* JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return emitJsxAttribute(node); - case 261 /* JsxAttributes */: + case 262 /* JsxAttributes */: return emitJsxAttributes(node); - case 262 /* JsxSpreadAttribute */: + case 263 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 263 /* JsxExpression */: + case 264 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 264 /* CaseClause */: + case 265 /* CaseClause */: return emitCaseClause(node); - case 265 /* DefaultClause */: + case 266 /* DefaultClause */: return emitDefaultClause(node); - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: return emitHeritageClause(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 269 /* ShorthandPropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 270 /* SpreadAssignment */: + case 271 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 271 /* EnumMember */: + case 272 /* EnumMember */: return emitEnumMember(node); // JSDoc nodes (ignored) // Transformation nodes (ignored) @@ -73125,81 +73390,123 @@ var ts; writeTokenNode(node, writeKeyword); return; // Expressions - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return emitElementAccessExpression(node); - case 185 /* CallExpression */: + case 186 /* CallExpression */: return emitCallExpression(node); - case 186 /* NewExpression */: + case 187 /* NewExpression */: return emitNewExpression(node); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return emitFunctionExpression(node); - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return emitArrowFunction(node); - case 192 /* DeleteExpression */: + case 193 /* DeleteExpression */: return emitDeleteExpression(node); - case 193 /* TypeOfExpression */: + case 194 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 194 /* VoidExpression */: + case 195 /* VoidExpression */: return emitVoidExpression(node); - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: return emitAwaitExpression(node); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return emitBinaryExpression(node); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return emitConditionalExpression(node); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: return emitTemplateExpression(node); - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: return emitYieldExpression(node); - case 202 /* SpreadElement */: + case 203 /* SpreadElement */: return emitSpreadExpression(node); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return emitClassExpression(node); - case 204 /* OmittedExpression */: + case 205 /* OmittedExpression */: return; - case 206 /* AsExpression */: + case 207 /* AsExpression */: return emitAsExpression(node); - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: return emitNonNullExpression(node); - case 208 /* MetaProperty */: + case 209 /* MetaProperty */: return emitMetaProperty(node); // JSX - case 253 /* JsxElement */: + case 254 /* JsxElement */: return emitJsxElement(node); - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 257 /* JsxFragment */: + case 258 /* JsxFragment */: return emitJsxFragment(node); // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 296 /* CommaListExpression */: + case 297 /* CommaListExpression */: return emitCommaList(node); } } function trySubstituteNode(hint, node) { return node && substituteNode && substituteNode(hint, node) || node; } - function emitHelpersIndirect(node) { - if (onEmitHelpers) { - onEmitHelpers(node, writeLines); + function emitHelpers(node) { + var helpersEmitted = false; + var bundle = node.kind === 274 /* Bundle */ ? node : undefined; + if (bundle && moduleKind === ts.ModuleKind.None) { + return; } + var numNodes = bundle ? bundle.sourceFiles.length : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? bundle.sourceFiles[i] : node; + var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; + var shouldSkip = printerOptions.noEmitHelpers || ts.getExternalHelpersModuleName(sourceFile) !== undefined; + var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; + var helpers = ts.getEmitHelpers(currentNode); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + // Skip the helper if it can be skipped and the noEmitHelpers compiler + // option is set, or if it can be imported and the importHelpers compiler + // option is set. + if (shouldSkip) + continue; + // Skip the helper if it can be bundled but hasn't already been emitted and we + // are emitting a bundled module. + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } + else if (bundle) { + // Skip the helper if it is scoped and we are emitting bundled helpers + continue; + } + if (typeof helper.text === "string") { + writeLines(helper.text); + } + else { + writeLines(helper.text(makeFileLevelOptmiisticUniqueName)); + } + helpersEmitted = true; + } + } + } + return helpersEmitted; } // // Literals/Pseudo-literals @@ -73280,8 +73587,8 @@ var ts; emitNodeWithWriter(node.name, writeParameter); } emitIfPresent(node.questionToken); - if (node.parent && node.parent.kind === 280 /* JSDocFunctionType */ && !node.name) { - emit(node.type); + if (node.parent && node.parent.kind === 281 /* JSDocFunctionType */ && !node.name) { + emitIfPresent(node.type); } else { emitTypeAnnotation(node.type); @@ -73393,13 +73700,13 @@ var ts; writeSpace(); writePunctuation("=>"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); } function emitJSDocFunctionType(node) { write("function"); emitParameters(node, node.parameters); write(":"); - emit(node.type); + emitIfPresent(node.type); } function emitJSDocNullableType(node) { write("?"); @@ -73421,7 +73728,7 @@ var ts; writeSpace(); writePunctuation("=>"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); } function emitTypeQuery(node) { writeKeyword("typeof"); @@ -73521,7 +73828,7 @@ var ts; } writePunctuation(":"); writeSpace(); - emit(node.type); + emitIfPresent(node.type); writeSemicolon(); if (emitFlags & 1 /* SingleLine */) { writeSpace(); @@ -73535,6 +73842,21 @@ var ts; function emitLiteralType(node) { emitExpression(node.literal); } + function emitImportTypeNode(node) { + if (node.isTypeOf) { + writeKeyword("typeof"); + writeSpace(); + } + writeKeyword("import"); + writePunctuation("("); + emit(node.argument); + writePunctuation(")"); + if (node.qualifier) { + writePunctuation("."); + emit(node.qualifier); + } + emitTypeArguments(node, node.typeArguments); + } // // Binding patterns // @@ -73710,7 +74032,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 === 196 /* PrefixUnaryExpression */ + return operand.kind === 197 /* PrefixUnaryExpression */ && ((node.operator === 37 /* PlusToken */ && (operand.operator === 37 /* PlusToken */ || operand.operator === 43 /* PlusPlusToken */)) || (node.operator === 38 /* MinusToken */ && (operand.operator === 38 /* MinusToken */ || operand.operator === 44 /* MinusMinusToken */))); } @@ -73754,7 +74076,7 @@ var ts; } function emitYieldExpression(node) { emitTokenWithComment(116 /* YieldKeyword */, node.pos, writeKeyword, node); - emit(node.asteriskToken); + emitIfPresent(node.asteriskToken); emitExpressionWithLeadingSpace(node.expression); } function emitSpreadExpression(node) { @@ -73827,7 +74149,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node); emitTokenWithComment(82 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 215 /* IfStatement */) { + if (node.elseStatement.kind === 216 /* IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -73898,7 +74220,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 231 /* VariableDeclarationList */) { + if (node.kind === 232 /* VariableDeclarationList */) { emit(node); } else { @@ -74109,7 +74431,7 @@ var ts; // Emit all the prologue directives (like "use strict"). var statementOffset = emitPrologueDirectives(body.statements, /*startWithNewLine*/ true); var pos = writer.getTextPos(); - emitHelpersIndirect(body); + emitHelpers(body); if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) { decreaseIndent(); emitList(body, body.statements, 384 /* SingleLineFunctionBodyStatements */); @@ -74190,7 +74512,7 @@ var ts; var body = node.body; if (!body) return writeSemicolon(); - while (body.kind === 237 /* ModuleDeclaration */) { + while (body.kind === 238 /* ModuleDeclaration */) { writePunctuation("."); emit(body.name); body = body.body; @@ -74241,12 +74563,12 @@ var ts; writeSemicolon(); } function emitImportClause(node) { - emit(node.name); + emitIfPresent(node.name); if (node.name && node.namedBindings) { emitTokenWithComment(26 /* CommaToken */, node.name.end, writePunctuation, node); writeSpace(); } - emit(node.namedBindings); + emitIfPresent(node.namedBindings); } function emitNamespaceImport(node) { var asPos = emitTokenWithComment(39 /* AsteriskToken */, node.pos, writePunctuation, node); @@ -74512,20 +74834,40 @@ var ts; emitSourceFileWorker(node); } function emitSyntheticTripleSlashReferencesIfNeeded(node) { - emitTripleSlashDirectives(node.syntheticFileReferences || [], node.syntheticTypeReferences || []); + emitTripleSlashDirectives(node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || []); } function emitTripleSlashDirectivesIfNeeded(node) { if (node.isDeclarationFile) - emitTripleSlashDirectives(node.referencedFiles, node.typeReferenceDirectives); + emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives); } - function emitTripleSlashDirectives(files, types) { - for (var _a = 0, files_1 = files; _a < files_1.length; _a++) { - var directive = files_1[_a]; + function emitTripleSlashDirectives(hasNoDefaultLib, files, types) { + if (hasNoDefaultLib) { + write("/// "); + writeLine(); + } + if (currentSourceFile && currentSourceFile.moduleName) { + write("/// "); + writeLine(); + } + if (currentSourceFile && currentSourceFile.amdDependencies) { + for (var _a = 0, _b = currentSourceFile.amdDependencies; _a < _b.length; _a++) { + var dep = _b[_a]; + if (dep.name) { + write("/// "); + } + else { + write("/// "); + } + writeLine(); + } + } + for (var _c = 0, files_1 = files; _c < files_1.length; _c++) { + var directive = files_1[_c]; write("/// "); writeLine(); } - for (var _b = 0, types_18 = types; _b < types_18.length; _b++) { - var directive = types_18[_b]; + for (var _d = 0, types_18 = types; _d < types_18.length; _d++) { + var directive = types_18[_d]; write("/// "); writeLine(); } @@ -74533,7 +74875,7 @@ var ts; function emitSourceFileWorker(node) { var statements = node.statements; pushNameGenerationScope(node); - emitHelpersIndirect(node); + emitHelpers(node); var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); }); emitTripleSlashDirectivesIfNeeded(node); emitList(node, statements, 1 /* MultiLine */, index === -1 ? statements.length : index); @@ -75089,7 +75431,7 @@ var ts; && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 189 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 190 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -75185,11 +75527,16 @@ var ts; * or within the NameGenerator. */ function isUniqueName(name) { - return !(hasGlobalName && hasGlobalName(name)) - && !currentSourceFile.identifiers.has(name) + return isFileLevelUniqueName(name) && !generatedNames.has(name) && !(reservedNames && reservedNames.has(name)); } + /** + * Returns a value indicating whether a name is unique globally or within the current file. + */ + function isFileLevelUniqueName(name) { + return ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName); + } /** * Returns a value indicating whether a name is unique within a container. */ @@ -75245,9 +75592,10 @@ 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, optimistic) { + function makeUniqueName(baseName, checkFn, optimistic) { + if (checkFn === void 0) { checkFn = isUniqueName; } if (optimistic) { - if (isUniqueName(baseName)) { + if (checkFn(baseName)) { generatedNames.set(baseName, true); return baseName; } @@ -75259,13 +75607,16 @@ var ts; var i = 1; while (true) { var generatedName = baseName + i; - if (isUniqueName(generatedName)) { + if (checkFn(generatedName)) { generatedNames.set(generatedName, true); return generatedName; } i++; } } + function makeFileLevelOptmiisticUniqueName(name) { + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. */ @@ -75308,17 +75659,17 @@ var ts; switch (node.kind) { case 71 /* Identifier */: return makeUniqueName(getTextOfNode(node)); - case 237 /* ModuleDeclaration */: - case 236 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: - case 247 /* ExportAssignment */: + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: + case 248 /* ExportAssignment */: return generateNameForExportDefault(); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: return generateNameForClassExpression(); case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: @@ -75338,9 +75689,7 @@ var ts; case 2 /* Loop */: return makeTempVariableName(268435456 /* _i */, !!(name.autoGenerateFlags & 16 /* ReservedInNestedScopes */)); case 3 /* Unique */: - return makeUniqueName(ts.idText(name)); - case 5 /* OptimisticUnique */: - return makeUniqueName(ts.idText(name), /*optimistic*/ true); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 64 /* FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 32 /* Optimistic */)); } ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } @@ -75557,7 +75906,7 @@ var ts; } ts.createCompilerHost = createCompilerHost; function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { - var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + var diagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(cancellationToken), program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (program.getCompilerOptions().declaration) { ts.addRange(diagnostics, program.getDeclarationDiagnostics(sourceFile, cancellationToken)); } @@ -75766,6 +76115,12 @@ var ts; } } ts.isProgramUptoDate = isProgramUptoDate; + function getConfigFileParsingDiagnostics(configFileParseResult) { + return configFileParseResult.options.configFile ? + configFileParseResult.options.configFile.parseDiagnostics.concat(configFileParseResult.errors) : + configFileParseResult.errors; + } + ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics; /** * Determined if source file needs to be re-created even if its text hasn't changed */ @@ -75794,9 +76149,10 @@ var ts; * @param options - The compiler options which should be used. * @param host - The host interacts with the underlying file system. * @param oldProgram - Reuses an old program structure. + * @param configFileParsingDiagnostics - error during config file parsing * @returns A 'Program' object. */ - function createProgram(rootNames, options, host, oldProgram) { + function createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics) { var program; var files = []; var commonSourceDirectory; @@ -75837,7 +76193,7 @@ var ts; var resolveModuleNamesWorker; var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; if (host.resolveModuleNames) { - resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(checkAllDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { + resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. if (!resolved || resolved.extension !== undefined) { return resolved; @@ -75850,15 +76206,15 @@ var ts; else { moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; - resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(checkAllDefined(moduleNames), containingFile, loader_1); }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; if (host.resolveTypeReferenceDirectives) { - resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(checkAllDefined(typeDirectiveNames), containingFile); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile); }; } else { var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; - resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(checkAllDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; } // Map from a stringified PackageId to the source file with that id. // Only one source file may have a given packageId. Others become redirects (see createRedirectSourceFile). @@ -75895,8 +76251,9 @@ var ts; if (!skipDefaultLib) { // If '--lib' is not specified, include default library file according to '--target' // otherwise, using options specified in '--lib' instead of '--target' default library file - if (!options.lib) { - processRootFile(getDefaultLibraryFileName(), /*isDefaultLib*/ true); + var defaultLibraryFileName = getDefaultLibraryFileName(); + if (!options.lib && defaultLibraryFileName) { + processRootFile(defaultLibraryFileName, /*isDefaultLib*/ true); } else { ts.forEach(options.lib, function (libFileName) { @@ -75952,7 +76309,8 @@ var ts; getSourceFileFromReference: getSourceFileFromReference, sourceFileToPackageName: sourceFileToPackageName, redirectTargetsSet: redirectTargetsSet, - isEmittedFile: isEmittedFile + isEmittedFile: isEmittedFile, + getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics }; verifyCompilerOptions(); ts.performance.mark("afterProgram"); @@ -76539,10 +76897,10 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: - case 230 /* VariableDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: + case 231 /* VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -76550,41 +76908,41 @@ var ts; } } switch (node.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 266 /* HeritageClause */: + case 267 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 108 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 207 /* NonNullExpression */: + case 208 /* NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file)); return; - case 206 /* AsExpression */: + case 207 /* AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; - case 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } var prevParent = parent; @@ -76597,25 +76955,25 @@ 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_to_remove_this_warning)); } switch (parent.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } // falls through - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 212 /* VariableStatement */); + return checkModifiers(nodes, parent.kind === 213 /* VariableStatement */); } break; case 151 /* PropertyDeclaration */: @@ -76637,11 +76995,11 @@ var ts; return; } break; - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 205 /* ExpressionWithTypeArguments */: - case 254 /* JsxSelfClosingElement */: - case 255 /* JsxOpeningElement */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 206 /* ExpressionWithTypeArguments */: + case 255 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); @@ -76728,6 +77086,9 @@ var ts; function getGlobalDiagnostics() { return ts.sortAndDeduplicateDiagnostics(getDiagnosticsProducingTypeChecker().getGlobalDiagnostics().slice()); } + function getConfigFileParsingDiagnostics() { + return configFileParsingDiagnostics || ts.emptyArray; + } function processRootFile(fileName, isDefaultLib) { processSourceFile(ts.normalizePath(fileName), isDefaultLib, /*packageId*/ undefined); } @@ -76823,9 +77184,18 @@ var ts; else if (ts.isImportCall(node) && node.arguments.length === 1 && ts.isStringLiteralLike(node.arguments[0])) { imports = ts.append(imports, node.arguments[0]); } - else { - ts.forEachChild(node, collectDynamicImportOrRequireCalls); + else if (ts.isLiteralImportTypeNode(node)) { + imports = ts.append(imports, node.argument.literal); } + else { + collectDynamicImportOrRequireCallsForEachChild(node); + if (ts.hasJSDocNodes(node)) { + ts.forEach(node.jsDoc, collectDynamicImportOrRequireCallsForEachChild); + } + } + } + function collectDynamicImportOrRequireCallsForEachChild(node) { + ts.forEachChild(node, collectDynamicImportOrRequireCalls); } } /** This should have similar behavior to 'processSourceFile' without diagnostics or mutation. */ @@ -77477,10 +77847,6 @@ var ts; } } ts.getResolutionDiagnostic = getResolutionDiagnostic; - function checkAllDefined(names) { - ts.Debug.assert(names.every(function (name) { return name !== undefined; }), "A name is undefined.", function () { return JSON.stringify(names); }); - return names; - } function getModuleNames(_a) { var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations; var res = imports.map(function (i) { return i.text; }); @@ -77962,26 +78328,36 @@ var ts; BuilderProgramKind[BuilderProgramKind["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram"; BuilderProgramKind[BuilderProgramKind["EmitAndSemanticDiagnosticsBuilderProgram"] = 1] = "EmitAndSemanticDiagnosticsBuilderProgram"; })(BuilderProgramKind = ts.BuilderProgramKind || (ts.BuilderProgramKind = {})); - function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { + function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { var host; var newProgram; - if (ts.isArray(newProgramOrRootNames)) { - newProgram = ts.createProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram && oldProgram.getProgram()); + var oldProgram; + if (newProgramOrRootNames === undefined) { + ts.Debug.assert(hostOrOptions === undefined); + host = oldProgramOrHost; + oldProgram = configFileParsingDiagnosticsOrOldProgram; + ts.Debug.assert(!!oldProgram); + newProgram = oldProgram.getProgram(); + } + else if (ts.isArray(newProgramOrRootNames)) { + oldProgram = configFileParsingDiagnosticsOrOldProgram; + newProgram = ts.createProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram && oldProgram.getProgram(), configFileParsingDiagnostics); host = oldProgramOrHost; } else { newProgram = newProgramOrRootNames; host = hostOrOptions; oldProgram = oldProgramOrHost; + configFileParsingDiagnostics = configFileParsingDiagnosticsOrOldProgram; } - return { host: host, newProgram: newProgram, oldProgram: oldProgram }; + return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray }; } ts.getBuilderCreationParameters = getBuilderCreationParameters; function createBuilderProgram(kind, _a) { - var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram; + var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics; // Return same program if underlying program doesnt change var oldState = oldProgram && oldProgram.getState(); - if (oldState && newProgram === oldState.program) { + if (oldState && newProgram === oldState.program && configFileParsingDiagnostics !== newProgram.getConfigFileParsingDiagnostics()) { newProgram = undefined; oldState = undefined; return oldProgram; @@ -78007,6 +78383,7 @@ var ts; getSourceFiles: function () { return state.program.getSourceFiles(); }, getOptionsDiagnostics: function (cancellationToken) { return state.program.getOptionsDiagnostics(cancellationToken); }, getGlobalDiagnostics: function (cancellationToken) { return state.program.getGlobalDiagnostics(cancellationToken); }, + getConfigFileParsingDiagnostics: function () { return configFileParsingDiagnostics || state.program.getConfigFileParsingDiagnostics(); }, getSyntacticDiagnostics: function (sourceFile, cancellationToken) { return state.program.getSyntacticDiagnostics(sourceFile, cancellationToken); }, getSemanticDiagnostics: getSemanticDiagnostics, emit: emit, @@ -78138,16 +78515,16 @@ var ts; ts.createBuilderProgram = createBuilderProgram; })(ts || (ts = {})); (function (ts) { - function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { - return ts.createBuilderProgram(ts.BuilderProgramKind.SemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram)); + function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { + return ts.createBuilderProgram(ts.BuilderProgramKind.SemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics)); } ts.createSemanticDiagnosticsBuilderProgram = createSemanticDiagnosticsBuilderProgram; - function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { - return ts.createBuilderProgram(ts.BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram)); + function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { + return ts.createBuilderProgram(ts.BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics)); } ts.createEmitAndSemanticDiagnosticsBuilderProgram = createEmitAndSemanticDiagnosticsBuilderProgram; - function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram) { - var program = ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram).newProgram; + function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { + var program = ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics).newProgram; return { // Only return program, all other methods are not implemented getProgram: function () { return program; }, @@ -78157,6 +78534,7 @@ var ts; getSourceFiles: ts.notImplemented, getOptionsDiagnostics: ts.notImplemented, getGlobalDiagnostics: ts.notImplemented, + getConfigFileParsingDiagnostics: ts.notImplemented, getSyntacticDiagnostics: ts.notImplemented, getSemanticDiagnostics: ts.notImplemented, emit: ts.notImplemented, @@ -79075,10 +79453,8 @@ var ts; /** Parses config file using System interface */ function parseConfigFileWithSystem(configFileName, optionsToExtend, system, reportDiagnostic) { var host = system; - host.onConfigFileDiagnostic = reportDiagnostic; host.onUnRecoverableConfigFileDiagnostic = function (diagnostic) { return reportUnrecoverableDiagnostic(ts.sys, reportDiagnostic, diagnostic); }; var result = getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host); - host.onConfigFileDiagnostic = undefined; host.onUnRecoverableConfigFileDiagnostic = undefined; return result; } @@ -79102,11 +79478,8 @@ var ts; return undefined; } var result = ts.parseJsonText(configFileName, configFileText); - result.parseDiagnostics.forEach(function (diagnostic) { return host.onConfigFileDiagnostic(diagnostic); }); var cwd = host.getCurrentDirectory(); - var configParseResult = ts.parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd)); - configParseResult.errors.forEach(function (diagnostic) { return host.onConfigFileDiagnostic(diagnostic); }); - return configParseResult; + return ts.parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd)); } ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile; /** @@ -79114,14 +79487,16 @@ var ts; */ function emitFilesAndReportErrors(program, reportDiagnostic, writeFileName) { // First get and report any syntactic errors. - var diagnostics = program.getSyntacticDiagnostics().slice(); + var diagnostics = program.getConfigFileParsingDiagnostics().slice(); + var configFileParsingDiagnosticsLength = diagnostics.length; + ts.addRange(diagnostics, program.getSyntacticDiagnostics()); var reportSemanticDiagnostics = false; // If we didn't have any syntactic errors, then also try getting the global and // semantic errors. - if (diagnostics.length === 0) { + if (diagnostics.length === configFileParsingDiagnosticsLength) { ts.addRange(diagnostics, program.getOptionsDiagnostics()); ts.addRange(diagnostics, program.getGlobalDiagnostics()); - if (diagnostics.length === 0) { + if (diagnostics.length === configFileParsingDiagnosticsLength) { reportSemanticDiagnostics = true; } } @@ -79221,7 +79596,6 @@ var ts; function createWatchCompilerHostOfConfigFile(configFileName, optionsToExtend, system, createProgram, reportDiagnostic, reportWatchStatus) { reportDiagnostic = reportDiagnostic || createDiagnosticReporter(system); var host = createWatchCompilerHost(system, createProgram, reportDiagnostic, reportWatchStatus); - host.onConfigFileDiagnostic = reportDiagnostic; host.onUnRecoverableConfigFileDiagnostic = function (diagnostic) { return reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic); }; host.configFileName = configFileName; host.optionsToExtend = optionsToExtend; @@ -79265,7 +79639,10 @@ var ts; var getCurrentDirectory = function () { return currentDirectory; }; var readFile = function (path, encoding) { return host.readFile(path, encoding); }; var configFileName = host.configFileName, _a = host.optionsToExtend, optionsToExtendForConfigFile = _a === void 0 ? {} : _a, createProgram = host.createProgram; - var rootFileNames = host.rootFiles, compilerOptions = host.options, configFileSpecs = host.configFileSpecs, configFileWildCardDirectories = host.configFileWildCardDirectories; + var rootFileNames = host.rootFiles, compilerOptions = host.options; + var configFileSpecs; + var configFileParsingDiagnostics; + var hasChangedConfigFileParsingErrors = false; var cachedDirectoryStructureHost = configFileName && ts.createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames); if (cachedDirectoryStructureHost && host.onCachedDirectoryStructureHostCreate) { host.onCachedDirectoryStructureHostCreate(cachedDirectoryStructureHost); @@ -79277,12 +79654,21 @@ var ts; fileExists: function (path) { return host.fileExists(path); }, readFile: readFile, getCurrentDirectory: getCurrentDirectory, - onConfigFileDiagnostic: host.onConfigFileDiagnostic, onUnRecoverableConfigFileDiagnostic: host.onUnRecoverableConfigFileDiagnostic }; // From tsc we want to get already parsed result and hence check for rootFileNames - if (configFileName && !rootFileNames) { - parseConfigFile(); + var newLine = updateNewLine(); + reportWatchDiagnostic(ts.Diagnostics.Starting_compilation_in_watch_mode); + if (configFileName) { + newLine = ts.getNewLineCharacter(optionsToExtendForConfigFile, function () { return host.getNewLine(); }); + if (host.configFileParsingResult) { + setConfigFileParsingResult(host.configFileParsingResult); + } + else { + ts.Debug.assert(!rootFileNames); + parseConfigFile(); + } + newLine = updateNewLine(); } var trace = host.trace && (function (s) { host.trace(s + newLine); }); var watchLogLevel = trace ? compilerOptions.extendedDiagnostics ? ts.WatchLogLevel.Verbose : @@ -79290,7 +79676,6 @@ var ts; var writeLog = watchLogLevel !== ts.WatchLogLevel.None ? trace : ts.noop; var _b = ts.getWatchFactory(watchLogLevel, writeLog), watchFile = _b.watchFile, watchFilePath = _b.watchFilePath, watchDirectoryWorker = _b.watchDirectory; var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - var newLine = updateNewLine(); writeLog("Current directory: " + currentDirectory + " CaseSensitiveFileNames: " + useCaseSensitiveFileNames); if (configFileName) { watchFile(host, configFileName, scheduleProgramReload, ts.PollingInterval.High); @@ -79343,7 +79728,6 @@ var ts; (function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }) : (function (typeDirectiveNames, containingFile) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; - reportWatchDiagnostic(ts.Diagnostics.Starting_compilation_in_watch_mode); synchronizeProgram(); // Update the wild card directory watch watchConfigFileWildCardDirectories(); @@ -79368,6 +79752,10 @@ 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)) { + if (hasChangedConfigFileParsingErrors) { + builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics); + hasChangedConfigFileParsingErrors = false; + } return builderProgram; } // Compile the program @@ -79378,10 +79766,11 @@ var ts; } var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !program; hasChangedCompilerOptions = false; + hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; - builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram); + builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics); resolutionCache.finishCachingPerDirectoryResolution(); // Update watches ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = ts.createMap()), watchMissingFilePath); @@ -79414,7 +79803,7 @@ var ts; scheduleProgramUpdate(); } function updateNewLine() { - return ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); }); + return ts.getNewLineCharacter(compilerOptions || optionsToExtendForConfigFile, function () { return host.getNewLine(); }); } function toPath(fileName) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); @@ -79530,7 +79919,7 @@ var ts; } function reportWatchDiagnostic(message) { if (host.onWatchStatusChange) { - host.onWatchStatusChange(ts.createCompilerDiagnostic(message), newLine, compilerOptions); + host.onWatchStatusChange(ts.createCompilerDiagnostic(message), newLine, compilerOptions || optionsToExtendForConfigFile); } } // Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch @@ -79565,8 +79954,13 @@ var ts; } function reloadFileNamesFromConfigFile() { var result = ts.getFileNamesFromConfigSpecs(configFileSpecs, ts.getDirectoryPath(configFileName), compilerOptions, parseConfigFileHost); - if (!configFileSpecs.filesSpecs && result.fileNames.length === 0) { - host.onConfigFileDiagnostic(ts.getErrorForNoInputFiles(configFileSpecs, configFileName)); + if (result.fileNames.length) { + configFileParsingDiagnostics = ts.filter(configFileParsingDiagnostics, function (error) { return !ts.isErrorNoInputFiles(error); }); + hasChangedConfigFileParsingErrors = true; + } + else if (!configFileSpecs.filesSpecs && !ts.some(configFileParsingDiagnostics, ts.isErrorNoInputFiles)) { + configFileParsingDiagnostics = configFileParsingDiagnostics.concat(ts.getErrorForNoInputFiles(configFileSpecs, configFileName)); + hasChangedConfigFileParsingErrors = true; } rootFileNames = result.fileNames; // Update the program @@ -79585,11 +79979,14 @@ var ts; watchConfigFileWildCardDirectories(); } function parseConfigFile() { - var configParseResult = ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost); - rootFileNames = configParseResult.fileNames; - compilerOptions = configParseResult.options; - configFileSpecs = configParseResult.configFileSpecs; - configFileWildCardDirectories = configParseResult.wildcardDirectories; + setConfigFileParsingResult(ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost)); + } + function setConfigFileParsingResult(configFileParseResult) { + rootFileNames = configFileParseResult.fileNames; + compilerOptions = configFileParseResult.options; + configFileSpecs = configFileParseResult.configFileSpecs; + configFileParsingDiagnostics = ts.getConfigFileParsingDiagnostics(configFileParseResult); + hasChangedConfigFileParsingErrors = true; } function onSourceFileChange(fileName, eventKind, path) { updateCachedSystemWithFile(fileName, path, eventKind); @@ -79624,8 +80021,8 @@ var ts; } } function watchConfigFileWildCardDirectories() { - if (configFileWildCardDirectories) { - ts.updateWatchingWildcardDirectories(watchedWildcardDirectories || (watchedWildcardDirectories = ts.createMap()), ts.createMapFromTemplate(configFileWildCardDirectories), watchWildcardDirectory); + if (configFileSpecs) { + ts.updateWatchingWildcardDirectories(watchedWildcardDirectories || (watchedWildcardDirectories = ts.createMap()), ts.createMapFromTemplate(configFileSpecs.wildcardDirectories), watchWildcardDirectory); } else if (watchedWildcardDirectories) { ts.clearMap(watchedWildcardDirectories, ts.closeFileWatcherOf); @@ -80702,7 +81099,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 268 /* PropertyAssignment */) { + if (element.kind !== 269 /* PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -80777,13 +81174,13 @@ var ts; case 8 /* NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return Number(valueExpression.text); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: if (valueExpression.operator !== 38 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return -Number(valueExpression.operand.text); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -80800,7 +81197,7 @@ var ts; return convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined); } - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element); } @@ -80923,13 +81320,21 @@ var ts; function makePadding(paddingLength) { return Array(paddingLength + 1).join(" "); } + function isAllowedOption(_a) { + var category = _a.category, name = _a.name; + // Skip options which do not have a category or have category `Command_line_Options` + // Exclude all possible `Advanced_Options` in tsconfig.json which were NOT defined in command line + return category !== undefined + && category !== ts.Diagnostics.Command_line_Options + && (category !== ts.Diagnostics.Advanced_Options || compilerOptionsMap.has(name)); + } function writeConfigurations() { // Filter applicable options to place in the file var categorizedOptions = ts.createMultiMap(); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; var category = option.category; - if (category !== undefined && category !== ts.Diagnostics.Command_line_Options && category !== ts.Diagnostics.Advanced_Options) { + if (isAllowedOption(option)) { categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); } } @@ -81974,35 +82379,35 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 148 /* Parameter */: - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 268 /* PropertyAssignment */: - case 269 /* ShorthandPropertyAssignment */: + case 269 /* PropertyAssignment */: + case 270 /* ShorthandPropertyAssignment */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 267 /* CatchClause */: - case 260 /* JsxAttribute */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 268 /* CatchClause */: + case 261 /* JsxAttribute */: return 1 /* Value */; case 147 /* TypeParameter */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: case 165 /* TypeLiteral */: return 2 /* Type */; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */; - case 271 /* EnumMember */: - case 233 /* ClassDeclaration */: + case 272 /* EnumMember */: + case 234 /* ClassDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -82012,26 +82417,26 @@ var ts; else { return 4 /* Namespace */; } - case 236 /* EnumDeclaration */: - case 245 /* NamedImports */: - case 246 /* ImportSpecifier */: - case 241 /* ImportEqualsDeclaration */: - case 242 /* ImportDeclaration */: - case 247 /* ExportAssignment */: - case 248 /* ExportDeclaration */: + case 237 /* EnumDeclaration */: + case 246 /* NamedImports */: + case 247 /* ImportSpecifier */: + case 242 /* ImportEqualsDeclaration */: + case 243 /* ImportDeclaration */: + case 248 /* ExportAssignment */: + case 249 /* ExportDeclaration */: return 7 /* All */; // An external module can be a Value - case 272 /* SourceFile */: + case 273 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 7 /* All */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* SourceFile */) { return 1 /* Value */; } - else if (node.parent.kind === 247 /* ExportAssignment */) { + else if (node.parent.kind === 248 /* ExportAssignment */) { return 7 /* All */; } else if (isInRightSideOfInternalImportEqualsDeclaration(node)) { @@ -82060,7 +82465,7 @@ var ts; // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace var name = node.kind === 145 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 241 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; + return name && name.parent.kind === 242 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { while (node.parent.kind === 145 /* QualifiedName */) { @@ -82086,16 +82491,16 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 183 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 183 /* PropertyAccessExpression */) { + if (root.parent.kind === 184 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 184 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 205 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 266 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 206 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 267 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 233 /* ClassDeclaration */ && root.parent.parent.token === 108 /* ImplementsKeyword */) || - (decl.kind === 234 /* InterfaceDeclaration */ && root.parent.parent.token === 85 /* ExtendsKeyword */); + return (decl.kind === 234 /* ClassDeclaration */ && root.parent.parent.token === 108 /* ImplementsKeyword */) || + (decl.kind === 235 /* InterfaceDeclaration */ && root.parent.parent.token === 85 /* ExtendsKeyword */); } return false; } @@ -82112,17 +82517,17 @@ var ts; switch (node.parent.kind) { case 161 /* TypeReference */: return true; - case 205 /* ExpressionWithTypeArguments */: + case 206 /* ExpressionWithTypeArguments */: return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent); } return false; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 185 /* CallExpression */); + return isCallOrNewExpressionTarget(node, 186 /* CallExpression */); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 186 /* NewExpression */); + return isCallOrNewExpressionTarget(node, 187 /* NewExpression */); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -82135,7 +82540,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 226 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 227 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -82160,11 +82565,11 @@ var ts; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 183 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 184 /* PropertyAccessExpression */ && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 237 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 238 /* ModuleDeclaration */ && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -82176,15 +82581,15 @@ var ts; switch (node.parent.kind) { case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: - case 268 /* PropertyAssignment */: - case 271 /* EnumMember */: + case 269 /* PropertyAssignment */: + case 272 /* EnumMember */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: return node.parent.argumentExpression === node; case 146 /* ComputedPropertyName */: return true; @@ -82199,7 +82604,7 @@ var ts; } ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; function getContainerNode(node) { - if (node.kind === 291 /* JSDocTypedefTag */) { + if (node.kind === 292 /* JSDocTypedefTag */) { // This doesn't just apply to the node immediately under the comment, but to everything in its parent's scope. // node.parent = the JSDoc comment, node.parent.parent = the node having the comment. // Then we get parent again in the loop. @@ -82211,17 +82616,17 @@ var ts; return undefined; } switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 237 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: return node; } } @@ -82229,23 +82634,23 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return "module" /* moduleElement */; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: return "class" /* classElement */; - case 234 /* InterfaceDeclaration */: return "interface" /* interfaceElement */; - case 235 /* TypeAliasDeclaration */: return "type" /* typeElement */; - case 236 /* EnumDeclaration */: return "enum" /* enumElement */; - case 230 /* VariableDeclaration */: + case 235 /* InterfaceDeclaration */: return "interface" /* interfaceElement */; + case 236 /* TypeAliasDeclaration */: return "type" /* typeElement */; + case 237 /* EnumDeclaration */: return "enum" /* enumElement */; + case 231 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 180 /* BindingElement */: + case 181 /* BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return "function" /* functionElement */; case 155 /* GetAccessor */: return "getter" /* memberGetAccessorElement */; case 156 /* SetAccessor */: return "setter" /* memberSetAccessorElement */; @@ -82260,17 +82665,17 @@ var ts; case 157 /* CallSignature */: return "call" /* callSignatureElement */; case 154 /* Constructor */: return "constructor" /* constructorImplementationElement */; case 147 /* TypeParameter */: return "type parameter" /* typeParameterElement */; - case 271 /* EnumMember */: return "enum member" /* enumMemberElement */; + case 272 /* EnumMember */: return "enum member" /* enumMemberElement */; case 148 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */; - case 241 /* ImportEqualsDeclaration */: - case 246 /* ImportSpecifier */: - case 243 /* ImportClause */: - case 250 /* ExportSpecifier */: - case 244 /* NamespaceImport */: + case 242 /* ImportEqualsDeclaration */: + case 247 /* ImportSpecifier */: + case 244 /* ImportClause */: + case 251 /* ExportSpecifier */: + case 245 /* NamespaceImport */: return "alias" /* alias */; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return "type" /* typeElement */; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: var kind = ts.getSpecialPropertyAssignmentKind(node); var right = node.right; switch (kind) { @@ -82362,27 +82767,27 @@ var ts; return false; } switch (n.kind) { - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 182 /* ObjectLiteralExpression */: - case 178 /* ObjectBindingPattern */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 183 /* ObjectLiteralExpression */: + case 179 /* ObjectBindingPattern */: case 165 /* TypeLiteral */: - case 211 /* Block */: - case 238 /* ModuleBlock */: - case 239 /* CaseBlock */: - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 212 /* Block */: + case 239 /* ModuleBlock */: + case 240 /* CaseBlock */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return nodeEndsWith(n, 18 /* CloseBraceToken */, sourceFile); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 186 /* NewExpression */: + case 187 /* NewExpression */: if (!n.arguments) { return true; } // falls through - case 185 /* CallExpression */: - case 189 /* ParenthesizedExpression */: + case 186 /* CallExpression */: + case 190 /* ParenthesizedExpression */: case 172 /* ParenthesizedType */: return nodeEndsWith(n, 20 /* CloseParenToken */, sourceFile); case 162 /* FunctionType */: @@ -82391,13 +82796,13 @@ var ts; case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 158 /* ConstructSignature */: case 157 /* CallSignature */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -82407,19 +82812,19 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 20 /* CloseParenToken */, sourceFile); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 215 /* IfStatement */: + case 216 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 25 /* SemicolonToken */, sourceFile); - case 181 /* ArrayLiteralExpression */: - case 179 /* ArrayBindingPattern */: - case 184 /* ElementAccessExpression */: + case 182 /* ArrayLiteralExpression */: + case 180 /* ArrayBindingPattern */: + case 185 /* ElementAccessExpression */: case 146 /* ComputedPropertyName */: case 167 /* TupleType */: return nodeEndsWith(n, 22 /* CloseBracketToken */, sourceFile); @@ -82428,44 +82833,44 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 22 /* CloseBracketToken */, sourceFile); - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 217 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 218 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 216 /* DoStatement */: + case 217 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 106 /* WhileKeyword */, sourceFile) ? nodeEndsWith(n, 20 /* CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); case 164 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 193 /* TypeOfExpression */: - case 192 /* DeleteExpression */: - case 194 /* VoidExpression */: - case 201 /* YieldExpression */: - case 202 /* SpreadElement */: + case 194 /* TypeOfExpression */: + case 193 /* DeleteExpression */: + case 195 /* VoidExpression */: + case 202 /* YieldExpression */: + case 203 /* SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 187 /* TaggedTemplateExpression */: + case 188 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 200 /* TemplateExpression */: + case 201 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 209 /* TemplateSpan */: + case 210 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 248 /* ExportDeclaration */: - case 242 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 199 /* ConditionalExpression */: + case 200 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -82662,7 +83067,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 272 /* SourceFile */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 273 /* SourceFile */ || 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. @@ -82734,17 +83139,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 263 /* JsxExpression */) { + if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 264 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 263 /* JsxExpression */) { + if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 264 /* JsxExpression */) { return true; } //
|
- if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 256 /* JsxClosingElement */) { + if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 257 /* JsxClosingElement */) { return true; } return false; @@ -82901,10 +83306,10 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 161 /* TypeReference */ || node.kind === 185 /* CallExpression */) { + if (node.kind === 161 /* TypeReference */ || node.kind === 186 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 233 /* ClassDeclaration */ || node.kind === 234 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 234 /* ClassDeclaration */ || node.kind === 235 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -82956,18 +83361,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 181 /* ArrayLiteralExpression */ || - node.kind === 182 /* ObjectLiteralExpression */) { + if (node.kind === 182 /* ArrayLiteralExpression */ || + node.kind === 183 /* ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 198 /* BinaryExpression */ && + if (node.parent.kind === 199 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 58 /* EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 220 /* ForOfStatement */ && + if (node.parent.kind === 221 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -82975,7 +83380,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 268 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 269 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -83062,6 +83467,17 @@ var ts; return result; } ts.repeatString = repeatString; + function skipConstraint(type) { + return type.isTypeParameter() ? type.getConstraint() : type; + } + ts.skipConstraint = skipConstraint; + function getNameFromPropertyName(name) { + return name.kind === 146 /* ComputedPropertyName */ + // treat computed property names where expression is string/numeric literal as just string/numeric literal + ? ts.isStringOrNumericLiteral(name.expression) ? name.expression.text : undefined + : ts.getTextOfIdentifierOrLiteral(name); + } + ts.getNameFromPropertyName = getNameFromPropertyName; })(ts || (ts = {})); // Display-part writer helpers /* @internal */ @@ -83260,7 +83676,7 @@ var ts; ts.signatureToDisplayParts = signatureToDisplayParts; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 246 /* ImportSpecifier */ || location.parent.kind === 250 /* ExportSpecifier */) && + (location.parent.kind === 247 /* ImportSpecifier */ || location.parent.kind === 251 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -83805,10 +84221,10 @@ 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 237 /* ModuleDeclaration */: - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 232 /* FunctionDeclaration */: + case 238 /* ModuleDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 233 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -84019,16 +84435,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param" pos = tag.tagName.end; switch (tag.kind) { - case 287 /* JSDocParameterTag */: + case 288 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 290 /* JSDocTemplateTag */: + case 291 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 289 /* JSDocTypeTag */: + case 290 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 288 /* JSDocReturnTag */: + case 289 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -84115,22 +84531,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 255 /* JsxOpeningElement */: + case 256 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 254 /* JsxSelfClosingElement */: + case 255 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -84158,17 +84574,17 @@ var ts; if (token) { if (tokenKind === 58 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 230 /* VariableDeclaration */ || + if (token.parent.kind === 231 /* VariableDeclaration */ || token.parent.kind === 151 /* PropertyDeclaration */ || token.parent.kind === 148 /* Parameter */ || - token.parent.kind === 260 /* JsxAttribute */) { + token.parent.kind === 261 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 198 /* BinaryExpression */ || - token.parent.kind === 196 /* PrefixUnaryExpression */ || - token.parent.kind === 197 /* PostfixUnaryExpression */ || - token.parent.kind === 199 /* ConditionalExpression */) { + if (token.parent.kind === 199 /* BinaryExpression */ || + token.parent.kind === 197 /* PrefixUnaryExpression */ || + token.parent.kind === 198 /* PostfixUnaryExpression */ || + token.parent.kind === 200 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -84178,7 +84594,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 260 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 261 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 12 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -84194,7 +84610,7 @@ var ts; else if (tokenKind === 71 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } @@ -84204,17 +84620,17 @@ var ts; return 15 /* typeParameterName */; } return; - case 234 /* InterfaceDeclaration */: + case 235 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } @@ -84730,7 +85146,9 @@ var ts; GlobalsSearch[GlobalsSearch["Success"] = 1] = "Success"; GlobalsSearch[GlobalsSearch["Fail"] = 2] = "Fail"; })(GlobalsSearch || (GlobalsSearch = {})); - function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position, allSourceFiles, preferences) { + function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences) { + var typeChecker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); if (ts.isInReferenceComment(sourceFile, position)) { var entries = Completions.PathCompletions.getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); return entries && convertPathCompletions(entries); @@ -84745,7 +85163,7 @@ var ts; && (contextToken.kind === 72 /* BreakKeyword */ || contextToken.kind === 77 /* ContinueKeyword */ || contextToken.kind === 71 /* Identifier */)) { return getLabelCompletionAtPosition(contextToken.parent); } - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, preferences, compilerOptions.target); + var completionData = getCompletionData(program, log, sourceFile, position, preferences); if (!completionData) { return undefined; } @@ -84779,7 +85197,7 @@ var ts; } case 2 /* Types */: { var entries = completion.types.map(function (type) { return ({ name: type.value, kindModifiers: "" /* none */, kind: "type" /* typeElement */, sortText: "0" }); }); - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, entries: entries }; } default: return ts.Debug.assertNever(completion); @@ -84870,24 +85288,24 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var insertText; var replacementSpan; - if (preferences.includeCompletionsWithInsertText) { - if (origin && origin.type === "this-type") { - insertText = needsConvertPropertyAccess ? "this[" + quote(name, preferences) + "]" : "this." + name; - } - else if (needsConvertPropertyAccess) { - insertText = "[" + quote(name, preferences) + "]"; - var dot = ts.findChildOfKind(propertyAccessToConvert, 23 /* DotToken */, sourceFile); - // If the text after the '.' starts with this name, write over it. Else, add new text. - var end = ts.startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; - replacementSpan = ts.createTextSpanFromBounds(dot.getStart(sourceFile), end); - } - if (isJsxInitializer) { - if (insertText === undefined) - insertText = name; - insertText = "{" + insertText + "}"; - if (typeof isJsxInitializer !== "boolean") { - replacementSpan = ts.createTextSpanFromNode(isJsxInitializer, sourceFile); - } + if (origin && origin.type === "this-type") { + insertText = needsConvertPropertyAccess ? "this[" + quote(name, preferences) + "]" : "this." + name; + } + // We should only have needsConvertPropertyAccess if there's a property access to convert. But see #21790. + // Somehow there was a global with a non-identifier name. Hopefully someone will complain about getting a "foo bar" global completion and provide a repro. + else if ((origin && origin.type === "symbol-member" || needsConvertPropertyAccess) && propertyAccessToConvert) { + insertText = needsConvertPropertyAccess ? "[" + quote(name, preferences) + "]" : "[" + name + "]"; + var dot = ts.findChildOfKind(propertyAccessToConvert, 23 /* DotToken */, sourceFile); + // If the text after the '.' starts with this name, write over it. Else, add new text. + var end = ts.startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; + replacementSpan = ts.createTextSpanFromBounds(dot.getStart(sourceFile), end); + } + if (isJsxInitializer) { + if (insertText === undefined) + insertText = name; + insertText = "{" + insertText + "}"; + if (typeof isJsxInitializer !== "boolean") { + replacementSpan = ts.createTextSpanFromNode(isJsxInitializer, sourceFile); } } if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) { @@ -85002,7 +85420,7 @@ var ts; case 177 /* LiteralType */: switch (node.parent.parent.kind) { case 161 /* TypeReference */: - return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(node.parent), typeChecker) }; + return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(node.parent), typeChecker), isNewIdentifier: false }; case 175 /* IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { @@ -85011,10 +85429,12 @@ var ts; // } // let x: Foo["/*completion position*/"] return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(node.parent.parent.objectType)); + case 178 /* ImportType */: + return { kind: 0 /* Paths */, paths: Completions.PathCompletions.getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) }; default: return undefined; } - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: if (ts.isObjectLiteralExpression(node.parent.parent) && node.parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -85031,7 +85451,7 @@ var ts; return stringLiteralCompletionsFromProperties(typeChecker.getContextualType(node.parent.parent)); } return fromContextualType(); - case 184 /* ElementAccessExpression */: { + case 185 /* ElementAccessExpression */: { var _a = node.parent, expression = _a.expression, argumentExpression = _a.argumentExpression; if (node === argumentExpression) { // Get all names of properties on the expression @@ -85044,25 +85464,19 @@ var ts; } return undefined; } - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: if (!ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false) && !ts.isImportCall(node.parent)) { - var argumentInfo_1 = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - if (argumentInfo_1) { - var candidates = []; - typeChecker.getResolvedSignature(argumentInfo_1.invocation, candidates, argumentInfo_1.argumentCount); - var uniques_1 = ts.createMap(); - return { kind: 2 /* Types */, types: ts.flatMap(candidates, function (candidate) { return getStringLiteralTypes(typeChecker.getParameterType(candidate, argumentInfo_1.argumentIndex), typeChecker, uniques_1); }) }; - } - return fromContextualType(); + return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo, typeChecker) : fromContextualType(); } // falls through (is `require("")` or `import("")`) - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: - case 252 /* ExternalModuleReference */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: + case 253 /* 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*/"); @@ -85076,26 +85490,40 @@ var ts; function fromContextualType() { // Get completion for string literal from string literal type // i.e. var x: "hi" | "hello" = "/*completion position*/" - return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker), typeChecker) }; + return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker), typeChecker), isNewIdentifier: false }; } } + function getStringLiteralCompletionsFromSignature(argumentInfo, checker) { + var isNewIdentifier = false; + var uniques = ts.createMap(); + var candidates = []; + checker.getResolvedSignature(argumentInfo.invocation, candidates, argumentInfo.argumentCount); + var types = ts.flatMap(candidates, function (candidate) { + if (!candidate.hasRestParameter && argumentInfo.argumentCount > candidate.parameters.length) + return; + var type = checker.getParameterType(candidate, argumentInfo.argumentIndex); + isNewIdentifier = isNewIdentifier || !!(type.flags & 2 /* String */); + return getStringLiteralTypes(type, checker, uniques); + }); + return { kind: 2 /* Types */, types: types, isNewIdentifier: isNewIdentifier }; + } function stringLiteralCompletionsFromProperties(type) { return type && { kind: 1 /* Properties */, symbols: type.getApparentProperties(), hasIndexSignature: hasIndexSignature(type) }; } function getStringLiteralTypes(type, typeChecker, uniques) { if (uniques === void 0) { uniques = ts.createMap(); } - if (type && type.flags & 32768 /* TypeParameter */) { - type = type.getConstraint(); - } - return type && type.flags & 131072 /* Union */ + if (!type) + return ts.emptyArray; + type = ts.skipConstraint(type); + return type.isUnion() ? ts.flatMap(type.types, function (t) { return getStringLiteralTypes(t, typeChecker, uniques); }) - : type && type.flags & 32 /* StringLiteral */ && !(type.flags & 256 /* EnumLiteral */) && ts.addToSeen(uniques, type.value) + : type.isStringLiteral() && !(type.flags & 256 /* EnumLiteral */) && ts.addToSeen(uniques, type.value) ? [type] : ts.emptyArray; } - function getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, _a, allSourceFiles) { + function getSymbolCompletionFromEntryId(program, log, sourceFile, position, _a) { var name = _a.name, source = _a.source; - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }, compilerOptions.target); + var completionData = getCompletionData(program, log, sourceFile, position, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }); if (!completionData) { return { type: "none" }; } @@ -85109,7 +85537,7 @@ var ts; // completion entry. return ts.firstDefined(symbols, function (symbol) { var origin = symbolToOriginInfoMap[ts.getSymbolId(symbol)]; - var info = getCompletionEntryDisplayNameForSymbol(symbol, compilerOptions.target, origin, completionKind); + var info = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, origin, completionKind); return info && info.name === name && getSourceFromOrigin(origin) === source ? { type: "symbol", symbol: symbol, location: location, symbolToOriginInfoMap: symbolToOriginInfoMap, previousToken: previousToken, isJsxInitializer: isJsxInitializer } : undefined; }) || { type: "none" }; } @@ -85120,8 +85548,9 @@ var ts; || ts.codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) : symbol.name; } - function getCompletionEntryDetails(program, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, formatContext, getCanonicalFileName, preferences) { + function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, getCanonicalFileName, preferences) { var typeChecker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); var name = entryId.name; var contextToken = ts.findPrecedingToken(position, sourceFile); if (ts.isInString(sourceFile, position, contextToken)) { @@ -85131,7 +85560,7 @@ var ts; return stringLiteralCompletions && stringLiteralCompletionDetails(name, contextToken, stringLiteralCompletions, sourceFile, typeChecker); } // Compute all the completion symbols again. - var symbolCompletion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); + var symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); switch (symbolCompletion.type) { case "request": { var request = symbolCompletion.request; @@ -85148,7 +85577,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, symbolToOriginInfoMap = symbolCompletion.symbolToOriginInfoMap, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, program, typeChecker, host, compilerOptions, sourceFile, previousToken, formatContext, getCanonicalFileName, allSourceFiles, preferences), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, program, typeChecker, host, compilerOptions, sourceFile, previousToken, formatContext, getCanonicalFileName, program.getSourceFiles(), preferences), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, codeActions, sourceDisplay); } case "none": @@ -85190,8 +85619,8 @@ var ts; var _a = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, getSymbolName(symbol, symbolOriginInfo, compilerOptions.target), host, program, checker, compilerOptions, allSourceFiles, formatContext, getCanonicalFileName, previousToken, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } - function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles) { - var completion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); + function getCompletionEntrySymbol(program, log, sourceFile, position, entryId) { + var completion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); return completion.type === "symbol" ? completion.symbol : undefined; } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; @@ -85226,11 +85655,11 @@ var ts; return getContextualTypeFromParent(currentToken, checker); case 58 /* EqualsToken */: switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return checker.getContextualType(parent.initializer); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -85240,7 +85669,7 @@ var ts; case 73 /* CaseKeyword */: return getSwitchedType(ts.cast(parent, ts.isCaseClause), checker); case 17 /* OpenBraceToken */: - return ts.isJsxExpression(parent) && parent.parent.kind !== 253 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined; + return ts.isJsxExpression(parent) && parent.parent.kind !== 254 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined; default: var argInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(currentToken, position, sourceFile); return argInfo @@ -85255,15 +85684,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 186 /* NewExpression */: + case 187 /* NewExpression */: return checker.getContextualType(parent); - case 198 /* BinaryExpression */: { + case 199 /* 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 264 /* CaseClause */: + case 265 /* CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -85279,9 +85708,10 @@ var ts; return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); } function isModuleSymbol(symbol) { - return symbol.declarations.some(function (d) { return d.kind === 272 /* SourceFile */; }); + return symbol.declarations.some(function (d) { return d.kind === 273 /* SourceFile */; }); } - function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, preferences, target) { + function getCompletionData(program, log, sourceFile, position, preferences) { + var typeChecker = program.getTypeChecker(); var start = ts.timestamp(); var currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false); // TODO: GH#15853 // We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.) @@ -85330,11 +85760,11 @@ var ts; if (tag.tagName.pos <= position && position <= tag.tagName.end) { return { kind: 1 /* JsDocTagName */ }; } - if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 274 /* JSDocTypeExpression */) { + if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 275 /* JSDocTypeExpression */) { currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ true); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 292 /* JSDocPropertyTag */ || + (currentToken.parent.kind !== 293 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression); @@ -85384,13 +85814,16 @@ var ts; if (contextToken.kind === 23 /* DotToken */) { isRightOfDot = true; switch (parent.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; break; case 145 /* QualifiedName */: node = parent.left; break; + case 178 /* ImportType */: + node = parent; + break; default: // There is nothing that precedes the dot, so this likely just a stray character // or leading into a '...' token. Just bail out instead. @@ -85401,7 +85834,7 @@ var ts; // // 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 === 183 /* PropertyAccessExpression */) { + if (parent && parent.kind === 184 /* PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -85409,39 +85842,39 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 29 /* GreaterThanToken */: - if (currentToken.parent.kind === 253 /* JsxElement */ || currentToken.parent.kind === 255 /* JsxOpeningElement */) { + if (currentToken.parent.kind === 254 /* JsxElement */ || currentToken.parent.kind === 256 /* JsxOpeningElement */) { location = currentToken; } break; case 41 /* SlashToken */: - if (currentToken.parent.kind === 254 /* JsxSelfClosingElement */) { + if (currentToken.parent.kind === 255 /* JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 256 /* JsxClosingElement */: + case 257 /* JsxClosingElement */: if (contextToken.kind === 41 /* SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (!(parent.left.flags & 32768 /* ThisNodeHasError */)) { // It has a left-hand side, so we're not in an opening JSX tag. break; } // falls through - case 254 /* JsxSelfClosingElement */: - case 253 /* JsxElement */: - case 255 /* JsxOpeningElement */: + case 255 /* JsxSelfClosingElement */: + case 254 /* JsxElement */: + case 256 /* JsxOpeningElement */: if (contextToken.kind === 27 /* LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: switch (previousToken.kind) { case 58 /* EqualsToken */: isJsxInitializer = true; @@ -85495,11 +85928,11 @@ var ts; return { kind: 0 /* Data */, symbols: symbols, completionKind: completionKind, isInSnippetScope: isInSnippetScope, propertyAccessToConvert: propertyAccessToConvert, isNewIdentifierLocation: isNewIdentifierLocation, location: location, keywordFilters: keywordFilters, symbolToOriginInfoMap: symbolToOriginInfoMap, recommendedCompletion: recommendedCompletion, previousToken: previousToken, isJsxInitializer: isJsxInitializer }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 287 /* JSDocParameterTag */: - case 292 /* JSDocPropertyTag */: - case 288 /* JSDocReturnTag */: - case 289 /* JSDocTypeTag */: - case 291 /* JSDocTypedefTag */: + case 288 /* JSDocParameterTag */: + case 293 /* JSDocPropertyTag */: + case 289 /* JSDocReturnTag */: + case 290 /* JSDocTypeTag */: + case 292 /* JSDocTypedefTag */: return true; } } @@ -85507,17 +85940,18 @@ var ts; // Right of dot member completion list completionKind = 2 /* PropertyAccess */; // Since this is qualified name check its a type node location - var isTypeLocation = insideJsDocTagTypeExpression || ts.isPartOfTypeNode(node.parent); + var isImportType = ts.isLiteralImportTypeNode(node); + var isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !node.isTypeOf) || ts.isPartOfTypeNode(node.parent); var isRhsOfImportDeclaration = ts.isInRightSideOfInternalImportEqualsDeclaration(node); var allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile)); - if (ts.isEntityName(node)) { + if (ts.isEntityName(node) || isImportType) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { symbol = ts.skipAlias(symbol, typeChecker); if (symbol.flags & (1536 /* Module */ | 384 /* Enum */)) { // Extract module or enum members var exportedSymbols = ts.Debug.assertEachDefined(typeChecker.getExportsOfModule(symbol), "getExportsOfModule() should all be defined"); - var isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess((node.parent), symbol.name); }; + var isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess(isImportType ? node : (node.parent), symbol.name); }; var isValidTypeAccess_1 = function (symbol) { return symbolCanBeReferencedAtTypeLocation(symbol); }; var isValidAccess = allowTypeOrValue ? // Any kind is allowed when dotting off namespace in internal import equals declaration @@ -85530,7 +85964,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.some(function (d) { return d.kind !== 272 /* SourceFile */ && d.kind !== 237 /* ModuleDeclaration */ && d.kind !== 236 /* EnumDeclaration */; })) { + if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 273 /* SourceFile */ && d.kind !== 238 /* ModuleDeclaration */ && d.kind !== 237 /* EnumDeclaration */; })) { addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node)); } return; @@ -85554,12 +85988,31 @@ var ts; else { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; - if (typeChecker.isValidPropertyAccessForCompletions((node.parent), type, symbol)) { - symbols.push(symbol); + if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 178 /* ImportType */ ? node : node.parent, type, symbol)) { + addPropertySymbol(symbol); } } } } + function addPropertySymbol(symbol) { + // If this is e.g. [Symbol.iterator], add a completion for `Symbol`. + var symbolSymbol = ts.firstDefined(symbol.declarations, function (decl) { + var name = ts.getNameOfDeclaration(decl); + var leftName = name.kind === 146 /* ComputedPropertyName */ ? getLeftMostName(name.expression) : undefined; + return leftName && typeChecker.getSymbolAtLocation(leftName); + }); + if (symbolSymbol) { + symbols.push(symbolSymbol); + symbolToOriginInfoMap[ts.getSymbolId(symbolSymbol)] = { type: "symbol-member" }; + } + else { + symbols.push(symbol); + } + } + /** Given 'a.b.c', returns 'a'. */ + function getLeftMostName(e) { + return ts.isIdentifier(e) ? e : ts.isPropertyAccessExpression(e) ? getLeftMostName(e.expression) : undefined; + } function tryGetGlobalSymbols() { var result = tryGetObjectLikeCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() @@ -85634,7 +86087,7 @@ var ts; var symbolMeanings = 67901928 /* Type */ | 67216319 /* Value */ | 1920 /* Namespace */ | 2097152 /* Alias */; symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined"); // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 272 /* SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 273 /* SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode); if (thisType) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker, /*isForAccess*/ true); _i < _a.length; _i++) { @@ -85644,18 +86097,38 @@ var ts; } } } - // Don't suggest import completions for a commonjs-only module - if (preferences.includeCompletionsForModuleExports && !(sourceFile.commonJsModuleIndicator && !sourceFile.externalModuleIndicator)) { - getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", target); + if (shouldOfferImportCompletions()) { + getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", program.getCompilerOptions().target); } filterGlobalCompletion(symbols); } + function shouldOfferImportCompletions() { + // If not already a module, must have modules enabled and not currently be in a commonjs module. (TODO: import completions for commonjs) + if (!preferences.includeCompletionsForModuleExports) + return false; + // If already using ES6 modules, OK to continue using them. + if (sourceFile.externalModuleIndicator) + return true; + // If already using commonjs, don't introduce ES6. + if (sourceFile.commonJsModuleIndicator) + return false; + // If some file is using ES6 modules, assume that it's OK to add more. + if (program.getSourceFiles().some(function (s) { return !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!s.externalModuleIndicator; })) { + return true; + } + // For JS, stay on the safe side. + if (ts.isSourceFileJavaScript(sourceFile)) + return false; + // If module transpilation is enabled or we're targeting es6 or above, or not emitting, OK. + var compilerOptions = program.getCompilerOptions(); + return !!compilerOptions.module || compilerOptions.target >= 2 /* ES2015 */ || !!compilerOptions.noEmit; + } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 272 /* SourceFile */: - case 200 /* TemplateExpression */: - case 263 /* JsxExpression */: - case 211 /* Block */: + case 273 /* SourceFile */: + case 201 /* TemplateExpression */: + case 264 /* JsxExpression */: + case 212 /* Block */: return true; default: return ts.isStatement(scopeNode); @@ -85702,12 +86175,12 @@ var ts; return parentKind === 151 /* PropertyDeclaration */ || parentKind === 150 /* PropertySignature */ || parentKind === 148 /* Parameter */ || - parentKind === 230 /* VariableDeclaration */ || + parentKind === 231 /* VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 58 /* EqualsToken */: - return parentKind === 235 /* TypeAliasDeclaration */; + return parentKind === 236 /* TypeAliasDeclaration */; case 118 /* AsKeyword */: - return parentKind === 206 /* AsExpression */; + return parentKind === 207 /* AsExpression */; } } return false; @@ -85728,7 +86201,7 @@ var ts; } function getSymbolsFromOtherSourceFileExports(symbols, tokenText, target) { var tokenTextLowerCase = tokenText.toLowerCase(); - ts.codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, allSourceFiles, function (moduleSymbol) { + ts.codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, program.getSourceFiles(), function (moduleSymbol) { for (var _i = 0, _a = typeChecker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) { var symbol = _a[_i]; // Don't add a completion for a re-export, only for the original. @@ -85799,11 +86272,11 @@ var ts; return true; } if (contextToken.kind === 29 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 255 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 256 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 256 /* JsxClosingElement */ || contextToken.parent.kind === 254 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 253 /* JsxElement */; + if (contextToken.parent.kind === 257 /* JsxClosingElement */ || contextToken.parent.kind === 255 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 254 /* JsxElement */; } } return false; @@ -85813,36 +86286,36 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 26 /* CommaToken */: - return containingNodeKind === 185 /* CallExpression */ // func( a, | + return containingNodeKind === 186 /* CallExpression */ // func( a, | || containingNodeKind === 154 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 186 /* NewExpression */ // new C(a, | - || containingNodeKind === 181 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 198 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 187 /* NewExpression */ // new C(a, | + || containingNodeKind === 182 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 199 /* BinaryExpression */ // const x = (a, | || containingNodeKind === 162 /* FunctionType */; // var x: (s: string, list| case 19 /* OpenParenToken */: - return containingNodeKind === 185 /* CallExpression */ // func( | + return containingNodeKind === 186 /* CallExpression */ // func( | || containingNodeKind === 154 /* Constructor */ // constructor( | - || containingNodeKind === 186 /* NewExpression */ // new C(a| - || containingNodeKind === 189 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 187 /* NewExpression */ // new C(a| + || containingNodeKind === 190 /* ParenthesizedExpression */ // const x = (a| || containingNodeKind === 172 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 21 /* OpenBracketToken */: - return containingNodeKind === 181 /* ArrayLiteralExpression */ // [ | + return containingNodeKind === 182 /* ArrayLiteralExpression */ // [ | || containingNodeKind === 159 /* IndexSignature */ // [ | : string ] || containingNodeKind === 146 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 129 /* ModuleKeyword */: // module | case 130 /* NamespaceKeyword */: // namespace | return true; case 23 /* DotToken */: - return containingNodeKind === 237 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 238 /* ModuleDeclaration */; // module A.| case 17 /* OpenBraceToken */: - return containingNodeKind === 233 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 234 /* ClassDeclaration */; // class A{ | case 58 /* EqualsToken */: - return containingNodeKind === 230 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 198 /* BinaryExpression */; // x = a| + return containingNodeKind === 231 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 199 /* BinaryExpression */; // x = a| case 14 /* TemplateHead */: - return containingNodeKind === 200 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 201 /* TemplateExpression */; // `aa ${| case 15 /* TemplateMiddle */: - return containingNodeKind === 209 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 210 /* TemplateSpan */; // `aa ${10} dd ${| case 114 /* PublicKeyword */: case 112 /* PrivateKeyword */: case 113 /* ProtectedKeyword */: @@ -85892,7 +86365,7 @@ var ts; completionKind = 0 /* ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 182 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 183 /* ObjectLiteralExpression */) { var typeForObject = typeChecker.getContextualType(objectLikeContainer); if (!typeForObject) return 2 /* Fail */; @@ -85901,7 +86374,7 @@ var ts; existingMembers = objectLikeContainer.properties; } else { - ts.Debug.assert(objectLikeContainer.kind === 178 /* ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 179 /* ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -85912,7 +86385,7 @@ 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.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 220 /* ForOfStatement */; + var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 221 /* ForOfStatement */; if (!canGetType && rootDeclaration.kind === 148 /* Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); @@ -85957,9 +86430,9 @@ var ts; return undefined; // cursor is in an import clause // try to show exported member for imported module - var declarationKind = namedImportsOrExports.kind === 245 /* NamedImports */ ? - 242 /* ImportDeclaration */ : - 248 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 246 /* NamedImports */ ? + 243 /* ImportDeclaration */ : + 249 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -86044,8 +86517,8 @@ var ts; case 17 /* OpenBraceToken */: // import { | case 26 /* CommaToken */: // import { a as 0, | switch (contextToken.parent.kind) { - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return contextToken.parent; } } @@ -86096,14 +86569,14 @@ var ts; case 28 /* LessThanSlashToken */: case 41 /* SlashToken */: case 71 /* Identifier */: - case 183 /* PropertyAccessExpression */: - case 261 /* JsxAttributes */: - case 260 /* JsxAttribute */: - case 262 /* JsxSpreadAttribute */: - if (parent && (parent.kind === 254 /* JsxSelfClosingElement */ || parent.kind === 255 /* JsxOpeningElement */)) { + case 184 /* PropertyAccessExpression */: + case 262 /* JsxAttributes */: + case 261 /* JsxAttribute */: + case 263 /* JsxSpreadAttribute */: + if (parent && (parent.kind === 255 /* JsxSelfClosingElement */ || parent.kind === 256 /* JsxOpeningElement */)) { return parent; } - else if (parent.kind === 260 /* JsxAttribute */) { + else if (parent.kind === 261 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -86115,7 +86588,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent && ((parent.kind === 260 /* JsxAttribute */) || (parent.kind === 262 /* JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 261 /* JsxAttribute */) || (parent.kind === 263 /* JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -86125,8 +86598,8 @@ var ts; break; case 18 /* CloseBraceToken */: if (parent && - parent.kind === 263 /* JsxExpression */ && - parent.parent && parent.parent.kind === 260 /* JsxAttribute */) { + parent.kind === 264 /* JsxExpression */ && + parent.parent && parent.parent.kind === 261 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -86134,7 +86607,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 262 /* JsxSpreadAttribute */) { + if (parent && parent.kind === 263 /* JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -86153,50 +86626,50 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 26 /* CommaToken */: - return containingNodeKind === 230 /* VariableDeclaration */ || - containingNodeKind === 231 /* VariableDeclarationList */ || - containingNodeKind === 212 /* VariableStatement */ || - containingNodeKind === 236 /* EnumDeclaration */ || // enum a { foo, | + return containingNodeKind === 231 /* VariableDeclaration */ || + containingNodeKind === 232 /* VariableDeclarationList */ || + containingNodeKind === 213 /* VariableStatement */ || + containingNodeKind === 237 /* EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 234 /* InterfaceDeclaration */ || // interface A= contextToken.pos); case 23 /* DotToken */: - return containingNodeKind === 179 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 180 /* ArrayBindingPattern */; // var [.| case 56 /* ColonToken */: - return containingNodeKind === 180 /* BindingElement */; // var {x :html| + return containingNodeKind === 181 /* BindingElement */; // var {x :html| case 21 /* OpenBracketToken */: - return containingNodeKind === 179 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 180 /* ArrayBindingPattern */; // var [x| case 19 /* OpenParenToken */: - return containingNodeKind === 267 /* CatchClause */ || + return containingNodeKind === 268 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 17 /* OpenBraceToken */: - return containingNodeKind === 236 /* EnumDeclaration */; // enum a { | + return containingNodeKind === 237 /* EnumDeclaration */; // enum a { | case 27 /* LessThanToken */: - return containingNodeKind === 233 /* ClassDeclaration */ || // class A< | - containingNodeKind === 203 /* ClassExpression */ || // var C = class D< | - containingNodeKind === 234 /* InterfaceDeclaration */ || // interface A< | - containingNodeKind === 235 /* TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 234 /* ClassDeclaration */ || // class A< | + containingNodeKind === 204 /* ClassExpression */ || // var C = class D< | + containingNodeKind === 235 /* InterfaceDeclaration */ || // interface A< | + containingNodeKind === 236 /* TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 115 /* StaticKeyword */: return containingNodeKind === 151 /* PropertyDeclaration */ && !ts.isClassLike(contextToken.parent.parent); case 24 /* DotDotDotToken */: return containingNodeKind === 148 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 179 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 180 /* ArrayBindingPattern */); // var [...z| case 114 /* PublicKeyword */: case 112 /* PrivateKeyword */: case 113 /* ProtectedKeyword */: return containingNodeKind === 148 /* Parameter */ && !ts.isConstructorDeclaration(contextToken.parent.parent); case 118 /* AsKeyword */: - return containingNodeKind === 246 /* ImportSpecifier */ || - containingNodeKind === 250 /* ExportSpecifier */ || - containingNodeKind === 244 /* NamespaceImport */; + return containingNodeKind === 247 /* ImportSpecifier */ || + containingNodeKind === 251 /* ExportSpecifier */ || + containingNodeKind === 245 /* NamespaceImport */; case 125 /* GetKeyword */: case 136 /* SetKeyword */: if (isFromObjectTypeDeclaration(contextToken)) { @@ -86302,9 +86775,9 @@ 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 !== 268 /* PropertyAssignment */ && - m.kind !== 269 /* ShorthandPropertyAssignment */ && - m.kind !== 180 /* BindingElement */ && + if (m.kind !== 269 /* PropertyAssignment */ && + m.kind !== 270 /* ShorthandPropertyAssignment */ && + m.kind !== 181 /* BindingElement */ && m.kind !== 153 /* MethodDeclaration */ && m.kind !== 155 /* GetAccessor */ && m.kind !== 156 /* SetAccessor */) { @@ -86315,7 +86788,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 180 /* BindingElement */ && m.propertyName) { + if (m.kind === 181 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 71 /* Identifier */) { existingName = m.propertyName.escapedText; @@ -86385,7 +86858,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 260 /* JsxAttribute */) { + if (attr.kind === 261 /* JsxAttribute */) { seenNames.set(attr.name.escapedText, true); } } @@ -86415,7 +86888,7 @@ var ts; // TODO: GH#18169 return { name: JSON.stringify(name), needsConvertPropertyAccess: false }; case 2 /* PropertyAccess */: - case 1 /* Global */: + case 1 /* Global */: // For a 'this.' completion it will be in a global context, but may have a non-identifier name. // Don't add a completion for a name starting with a space. See https://github.com/Microsoft/TypeScript/pull/20547 return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true }; case 5 /* None */: @@ -86525,12 +86998,11 @@ var ts; * excludes array-like types or callable/constructable types. */ function getPropertiesForCompletion(type, checker, isForAccess) { - if (!(type.flags & 131072 /* Union */)) { + if (!(type.isUnion())) { return ts.Debug.assertEachDefined(type.getApparentProperties(), "getApparentProperties() should all be defined"); } - var types = type.types; // If we're providing completions for an object literal, skip primitive, array-like, or callable types since those shouldn't be implemented by object literals. - var filteredTypes = isForAccess ? types : types.filter(function (memberType) { + var filteredTypes = isForAccess ? type.types : type.types.filter(function (memberType) { return !(memberType.flags & 16382 /* Primitive */ || checker.isArrayLikeType(memberType) || ts.typeHasCallOrConstructSignatures(memberType, checker)); }); return ts.Debug.assertEachDefined(checker.getAllPossiblePropertiesOfTypes(filteredTypes), "getAllPossiblePropertiesOfTypes() should all be defined"); @@ -86542,7 +87014,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) { // class c { method() { } | method2() { } } switch (location.kind) { - case 293 /* SyntaxList */: + case 294 /* SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -86691,7 +87163,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 272 /* SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 273 /* SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -86723,16 +87195,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 225 /* SwitchStatement */: - if (statement.kind === 221 /* ContinueStatement */) { + case 226 /* SwitchStatement */: + if (statement.kind === 222 /* ContinueStatement */) { return false; } // falls through - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 217 /* WhileStatement */: - case 216 /* DoStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 218 /* WhileStatement */: + case 217 /* DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -86755,11 +87227,11 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 238 /* ModuleBlock */: - case 272 /* SourceFile */: - case 211 /* Block */: - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 239 /* ModuleBlock */: + case 273 /* SourceFile */: + case 212 /* Block */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */ && ts.isClassDeclaration(declaration)) { return declaration.members.concat([declaration]); @@ -86769,11 +87241,11 @@ var ts; } case 154 /* Constructor */: case 153 /* MethodDeclaration */: - case 232 /* FunctionDeclaration */: { + case 233 /* FunctionDeclaration */: { return container.parameters.concat((ts.isClassLike(container.parent) ? container.parent.members : [])); } - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: 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. @@ -86806,7 +87278,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 88 /* ForKeyword */, 106 /* WhileKeyword */, 81 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 216 /* DoStatement */) { + if (loopNode.kind === 217 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 106 /* WhileKeyword */)) { @@ -86826,13 +87298,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 216 /* DoStatement */: - case 217 /* WhileStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 217 /* DoStatement */: + case 218 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -87134,10 +87606,10 @@ var ts; } cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportEquals */ && parent.kind === 230 /* VariableDeclaration */) { + if (exportKind === 2 /* ExportEquals */ && parent.kind === 231 /* VariableDeclaration */) { var name = parent.name; if (name.kind === 71 /* Identifier */) { directImports.push(name); @@ -87148,12 +87620,12 @@ var ts; addIndirectUser(direct.getSourceFile()); } break; - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */)); break; - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 244 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 245 /* NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name); } else if (ts.isDefaultImport(direct)) { @@ -87167,7 +87639,7 @@ var ts; directImports.push(direct); } break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); @@ -87188,7 +87660,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 272 /* SourceFile */ || sourceFileLike.kind === 237 /* ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 273 /* SourceFile */ || sourceFileLike.kind === 238 /* ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUsers(sourceFileLike); } @@ -87243,7 +87715,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 241 /* ImportEqualsDeclaration */) { + if (decl.kind === 242 /* ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -87257,7 +87729,7 @@ var ts; if (decl.moduleSpecifier.kind !== 9 /* StringLiteral */) { return; } - if (decl.kind === 248 /* ExportDeclaration */) { + if (decl.kind === 249 /* ExportDeclaration */) { searchForNamedImport(decl.exportClause); return; } @@ -87266,7 +87738,7 @@ var ts; return; } var namedBindings = importClause.namedBindings; - if (namedBindings && namedBindings.kind === 244 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 245 /* NamespaceImport */) { handleNamespaceImportLike(namedBindings.name); return; } @@ -87318,7 +87790,7 @@ var ts; } } else { - var localSymbol = element.kind === 250 /* ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 251 /* 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); @@ -87334,7 +87806,7 @@ var ts; function findNamespaceReExports(sourceFileLike, name, checker) { var namespaceImportSymbol = checker.getSymbolAtLocation(name); return forEachPossibleImportOrExportStatement(sourceFileLike, function (statement) { - if (statement.kind !== 248 /* ExportDeclaration */) + if (statement.kind !== 249 /* ExportDeclaration */) return; var _a = statement, exportClause = _a.exportClause, moduleSpecifier = _a.moduleSpecifier; if (moduleSpecifier || !exportClause) @@ -87353,7 +87825,7 @@ var ts; for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { var referencingFile = sourceFiles_4[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if (searchSourceFile.kind === 272 /* SourceFile */) { + if (searchSourceFile.kind === 273 /* SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -87400,7 +87872,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 === 272 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 273 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -87415,20 +87887,18 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 248 /* ExportDeclaration */: - case 242 /* ImportDeclaration */: { + case 249 /* ExportDeclaration */: + case 243 /* ImportDeclaration */: { var decl = statement; - if (decl.moduleSpecifier && decl.moduleSpecifier.kind === 9 /* StringLiteral */) { + if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 241 /* ImportEqualsDeclaration */: { + case 242 /* ImportEqualsDeclaration */: { var decl = statement; - var moduleReference = decl.moduleReference; - if (moduleReference.kind === 252 /* ExternalModuleReference */ && - moduleReference.expression.kind === 9 /* StringLiteral */) { - action(decl, moduleReference.expression); + if (isExternalModuleImportEquals(decl)) { + action(decl, decl.moduleReference.expression); } break; } @@ -87448,7 +87918,7 @@ var ts; function getExport() { var parent = node.parent; if (symbol.exportSymbol) { - if (parent.kind === 183 /* PropertyAccessExpression */) { + if (parent.kind === 184 /* 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 symbol.declarations.some(function (d) { return d === parent; }) && ts.isBinaryExpression(parent.parent) @@ -87564,10 +88034,10 @@ var ts; // 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. function getExportNode(parent, node) { - if (parent.kind === 230 /* VariableDeclaration */) { + if (parent.kind === 231 /* VariableDeclaration */) { var p = parent; return p.name !== node ? undefined : - p.parent.kind === 267 /* CatchClause */ ? undefined : p.parent.parent.kind === 212 /* VariableStatement */ ? p.parent.parent : undefined; + p.parent.kind === 268 /* CatchClause */ ? undefined : p.parent.parent.kind === 213 /* VariableStatement */ ? p.parent.parent : undefined; } else { return parent; @@ -87576,15 +88046,15 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent) ? { isNamedImport: false } : undefined; - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return parent.propertyName ? undefined : { isNamedImport: true }; - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: ts.Debug.assert(parent.name === node); return { isNamedImport: false }; default: @@ -87626,22 +88096,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 185 /* CallExpression */) { + if (node.kind === 186 /* CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 272 /* SourceFile */) { + if (parent.kind === 273 /* SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 238 /* ModuleBlock */); + ts.Debug.assert(parent.kind === 239 /* ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 237 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */; + return node.kind === 238 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */; } - function isExternalModuleImportEquals(_a) { - var moduleReference = _a.moduleReference; - return moduleReference.kind === 252 /* ExternalModuleReference */ && moduleReference.expression.kind === 9 /* StringLiteral */; + function isExternalModuleImportEquals(eq) { + return eq.moduleReference.kind === 253 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 9 /* StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -87675,13 +88144,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 272 /* SourceFile */) { + if (node.kind === 273 /* 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 === 269 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 270 /* ShorthandPropertyAssignment */) { var result_5 = []; FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_5.push(nodeEntry(node)); }); return result_5; @@ -87783,13 +88252,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 182 /* ObjectLiteralExpression */) { + else if (node.kind === 183 /* ObjectLiteralExpression */) { return { kind: "interface" /* interfaceElement */, displayParts: [ts.punctuationPart(19 /* OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(20 /* CloseParenToken */)] }; } - else if (node.kind === 203 /* ClassExpression */) { + else if (node.kind === 204 /* ClassExpression */) { return { kind: "local class" /* localClassElement */, displayParts: [ts.punctuationPart(19 /* OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(20 /* CloseParenToken */)] @@ -87868,12 +88337,12 @@ var ts; return false; } switch (node.parent.kind) { - case 237 /* ModuleDeclaration */: - case 252 /* ExternalModuleReference */: - case 242 /* ImportDeclaration */: - case 248 /* ExportDeclaration */: + case 238 /* ModuleDeclaration */: + case 253 /* ExternalModuleReference */: + case 243 /* ImportDeclaration */: + case 249 /* ExportDeclaration */: return true; - case 185 /* CallExpression */: + case 186 /* CallExpression */: return ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false) || ts.isImportCall(node.parent); default: return false; @@ -87896,10 +88365,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 272 /* SourceFile */: + case 273 /* 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 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: references.push({ type: "node", node: decl.name }); break; default: @@ -87990,7 +88459,7 @@ var ts; return ts.firstDefined(symbol.declarations, function (decl) { if (!decl.parent) { // Assertions for GH#21814. We should be handling SourceFile symbols in `getReferencedSymbolsForModule` instead of getting here. - ts.Debug.assert(decl.kind === 272 /* SourceFile */); + ts.Debug.assert(decl.kind === 273 /* SourceFile */); ts.Debug.fail("Unexpected symbol at " + ts.Debug.showSyntaxKind(node) + ": " + ts.Debug.showSymbol(symbol)); } return ts.isTypeLiteralNode(decl.parent) && ts.isUnionTypeNode(decl.parent.parent) @@ -88156,9 +88625,9 @@ var ts; checker.getPropertySymbolOfDestructuringAssignment(location); } function getObjectBindingElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 180 /* BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 181 /* BindingElement */); if (bindingElement && - bindingElement.parent.kind === 178 /* ObjectBindingPattern */ && + bindingElement.parent.kind === 179 /* ObjectBindingPattern */ && !bindingElement.propertyName) { return bindingElement; } @@ -88188,7 +88657,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 === 190 /* FunctionExpression */ || valueDeclaration.kind === 203 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 191 /* FunctionExpression */ || valueDeclaration.kind === 204 /* ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -88198,7 +88667,7 @@ var ts; if (flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasModifier(d, 8 /* Private */); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 233 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 234 /* ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -88227,7 +88696,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 272 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 273 /* 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; @@ -88589,7 +89058,7 @@ var ts; if (refNode.kind !== 71 /* Identifier */) { return; } - if (refNode.parent.kind === 269 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 270 /* ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -88608,7 +89077,7 @@ var ts; } else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { var body = parent.body; - if (body.kind === 211 /* Block */) { + if (body.kind === 212 /* Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { addReference(returnStatement.expression); @@ -88631,7 +89100,7 @@ var ts; if (componentType.symbol && componentType.symbol.getFlags() & (32 /* Class */ | 64 /* Interface */)) { result.push(componentType.symbol); } - if (componentType.getFlags() & 393216 /* UnionOrIntersection */) { + if (componentType.isUnionOrIntersection()) { getSymbolsForClassAndInterfaceComponents(componentType, result); } } @@ -88649,12 +89118,12 @@ var ts; } function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { - if (node.kind === 205 /* ExpressionWithTypeArguments */ - && node.parent.kind === 266 /* HeritageClause */ + if (node.kind === 206 /* ExpressionWithTypeArguments */ + && node.parent.kind === 267 /* HeritageClause */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } - else if (node.kind === 71 /* Identifier */ || node.kind === 183 /* PropertyAccessExpression */) { + else if (node.kind === 71 /* Identifier */ || node.kind === 184 /* PropertyAccessExpression */) { return getContainingClassIfInHeritageClause(node.parent); } } @@ -88665,13 +89134,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 189 /* ParenthesizedExpression */: + case 190 /* ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 191 /* ArrowFunction */: - case 190 /* FunctionExpression */: - case 182 /* ObjectLiteralExpression */: - case 203 /* ClassExpression */: - case 181 /* ArrayLiteralExpression */: + case 192 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 183 /* ObjectLiteralExpression */: + case 204 /* ClassExpression */: + case 182 /* ArrayLiteralExpression */: return true; default: return false; @@ -88770,13 +89239,13 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 272 /* SourceFile */: + case 273 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // falls through - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* 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. @@ -88784,11 +89253,11 @@ var ts; return undefined; } var references = []; - for (var _i = 0, _a = searchSpaceNode.kind === 272 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()]; _i < _a.length; _i++) { + for (var _i = 0, _a = searchSpaceNode.kind === 273 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()]; _i < _a.length; _i++) { var sourceFile = _a[_i]; cancellationToken.throwIfCancellationRequested(); var positions = getPossibleSymbolReferencePositions(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode); - getThisReferencesInFile(sourceFile, searchSpaceNode.kind === 272 /* SourceFile */ ? sourceFile : searchSpaceNode, positions, staticFlag, references); + getThisReferencesInFile(sourceFile, searchSpaceNode.kind === 273 /* SourceFile */ ? sourceFile : searchSpaceNode, positions, staticFlag, references); } return [{ definition: { type: "this", node: thisOrSuperKeyword }, @@ -88803,8 +89272,8 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(FindAllReferences.nodeEntry(node)); } @@ -88815,16 +89284,16 @@ var ts; result.push(FindAllReferences.nodeEntry(node)); } break; - case 203 /* ClassExpression */: - case 233 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 234 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { result.push(FindAllReferences.nodeEntry(node)); } break; - case 272 /* SourceFile */: - if (container.kind === 272 /* SourceFile */ && !ts.isExternalModule(container)) { + case 273 /* SourceFile */: + if (container.kind === 273 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(FindAllReferences.nodeEntry(node)); } break; @@ -88854,7 +89323,7 @@ var ts; // If the location is name of property symbol from object literal destructuring pattern // Search the property symbol // for ( { property: p2 } of elems) { } - if (containingObjectLiteralElement.kind !== 269 /* ShorthandPropertyAssignment */) { + if (containingObjectLiteralElement.kind !== 270 /* ShorthandPropertyAssignment */) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); if (propertySymbol) { result.push(propertySymbol); @@ -88905,7 +89374,7 @@ var ts; result.push(rootSymbol); // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, result, /*previousIterationSymbolsCache*/ ts.createSymbolTable(), checker); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, result); } } } @@ -88923,36 +89392,31 @@ var ts; * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. * The value of previousIterationSymbol is undefined when the function is first called. */ - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, checker) { - // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited - // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. - // For example: - // interface C extends C { - // /*findRef*/propName: string; - // } - // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, - // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, - // the function will add any found symbol of the property-name, then its sub-routine will call - // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already - // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. - if (!symbol || previousIterationSymbolsCache.has(symbol.escapedName)) { - return; - } - if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + function getPropertySymbolsFromBaseTypes(symbol, propertyName, checker, result) { + if (result === void 0) { result = []; } + var seen = ts.createMap(); + recur(symbol); + return result; + function recur(symbol) { + // Use `addToSeen` to ensure we don't infinitely recurse in this situation: + // interface C extends C { + // /*findRef*/propName: string; + // } + if (!(symbol.flags & (32 /* Class */ | 64 /* Interface */)) || !ts.addToSeen(seen, ts.getSymbolId(symbol))) + return; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; for (var _b = 0, _c = ts.getAllSuperTypeNodes(declaration); _b < _c.length; _b++) { var typeReference = _c[_b]; var type = checker.getTypeAtLocation(typeReference); - if (!type) + if (!(type && type.symbol)) continue; var propertySymbol = checker.getPropertyOfType(type, propertyName); if (propertySymbol) { result.push.apply(result, checker.getRootSymbols(propertySymbol)); } // Visit the typeReference as well to see if it directly or indirectly use that property - previousIterationSymbolsCache.set(symbol.escapedName, symbol); - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, checker); + recur(type.symbol); } } } @@ -89016,32 +89480,19 @@ var ts; if (search.parents && !ts.some(search.parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker); })) { return undefined; } - var result = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, result, /*previousIterationSymbolsCache*/ ts.createSymbolTable(), checker); - return result.some(search.includes) ? rootSymbol : undefined; + return getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker).some(search.includes) ? rootSymbol : undefined; } return undefined; }); } } - function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 146 /* ComputedPropertyName */) { - var nameExpression = node.name.expression; - // treat computed property names where expression is string/numeric literal as just string/numeric literal - if (ts.isStringOrNumericLiteral(nameExpression)) { - return nameExpression.text; - } - return undefined; - } - return ts.getTextOfIdentifierOrLiteral(node.name); - } /** Gets all symbols for one property. Does not get symbols for every property. */ function getPropertySymbolsFromContextualType(node, checker) { var contextualType = checker.getContextualType(node.parent); - var name = getNameFromObjectLiteralElement(node); + var name = ts.getNameFromPropertyName(node.name); var symbol = contextualType && name && contextualType.getProperty(name); return symbol ? [symbol] : - contextualType && contextualType.flags & 131072 /* Union */ ? ts.mapDefined(contextualType.types, function (t) { return t.getProperty(name); }) : ts.emptyArray; + contextualType && contextualType.isUnion() ? ts.mapDefined(contextualType.types, function (t) { return t.getProperty(name); }) : ts.emptyArray; } /** * Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations @@ -89114,19 +89565,12 @@ var ts; */ function getParentSymbolsOfPropertyAccess(location, symbol, checker) { var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(location); - if (!propertyAccessExpression) { - return undefined; - } - var localParentType = checker.getTypeAtLocation(propertyAccessExpression.expression); - if (!localParentType) { - return undefined; - } - if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== symbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 393216 /* UnionOrIntersection */) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } + var localParentType = propertyAccessExpression && checker.getTypeAtLocation(propertyAccessExpression.expression); + return localParentType && localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== symbol.parent + ? [localParentType.symbol] + : localParentType && localParentType.isUnionOrIntersection() + ? getSymbolsForClassAndInterfaceComponents(localParentType) + : undefined; } })(Core = FindAllReferences.Core || (FindAllReferences.Core = {})); })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); @@ -89176,7 +89620,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 === 269 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 270 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -89252,7 +89696,7 @@ var ts; if (!type) { return undefined; } - if (type.flags & 131072 /* Union */ && !(type.flags & 16 /* Enum */)) { + if (type.isUnion() && !(type.flags & 16 /* Enum */)) { return ts.flatMap(type.types, function (t) { return t.symbol && getDefinitionFromSymbol(typeChecker, t.symbol, node); }); } return type.symbol && getDefinitionFromSymbol(typeChecker, type.symbol, node); @@ -89286,11 +89730,11 @@ var ts; return true; } switch (declaration.kind) { - case 243 /* ImportClause */: - case 241 /* ImportEqualsDeclaration */: + case 244 /* ImportClause */: + case 242 /* ImportEqualsDeclaration */: return true; - case 246 /* ImportSpecifier */: - return declaration.parent.kind === 245 /* NamedImports */; + case 247 /* ImportSpecifier */: + return declaration.parent.kind === 246 /* NamedImports */; default: return false; } @@ -89325,7 +89769,7 @@ var ts; switch (node.kind) { case 154 /* Constructor */: case 158 /* ConstructSignature */: - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: return true; @@ -89477,9 +89921,9 @@ var ts; JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 292 /* JSDocPropertyTag */: + case 293 /* JSDocPropertyTag */: return [declaration]; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return [declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -89500,15 +89944,15 @@ var ts; function getCommentText(tag) { var comment = tag.comment; switch (tag.kind) { - case 285 /* JSDocAugmentsTag */: + case 286 /* JSDocAugmentsTag */: return withNode(tag.class); - case 290 /* JSDocTemplateTag */: + case 291 /* JSDocTemplateTag */: return withList(tag.typeParameters); - case 289 /* JSDocTypeTag */: + case 290 /* JSDocTypeTag */: return withNode(tag.typeExpression); - case 291 /* JSDocTypedefTag */: - case 292 /* JSDocPropertyTag */: - case 287 /* JSDocParameterTag */: + case 292 /* JSDocTypedefTag */: + case 293 /* JSDocPropertyTag */: + case 288 /* JSDocParameterTag */: var name = tag.name; return name ? withNode(name) : comment; default: @@ -89691,20 +90135,20 @@ var ts; function getCommentOwnerInfo(tokenAtPos) { for (var commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: case 152 /* MethodSignature */: var parameters = commentOwner.parameters; return { commentOwner: commentOwner, parameters: parameters }; - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: case 150 /* PropertySignature */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 235 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 236 /* TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 212 /* VariableStatement */: { + case 213 /* VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; var parameters_1 = varDeclarations.length === 1 && varDeclarations[0].initializer @@ -89712,14 +90156,14 @@ var ts; : undefined; return { commentOwner: commentOwner, parameters: parameters_1 }; } - case 272 /* SourceFile */: + case 273 /* SourceFile */: return undefined; - case 237 /* ModuleDeclaration */: + case 238 /* 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 === 237 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 198 /* BinaryExpression */: { + return commentOwner.parent.kind === 238 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 199 /* BinaryExpression */: { var be = commentOwner; if (ts.getSpecialPropertyAssignmentKind(be) === 0 /* None */) { return undefined; @@ -89739,14 +90183,14 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 189 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 190 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return rightHandSide.parameters; - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; if (member.kind === 154 /* Constructor */) { @@ -90145,16 +90589,14 @@ var ts; continue; } } - var matchKind = bestMatchKind(containerMatches); - var isCaseSensitive = allMatchesAreCaseSensitive(containerMatches); - rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: isCaseSensitive, declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: Math.min.apply(Math, matches.map(function (m) { return m.kind; })), isCaseSensitive: matches.every(function (m) { return m.isCaseSensitive; }), declaration: declaration }); } } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 243 /* ImportClause */: - case 246 /* ImportSpecifier */: - case 241 /* ImportEqualsDeclaration */: + case 244 /* ImportClause */: + case 247 /* ImportSpecifier */: + case 242 /* ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -90162,17 +90604,6 @@ var ts; return true; } } - function allMatchesAreCaseSensitive(matches) { - ts.Debug.assert(matches.length > 0); - // This is a case sensitive match, only if all the submatches were case sensitive. - for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { - var match = matches_1[_i]; - if (!match.isCaseSensitive) { - return false; - } - } - return true; - } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); if (name && ts.isPropertyNameLiteral(name)) { @@ -90211,10 +90642,8 @@ 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.kind === 146 /* ComputedPropertyName */) { - if (!tryAddComputedPropertyName(name.expression, containers, /*includeLastPortion*/ false)) { - return undefined; - } + if (name.kind === 146 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers, /*includeLastPortion*/ false)) { + return undefined; } // Now, walk up our containers, adding all their names to the container array. declaration = ts.getContainerNode(declaration); @@ -90226,18 +90655,6 @@ var ts; } return containers; } - function bestMatchKind(matches) { - ts.Debug.assert(matches.length > 0); - var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) { - var match = matches_2[_i]; - var kind = match.kind; - if (kind < bestMatchKind) { - bestMatchKind = kind; - } - } - return bestMatchKind; - } function compareNavigateToItems(i1, i2) { // TODO(cyrusn): get the gamut of comparisons that VS already uses here. return ts.compareValues(i1.matchKind, i2.matchKind) @@ -90418,7 +90835,7 @@ var ts; addLeafNode(node); } break; - case 243 /* ImportClause */: + case 244 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -90430,7 +90847,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 244 /* NamespaceImport */) { + if (namedBindings.kind === 245 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -90441,8 +90858,8 @@ var ts; } } break; - case 180 /* BindingElement */: - case 230 /* VariableDeclaration */: + case 181 /* BindingElement */: + case 231 /* VariableDeclaration */: var _d = node, name = _d.name, initializer = _d.initializer; if (ts.isBindingPattern(name)) { addChildrenRecursively(name); @@ -90463,12 +90880,12 @@ var ts; addNodeWithRecursiveChild(node, initializer); } break; - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -90478,9 +90895,9 @@ var ts; } endNode(); break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -90488,18 +90905,18 @@ var ts; } endNode(); break; - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 250 /* ExportSpecifier */: - case 241 /* ImportEqualsDeclaration */: + case 251 /* ExportSpecifier */: + case 242 /* ImportEqualsDeclaration */: case 159 /* IndexSignature */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: addLeafNode(node); break; - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var special = ts.getSpecialPropertyAssignmentKind(node); switch (special) { case 1 /* ExportsProperty */: @@ -90521,7 +90938,7 @@ var ts; if (ts.hasJSDocNodes(node)) { ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 291 /* JSDocTypedefTag */) { + if (tag.kind === 292 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -90583,7 +91000,7 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: return ts.hasModifier(a, 32 /* Static */) === ts.hasModifier(b, 32 /* Static */); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: return areSameModule(a, b); default: return true; @@ -90592,7 +91009,7 @@ var ts; // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes. // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { - return a.body.kind === b.body.kind && (a.body.kind !== 237 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 238 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -90622,7 +91039,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 237 /* ModuleDeclaration */) { + if (node.kind === 238 /* ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -90630,18 +91047,18 @@ var ts; return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); } switch (node.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: - case 203 /* ClassExpression */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 204 /* ClassExpression */: return getFunctionOrClassName(node); - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 237 /* ModuleDeclaration */) { + if (node.kind === 238 /* ModuleDeclaration */) { return getModuleName(node); } var name = ts.getNameOfDeclaration(node); @@ -90652,16 +91069,16 @@ var ts; } } switch (node.kind) { - case 272 /* SourceFile */: + case 273 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; } @@ -90677,7 +91094,7 @@ var ts; return "()"; case 159 /* IndexSignature */: return "[]"; - case 291 /* JSDocTypedefTag */: + case 292 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -90689,7 +91106,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 212 /* VariableStatement */) { + if (parentNode && parentNode.kind === 213 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 71 /* Identifier */) { @@ -90718,24 +91135,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 236 /* EnumDeclaration */: - case 234 /* InterfaceDeclaration */: - case 237 /* ModuleDeclaration */: - case 272 /* SourceFile */: - case 235 /* TypeAliasDeclaration */: - case 291 /* JSDocTypedefTag */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 237 /* EnumDeclaration */: + case 235 /* InterfaceDeclaration */: + case 238 /* ModuleDeclaration */: + case 273 /* SourceFile */: + case 236 /* TypeAliasDeclaration */: + case 292 /* JSDocTypedefTag */: return true; case 154 /* Constructor */: case 153 /* MethodDeclaration */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: return hasSomeImportantChild(item); - case 191 /* ArrowFunction */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 192 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -90745,8 +91162,8 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 238 /* ModuleBlock */: - case 272 /* SourceFile */: + case 239 /* ModuleBlock */: + case 273 /* SourceFile */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: return true; @@ -90757,7 +91174,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 230 /* VariableDeclaration */ && childKind !== 180 /* BindingElement */; + return childKind !== 231 /* VariableDeclaration */ && childKind !== 181 /* BindingElement */; }); } } @@ -90813,7 +91230,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 237 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 238 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -90824,16 +91241,16 @@ var ts; * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again. */ function getInteriorModule(decl) { - return decl.body.kind === 237 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 238 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { return !member.name || member.name.kind === 146 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 272 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 273 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 230 /* VariableDeclaration */) { + if (node.parent && node.parent.kind === 231 /* VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -90843,16 +91260,16 @@ var ts; return ts.declarationNameToString(node.name); } // See if it is a var initializer. If so, use the var name. - else if (node.parent.kind === 230 /* VariableDeclaration */) { + else if (node.parent.kind === 231 /* VariableDeclaration */) { return ts.declarationNameToString(node.parent.name); } // See if it is of the form " = function(){...}". If so, use the text from the left-hand side. - else if (node.parent.kind === 198 /* BinaryExpression */ && + else if (node.parent.kind === 199 /* BinaryExpression */ && node.parent.operatorToken.kind === 58 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } // See if it is a property assignment, and if so use the property name - else if (node.parent.kind === 268 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 269 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } // Default exports are named "default" @@ -90865,9 +91282,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 191 /* ArrowFunction */: - case 190 /* FunctionExpression */: - case 203 /* ClassExpression */: + case 192 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 204 /* ClassExpression */: return true; default: return false; @@ -91204,24 +91621,24 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 211 /* Block */: + case 212 /* Block */: if (ts.isFunctionBlock(n)) { - return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 191 /* ArrowFunction */); + return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 192 /* ArrowFunction */); } // Check if the block is standalone, or 'attached' to some parent statement. // 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 216 /* DoStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 218 /* ForStatement */: - case 215 /* IfStatement */: - case 217 /* WhileStatement */: - case 224 /* WithStatement */: - case 267 /* CatchClause */: + case 217 /* DoStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 219 /* ForStatement */: + case 216 /* IfStatement */: + case 218 /* WhileStatement */: + case 225 /* WithStatement */: + case 268 /* CatchClause */: return spanForNode(n.parent); - case 228 /* TryStatement */: + case 229 /* TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -91236,16 +91653,16 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile)); } - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return spanForNode(n.parent); - case 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 239 /* CaseBlock */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 240 /* CaseBlock */: return spanForNode(n); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 21 /* OpenBracketToken */); } function spanForObjectOrArrayLiteral(node, open) { @@ -91288,12 +91705,10 @@ var ts; PatternMatchKind[PatternMatchKind["substring"] = 2] = "substring"; PatternMatchKind[PatternMatchKind["camelCase"] = 3] = "camelCase"; })(PatternMatchKind = ts.PatternMatchKind || (ts.PatternMatchKind = {})); - function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) { + function createPatternMatch(kind, isCaseSensitive) { return { kind: kind, - punctuationStripped: punctuationStripped, - isCaseSensitive: isCaseSensitive, - camelCaseWeight: camelCaseWeight + isCaseSensitive: isCaseSensitive }; } function createPatternMatcher(pattern) { @@ -91306,304 +91721,237 @@ var ts; var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { - getMatches: getMatches, - getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern, + getMatches: function (containers, candidate) { return skipMatch(candidate) ? undefined : getMatches(containers, candidate, dotSeparatedSegments, stringToWordSpans); }, + getMatchesForLastSegmentOfPattern: function (candidate) { return skipMatch(candidate) ? undefined : matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments), stringToWordSpans); }, patternContainsDots: dotSeparatedSegments.length > 1 }; // Quick checks so we can bail out when asked to match a candidate. function skipMatch(candidate) { return invalidPattern || !candidate; } - function getMatchesForLastSegmentOfPattern(candidate) { - if (skipMatch(candidate)) { - return undefined; - } - return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); - } - function getMatches(candidateContainers, candidate) { - if (skipMatch(candidate)) { - return undefined; - } - // First, check that the last part of the dot separated pattern matches the name of the - // candidate. If not, then there's no point in proceeding and doing the more - // expensive work. - var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); - if (!candidateMatch) { - return undefined; - } - candidateContainers = candidateContainers || []; - // -1 because the last part was checked against the name, and only the rest - // of the parts are checked against the container. - if (dotSeparatedSegments.length - 1 > candidateContainers.length) { - // There weren't enough container parts to match against the pattern parts. - // So this definitely doesn't match. - return undefined; - } - // So far so good. Now break up the container for the candidate and check if all - // the dotted parts match up correctly. - var totalMatch = candidateMatch; - for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { - var segment = dotSeparatedSegments[i]; - var containerName = candidateContainers[j]; - var containerMatch = matchSegment(containerName, segment); - if (!containerMatch) { - // This container didn't match the pattern piece. So there's no match at all. - return undefined; - } - ts.addRange(totalMatch, containerMatch); - } - // Success, this symbol's full name matched against the dotted name the user was asking - // about. - return totalMatch; - } - function getWordSpans(word) { - var spans = stringToWordSpans.get(word); - if (!spans) { - stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); - } - return spans; - } - function matchTextChunk(candidate, chunk, punctuationStripped) { - var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); - if (index === 0) { - if (chunk.text.length === candidate.length) { - // a) Check if the part matches the candidate entirely, in an case insensitive or - // sensitive manner. If it does, return that there was an exact match. - return createPatternMatch(PatternMatchKind.exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text); - } - else { - // b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive - // manner. If it does, return that there was a prefix match. - return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text)); - } - } - var isLowercase = chunk.isLowerCase; - if (isLowercase) { - if (index > 0) { - // c) If the part is entirely lowercase, then check if it is contained anywhere in the - // candidate in a case insensitive manner. If so, return that there was a substring - // match. - // - // Note: We only have a substring match if the lowercase part is prefix match of some - // word part. That way we don't match something like 'Class' when the user types 'a'. - // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). - var wordSpans = getWordSpans(candidate); - for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { - var span = wordSpans_1[_i]; - if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, - /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); - } - } - } - } - else { - // d) If the part was not entirely lowercase, then check if it is contained in the - // candidate in a case *sensitive* manner. If so, return that there was a substring - // match. - if (candidate.indexOf(chunk.text) > 0) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ true); - } - } - if (!isLowercase) { - // e) If the part was not entirely lowercase, then attempt a camel cased match as well. - if (chunk.characterSpans.length > 0) { - var candidateParts = getWordSpans(candidate); - var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); - if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); - } - camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true); - if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); - } - } - } - if (isLowercase) { - // f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? - // We could check every character boundary start of the candidate for the pattern. However, that's - // an m * n operation in the wost case. Instead, find the first instance of the pattern - // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to - // filter the list based on a substring that starts on a capital letter and also with a lowercase one. - // (Pattern: fogbar, Candidate: quuxfogbarFogBar). - if (chunk.text.length < candidate.length) { - if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ false); - } - } - } + } + ts.createPatternMatcher = createPatternMatcher; + function getMatches(candidateContainers, candidate, dotSeparatedSegments, stringToWordSpans) { + // First, check that the last part of the dot separated pattern matches the name of the + // candidate. If not, then there's no point in proceeding and doing the more + // expensive work. + var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments), stringToWordSpans); + if (!candidateMatch) { return undefined; } - function containsSpaceOrAsterisk(text) { - for (var i = 0; i < text.length; i++) { - var ch = text.charCodeAt(i); - if (ch === 32 /* space */ || ch === 42 /* asterisk */) { - return true; - } - } - return false; + candidateContainers = candidateContainers || []; + // -1 because the last part was checked against the name, and only the rest + // of the parts are checked against the container. + if (dotSeparatedSegments.length - 1 > candidateContainers.length) { + // There weren't enough container parts to match against the pattern parts. + // So this definitely doesn't match. + return undefined; } - function matchSegment(candidate, segment) { - // First check if the segment matches as is. This is also useful if the segment contains - // characters we would normally strip when splitting into parts that we also may want to - // match in the candidate. For example if the segment is "@int" and the candidate is - // "@int", then that will show up as an exact match here. - // - // Note: if the segment contains a space or an asterisk then we must assume that it's a - // multi-word segment. - if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { - var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); - if (match) { - return [match]; - } + // So far so good. Now break up the container for the candidate and check if all + // the dotted parts match up correctly. + var totalMatch = candidateMatch; + for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { + var segment = dotSeparatedSegments[i]; + var containerName = candidateContainers[j]; + var containerMatch = matchSegment(containerName, segment, stringToWordSpans); + if (!containerMatch) { + // This container didn't match the pattern piece. So there's no match at all. + return undefined; } - // The logic for pattern matching is now as follows: - // - // 1) Break the segment passed in into words. Breaking is rather simple and a - // good way to think about it that if gives you all the individual alphanumeric words - // of the pattern. - // - // 2) For each word try to match the word against the candidate value. - // - // 3) Matching is as follows: - // - // a) Check if the word matches the candidate entirely, in an case insensitive or - // sensitive manner. If it does, return that there was an exact match. - // - // b) Check if the word is a prefix of the candidate, in a case insensitive or - // sensitive manner. If it does, return that there was a prefix match. - // - // c) If the word is entirely lowercase, then check if it is contained anywhere in the - // candidate in a case insensitive manner. If so, return that there was a substring - // match. - // - // Note: We only have a substring match if the lowercase part is prefix match of - // some word part. That way we don't match something like 'Class' when the user - // types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with - // 'a'). - // - // d) If the word was not entirely lowercase, then check if it is contained in the - // candidate in a case *sensitive* manner. If so, return that there was a substring - // match. - // - // e) If the word was not entirely lowercase, then attempt a camel cased match as - // well. - // - // f) The word is all lower case. Is it a case insensitive substring of the candidate starting - // on a part boundary of the candidate? - // - // Only if all words have some sort of match is the pattern considered matched. - var subWordTextChunks = segment.subWordTextChunks; - var matches; - for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { - var subWordTextChunk = subWordTextChunks_1[_i]; - // Try to match the candidate with this word - var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); - if (!result) { - return undefined; - } - matches = matches || []; - matches.push(result); - } - return matches; + ts.addRange(totalMatch, containerMatch); } - function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { - var patternPartStart = patternSpan ? patternSpan.start : 0; - var patternPartLength = patternSpan ? patternSpan.length : pattern.length; - if (patternPartLength > candidateSpan.length) { - // Pattern part is longer than the candidate part. There can never be a match. - return false; - } - if (ignoreCase) { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (toLowerCase(ch1) !== toLowerCase(ch2)) { - return false; - } - } - } - else { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (ch1 !== ch2) { - return false; - } - } - } - return true; + // Success, this symbol's full name matched against the dotted name the user was asking + // about. + return totalMatch; + } + function getWordSpans(word, stringToWordSpans) { + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { - var chunkCharacterSpans = chunk.characterSpans; - // Note: we may have more pattern parts than candidate parts. This is because multiple - // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". - // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U - // and I will both match in UI. - var currentCandidate = 0; - var currentChunkSpan = 0; - var firstMatch; - var contiguous; - while (true) { - // Let's consider our termination cases - if (currentChunkSpan === chunkCharacterSpans.length) { - // We did match! We shall assign a weight to this - var weight = 0; - // Was this contiguous? - if (contiguous) { - weight += 1; - } - // Did we start at the beginning of the candidate? - if (firstMatch === 0) { - weight += 2; - } - return weight; + return spans; + } + function matchTextChunk(candidate, chunk, stringToWordSpans) { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + // a) Check if the word is a prefix of the candidate, in a case insensitive or + // sensitive manner. If it does, return that there was an exact match if the word and candidate are the same length, else a prefix match. + return createPatternMatch(chunk.text.length === candidate.length ? PatternMatchKind.exact : PatternMatchKind.prefix, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text)); + } + if (chunk.isLowerCase) { + if (index === -1) + return undefined; + // b) If the part is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of some + // word part. That way we don't match something like 'Class' when the user types 'a'. + // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). + var wordSpans = getWordSpans(candidate, stringToWordSpans); + for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { + var span = wordSpans_1[_i]; + if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { + return createPatternMatch(PatternMatchKind.substring, /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); } - else if (currentCandidate === candidateParts.length) { - // No match, since we still have more of the pattern to hit - return undefined; + } + // c) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? + // We could check every character boundary start of the candidate for the pattern. However, that's + // an m * n operation in the wost case. Instead, find the first instance of the pattern + // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to + // filter the list based on a substring that starts on a capital letter and also with a lowercase one. + // (Pattern: fogbar, Candidate: quuxfogbarFogBar). + if (chunk.text.length < candidate.length && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(PatternMatchKind.substring, /*isCaseSensitive:*/ false); + } + } + else { + // d) If the part was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(PatternMatchKind.substring, /*isCaseSensitive:*/ true); + } + // e) If the part was not entirely lowercase, then attempt a camel cased match as well. + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate, stringToWordSpans); + var isCaseSensitive = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false) ? true + : tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true) ? false : undefined; + if (isCaseSensitive !== undefined) { + return createPatternMatch(PatternMatchKind.camelCase, isCaseSensitive); } - var candidatePart = candidateParts[currentCandidate]; - var gotOneMatchThisCandidate = false; - // Consider the case of matching SiUI against SimpleUIElement. The candidate parts - // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' - // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to - // still keep matching pattern parts against that candidate part. - for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { - var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; - if (gotOneMatchThisCandidate) { - // We've already gotten one pattern part match in this candidate. We will - // only continue trying to consumer pattern parts if the last part and this - // part are both upper case. - if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || - !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { - break; - } - } - if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { - break; - } - gotOneMatchThisCandidate = true; - firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; - // If we were contiguous, then keep that value. If we weren't, then keep that - // value. If we don't know, then set the value to 'true' as an initial match is - // obviously contiguous. - contiguous = contiguous === undefined ? true : contiguous; - candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); - } - // Check if we matched anything at all. If we didn't, then we need to unset the - // contiguous bit if we currently had it set. - // If we haven't set the bit yet, then that means we haven't matched anything so - // far, and we don't want to change that. - if (!gotOneMatchThisCandidate && contiguous !== undefined) { - contiguous = false; - } - // Move onto the next candidate. - currentCandidate++; } } } - ts.createPatternMatcher = createPatternMatcher; + function matchSegment(candidate, segment, stringToWordSpans) { + // First check if the segment matches as is. This is also useful if the segment contains + // characters we would normally strip when splitting into parts that we also may want to + // match in the candidate. For example if the segment is "@int" and the candidate is + // "@int", then that will show up as an exact match here. + // + // Note: if the segment contains a space or an asterisk then we must assume that it's a + // multi-word segment. + if (every(segment.totalTextChunk.text, function (ch) { return ch !== 32 /* space */ && ch !== 42 /* asterisk */; })) { + var match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans); + if (match) { + return [match]; + } + } + // The logic for pattern matching is now as follows: + // + // 1) Break the segment passed in into words. Breaking is rather simple and a + // good way to think about it that if gives you all the individual alphanumeric words + // of the pattern. + // + // 2) For each word try to match the word against the candidate value. + // + // 3) Matching is as follows: + // + // a) Check if the word is a prefix of the candidate, in a case insensitive or + // sensitive manner. If it does, return that there was an exact match if the word and candidate are the same length, else a prefix match. + // + // If the word is entirely lowercase: + // b) Then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of + // some word part. That way we don't match something like 'Class' when the user + // types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with + // 'a'). + // + // c) The word is all lower case. Is it a case insensitive substring of the candidate starting + // on a part boundary of the candidate? + // + // Else: + // d) If the word was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + // + // e) If the word was not entirely lowercase, then attempt a camel cased match as + // well. + // + // Only if all words have some sort of match is the pattern considered matched. + var subWordTextChunks = segment.subWordTextChunks; + var matches; + for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { + var subWordTextChunk = subWordTextChunks_1[_i]; + // Try to match the candidate with this word + var result = matchTextChunk(candidate, subWordTextChunk, stringToWordSpans); + if (!result) { + return undefined; + } + matches = matches || []; + matches.push(result); + } + return matches; + } + function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { + if (patternSpan === void 0) { patternSpan = { start: 0, length: pattern.length }; } + return patternSpan.length <= candidateSpan.length // If pattern part is longer than the candidate part there can never be a match. + && everyInRange(0, patternSpan.length, function (i) { return equalChars(pattern.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase); }); + } + function equalChars(ch1, ch2, ignoreCase) { + return ignoreCase ? toLowerCase(ch1) === toLowerCase(ch2) : ch1 === ch2; + } + function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { + var chunkCharacterSpans = chunk.characterSpans; + // Note: we may have more pattern parts than candidate parts. This is because multiple + // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". + // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U + // and I will both match in UI. + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch; + var contiguous; + while (true) { + // Let's consider our termination cases + if (currentChunkSpan === chunkCharacterSpans.length) { + return true; + } + else if (currentCandidate === candidateParts.length) { + // No match, since we still have more of the pattern to hit + return false; + } + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + // Consider the case of matching SiUI against SimpleUIElement. The candidate parts + // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' + // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to + // still keep matching pattern parts against that candidate part. + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + if (gotOneMatchThisCandidate) { + // We've already gotten one pattern part match in this candidate. We will + // only continue trying to consumer pattern parts if the last part and this + // part are both upper case. + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + gotOneMatchThisCandidate = true; + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + // If we were contiguous, then keep that value. If we weren't, then keep that + // value. If we don't know, then set the value to 'true' as an initial match is + // obviously contiguous. + contiguous = contiguous === undefined ? true : contiguous; + candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + // Check if we matched anything at all. If we didn't, then we need to unset the + // contiguous bit if we currently had it set. + // If we haven't set the bit yet, then that means we haven't matched anything so + // far, and we don't want to change that. + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + // Move onto the next candidate. + currentCandidate++; + } + } function createSegment(text) { return { totalTextChunk: createTextChunk(text), @@ -91643,24 +91991,18 @@ var ts; // Assumes 'value' is already lowercase. function indexOfIgnoringCase(str, value) { var n = str.length - value.length; - for (var i = 0; i <= n; i++) { - if (startsWithIgnoringCase(str, value, i)) { - return i; + var _loop_10 = function (start) { + if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) { + return { value: start }; } + }; + for (var start = 0; start <= n; start++) { + var state_3 = _loop_10(start); + if (typeof state_3 === "object") + return state_3.value; } return -1; } - // Assumes 'value' is already lowercase. - function startsWithIgnoringCase(str, value, start) { - for (var i = 0; i < value.length; i++) { - var ch1 = toLowerCase(str.charCodeAt(i + start)); - var ch2 = value.charCodeAt(i); - if (ch1 !== ch2) { - return false; - } - } - return true; - } function toLowerCase(ch) { // Fast convert for the ascii range. if (ch >= 65 /* A */ && ch <= 90 /* Z */) { @@ -91728,7 +92070,7 @@ var ts; var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); - var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + var hasTransitionFromUpperToLower = word && transitionFromUpperToLower(identifier, i, wordStart); if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit !== currentIsDigit || @@ -91775,46 +92117,28 @@ var ts; return false; } function isAllPunctuation(identifier, start, end) { - for (var i = start; i < end; i++) { - var ch = identifier.charCodeAt(i); - // We don't consider _ or $ as punctuation as there may be things with that name. - if (!charIsPunctuation(ch) || ch === 95 /* _ */ || ch === 36 /* $ */) { - return false; - } - } - return true; + return every(identifier, function (ch) { return charIsPunctuation(ch) && ch !== 95 /* _ */; }, start, end); } - function transitionFromUpperToLower(identifier, word, index, wordStart) { - if (word) { - // Cases this supports: - // 1) IDisposable -> I, Disposable - // 2) UIElement -> UI, Element - // 3) HTMLDocument -> HTML, Document - // - // etc. - if (index !== wordStart && - index + 1 < identifier.length) { - var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); - if (currentIsUpper && nextIsLower) { - // We have a transition from an upper to a lower letter here. But we only - // want to break if all the letters that preceded are uppercase. i.e. if we - // have "Foo" we don't want to break that into "F, oo". But if we have - // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, - // Foo". i.e. the last uppercase letter belongs to the lowercase letters - // that follows. Note: this will make the following not split properly: - // "HELLOthere". However, these sorts of names do not show up in .Net - // programs. - for (var i = wordStart; i < index; i++) { - if (!isUpperCaseLetter(identifier.charCodeAt(i))) { - return false; - } - } - return true; - } - } - } - return false; + function transitionFromUpperToLower(identifier, index, wordStart) { + // Cases this supports: + // 1) IDisposable -> I, Disposable + // 2) UIElement -> UI, Element + // 3) HTMLDocument -> HTML, Document + // + // etc. + // We have a transition from an upper to a lower letter here. But we only + // want to break if all the letters that preceded are uppercase. i.e. if we + // have "Foo" we don't want to break that into "F, oo". But if we have + // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, + // Foo". i.e. the last uppercase letter belongs to the lowercase letters + // that follows. Note: this will make the following not split properly: + // "HELLOthere". However, these sorts of names do not show up in .Net + // programs. + return index !== wordStart + && index + 1 < identifier.length + && isUpperCaseLetter(identifier.charCodeAt(index)) + && isLowerCaseLetter(identifier.charCodeAt(index + 1)) + && every(identifier, isUpperCaseLetter, wordStart, index); } function transitionFromLowerToUpper(identifier, word, index) { var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); @@ -91832,10 +92156,20 @@ var ts; // on characters would be: A M // // We break the search string on characters. But we break the symbol name on words. - var transition = word - ? (currentIsUpper && !lastIsUpper) - : currentIsUpper; - return transition; + return currentIsUpper && (!word || !lastIsUpper); + } + function everyInRange(start, end, pred) { + for (var i = start; i < end; i++) { + if (!pred(i)) { + return false; + } + } + return true; + } + function every(s, pred, start, end) { + if (start === void 0) { start = 0; } + if (end === void 0) { end = s.length; } + return everyInRange(start, end, function (i) { return pred(s.charCodeAt(i), i); }); } })(ts || (ts = {})); var ts; @@ -92304,7 +92638,7 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 185 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 186 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -92386,25 +92720,25 @@ var ts; var argumentsSpan = getApplicableSpanForArguments(list, sourceFile); return { kind: kind, invocation: invocation, argumentsSpan: argumentsSpan, argumentIndex: argumentIndex, argumentCount: argumentCount }; } - else if (node.kind === 13 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 187 /* TaggedTemplateExpression */) { + else if (node.kind === 13 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 188 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile); } } - else if (node.kind === 14 /* TemplateHead */ && node.parent.parent.kind === 187 /* TaggedTemplateExpression */) { + else if (node.kind === 14 /* TemplateHead */ && node.parent.parent.kind === 188 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 200 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 201 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 209 /* TemplateSpan */ && node.parent.parent.parent.kind === 187 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 210 /* TemplateSpan */ && node.parent.parent.parent.kind === 188 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 200 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 201 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 16 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -92539,7 +92873,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 === 200 /* TemplateExpression */) { + if (template.kind === 201 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -92548,7 +92882,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 272 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 273 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -92682,8 +93016,8 @@ var ts; var isJsFile = ts.isSourceFileJavaScript(sourceFile); function check(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: if (isJsFile) { var symbol = node.symbol; if (symbol.members && (symbol.members.size > 0)) { @@ -92717,12 +93051,12 @@ var ts; ts.computeSuggestionDiagnostics = computeSuggestionDiagnostics; function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings.kind === 244 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings.kind === 245 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -92742,7 +93076,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* Class */) { - return ts.getDeclarationOfKind(symbol, 203 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 204 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; } if (flags & 384 /* Enum */) @@ -92822,11 +93156,11 @@ var ts; // If we requested completions after `x.` at the top-level, we may be at a source file location. switch (location.parent && location.parent.kind) { // If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'. - case 255 /* JsxOpeningElement */: - case 253 /* JsxElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 254 /* JsxElement */: + case 255 /* JsxSelfClosingElement */: return location.kind === 71 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */; - case 260 /* JsxAttribute */: + case 261 /* JsxAttribute */: return "JSX attribute" /* jsxAttribute */; default: return "property" /* memberVariableElement */; @@ -92865,7 +93199,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location); - if (location.parent && location.parent.kind === 183 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 184 /* 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)) { @@ -92886,7 +93220,7 @@ var ts; if (callExpressionLike) { var candidateSignatures = []; signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); - var useConstructSignatures = callExpressionLike.kind === 186 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 97 /* SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 187 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 97 /* SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -92923,7 +93257,7 @@ var ts; // If it is call or construct signature of lambda's write type name displayParts.push(ts.punctuationPart(56 /* ColonToken */)); displayParts.push(ts.spacePart()); - if (!(type.flags & 65536 /* Object */ && type.objectFlags & 16 /* Anonymous */) && type.symbol) { + if (!(ts.getObjectFlags(type) & 16 /* Anonymous */) && type.symbol) { ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 4 /* AllowAnyNodeKind */ | 1 /* WriteTypeParametersOrArguments */)); displayParts.push(ts.lineBreakPart()); } @@ -92973,7 +93307,7 @@ var ts; } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 203 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 204 /* 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 @@ -93017,7 +93351,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 237 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 238 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 71 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 130 /* NamespaceKeyword */ : 129 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -93054,7 +93388,7 @@ var ts; } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 235 /* TypeAliasDeclaration */) { + else if (declaration.kind === 236 /* TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path @@ -93071,7 +93405,7 @@ var ts; symbolKind = "enum member" /* enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 271 /* EnumMember */) { + if (declaration.kind === 272 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -93100,12 +93434,12 @@ var ts; } } switch (symbol.declarations[0].kind) { - case 240 /* NamespaceExportDeclaration */: + case 241 /* NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(84 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(130 /* NamespaceKeyword */)); break; - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: displayParts.push(ts.keywordPart(84 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 58 /* EqualsToken */ : 79 /* DefaultKeyword */)); @@ -93116,7 +93450,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 241 /* ImportEqualsDeclaration */) { + if (declaration.kind === 242 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -93194,10 +93528,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 && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 272 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 273 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 198 /* BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 199 /* BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -93302,16 +93636,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 190 /* FunctionExpression */) { + if (declaration.kind === 191 /* FunctionExpression */) { return true; } - if (declaration.kind !== 230 /* VariableDeclaration */ && declaration.kind !== 232 /* FunctionDeclaration */) { + if (declaration.kind !== 231 /* VariableDeclaration */ && declaration.kind !== 233 /* 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 === 272 /* SourceFile */ || parent.kind === 238 /* ModuleBlock */) { + if (parent.kind === 273 /* SourceFile */ || parent.kind === 239 /* ModuleBlock */) { return false; } } @@ -93423,7 +93757,7 @@ var ts; return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.cloneCompilerOptions(options); - var _loop_10 = function (opt) { + var _loop_11 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -93442,7 +93776,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_10(opt); + _loop_11(opt); } return options; } @@ -93621,10 +93955,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 260 /* JsxAttribute */: - case 255 /* JsxOpeningElement */: - case 256 /* JsxClosingElement */: - case 254 /* JsxSelfClosingElement */: + case 261 /* JsxAttribute */: + case 256 /* JsxOpeningElement */: + case 257 /* JsxClosingElement */: + case 255 /* 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 === 71 /* Identifier */; } @@ -93955,7 +94289,7 @@ var ts; rule("NoSpaceBetweenCloseParenAndAngularBracket", 20 /* CloseParenToken */, 27 /* LessThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), rule("NoSpaceAfterOpenAngularBracket", 27 /* LessThanToken */, anyToken, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), rule("NoSpaceBeforeCloseAngularBracket", anyToken, 29 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), - rule("NoSpaceAfterCloseAngularBracket", 29 /* GreaterThanToken */, [19 /* OpenParenToken */, 21 /* OpenBracketToken */, 29 /* GreaterThanToken */, 26 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), + rule("NoSpaceAfterCloseAngularBracket", 29 /* GreaterThanToken */, [19 /* OpenParenToken */, 21 /* OpenBracketToken */, 29 /* GreaterThanToken */, 26 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/], 8 /* Delete */), // decorators rule("SpaceBeforeAt", [20 /* CloseParenToken */, 71 /* Identifier */], 57 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */), rule("NoSpaceAfterAt", 57 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */), @@ -94104,44 +94438,44 @@ var ts; return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 218 /* ForStatement */; + return context.contextNode.kind === 219 /* ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 198 /* BinaryExpression */: - case 199 /* ConditionalExpression */: + case 199 /* BinaryExpression */: + case 200 /* ConditionalExpression */: case 170 /* ConditionalType */: - case 206 /* AsExpression */: - case 250 /* ExportSpecifier */: - case 246 /* ImportSpecifier */: + case 207 /* AsExpression */: + case 251 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: case 160 /* TypePredicate */: case 168 /* UnionType */: case 169 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 180 /* BindingElement */: + case 181 /* BindingElement */: // equals in type X = ... - case 235 /* TypeAliasDeclaration */: + case 236 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: // equal in p = 0; case 148 /* Parameter */: - case 271 /* EnumMember */: + case 272 /* EnumMember */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return context.currentTokenSpan.kind === 58 /* EqualsToken */ || context.nextTokenSpan.kind === 58 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: // "in" keyword in [P in keyof T]: T[P] case 147 /* TypeParameter */: return context.currentTokenSpan.kind === 92 /* InKeyword */ || context.nextTokenSpan.kind === 92 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: return context.currentTokenSpan.kind === 144 /* OfKeyword */ || context.nextTokenSpan.kind === 144 /* OfKeyword */; } return false; @@ -94157,18 +94491,18 @@ var ts; return contextKind === 151 /* PropertyDeclaration */ || contextKind === 150 /* PropertySignature */ || contextKind === 148 /* Parameter */ || - contextKind === 230 /* VariableDeclaration */ || + contextKind === 231 /* VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 199 /* ConditionalExpression */ || + return context.contextNode.kind === 200 /* ConditionalExpression */ || context.contextNode.kind === 170 /* ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 178 /* ObjectBindingPattern */ || + return context.contextNode.kind === 179 /* ObjectBindingPattern */ || context.contextNode.kind === 176 /* MappedType */ || isSingleLineBlockContext(context); } @@ -94195,17 +94529,17 @@ var ts; return true; } switch (node.kind) { - case 211 /* Block */: - case 239 /* CaseBlock */: - case 182 /* ObjectLiteralExpression */: - case 238 /* ModuleBlock */: + case 212 /* Block */: + case 240 /* CaseBlock */: + case 183 /* ObjectLiteralExpression */: + case 239 /* ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: @@ -94213,52 +94547,55 @@ var ts; case 156 /* SetAccessor */: // case SyntaxKind.MethodSignature: case 157 /* CallSignature */: - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: case 154 /* Constructor */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 234 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 235 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; } + function isNotFunctionDeclContext(context) { + return !isFunctionDeclContext(context); + } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 232 /* FunctionDeclaration */ || context.contextNode.kind === 190 /* FunctionExpression */; + return context.contextNode.kind === 233 /* FunctionDeclaration */ || context.contextNode.kind === 191 /* FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: case 165 /* TypeLiteral */: - case 237 /* ModuleDeclaration */: - case 248 /* ExportDeclaration */: - case 249 /* NamedExports */: - case 242 /* ImportDeclaration */: - case 245 /* NamedImports */: + case 238 /* ModuleDeclaration */: + case 249 /* ExportDeclaration */: + case 250 /* NamedExports */: + case 243 /* ImportDeclaration */: + case 246 /* NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 233 /* ClassDeclaration */: - case 237 /* ModuleDeclaration */: - case 236 /* EnumDeclaration */: - case 267 /* CatchClause */: - case 238 /* ModuleBlock */: - case 225 /* SwitchStatement */: + case 234 /* ClassDeclaration */: + case 238 /* ModuleDeclaration */: + case 237 /* EnumDeclaration */: + case 268 /* CatchClause */: + case 239 /* ModuleBlock */: + case 226 /* SwitchStatement */: return true; - case 211 /* Block */: { + case 212 /* 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 !== 191 /* ArrowFunction */ && blockParent.kind !== 190 /* FunctionExpression */) { + if (!blockParent || blockParent.kind !== 192 /* ArrowFunction */ && blockParent.kind !== 191 /* FunctionExpression */) { return true; } } @@ -94267,31 +94604,31 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 215 /* IfStatement */: - case 225 /* SwitchStatement */: - case 218 /* ForStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 217 /* WhileStatement */: - case 228 /* TryStatement */: - case 216 /* DoStatement */: - case 224 /* WithStatement */: + case 216 /* IfStatement */: + case 226 /* SwitchStatement */: + case 219 /* ForStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 218 /* WhileStatement */: + case 229 /* TryStatement */: + case 217 /* DoStatement */: + case 225 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 267 /* CatchClause */: + case 268 /* CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 182 /* ObjectLiteralExpression */; + return context.contextNode.kind === 183 /* ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 185 /* CallExpression */; + return context.contextNode.kind === 186 /* CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 186 /* NewExpression */; + return context.contextNode.kind === 187 /* NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -94303,25 +94640,25 @@ var ts; return context.nextTokenSpan.kind !== 22 /* CloseBracketToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 191 /* ArrowFunction */; + return context.contextNode.kind === 192 /* ArrowFunction */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 253 /* JsxElement */ && context.contextNode.kind !== 257 /* JsxFragment */; + return context.contextNode.kind !== 254 /* JsxElement */ && context.contextNode.kind !== 258 /* JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 263 /* JsxExpression */ || context.contextNode.kind === 262 /* JsxSpreadAttribute */; + return context.contextNode.kind === 264 /* JsxExpression */ || context.contextNode.kind === 263 /* JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 260 /* JsxAttribute */; + return context.nextTokenParent.kind === 261 /* JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 260 /* JsxAttribute */; + return context.contextNode.kind === 261 /* JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 254 /* JsxSelfClosingElement */; + return context.contextNode.kind === 255 /* JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -94339,14 +94676,14 @@ var ts; return node.kind === 149 /* Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 231 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 232 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 237 /* ModuleDeclaration */; + return context.contextNode.kind === 238 /* ModuleDeclaration */; } function isObjectTypeContext(context) { return context.contextNode.kind === 165 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; @@ -94360,21 +94697,21 @@ var ts; } switch (parent.kind) { case 161 /* TypeReference */: - case 188 /* TypeAssertionExpression */: - case 235 /* TypeAliasDeclaration */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 189 /* TypeAssertionExpression */: + case 236 /* TypeAliasDeclaration */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 205 /* ExpressionWithTypeArguments */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 206 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -94385,16 +94722,16 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 188 /* TypeAssertionExpression */; + return context.contextNode.kind === 189 /* TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 105 /* VoidKeyword */ && context.currentTokenParent.kind === 194 /* VoidExpression */; + return context.currentTokenSpan.kind === 105 /* VoidKeyword */ && context.currentTokenParent.kind === 195 /* VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 201 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 202 /* YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 207 /* NonNullExpression */; + return context.contextNode.kind === 208 /* NonNullExpression */; } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -94633,17 +94970,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 233 /* ClassDeclaration */: - case 234 /* InterfaceDeclaration */: + case 234 /* ClassDeclaration */: + case 235 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 238 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 272 /* SourceFile */: - case 211 /* Block */: - case 238 /* ModuleBlock */: + return body && body.kind === 239 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 273 /* SourceFile */: + case 212 /* Block */: + case 239 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -94747,7 +95084,7 @@ var ts; if (previousLine !== -1 /* Unknown */ && line !== previousLine) { break; } - if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) { + if (formatting.SmartIndenter.shouldIndentChildNode(options, n, child, sourceFile)) { return options.indentSize; } previousLine = line; @@ -94834,7 +95171,7 @@ var ts; return -1 /* Unknown */; } function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { - var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0; + var delta = formatting.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; if (effectiveParentStartLine === startLine) { // if node is located on the same line with the parent // - inherit indentation from the parent @@ -94866,10 +95203,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 233 /* ClassDeclaration */: return 75 /* ClassKeyword */; - case 234 /* InterfaceDeclaration */: return 109 /* InterfaceKeyword */; - case 232 /* FunctionDeclaration */: return 89 /* FunctionKeyword */; - case 236 /* EnumDeclaration */: return 236 /* EnumDeclaration */; + case 234 /* ClassDeclaration */: return 75 /* ClassKeyword */; + case 235 /* InterfaceDeclaration */: return 109 /* InterfaceKeyword */; + case 233 /* FunctionDeclaration */: return 89 /* FunctionKeyword */; + case 237 /* EnumDeclaration */: return 237 /* EnumDeclaration */; case 155 /* GetAccessor */: return 125 /* GetKeyword */; case 156 /* SetAccessor */: return 136 /* SetKeyword */; case 153 /* MethodDeclaration */: @@ -94903,9 +95240,9 @@ var ts; getIndentation: function () { return indentation; }, getDelta: getDelta, recomputeIndentation: function (lineAdded) { - if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(options, node.parent, node, sourceFile)) { indentation += lineAdded ? options.indentSize : -options.indentSize; - delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0; + delta = formatting.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; } } }; @@ -94923,9 +95260,9 @@ var ts; case 41 /* SlashToken */: case 29 /* GreaterThanToken */: switch (container.kind) { - case 255 /* JsxOpeningElement */: - case 256 /* JsxClosingElement */: - case 254 /* JsxSelfClosingElement */: + case 256 /* JsxOpeningElement */: + case 257 /* JsxClosingElement */: + case 255 /* JsxSelfClosingElement */: return false; } break; @@ -94943,7 +95280,7 @@ var ts; } function getDelta(child) { // Delta value should be zero when the node explicitly prevents indentation of the child node - return formatting.SmartIndenter.nodeWillIndentChild(node, child, /*indentByDefault*/ true) ? delta : 0; + return formatting.SmartIndenter.nodeWillIndentChild(options, node, child, sourceFile, /*indentByDefault*/ true) ? delta : 0; } } function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { @@ -95031,7 +95368,7 @@ var ts; indentMultilineCommentOrJsxText(range, childIndentation.indentation, /*firstLineIsIndented*/ true, /*indentFinalLine*/ false); } childContextNode = node; - if (isFirstListItem && parent.kind === 181 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent.kind === 182 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -95443,11 +95780,11 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 154 /* Constructor */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (node.typeParameters === list) { return 27 /* LessThanToken */; } @@ -95455,8 +95792,8 @@ var ts; return 19 /* OpenParenToken */; } break; - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: if (node.typeArguments === list) { return 27 /* LessThanToken */; } @@ -95581,7 +95918,7 @@ var ts; if (options.indentStyle === ts.IndentStyle.Block) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 26 /* CommaToken */ && precedingToken.parent.kind !== 198 /* BinaryExpression */) { + if (precedingToken.kind === 26 /* CommaToken */ && precedingToken.parent.kind !== 199 /* 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 /* Unknown */) { @@ -95626,7 +95963,7 @@ var ts; var previous; var current = precedingToken; while (current) { - if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous, /*isNextChild*/ true)) { + if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(options, current, previous, sourceFile, /*isNextChild*/ true)) { var currentStart = getStartLineAndCharacterForNode(current, sourceFile); var nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile); var indentationDelta = nextTokenKind !== 0 /* Unknown */ @@ -95692,7 +96029,7 @@ var ts; } } // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line - if (shouldIndentChildNode(parent, current, isNextChild) && !parentAndChildShareLine) { + if (shouldIndentChildNode(options, parent, current, sourceFile, isNextChild) && !parentAndChildShareLine) { indentationDelta += options.indentSize; } // In our AST, a call argument's `parent` is the call-expression, not the argument list. @@ -95737,7 +96074,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 === 272 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 273 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -95785,7 +96122,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 215 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 216 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 82 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -95802,13 +96139,13 @@ var ts; switch (node.parent.kind) { case 161 /* TypeReference */: return getListIfStartEndIsInListRange(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd()); - case 182 /* ObjectLiteralExpression */: + case 183 /* ObjectLiteralExpression */: return node.parent.properties; - case 181 /* ArrayLiteralExpression */: + case 182 /* ArrayLiteralExpression */: return node.parent.elements; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 157 /* CallSignature */: @@ -95819,18 +96156,18 @@ var ts; return getListIfStartEndIsInListRange(node.parent.typeParameters, start, node.getEnd()) || getListIfStartEndIsInListRange(node.parent.parameters, start, node.getEnd()); } - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: return getListIfStartEndIsInListRange(node.parent.typeParameters, node.getStart(sourceFile), node.getEnd()); - case 186 /* NewExpression */: - case 185 /* CallExpression */: { + case 187 /* NewExpression */: + case 186 /* CallExpression */: { var start = node.getStart(sourceFile); return getListIfStartEndIsInListRange(node.parent.typeArguments, start, node.getEnd()) || getListIfStartEndIsInListRange(node.parent.arguments, start, node.getEnd()); } - case 231 /* VariableDeclarationList */: + case 232 /* VariableDeclarationList */: return getListIfStartEndIsInListRange(node.parent.declarations, node.getStart(sourceFile), node.getEnd()); - case 245 /* NamedImports */: - case 249 /* NamedExports */: + case 246 /* NamedImports */: + case 250 /* NamedExports */: return getListIfStartEndIsInListRange(node.parent.elements, node.getStart(sourceFile), node.getEnd()); } } @@ -95870,10 +96207,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 183 /* PropertyAccessExpression */: - case 184 /* ElementAccessExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 184 /* PropertyAccessExpression */: + case 185 /* ElementAccessExpression */: node = node.expression; break; default: @@ -95937,37 +96274,37 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 214 /* ExpressionStatement */: - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 236 /* EnumDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 181 /* ArrayLiteralExpression */: - case 211 /* Block */: - case 238 /* ModuleBlock */: - case 182 /* ObjectLiteralExpression */: + case 215 /* ExpressionStatement */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 237 /* EnumDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 182 /* ArrayLiteralExpression */: + case 212 /* Block */: + case 239 /* ModuleBlock */: + case 183 /* ObjectLiteralExpression */: case 165 /* TypeLiteral */: case 176 /* MappedType */: case 167 /* TupleType */: - case 239 /* CaseBlock */: - case 265 /* DefaultClause */: - case 264 /* CaseClause */: - case 189 /* ParenthesizedExpression */: - case 183 /* PropertyAccessExpression */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 212 /* VariableStatement */: - case 230 /* VariableDeclaration */: - case 247 /* ExportAssignment */: - case 223 /* ReturnStatement */: - case 199 /* ConditionalExpression */: - case 179 /* ArrayBindingPattern */: - case 178 /* ObjectBindingPattern */: - case 255 /* JsxOpeningElement */: - case 258 /* JsxOpeningFragment */: - case 254 /* JsxSelfClosingElement */: - case 263 /* JsxExpression */: + case 240 /* CaseBlock */: + case 266 /* DefaultClause */: + case 265 /* CaseClause */: + case 190 /* ParenthesizedExpression */: + case 184 /* PropertyAccessExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 213 /* VariableStatement */: + case 231 /* VariableDeclaration */: + case 248 /* ExportAssignment */: + case 224 /* ReturnStatement */: + case 200 /* ConditionalExpression */: + case 180 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 256 /* JsxOpeningElement */: + case 259 /* JsxOpeningFragment */: + case 255 /* JsxSelfClosingElement */: + case 264 /* JsxExpression */: case 152 /* MethodSignature */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: @@ -95975,44 +96312,51 @@ var ts; case 162 /* FunctionType */: case 163 /* ConstructorType */: case 172 /* ParenthesizedType */: - case 187 /* TaggedTemplateExpression */: - case 195 /* AwaitExpression */: - case 249 /* NamedExports */: - case 245 /* NamedImports */: - case 250 /* ExportSpecifier */: - case 246 /* ImportSpecifier */: - case 268 /* PropertyAssignment */: + case 188 /* TaggedTemplateExpression */: + case 196 /* AwaitExpression */: + case 250 /* NamedExports */: + case 246 /* NamedImports */: + case 251 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 269 /* PropertyAssignment */: case 151 /* PropertyDeclaration */: return true; } return false; } - function nodeWillIndentChild(parent, child, indentByDefault) { + function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 216 /* DoStatement */: - case 217 /* WhileStatement */: - case 219 /* ForInStatement */: - case 220 /* ForOfStatement */: - case 218 /* ForStatement */: - case 215 /* IfStatement */: - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 231 /* VariableDeclaration */: + case 269 /* PropertyAssignment */: + case 183 /* ObjectLiteralExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 183 /* ObjectLiteralExpression */) { + return rangeIsOnOneLine(sourceFile, child); + } + break; + case 217 /* DoStatement */: + case 218 /* WhileStatement */: + case 220 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 219 /* ForStatement */: + case 216 /* IfStatement */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: case 154 /* Constructor */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: - return childKind !== 211 /* Block */; - case 248 /* ExportDeclaration */: - return childKind !== 249 /* NamedExports */; - case 242 /* ImportDeclaration */: - return childKind !== 243 /* ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 245 /* NamedImports */); - case 253 /* JsxElement */: - return childKind !== 256 /* JsxClosingElement */; - case 257 /* JsxFragment */: - return childKind !== 259 /* JsxClosingFragment */; + return childKind !== 212 /* Block */; + case 249 /* ExportDeclaration */: + return childKind !== 250 /* NamedExports */; + case 243 /* ImportDeclaration */: + return childKind !== 244 /* ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 246 /* NamedImports */); + case 254 /* JsxElement */: + return childKind !== 257 /* JsxClosingElement */; + case 258 /* JsxFragment */: + return childKind !== 260 /* JsxClosingFragment */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -96020,17 +96364,17 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 223 /* ReturnStatement */: - case 227 /* ThrowStatement */: { - if (parent.kind !== 211 /* Block */) { + case 224 /* ReturnStatement */: + case 228 /* ThrowStatement */: { + if (parent.kind !== 212 /* Block */) { return true; } var grandParent = parent.parent; // In a function, we may want to write inner functions after this. - return !(grandParent && grandParent.kind === 190 /* FunctionExpression */ || grandParent.kind === 232 /* FunctionDeclaration */); + return !(grandParent && grandParent.kind === 191 /* FunctionExpression */ || grandParent.kind === 233 /* FunctionDeclaration */); } - case 221 /* ContinueStatement */: - case 222 /* BreakStatement */: + case 222 /* ContinueStatement */: + case 223 /* BreakStatement */: return true; default: return false; @@ -96040,12 +96384,18 @@ var ts; * True when the parent node should indent the given child by an explicit rule. * @param isNextChild If true, we are judging indent of a hypothetical child *after* this one, not the current child. */ - function shouldIndentChildNode(parent, child, isNextChild) { + function shouldIndentChildNode(settings, parent, child, sourceFile, isNextChild) { if (isNextChild === void 0) { isNextChild = false; } - return (nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, /*indentByDefault*/ false)) + return (nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(settings, parent, child, sourceFile, /*indentByDefault*/ false)) && !(isNextChild && child && isControlFlowEndingStatement(child.kind, parent)); } SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; + function rangeIsOnOneLine(sourceFile, range) { + var rangeStart = ts.skipTrivia(sourceFile.text, range.pos); + var startLine = sourceFile.getLineAndCharacterOfPosition(rangeStart).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(range.end).line; + return startLine === endLine; + } })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -96153,7 +96503,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 === 26 /* CommaToken */ || (candidate.kind === 25 /* SemicolonToken */ && node.parent.kind === 182 /* ObjectLiteralExpression */)); + return candidate && node.parent && (candidate.kind === 26 /* CommaToken */ || (candidate.kind === 25 /* SemicolonToken */ && node.parent.kind === 183 /* ObjectLiteralExpression */)); } function spaces(count) { var s = ""; @@ -96310,12 +96660,21 @@ var ts; this.changes.push({ kind: ChangeKind.Text, sourceFile: sourceFile, range: { pos: pos, end: pos }, text: text }); }; /** Prefer this over replacing a node with another that has a type annotation, as it avoids reformatting the other parts of the node. */ - ChangeTracker.prototype.insertTypeAnnotation = function (sourceFile, node, type) { - var end = (ts.isFunctionLike(node) - // If no `)`, is an arrow function `x => x`, so use the end of the first parameter - ? ts.findChildOfKind(node, 20 /* CloseParenToken */, sourceFile) || ts.first(node.parameters) - : node.kind !== 230 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name).end; - this.insertNodeAt(sourceFile, end, type, { prefix: ": " }); + ChangeTracker.prototype.tryInsertTypeAnnotation = function (sourceFile, node, type) { + var endNode; + if (ts.isFunctionLike(node)) { + endNode = ts.findChildOfKind(node, 20 /* CloseParenToken */, sourceFile); + if (!endNode) { + if (!ts.isArrowFunction(node)) + return; // Function missing parentheses, give up + // If no `)`, is an arrow function `x => x`, so use the end of the first parameter + endNode = ts.first(node.parameters); + } + } + else { + endNode = node.kind !== 231 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name; + } + this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); }; ChangeTracker.prototype.insertTypeParameters = function (sourceFile, node, typeParameters) { // If no `(`, is an arrow function `x => x`, so use the pos of the first parameter @@ -96525,7 +96884,7 @@ var ts; var _this = this; this.nodesInsertedAtClassStarts.forEach(function (_a) { var sourceFile = _a.sourceFile, cls = _a.cls, members = _a.members; - var newCls = cls.kind === 233 /* ClassDeclaration */ + var newCls = cls.kind === 234 /* ClassDeclaration */ ? ts.updateClassDeclaration(cls, cls.decorators, cls.modifiers, cls.name, cls.typeParameters, cls.heritageClauses, members) : ts.updateClassExpression(cls, cls.modifiers, cls.name, cls.typeParameters, cls.heritageClauses, members); _this.replaceNode(sourceFile, cls, newCls); @@ -96551,14 +96910,14 @@ var ts; var sourceFile = changesInFile[0].sourceFile; // order changes by start position var normalized = ts.stableSort(changesInFile, function (a, b) { return a.range.pos - b.range.pos; }); - var _loop_11 = function (i) { + var _loop_12 = function (i) { ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () { return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range); }); }; // verify that change intervals do not overlap, except possibly at end points. for (var i = 0; i < normalized.length - 1; i++) { - _loop_11(i); + _loop_12(i); } var textChanges = normalized.map(function (c) { return ts.createTextChange(ts.createTextSpanFromRange(c.range), computeNewText(c, sourceFile, newLineCharacter, formatContext, validate)); @@ -96594,7 +96953,7 @@ var ts; ? indentation : ts.formatting.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix === newLineCharacter || ts.getLineStartPositionForPosition(pos, sourceFile) === pos); if (delta === undefined) { - delta = ts.formatting.SmartIndenter.shouldIndentChildNode(nodeIn) ? (formatOptions.indentSize || 0) : 0; + delta = ts.formatting.SmartIndenter.shouldIndentChildNode(formatContext.options, nodeIn) ? (formatOptions.indentSize || 0) : 0; } var file = { text: text, getLineAndCharacterOfPosition: function (pos) { return ts.getLineAndCharacterOfPosition(this, pos); } }; var changes = ts.formatting.formatNodeGivenIndentation(node, file, sourceFile.languageVariant, initialIndentation, delta, formatContext); @@ -97015,7 +97374,7 @@ var ts; if (!param.type) { var paramType = ts.getJSDocType(param); if (paramType) - changes.insertTypeAnnotation(sourceFile, param, transformJSDocType(paramType)); + changes.tryInsertTypeAnnotation(sourceFile, param, transformJSDocType(paramType)); } } if (needParens) @@ -97023,35 +97382,35 @@ var ts; if (!decl.type) { var returnType = ts.getJSDocReturnType(decl); if (returnType) - changes.insertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType)); + changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType)); } } else { var jsdocType = ts.Debug.assertDefined(ts.getJSDocType(decl)); // If not defined, shouldn't have been an error to fix ts.Debug.assert(!decl.type); // If defined, shouldn't have been an error to fix. - changes.insertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType)); + changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType)); } } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 230 /* VariableDeclaration */ || + node.kind === 231 /* VariableDeclaration */ || node.kind === 150 /* PropertySignature */ || node.kind === 151 /* PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 275 /* JSDocAllType */: - case 276 /* JSDocUnknownType */: + case 276 /* JSDocAllType */: + case 277 /* JSDocUnknownType */: return ts.createTypeReferenceNode("any", ts.emptyArray); - case 279 /* JSDocOptionalType */: + case 280 /* JSDocOptionalType */: return transformJSDocOptionalType(node); - case 278 /* JSDocNonNullableType */: + case 279 /* JSDocNonNullableType */: return transformJSDocType(node.type); - case 277 /* JSDocNullableType */: + case 278 /* JSDocNullableType */: return transformJSDocNullableType(node); - case 281 /* JSDocVariadicType */: + case 282 /* JSDocVariadicType */: return transformJSDocVariadicType(node); - case 280 /* JSDocFunctionType */: + case 281 /* JSDocFunctionType */: return transformJSDocFunctionType(node); case 161 /* TypeReference */: return transformJSDocTypeReference(node); @@ -97075,7 +97434,7 @@ var ts; } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 281 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + var isRest = node.type.kind === 282 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.createToken(24 /* DotDotDotToken */) : node.dotDotDotToken; return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -97151,12 +97510,12 @@ var ts; var precedingNode; var newClassDeclaration; switch (ctorDeclaration.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: precedingNode = ctorDeclaration; deleteNode(ctorDeclaration); newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration); break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: precedingNode = ctorDeclaration.parent.parent; if (ctorDeclaration.parent.declarations.length === 1) { deleteNode(precedingNode); @@ -97216,8 +97575,8 @@ var ts; return ts.isFunctionLike(source); } function createClassElement(symbol, modifiers) { - // both properties and methods are bound as property symbols - if (!(symbol.flags & 4 /* Property */)) { + // Right now the only thing we can convert are function expressions, which are marked as methods + if (!(symbol.flags & 8192 /* Method */)) { return; } var memberDeclaration = symbol.valueDeclaration; @@ -97226,7 +97585,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 === 214 /* ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 215 /* ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; deleteNode(nodeToDelete); if (!assignmentBinaryExpression.right) { @@ -97234,7 +97593,7 @@ var ts; /*type*/ undefined, /*initializer*/ undefined); } switch (assignmentBinaryExpression.right.kind) { - case 190 /* FunctionExpression */: { + case 191 /* FunctionExpression */: { var functionExpression = assignmentBinaryExpression.right; var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 120 /* AsyncKeyword */)); var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined, @@ -97242,12 +97601,12 @@ var ts; copyComments(assignmentBinaryExpression, method, sourceFile); return method; } - case 191 /* ArrowFunction */: { + case 192 /* ArrowFunction */: { var arrowFunction = assignmentBinaryExpression.right; var arrowFunctionBody = arrowFunction.body; var bodyBlock = void 0; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 211 /* Block */) { + if (arrowFunctionBody.kind === 212 /* Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] @@ -97275,7 +97634,7 @@ var ts; } function createClassFromVariableDeclaration(node) { var initializer = node.initializer; - if (!initializer || initializer.kind !== 190 /* FunctionExpression */) { + if (!initializer || initializer.kind !== 191 /* FunctionExpression */) { return undefined; } if (node.name.kind !== 71 /* Identifier */) { @@ -97354,10 +97713,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier)); break; - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.createPropertyAccess(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -97410,20 +97769,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports) { switch (statement.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target); return false; - case 214 /* ExpressionStatement */: { + case 215 /* ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 185 /* CallExpression */: { + case 186 /* CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0])); } return false; } - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var _a = expression, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return operatorToken.kind === 58 /* EqualsToken */ && convertAssignment(sourceFile, checker, statement, left, right, changes, exports); } @@ -97465,8 +97824,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers) { switch (name.kind) { - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: { + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return [ @@ -97516,10 +97875,10 @@ var ts; case 155 /* GetAccessor */: case 156 /* SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. - case 269 /* ShorthandPropertyAssignment */: - case 270 /* SpreadAssignment */: + case 270 /* ShorthandPropertyAssignment */: + case 271 /* SpreadAssignment */: return undefined; - case 268 /* PropertyAssignment */: + case 269 /* PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals(prop.name.text, prop.initializer); case 153 /* MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(84 /* ExportKeyword */)], prop); @@ -97550,18 +97909,18 @@ var ts; function convertModuleExportsToExportDefault(exported, checker) { var modifiers = [ts.createToken(84 /* ExportKeyword */), ts.createToken(79 /* DefaultKeyword */)]; switch (exported.kind) { - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: { + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: { // `module.exports = function f() {}` --> `export default function f() {}` var fn = exported; return [[functionExpressionToDeclaration(fn.name && fn.name.text, modifiers, fn)], true]; } - case 203 /* ClassExpression */: { + case 204 /* ClassExpression */: { // `module.exports = class C {}` --> `export default class C {}` var cls = exported; return [[classExpressionToDeclaration(cls.name && cls.name.text, modifiers, cls)], true]; } - case 185 /* CallExpression */: + case 186 /* CallExpression */: if (ts.isRequireCall(exported, /*checkArgumentIsStringLiteralLike*/ true)) { return convertReExportAll(exported.arguments[0], checker); } @@ -97592,7 +97951,7 @@ var ts; function convertExportsDotXEquals(name, exported) { var modifiers = [ts.createToken(84 /* ExportKeyword */)]; switch (exported.kind) { - case 190 /* FunctionExpression */: { + case 191 /* FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -97600,10 +97959,10 @@ var ts; } } // falls through - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported); - case 203 /* ClassExpression */: + case 204 /* ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported); default: @@ -97621,7 +97980,7 @@ var ts; */ function convertSingleImport(file, name, moduleSpecifier, changes, checker, identifiers, target) { switch (name.kind) { - case 178 /* ObjectBindingPattern */: { + case 179 /* 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 @@ -97632,7 +97991,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 179 /* ArrayBindingPattern */: { + case 180 /* ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -97711,9 +98070,9 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: return parent.name !== node; - case 180 /* BindingElement */: + case 181 /* BindingElement */: return parent.propertyName !== node; default: return true; @@ -97909,40 +98268,19 @@ var ts; if (!ts.isIdentifier(token)) { return undefined; } - var classAndMakeStatic = getClassAndMakeStatic(token, checker); - if (!classAndMakeStatic) { - return undefined; - } - var classDeclaration = classAndMakeStatic.classDeclaration, makeStatic = classAndMakeStatic.makeStatic; - var classDeclarationSourceFile = classDeclaration.getSourceFile(); - var inJs = ts.isInJavaScriptFile(classDeclarationSourceFile); - var call = ts.tryCast(token.parent.parent, ts.isCallExpression); - return { token: token, classDeclaration: classDeclaration, makeStatic: makeStatic, classDeclarationSourceFile: classDeclarationSourceFile, inJs: inJs, call: call }; - } - function getClassAndMakeStatic(token, checker) { var parent = token.parent; - if (!ts.isPropertyAccessExpression(parent)) { + if (!ts.isPropertyAccessExpression(parent)) return undefined; - } - if (parent.expression.kind === 99 /* ThisKeyword */) { - var containingClassMemberDeclaration = ts.getThisContainer(token, /*includeArrowFunctions*/ false); - if (!ts.isClassElement(containingClassMemberDeclaration)) { - return undefined; - } - var classDeclaration = containingClassMemberDeclaration.parent; - // Property accesses on `this` in a static method are accesses of a static member. - return ts.isClassLike(classDeclaration) ? { classDeclaration: classDeclaration, makeStatic: ts.hasModifier(containingClassMemberDeclaration, 32 /* Static */) } : undefined; - } - else { - var leftExpressionType = checker.getTypeAtLocation(parent.expression); - var symbol = leftExpressionType.symbol; - if (!(symbol && leftExpressionType.flags & 65536 /* Object */ && symbol.flags & 32 /* Class */)) { - return undefined; - } - var classDeclaration = ts.cast(ts.first(symbol.declarations), ts.isClassLike); - // The expression is a class symbol but the type is not the instance-side. - return { classDeclaration: classDeclaration, makeStatic: leftExpressionType !== checker.getDeclaredTypeOfSymbol(symbol) }; - } + var leftExpressionType = ts.skipConstraint(checker.getTypeAtLocation(parent.expression)); + var symbol = leftExpressionType.symbol; + var classDeclaration = symbol && symbol.declarations && ts.find(symbol.declarations, ts.isClassLike); + if (!classDeclaration) + return undefined; + var makeStatic = leftExpressionType.target !== checker.getDeclaredTypeOfSymbol(symbol); + var classDeclarationSourceFile = classDeclaration.getSourceFile(); + var inJs = ts.isSourceFileJavaScript(classDeclarationSourceFile); + var call = ts.tryCast(parent.parent, ts.isCallExpression); + return { token: token, classDeclaration: classDeclaration, makeStatic: makeStatic, classDeclarationSourceFile: classDeclarationSourceFile, inJs: inJs, call: call }; } function getActionsForAddMissingMemberInJavaScriptFile(context, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingMemberInJs(t, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic); }); @@ -97951,7 +98289,7 @@ var ts; } function addMissingMemberInJs(changeTracker, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) { if (makeStatic) { - if (classDeclaration.kind === 203 /* ClassExpression */) { + if (classDeclaration.kind === 204 /* ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -97977,7 +98315,7 @@ var ts; } function getTypeNode(checker, classDeclaration, token) { var typeNode; - if (token.parent.parent.kind === 198 /* BinaryExpression */) { + if (token.parent.parent.kind === 199 /* 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))); @@ -98032,36 +98370,48 @@ var ts; var errorCodes = [ ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, + ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2.code, ]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile; - var info = getInfo(sourceFile, context.span.start, context.program.getTypeChecker()); + var info = getInfo(sourceFile, context.span.start, context); if (!info) return undefined; var node = info.node, suggestion = info.suggestion; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestion); }); + var target = context.host.getCompilationSettings().target; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestion, target); }); return [codefix.createCodeFixAction(changes, [ts.Diagnostics.Change_spelling_to_0, suggestion], fixId, ts.Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start, context.program.getTypeChecker()); + var info = getInfo(diag.file, diag.start, context); + var target = context.host.getCompilationSettings().target; if (info) - doChange(changes, context.sourceFile, info.node, info.suggestion); + doChange(changes, context.sourceFile, info.node, info.suggestion, target); }); }, }); - function getInfo(sourceFile, pos, checker) { + function getInfo(sourceFile, pos, context) { // This is the identifier of the misspelled word. eg: // this.speling = 1; // ^^^^^^^ var node = ts.getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false); // TODO: GH#15852 + var checker = context.program.getTypeChecker(); var suggestion; if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) { ts.Debug.assert(node.kind === 71 /* Identifier */); var containingType = checker.getTypeAtLocation(node.parent.expression); suggestion = checker.getSuggestionForNonexistentProperty(node, containingType); } + else if (ts.isImportSpecifier(node.parent) && node.parent.name === node) { + ts.Debug.assert(node.kind === 71 /* Identifier */); + var importDeclaration = ts.findAncestor(node, ts.isImportDeclaration); + var resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration); + if (resolvedSourceFile && resolvedSourceFile.symbol) { + suggestion = checker.getSuggestionForNonexistentModule(node, resolvedSourceFile.symbol); + } + } else { var meaning = ts.getMeaningFromLocation(node); var name = ts.getTextOfNode(node); @@ -98070,8 +98420,13 @@ var ts; } return suggestion === undefined ? undefined : { node: node, suggestion: suggestion }; } - function doChange(changes, sourceFile, node, suggestion) { - changes.replaceNode(sourceFile, node, ts.createIdentifier(suggestion)); + function doChange(changes, sourceFile, node, suggestion, target) { + if (!ts.isIdentifierText(suggestion, target) && ts.isPropertyAccessExpression(node.parent)) { + changes.replaceNode(sourceFile, node.parent, ts.createElementAccess(node.parent.expression, ts.createLiteral(suggestion))); + } + else { + changes.replaceNode(sourceFile, node, ts.createIdentifier(suggestion)); + } } function convertSemanticMeaningToSymbolFlags(meaning) { var flags = 0; @@ -98086,6 +98441,14 @@ var ts; } return flags; } + function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) { + if (!importDeclaration || !ts.isStringLiteralLike(importDeclaration.moduleSpecifier)) + return undefined; + var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text); + if (!resolvedModule) + return undefined; + return context.program.getSourceFile(resolvedModule.resolvedFileName); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -98426,11 +98789,11 @@ var ts; switch (token.parent.kind) { case 148 /* Parameter */: return true; - case 230 /* VariableDeclaration */: { + case 231 /* VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 220 /* ForOfStatement */: - case 219 /* ForInStatement */: + case 221 /* ForOfStatement */: + case 220 /* ForInStatement */: return true; } } @@ -98443,7 +98806,7 @@ var ts; tryDeleteIdentifier(changes, sourceFile, token); break; case 151 /* PropertyDeclaration */: - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: changes.deleteNode(sourceFile, token.parent); break; default: @@ -98461,7 +98824,7 @@ var ts; function tryDeleteIdentifier(changes, sourceFile, identifier) { var parent = identifier.parent; switch (parent.kind) { - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: tryDeleteVariableDeclaration(changes, sourceFile, parent); break; case 147 /* TypeParameter */: @@ -98500,11 +98863,11 @@ var ts; } break; // handle case where 'import a = A;' - case 241 /* ImportEqualsDeclaration */: - var importEquals = ts.getAncestor(identifier, 241 /* ImportEqualsDeclaration */); + case 242 /* ImportEqualsDeclaration */: + var importEquals = ts.getAncestor(identifier, 242 /* ImportEqualsDeclaration */); changes.deleteNode(sourceFile, importEquals); break; - case 246 /* ImportSpecifier */: + case 247 /* ImportSpecifier */: var namedImports = parent.parent; if (namedImports.elements.length === 1) { tryDeleteNamedImportBinding(changes, sourceFile, namedImports); @@ -98514,10 +98877,10 @@ var ts; changes.deleteNodeInList(sourceFile, parent); } break; - case 243 /* ImportClause */: // this covers both 'import |d|' and 'import |d,| *' + case 244 /* ImportClause */: // this covers both 'import |d|' and 'import |d,| *' var importClause = parent; if (!importClause.namedBindings) { // |import d from './file'| - changes.deleteNode(sourceFile, ts.getAncestor(importClause, 242 /* ImportDeclaration */)); + changes.deleteNode(sourceFile, ts.getAncestor(importClause, 243 /* ImportDeclaration */)); } else { // import |d,| * as ns from './file' @@ -98533,7 +98896,7 @@ var ts; } } break; - case 244 /* NamespaceImport */: + case 245 /* NamespaceImport */: tryDeleteNamedImportBinding(changes, sourceFile, parent); break; default: @@ -98555,14 +98918,14 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(namedBindings, 242 /* ImportDeclaration */); + var importDecl = ts.getAncestor(namedBindings, 243 /* ImportDeclaration */); changes.deleteNode(sourceFile, importDecl); } } // token.parent is a variableDeclaration function tryDeleteVariableDeclaration(changes, sourceFile, varDecl) { switch (varDecl.parent.parent.kind) { - case 218 /* ForStatement */: { + case 219 /* ForStatement */: { var forStatement = varDecl.parent.parent; var forInitializer = forStatement.initializer; if (forInitializer.declarations.length === 1) { @@ -98573,14 +98936,14 @@ var ts; } break; } - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: var forOfStatement = varDecl.parent.parent; - ts.Debug.assert(forOfStatement.initializer.kind === 231 /* VariableDeclarationList */); + ts.Debug.assert(forOfStatement.initializer.kind === 232 /* VariableDeclarationList */); var forOfInitializer = forOfStatement.initializer; changes.replaceNode(sourceFile, forOfInitializer.declarations[0], ts.createObjectLiteral()); break; - case 219 /* ForInStatement */: - case 228 /* TryStatement */: + case 220 /* ForInStatement */: + case 229 /* TryStatement */: break; default: var variableStatement = varDecl.parent.parent; @@ -98613,7 +98976,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 === 277 /* JSDocNullableType */) { + if (typeNode.kind === 278 /* 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, 4096 /* Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -98633,7 +98996,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 277 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 4096 /* Undefined */) : type; + var fixedType = typeNode.kind === 278 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 4096 /* Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -98650,10 +99013,10 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 206 /* AsExpression */: + case 207 /* AsExpression */: case 157 /* CallSignature */: case 158 /* ConstructSignature */: - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 155 /* GetAccessor */: case 159 /* IndexSignature */: case 176 /* MappedType */: @@ -98663,9 +99026,9 @@ var ts; case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: case 156 /* SetAccessor */: - case 235 /* TypeAliasDeclaration */: - case 188 /* TypeAssertionExpression */: - case 230 /* VariableDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 189 /* TypeAssertionExpression */: + case 231 /* VariableDeclaration */: return true; default: return false; @@ -98722,11 +99085,11 @@ var ts; case 153 /* MethodDeclaration */: insertBefore = containingFunction.name; break; - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 89 /* FunctionKeyword */, sourceFile); break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: insertBefore = ts.findChildOfKind(containingFunction, 19 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters); break; default: @@ -98847,9 +99210,9 @@ var ts; return useExistingImportActions.concat(getCodeActionsForAddImport(exportInfos, context, existingImports)); } function getNamespaceImportName(declaration) { - if (declaration.kind === 242 /* ImportDeclaration */) { + if (declaration.kind === 243 /* ImportDeclaration */) { var namedBindings = declaration.importClause && ts.isImportClause(declaration.importClause) && declaration.importClause.namedBindings; - return namedBindings && namedBindings.kind === 244 /* NamespaceImport */ ? namedBindings.name : undefined; + return namedBindings && namedBindings.kind === 245 /* NamespaceImport */ ? namedBindings.name : undefined; } else { return declaration.name; @@ -98865,7 +99228,7 @@ var ts; if (!cached) { cached = cachedImportDeclarations[moduleSymbolId] = ts.mapDefined(imports, function (moduleSpecifier) { var i = ts.importFromModuleSpecifier(moduleSpecifier); - return (i.kind === 242 /* ImportDeclaration */ || i.kind === 241 /* ImportEqualsDeclaration */) + return (i.kind === 243 /* ImportDeclaration */ || i.kind === 242 /* ImportEqualsDeclaration */) && checker.getSymbolAtLocation(moduleSpecifier) === moduleSymbol ? { declaration: i, importKind: importKind } : undefined; }); } @@ -99198,7 +99561,7 @@ var ts; function getCodeActionsForAddImport(exportInfos, ctx, existingImports) { var fromExistingImport = ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind; - if (declaration.kind === 242 /* ImportDeclaration */ && declaration.importClause) { + if (declaration.kind === 243 /* ImportDeclaration */ && declaration.importClause) { var changes = tryUpdateExistingImport(ctx, ts.isImportClause(declaration.importClause) && declaration.importClause || undefined, importKind); if (changes) { var moduleSpecifierWithoutQuotes = ts.stripQuotes(declaration.moduleSpecifier.getText()); @@ -99217,9 +99580,9 @@ var ts; } function newImportInfoFromExistingSpecifier(_a) { var declaration = _a.declaration, importKind = _a.importKind; - var expression = declaration.kind === 242 /* ImportDeclaration */ + var expression = declaration.kind === 243 /* ImportDeclaration */ ? declaration.moduleSpecifier - : declaration.moduleReference.kind === 252 /* ExternalModuleReference */ + : declaration.moduleReference.kind === 253 /* ExternalModuleReference */ ? declaration.moduleReference.expression : undefined; return expression && ts.isStringLiteral(expression) ? { moduleSpecifier: expression.text, importKind: importKind } : undefined; @@ -99227,7 +99590,7 @@ var ts; function tryUpdateExistingImport(context, importClause, importKind) { var symbolName = context.symbolName, sourceFile = context.sourceFile; var name = importClause.name; - var namedBindings = (importClause.kind !== 241 /* ImportEqualsDeclaration */ && importClause).namedBindings; + var namedBindings = (importClause.kind !== 242 /* ImportEqualsDeclaration */ && importClause).namedBindings; switch (importKind) { case 1 /* Default */: return name ? undefined : ChangeTracker.with(context, function (t) { @@ -99235,11 +99598,11 @@ var ts; }); case 0 /* Named */: { var newImportSpecifier_1 = ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(symbolName)); - if (namedBindings && namedBindings.kind === 245 /* NamedImports */ && namedBindings.elements.length !== 0) { + if (namedBindings && namedBindings.kind === 246 /* NamedImports */ && namedBindings.elements.length !== 0) { // There are already named imports; add another. return ChangeTracker.with(context, function (t) { return t.insertNodeInListAfter(sourceFile, namedBindings.elements[namedBindings.elements.length - 1], newImportSpecifier_1); }); } - if (!namedBindings || namedBindings.kind === 245 /* NamedImports */ && namedBindings.elements.length === 0) { + if (!namedBindings || namedBindings.kind === 246 /* NamedImports */ && namedBindings.elements.length === 0) { return ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, importClause, ts.createImportClause(name, ts.createNamedImports([newImportSpecifier_1]))); }); @@ -99290,7 +99653,7 @@ var ts; // The error wasn't for the symbolAtLocation, it was for the JSX tag itself, which needs access to e.g. `React`. var parent = token.parent; var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(parent); - if ((ts.isJsxOpeningLikeElement && parent.tagName === token) || parent.kind === 258 /* JsxOpeningFragment */) { + if ((ts.isJsxOpeningLikeElement && parent.tagName === token) || parent.kind === 259 /* JsxOpeningFragment */) { umdSymbol = checker.resolveName(checker.getJsxNamespace(parent), isNodeOpeningLikeElement ? parent.tagName : parent, 67216319 /* Value */, /*excludeGlobals*/ false); } } @@ -99802,11 +100165,11 @@ var ts; } function isApplicableFunctionForInference(declaration) { switch (declaration.kind) { - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 154 /* Constructor */: return true; - case 190 /* FunctionExpression */: + case 191 /* FunctionExpression */: return !!declaration.name; } return false; @@ -99838,7 +100201,7 @@ var ts; function annotate(changes, sourceFile, declaration, type, program) { var typeNode = type && getTypeNodeIfAccessible(type, declaration, program.getTypeChecker()); if (typeNode) - changes.insertTypeAnnotation(sourceFile, declaration, typeNode); + changes.tryInsertTypeAnnotation(sourceFile, declaration, typeNode); } function getTypeNodeIfAccessible(type, enclosingScope, checker) { var typeIsAccessible = true; @@ -99865,8 +100228,8 @@ var ts; function inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) { switch (containingFunction.kind) { case 154 /* Constructor */: - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: var isConstructor = containingFunction.kind === 154 /* Constructor */; var searchToken = isConstructor ? @@ -99934,21 +100297,21 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 197 /* PostfixUnaryExpression */: + case 198 /* PostfixUnaryExpression */: usageContext.isNumber = true; break; - case 196 /* PrefixUnaryExpression */: + case 197 /* PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpressionContext(node.parent, usageContext); break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext); break; - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext); break; - case 185 /* CallExpression */: - case 186 /* NewExpression */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpressionContext(node.parent, checker, usageContext); } @@ -99956,10 +100319,10 @@ var ts; inferTypeFromContextualType(node, checker, usageContext); } break; - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: inferTypeFromPropertyAccessExpressionContext(node.parent, checker, usageContext); break; - case 184 /* ElementAccessExpression */: + case 185 /* ElementAccessExpression */: inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext); break; default: @@ -100061,7 +100424,7 @@ var ts; // LogicalOperator case 54 /* BarBarToken */: if (node === parent.left && - (node.parent.parent.kind === 230 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 231 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usageContext, checker.getTypeAtLocation(parent.right)); @@ -100089,7 +100452,7 @@ var ts; } } inferTypeFromContext(parent, checker, callContext.returnType); - if (parent.kind === 185 /* CallExpression */) { + if (parent.kind === 186 /* CallExpression */) { (usageContext.callContexts || (usageContext.callContexts = [])).push(callContext); } else { @@ -100271,7 +100634,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 185 /* CallExpression */ : 186 /* NewExpression */; + var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 186 /* CallExpression */ : 187 /* NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false), function (a) { return a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length); }); if (!node) { return []; @@ -100386,13 +100749,13 @@ var ts; else if (type.flags & 8 /* Boolean */) { return ts.createFalse(); } - else if (type.flags & 224 /* Literal */) { + else if (type.isLiteral()) { return ts.createLiteral(type.value); } - else if (type.flags & 131072 /* Union */) { + else if (type.isUnion()) { return ts.firstDefined(type.types, function (t) { return getDefaultValueFromType(checker, t); }); } - else if (ts.getObjectFlags(type) & 1 /* Class */) { + else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); if (!classDeclaration || ts.hasModifier(classDeclaration, 128 /* Abstract */)) return undefined; @@ -100780,7 +101143,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 230 /* VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 231 /* VariableDeclaration */) ? node.parent.parent : node; if (ts.hasModifier(declaringNode, 1 /* Export */)) { (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; @@ -100789,13 +101152,13 @@ var ts; } // Some things can't be extracted in certain situations switch (node.kind) { - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; case 97 /* 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 === 185 /* CallExpression */) { + if (node.parent.kind === 186 /* CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -100810,8 +101173,8 @@ var ts; } if (!node || ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node)) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 233 /* ClassDeclaration */: + case 233 /* FunctionDeclaration */: + case 234 /* ClassDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); @@ -100823,20 +101186,20 @@ var ts; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 215 /* IfStatement */: + case 216 /* IfStatement */: permittedJumps = 0 /* None */; break; - case 228 /* TryStatement */: + case 229 /* TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* None */; break; - case 211 /* Block */: - if (node.parent && node.parent.kind === 228 /* TryStatement */ && node.parent.finallyBlock === node) { + case 212 /* Block */: + if (node.parent && node.parent.kind === 229 /* TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* Return */; } break; - case 264 /* CaseClause */: + case 265 /* CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* Break */; break; @@ -100852,7 +101215,7 @@ var ts; case 99 /* ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; break; - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); @@ -100860,8 +101223,8 @@ var ts; seenLabels.pop(); break; } - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: { var label = node.label; if (label) { @@ -100871,20 +101234,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 222 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { + if (!(permittedJumps & (node.kind === 223 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 195 /* AwaitExpression */: + case 196 /* AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 201 /* YieldExpression */: + case 202 /* YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: if (permittedJumps & 4 /* Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -100949,7 +101312,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 272 /* SourceFile */) { + if (current.kind === 273 /* SourceFile */) { return scopes; } } @@ -101041,12 +101404,12 @@ var ts; switch (scope.kind) { case 154 /* Constructor */: return "constructor"; - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: return scope.name ? "function '" + scope.name.text + "'" : "anonymous function"; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: return "arrow function"; case 153 /* MethodDeclaration */: return "method '" + scope.name.getText(); @@ -101059,12 +101422,12 @@ var ts; } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 233 /* ClassDeclaration */ + return scope.kind === 234 /* ClassDeclaration */ ? scope.name ? "class '" + scope.name.text + "'" : "anonymous class declaration" : scope.name ? "class expression '" + scope.name.text + "'" : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 238 /* ModuleBlock */ + return scope.kind === 239 /* ModuleBlock */ ? "namespace '" + scope.parent.name.getText() + "'" : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */; } @@ -101349,7 +101712,7 @@ var ts; var localReference = ts.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 214 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 215 /* 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.createVariableStatement( @@ -101368,7 +101731,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 214 /* ExpressionStatement */) { + if (node.parent.kind === 215 /* ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.deleteNode(context.file, node.parent, ts.textChanges.useNonAdjustedPositions); } @@ -101485,7 +101848,7 @@ var ts; return { body: ts.createBlock(statements, /*multiLine*/ true), returnValueProperty: undefined }; } function visitor(node) { - if (!ignoreReturns && node.kind === 223 /* ReturnStatement */ && hasWritesOrVariableDeclarations) { + if (!ignoreReturns && node.kind === 224 /* ReturnStatement */ && hasWritesOrVariableDeclarations) { var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); if (node.expression) { if (!returnValueProperty) { @@ -101665,7 +102028,7 @@ var ts; var scope = scopes_1[_i]; usagesPerScope.push({ usages: ts.createMap(), typeParameterUsages: ts.createMap(), substitutions: ts.createMap() }); substitutionsPerScope.push(ts.createMap()); - functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 232 /* FunctionDeclaration */ + functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 233 /* FunctionDeclaration */ ? [ts.createDiagnosticForNode(scope, Messages.cannotExtractToOtherFunctionLike)] : []); var constantErrors = []; @@ -101728,7 +102091,7 @@ var ts; : ts.getEnclosingBlockScopeContainer(scopes[0]); ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations); } - var _loop_12 = function (i) { + var _loop_13 = function (i) { var scopeUsages = usagesPerScope[i]; // Special case: in the innermost scope, all usages are available. // (The computed value reflects the value at the top-level of the scope, but the @@ -101768,7 +102131,7 @@ var ts; } }; for (var i = 0; i < scopes.length; i++) { - _loop_12(i); + _loop_13(i); } return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations }; function hasTypeParameters(node) { @@ -101792,7 +102155,7 @@ var ts; var visitedTypes = symbolWalker.walkType(type).visitedTypes; for (var _i = 0, visitedTypes_1 = visitedTypes; _i < visitedTypes_1.length; _i++) { var visitedType = visitedTypes_1[_i]; - if (visitedType.flags & 32768 /* TypeParameter */) { + if (visitedType.isTypeParameter()) { allTypeParameterUsages.set(visitedType.id.toString(), visitedType); } } @@ -102004,30 +102367,30 @@ var ts; */ function isExtractableExpression(node) { switch (node.parent.kind) { - case 271 /* EnumMember */: + case 272 /* EnumMember */: return false; } switch (node.kind) { case 9 /* StringLiteral */: - return node.parent.kind !== 242 /* ImportDeclaration */ && - node.parent.kind !== 246 /* ImportSpecifier */; - case 202 /* SpreadElement */: - case 178 /* ObjectBindingPattern */: - case 180 /* BindingElement */: + return node.parent.kind !== 243 /* ImportDeclaration */ && + node.parent.kind !== 247 /* ImportSpecifier */; + case 203 /* SpreadElement */: + case 179 /* ObjectBindingPattern */: + case 181 /* BindingElement */: return false; case 71 /* Identifier */: - return node.parent.kind !== 180 /* BindingElement */ && - node.parent.kind !== 246 /* ImportSpecifier */ && - node.parent.kind !== 250 /* ExportSpecifier */; + return node.parent.kind !== 181 /* BindingElement */ && + node.parent.kind !== 247 /* ImportSpecifier */ && + node.parent.kind !== 251 /* ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 211 /* Block */: - case 272 /* SourceFile */: - case 238 /* ModuleBlock */: - case 264 /* CaseClause */: + case 212 /* Block */: + case 273 /* SourceFile */: + case 239 /* ModuleBlock */: + case 265 /* CaseClause */: return true; default: return false; @@ -102392,7 +102755,7 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 274 /* FirstJSDocNode */ || kid.kind > 292 /* LastJSDocNode */; }); + var child = ts.find(children, function (kid) { return kid.kind < 275 /* FirstJSDocNode */ || kid.kind > 293 /* LastJSDocNode */; }); return child.kind < 145 /* FirstNode */ ? child : child.getFirstToken(sourceFile); @@ -102462,7 +102825,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(293 /* SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(294 /* SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -102557,28 +102920,9 @@ var ts; return this.declarations; }; SymbolObject.prototype.getDocumentationComment = function (checker) { - if (this.documentationComment === undefined) { - if (this.declarations) { - this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations(this.declarations); - if (this.documentationComment.length === 0 || this.declarations.some(hasJSDocInheritDocTag)) { - if (checker) { - for (var _i = 0, _a = this.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - var inheritedDocs = findInheritedJSDocComments(declaration, this.getName(), checker); - if (inheritedDocs.length > 0) { - if (this.documentationComment.length > 0) { - inheritedDocs.push(ts.lineBreakPart()); - } - this.documentationComment = ts.concatenate(inheritedDocs, this.documentationComment); - break; - } - } - } - } - } - else { - this.documentationComment = []; - } + if (!this.documentationComment) { + this.documentationComment = ts.emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs + this.documentationComment = getDocumentationComment(this.declarations, checker); } return this.documentationComment; }; @@ -102647,9 +102991,7 @@ var ts; return this.checker.getIndexTypeOfType(this, 1 /* Number */); }; TypeObject.prototype.getBaseTypes = function () { - return this.flags & 65536 /* Object */ && this.objectFlags & (1 /* Class */ | 2 /* Interface */) - ? this.checker.getBaseTypes(this) - : undefined; + return this.isClassOrInterface() ? this.checker.getBaseTypes(this) : undefined; }; TypeObject.prototype.getNonNullableType = function () { return this.checker.getNonNullableType(this); @@ -102660,6 +103002,33 @@ var ts; TypeObject.prototype.getDefault = function () { return this.checker.getDefaultFromTypeParameter(this); }; + TypeObject.prototype.isUnion = function () { + return !!(this.flags & 131072 /* Union */); + }; + TypeObject.prototype.isIntersection = function () { + return !!(this.flags & 262144 /* Intersection */); + }; + TypeObject.prototype.isUnionOrIntersection = function () { + return !!(this.flags & 393216 /* UnionOrIntersection */); + }; + TypeObject.prototype.isLiteral = function () { + return !!(this.flags & 224 /* Literal */); + }; + TypeObject.prototype.isStringLiteral = function () { + return !!(this.flags & 32 /* StringLiteral */); + }; + TypeObject.prototype.isNumberLiteral = function () { + return !!(this.flags & 64 /* NumberLiteral */); + }; + TypeObject.prototype.isTypeParameter = function () { + return !!(this.flags & 32768 /* TypeParameter */); + }; + TypeObject.prototype.isClassOrInterface = function () { + return !!(ts.getObjectFlags(this) & 3 /* ClassOrInterface */); + }; + TypeObject.prototype.isClass = function () { + return !!(ts.getObjectFlags(this) & 1 /* Class */); + }; return TypeObject; }()); var SignatureObject = /** @class */ (function () { @@ -102679,22 +103048,7 @@ var ts; return this.checker.getReturnTypeOfSignature(this); }; SignatureObject.prototype.getDocumentationComment = function () { - if (this.documentationComment === undefined) { - if (this.declaration) { - this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations([this.declaration]); - if (this.documentationComment.length === 0 || hasJSDocInheritDocTag(this.declaration)) { - var inheritedDocs = findInheritedJSDocComments(this.declaration, this.declaration.symbol.getName(), this.checker); - if (this.documentationComment.length > 0) { - inheritedDocs.push(ts.lineBreakPart()); - } - this.documentationComment = ts.concatenate(inheritedDocs, this.documentationComment); - } - } - else { - this.documentationComment = []; - } - } - return this.documentationComment; + return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker)); }; SignatureObject.prototype.getJsDocTags = function () { if (this.jsDocTags === undefined) { @@ -102712,6 +103066,21 @@ var ts; function hasJSDocInheritDocTag(node) { return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; }); } + function getDocumentationComment(declarations, checker) { + if (!declarations) + return ts.emptyArray; + var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations); + if (doc.length === 0 || declarations.some(hasJSDocInheritDocTag)) { + for (var _i = 0, declarations_13 = declarations; _i < declarations_13.length; _i++) { + var declaration = declarations_13[_i]; + var inheritedDocs = findInheritedJSDocComments(declaration, declaration.symbol.name, checker); + // TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs + if (inheritedDocs) + doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc); + } + } + return doc; + } /** * Attempts to find JSDoc comments for possibly-inherited properties. Checks superclasses then traverses * implemented interfaces until a symbol is found with the same name and with documentation. @@ -102721,22 +103090,11 @@ var ts; * @returns A filled array of documentation comments if any were found, otherwise an empty array. */ function findInheritedJSDocComments(declaration, propertyName, typeChecker) { - var foundDocs = false; - return ts.flatMap(declaration.parent ? ts.getAllSuperTypeNodes(declaration.parent) : ts.emptyArray, function (superTypeNode) { - if (foundDocs) { - return ts.emptyArray; - } + return ts.firstDefined(declaration.parent ? ts.getAllSuperTypeNodes(declaration.parent) : ts.emptyArray, function (superTypeNode) { var superType = typeChecker.getTypeAtLocation(superTypeNode); - if (!superType) { - return ts.emptyArray; - } - var baseProperty = typeChecker.getPropertyOfType(superType, propertyName); - if (!baseProperty) { - return ts.emptyArray; - } - var inheritedDocs = baseProperty.getDocumentationComment(typeChecker); - foundDocs = inheritedDocs.length > 0; - return inheritedDocs; + var baseProperty = superType && typeChecker.getPropertyOfType(superType, propertyName); + var inheritedDocs = baseProperty && baseProperty.getDocumentationComment(typeChecker); + return inheritedDocs && inheritedDocs.length ? inheritedDocs : undefined; }); } var SourceFileObject = /** @class */ (function (_super) { @@ -102795,13 +103153,13 @@ var ts; } function getDeclarationName(declaration) { var name = ts.getNameOfDeclaration(declaration); - return name && (ts.isPropertyNameLiteral(name) ? ts.getTextOfIdentifierOrLiteral(name) : - name.kind === 146 /* ComputedPropertyName */ && ts.isPropertyAccessExpression(name.expression) ? name.expression.name.text : undefined); + return name && (ts.isComputedPropertyName(name) && ts.isPropertyAccessExpression(name.expression) ? name.expression.name.text + : ts.isPropertyName(name) ? ts.getNameFromPropertyName(name) : undefined); } function visit(node) { switch (node.kind) { - case 232 /* FunctionDeclaration */: - case 190 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 191 /* FunctionExpression */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: var functionDeclaration = node; @@ -102823,17 +103181,17 @@ var ts; } ts.forEachChild(node, visit); break; - case 233 /* ClassDeclaration */: - case 203 /* ClassExpression */: - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: - case 236 /* EnumDeclaration */: - case 237 /* ModuleDeclaration */: - case 241 /* ImportEqualsDeclaration */: - case 250 /* ExportSpecifier */: - case 246 /* ImportSpecifier */: - case 243 /* ImportClause */: - case 244 /* NamespaceImport */: + case 234 /* ClassDeclaration */: + case 204 /* ClassExpression */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: + case 237 /* EnumDeclaration */: + case 238 /* ModuleDeclaration */: + case 242 /* ImportEqualsDeclaration */: + case 251 /* ExportSpecifier */: + case 247 /* ImportSpecifier */: + case 244 /* ImportClause */: + case 245 /* NamespaceImport */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 165 /* TypeLiteral */: @@ -102846,8 +103204,8 @@ var ts; break; } // falls through - case 230 /* VariableDeclaration */: - case 180 /* BindingElement */: { + case 231 /* VariableDeclaration */: + case 181 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -102858,19 +103216,19 @@ var ts; } } // falls through - case 271 /* EnumMember */: + case 272 /* EnumMember */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: addDeclaration(node); break; - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -102882,7 +103240,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 244 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 245 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -102891,7 +103249,7 @@ var ts; } } break; - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (ts.getSpecialPropertyAssignmentKind(node) !== 0 /* None */) { addDeclaration(node); } @@ -103426,16 +103784,16 @@ var ts; // Convert from deprecated options names to new names var fullPreferences = __assign({}, ts.identity(options), { includeCompletionsForModuleExports: options.includeCompletionsForModuleExports || options.includeExternalModuleExports, includeCompletionsWithInsertText: options.includeCompletionsWithInsertText || options.includeInsertTextCompletions }); synchronizeHostData(); - return ts.Completions.getCompletionsAtPosition(host, program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, program.getSourceFiles(), fullPreferences); + return ts.Completions.getCompletionsAtPosition(host, program, log, getValidSourceFile(fileName), position, fullPreferences); } function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences) { if (preferences === void 0) { preferences = ts.defaultPreferences; } synchronizeHostData(); - return ts.Completions.getCompletionEntryDetails(program, log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, formattingOptions && ts.formatting.getFormatContext(formattingOptions), getCanonicalFileName, preferences); + return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, formattingOptions && ts.formatting.getFormatContext(formattingOptions), getCanonicalFileName, preferences); } function getCompletionEntrySymbol(fileName, position, name, source) { synchronizeHostData(); - return ts.Completions.getCompletionEntrySymbol(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles()); + return ts.Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name: name, source: source }); } function getQuickInfoAtPosition(fileName, position) { synchronizeHostData(); @@ -103456,7 +103814,7 @@ var ts; return undefined; } // falls through - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 145 /* QualifiedName */: case 99 /* ThisKeyword */: case 173 /* ThisType */: @@ -103496,7 +103854,8 @@ var ts; } return checker.getSymbolAtLocation(node); } - var sourceMapCommentRegExp = /^\/\/[@#] sourceMappingURL=(.+)$/gm; + // Sometimes tools can sometimes see the following line as a source mapping url comment, so we mangle it a bit (the [M]) + var sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)$/gm; var base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/; function scanForSourcemapURL(fileName) { var mappedFile = sourcemappedFileCache.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); @@ -103723,7 +104082,7 @@ var ts; return; } switch (node.kind) { - case 183 /* PropertyAccessExpression */: + case 184 /* PropertyAccessExpression */: case 145 /* QualifiedName */: case 9 /* StringLiteral */: case 86 /* FalseKeyword */: @@ -103748,7 +104107,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 === 237 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 238 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -104178,7 +104537,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 252 /* ExternalModuleReference */ || + node.parent.kind === 253 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -104196,7 +104555,7 @@ var ts; // falls through case 71 /* Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 182 /* ObjectLiteralExpression */ || node.parent.parent.kind === 261 /* JsxAttributes */) && + (node.parent.parent.kind === 183 /* ObjectLiteralExpression */ || node.parent.parent.kind === 262 /* JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -104235,7 +104594,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 184 /* ElementAccessExpression */ && + node.parent.kind === 185 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -104316,114 +104675,114 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 212 /* VariableStatement */: + case 213 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 151 /* PropertyDeclaration */: case 150 /* PropertySignature */: return spanInVariableDeclaration(node); case 148 /* Parameter */: return spanInParameterDeclaration(node); - case 232 /* FunctionDeclaration */: + case 233 /* FunctionDeclaration */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 154 /* Constructor */: - case 190 /* FunctionExpression */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 192 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 211 /* Block */: + case 212 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: return spanInBlock(node); - case 267 /* CatchClause */: + case 268 /* CatchClause */: return spanInBlock(node.block); - case 214 /* ExpressionStatement */: + case 215 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 223 /* ReturnStatement */: + case 224 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 217 /* WhileStatement */: + case 218 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 216 /* DoStatement */: + case 217 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 229 /* DebuggerStatement */: + case 230 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 215 /* IfStatement */: + case 216 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 226 /* LabeledStatement */: + case 227 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 222 /* BreakStatement */: - case 221 /* ContinueStatement */: + case 223 /* BreakStatement */: + case 222 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 218 /* ForStatement */: + case 219 /* ForStatement */: return spanInForStatement(node); - case 219 /* ForInStatement */: + case 220 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 220 /* ForOfStatement */: + case 221 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 225 /* SwitchStatement */: + case 226 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 264 /* CaseClause */: - case 265 /* DefaultClause */: + case 265 /* CaseClause */: + case 266 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 228 /* TryStatement */: + case 229 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 227 /* ThrowStatement */: + case 228 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 247 /* ExportAssignment */: + case 248 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 241 /* ImportEqualsDeclaration */: + case 242 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 242 /* ImportDeclaration */: + case 243 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 248 /* ExportDeclaration */: + case 249 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } // falls through - case 233 /* ClassDeclaration */: - case 236 /* EnumDeclaration */: - case 271 /* EnumMember */: - case 180 /* BindingElement */: + case 234 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 272 /* EnumMember */: + case 181 /* BindingElement */: // span on complete node return textSpan(node); - case 224 /* WithStatement */: + case 225 /* WithStatement */: // span in statement return spanInNode(node.statement); case 149 /* Decorator */: return spanInNodeArray(node.parent.decorators); - case 178 /* ObjectBindingPattern */: - case 179 /* ArrayBindingPattern */: + case 179 /* ObjectBindingPattern */: + case 180 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 234 /* InterfaceDeclaration */: - case 235 /* TypeAliasDeclaration */: + case 235 /* InterfaceDeclaration */: + case 236 /* TypeAliasDeclaration */: return undefined; // Tokens: case 25 /* SemicolonToken */: @@ -104466,13 +104825,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 === 71 /* Identifier */ || - node.kind === 202 /* SpreadElement */ || - node.kind === 268 /* PropertyAssignment */ || - node.kind === 269 /* ShorthandPropertyAssignment */) && + node.kind === 203 /* SpreadElement */ || + node.kind === 269 /* PropertyAssignment */ || + node.kind === 270 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 198 /* BinaryExpression */) { + if (node.kind === 199 /* 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 @@ -104494,22 +104853,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (node.parent.kind) { - case 216 /* DoStatement */: + case 217 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); case 149 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 218 /* ForStatement */: - case 220 /* ForOfStatement */: + case 219 /* ForStatement */: + case 221 /* ForOfStatement */: return textSpan(node); - case 198 /* BinaryExpression */: + case 199 /* BinaryExpression */: if (node.parent.operatorToken.kind === 26 /* CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 191 /* ArrowFunction */: + case 192 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -104518,20 +104877,20 @@ var ts; } } switch (node.parent.kind) { - case 268 /* PropertyAssignment */: + case 269 /* 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 188 /* TypeAssertionExpression */: + case 189 /* TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 230 /* VariableDeclaration */: + case 231 /* VariableDeclaration */: case 148 /* Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; @@ -104540,7 +104899,7 @@ var ts; } break; } - case 198 /* BinaryExpression */: { + case 199 /* BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -104570,7 +104929,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 219 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 220 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern, set breakpoint in binding pattern @@ -104581,7 +104940,7 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1 /* Export */) || - variableDeclaration.parent.parent.kind === 220 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 221 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -104622,7 +104981,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1 /* Export */) || - (functionDeclaration.parent.kind === 233 /* ClassDeclaration */ && functionDeclaration.kind !== 154 /* Constructor */); + (functionDeclaration.parent.kind === 234 /* ClassDeclaration */ && functionDeclaration.kind !== 154 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -104645,26 +105004,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 237 /* ModuleDeclaration */: + case 238 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // falls through // Set on parent if on same line otherwise on first statement - case 217 /* WhileStatement */: - case 215 /* IfStatement */: - case 219 /* ForInStatement */: + case 218 /* WhileStatement */: + case 216 /* IfStatement */: + case 220 /* 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 218 /* ForStatement */: - case 220 /* ForOfStatement */: + case 219 /* ForStatement */: + case 221 /* 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 === 231 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 232 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -104689,21 +105048,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 204 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 205 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 180 /* BindingElement */) { + if (bindingPattern.parent.kind === 181 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 179 /* ArrayBindingPattern */ && node.kind !== 178 /* ObjectBindingPattern */); - var elements = node.kind === 181 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 204 /* OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 180 /* ArrayBindingPattern */ && node.kind !== 179 /* ObjectBindingPattern */); + var elements = node.kind === 182 /* ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 205 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -104711,18 +105070,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 === 198 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 199 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 236 /* EnumDeclaration */: + case 237 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 233 /* ClassDeclaration */: + case 234 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -104730,25 +105089,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 238 /* ModuleBlock */: + case 239 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } // falls through - case 236 /* EnumDeclaration */: - case 233 /* ClassDeclaration */: + case 237 /* EnumDeclaration */: + case 234 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 211 /* Block */: + case 212 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 267 /* CatchClause */: + case 268 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 239 /* CaseBlock */: + case 240 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -104756,7 +105115,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 178 /* ObjectBindingPattern */: + case 179 /* 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); @@ -104772,7 +105131,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 179 /* ArrayBindingPattern */: + case 180 /* 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); @@ -104787,12 +105146,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 216 /* DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 185 /* CallExpression */ || - node.parent.kind === 186 /* NewExpression */) { + if (node.parent.kind === 217 /* DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 186 /* CallExpression */ || + node.parent.kind === 187 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 189 /* ParenthesizedExpression */) { + if (node.parent.kind === 190 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -104801,21 +105160,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 190 /* FunctionExpression */: - case 232 /* FunctionDeclaration */: - case 191 /* ArrowFunction */: + case 191 /* FunctionExpression */: + case 233 /* FunctionDeclaration */: + case 192 /* ArrowFunction */: case 153 /* MethodDeclaration */: case 152 /* MethodSignature */: case 155 /* GetAccessor */: case 156 /* SetAccessor */: case 154 /* Constructor */: - case 217 /* WhileStatement */: - case 216 /* DoStatement */: - case 218 /* ForStatement */: - case 220 /* ForOfStatement */: - case 185 /* CallExpression */: - case 186 /* NewExpression */: - case 189 /* ParenthesizedExpression */: + case 218 /* WhileStatement */: + case 217 /* DoStatement */: + case 219 /* ForStatement */: + case 221 /* ForOfStatement */: + case 186 /* CallExpression */: + case 187 /* NewExpression */: + case 190 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -104825,20 +105184,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 268 /* PropertyAssignment */ || + node.parent.kind === 269 /* PropertyAssignment */ || node.parent.kind === 148 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 188 /* TypeAssertionExpression */) { + if (node.parent.kind === 189 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 216 /* DoStatement */) { + if (node.parent.kind === 217 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -104846,7 +105205,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 220 /* ForOfStatement */) { + if (node.parent.kind === 221 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 7bc03ae0a6c..b3d807a21c7 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -1428,7 +1428,7 @@ var ts; ts.compose = compose; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (_match, index) { return Debug.assertDefined(args[+index + baseIndex]); }); } ts.formatStringFromArgs = formatStringFromArgs; function getLocaleSpecificMessage(message) { @@ -2922,10 +2922,13 @@ var ts; } function watchChildDirectories(parentDir, existingChildWatches, callback) { var newChildWatches; - ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? host.getAccessileSortedChildDirectories(parentDir) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(ts.getNormalizedAbsolutePath(child, parentDir), childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); + ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? ts.mapDefined(host.getAccessibleSortedChildDirectories(parentDir), function (child) { + var childFullName = ts.getNormalizedAbsolutePath(child, parentDir); + return host.filePathComparer(childFullName, host.realpath(childFullName)) === 0 ? childFullName : undefined; + }) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher); return newChildWatches || ts.emptyArray; function createAndAddChildDirectoryWatcher(childName) { - var result = createDirectoryWatcher(ts.getNormalizedAbsolutePath(childName, parentDir), callback); + var result = createDirectoryWatcher(childName, callback); addChildDirectoryWatcher(result); } function addChildDirectoryWatcher(childWatcher) { @@ -3022,14 +3025,7 @@ var ts; exit: function (exitCode) { process.exit(exitCode); }, - realpath: function (path) { - try { - return _fs.realpathSync(path); - } - catch (_a) { - return path; - } - }, + realpath: realpath, debugMode: ts.some(process.execArgv, function (arg) { return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg); }), tryEnableSourceMapsForHost: function () { try { @@ -3103,8 +3099,9 @@ var ts; var watchDirectoryRecursively = createRecursiveDirectoryWatcher({ filePathComparer: useCaseSensitiveFileNames ? ts.compareStringsCaseSensitive : ts.compareStringsCaseInsensitive, directoryExists: directoryExists, - getAccessileSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, - watchDirectory: watchDirectory + getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; }, + watchDirectory: watchDirectory, + realpath: realpath }); return function (directoryName, callback, recursive) { if (recursive) { @@ -3356,6 +3353,14 @@ var ts; function getDirectories(path) { return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1); }); } + function realpath(path) { + try { + return _fs.realpathSync(path); + } + catch (_a) { + return path; + } + } function getModifiedTime(path) { try { return _fs.statSync(path).mtime; @@ -3458,6 +3463,7 @@ var ts; Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), Unexpected_token: diag(1012, ts.DiagnosticCategory.Error, "Unexpected_token_1012", "Unexpected token."), + A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma: diag(1013, ts.DiagnosticCategory.Error, "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013", "A rest parameter or binding pattern may not have a trailing comma."), A_rest_parameter_must_be_last_in_a_parameter_list: diag(1014, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."), Parameter_cannot_have_question_mark_and_initializer: diag(1015, ts.DiagnosticCategory.Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."), A_required_parameter_cannot_follow_an_optional_parameter: diag(1016, ts.DiagnosticCategory.Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."), @@ -3689,6 +3695,9 @@ var ts; An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead: diag(1336, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead_1336", "An index signature parameter type cannot be a type alias. Consider writing '[{0}: {1}]: {2}' instead."), An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead: diag(1337, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead_1337", "An index signature parameter type cannot be a union type. Consider using a mapped object type instead."), infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."), + Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."), + Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340", "Module '{0}' does not refer to a type, but is used as a type here."), + Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."), Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."), Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."), @@ -3794,7 +3803,7 @@ var ts; The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."), The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: diag(2405, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."), The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: diag(2406, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."), - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter."), + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."), Setters_cannot_return_a_value: diag(2408, ts.DiagnosticCategory.Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."), Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: diag(2409, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."), The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: diag(2410, ts.DiagnosticCategory.Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."), @@ -3868,7 +3877,7 @@ var ts; The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: diag(2483, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."), Export_declaration_conflicts_with_exported_declaration_of_0: diag(2484, ts.DiagnosticCategory.Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."), The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: diag(2487, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."), - Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type must have a '[Symbol.iterator]()' method that returns an iterator."), + Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."), An_iterator_must_have_a_next_method: diag(2489, ts.DiagnosticCategory.Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."), The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: diag(2490, ts.DiagnosticCategory.Error, "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the 'next()' method of an iterator must have a 'value' property."), The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: diag(2491, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."), @@ -3884,7 +3893,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: diag(2501, ts.DiagnosticCategory.Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."), _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: diag(2502, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."), Cannot_find_namespace_0: diag(2503, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."), - Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), + Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), A_generator_cannot_have_a_void_type_annotation: diag(2505, ts.DiagnosticCategory.Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."), _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: diag(2506, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."), Type_0_is_not_a_constructor_function_type: diag(2507, ts.DiagnosticCategory.Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."), @@ -3948,6 +3957,8 @@ var ts; Property_0_is_used_before_being_assigned: diag(2565, ts.DiagnosticCategory.Error, "Property_0_is_used_before_being_assigned_2565", "Property '{0}' is used before being assigned."), A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."), Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."), + Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2568, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568", "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), + Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."), The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."), JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."), @@ -4620,7 +4631,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 272) { + while (node && node.kind !== 273) { node = node.parent; } return node; @@ -4628,11 +4639,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 211: - case 239: - case 218: + case 212: + case 240: case 219: case 220: + case 221: return true; } return false; @@ -4668,6 +4679,11 @@ var ts; } } ts.getEndLinePosition = getEndLinePosition; + function isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) { + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name); + } + ts.isFileLevelUniqueName = isFileLevelUniqueName; function nodeIsMissing(node) { if (node === undefined) { return true; @@ -4708,7 +4724,7 @@ var ts; if (includeJsDoc && ts.hasJSDocNodes(node)) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 293 && node._children.length > 0) { + if (node.kind === 294 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -4802,7 +4818,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 230 && node.parent.kind === 267; + return node.kind === 231 && node.parent.kind === 268; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -4822,11 +4838,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node && node.kind === 237 && (!node.body); + return node && node.kind === 238 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 272 || - node.kind === 237 || + return node.kind === 273 || + node.kind === 238 || ts.isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -4840,9 +4856,9 @@ var ts; ts.isExternalModuleAugmentation = isExternalModuleAugmentation; function isModuleAugmentationExternal(node) { switch (node.parent.kind) { - case 272: + case 273: return ts.isExternalModule(node.parent); - case 238: + case 239: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -4854,22 +4870,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 272: - case 239: - case 267: - case 237: - case 218: + case 273: + case 240: + case 268: + case 238: case 219: case 220: + case 221: case 154: case 153: case 155: case 156: - case 232: - case 190: + case 233: case 191: + case 192: return true; - case 211: + case 212: return parentNode && !ts.isFunctionLike(parentNode); } return false; @@ -4883,19 +4899,19 @@ var ts; case 159: case 162: case 163: - case 280: - case 233: - case 203: + case 281: case 234: + case 204: case 235: - case 290: - case 232: + case 236: + case 291: + case 233: case 153: case 154: case 155: case 156: - case 190: case 191: + case 192: return true; default: ts.assertTypeIsNever(node); @@ -4905,8 +4921,8 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isAnyImportSyntax(node) { switch (node.kind) { + case 243: case 242: - case 241: return true; default: return false; @@ -4955,7 +4971,7 @@ var ts; return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); case 145: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 183: + case 184: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -5002,7 +5018,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 211) { + if (node.body && node.body.kind === 212) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -5014,29 +5030,29 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 272: + case 273: 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 230: - case 180: - case 233: - case 203: + case 231: + case 181: case 234: + case 204: + case 235: + case 238: case 237: - case 236: - case 271: - case 232: - case 190: + case 272: + case 233: + case 191: case 153: case 155: case 156: - case 235: + case 236: errorNode = node.name; break; - case 191: + case 192: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -5062,7 +5078,7 @@ var ts; } ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isConstEnumDeclaration(node) { - return node.kind === 236 && isConst(node); + return node.kind === 237 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -5075,15 +5091,21 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 185 && n.expression.kind === 97; + return n.kind === 186 && n.expression.kind === 97; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 185 && n.expression.kind === 91; + return n.kind === 186 && n.expression.kind === 91; } ts.isImportCall = isImportCall; + function isLiteralImportTypeNode(n) { + return n.kind === 178 && + n.argument.kind === 177 && + ts.isStringLiteral(n.argument.literal); + } + ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 214 + return node.kind === 215 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -5094,9 +5116,9 @@ var ts; function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 148 || node.kind === 147 || - node.kind === 190 || node.kind === 191 || - node.kind === 189) ? + node.kind === 192 || + node.kind === 190) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); return ts.filter(commentRanges, function (comment) { @@ -5111,7 +5133,7 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (160 <= node.kind && node.kind <= 177) { + if (160 <= node.kind && node.kind <= 178) { return true; } switch (node.kind) { @@ -5124,8 +5146,8 @@ var ts; case 131: return true; case 105: - return node.parent.kind !== 194; - case 205: + return node.parent.kind !== 195; + case 206: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 147: return node.parent.kind === 176 || node.parent.kind === 171; @@ -5133,33 +5155,36 @@ var ts; if (node.parent.kind === 145 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 183 && node.parent.name === node) { + else if (node.parent.kind === 184 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 71 || node.kind === 145 || node.kind === 183, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 71 || node.kind === 145 || node.kind === 184, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); case 145: - case 183: + case 184: case 99: var parent = node.parent; if (parent.kind === 164) { return false; } - if (160 <= parent.kind && parent.kind <= 177) { + if (parent.kind === 178) { + return !parent.isTypeOf; + } + if (160 <= parent.kind && parent.kind <= 178) { return true; } switch (parent.kind) { - case 205: + case 206: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 147: return node === parent.constraint; case 151: case 150: case 148: - case 230: + case 231: return node === parent.type; - case 232: - case 190: + case 233: case 191: + case 192: case 154: case 153: case 152: @@ -5170,12 +5195,12 @@ var ts; case 158: case 159: return node === parent.type; - case 188: + case 189: return node === parent.type; - case 185: case 186: - return ts.contains(parent.typeArguments, node); case 187: + return ts.contains(parent.typeArguments, node); + case 188: return false; } } @@ -5196,23 +5221,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 223: + case 224: return visitor(node); - case 239: - case 211: - case 215: + case 240: + case 212: case 216: case 217: case 218: case 219: case 220: - case 224: + case 221: case 225: - case 264: - case 265: case 226: - case 228: - case 267: + case 265: + case 266: + case 227: + case 229: + case 268: return ts.forEachChild(node, traverse); } } @@ -5222,19 +5247,19 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 201: + case 202: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 236: - case 234: case 237: case 235: - case 233: - case 203: + case 238: + case 236: + case 234: + case 204: return; default: if (ts.isFunctionLike(node)) { @@ -5264,12 +5289,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { + case 235: case 234: - case 233: - case 203: + case 204: case 165: return node.members; - case 182: + case 183: return node.properties; } } @@ -5277,14 +5302,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 180: - case 271: + case 181: + case 272: case 148: - case 268: + case 269: case 151: case 150: - case 269: - case 230: + case 270: + case 231: return true; } } @@ -5296,8 +5321,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 231 - && node.parent.parent.kind === 212; + return node.parent.kind === 232 + && node.parent.parent.kind === 213; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isValidESSymbolDeclaration(node) { @@ -5313,8 +5338,8 @@ var ts; case 154: case 155: case 156: - case 232: - case 190: + case 233: + case 191: return true; } return false; @@ -5325,7 +5350,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 226) { + if (node.statement.kind !== 227) { return node.statement; } node = node.statement; @@ -5333,17 +5358,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 211 && ts.isFunctionLike(node.parent); + return node && node.kind === 212 && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 153 && node.parent.kind === 182; + return node && node.kind === 153 && node.parent.kind === 183; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { return node.kind === 153 && - (node.parent.kind === 182 || - node.parent.kind === 203); + (node.parent.kind === 183 || + node.parent.kind === 204); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -5356,7 +5381,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 268) { + if (property.kind === 269) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -5392,13 +5417,13 @@ var ts; node = node.parent; } break; - case 191: + case 192: if (!includeArrowFunctions) { continue; } - case 232: - case 190: - case 237: + case 233: + case 191: + case 238: case 151: case 150: case 153: @@ -5409,8 +5434,8 @@ var ts; case 157: case 158: case 159: - case 236: - case 272: + case 237: + case 273: return node; } } @@ -5421,8 +5446,8 @@ var ts; if (container) { switch (container.kind) { case 154: - case 232: - case 190: + case 233: + case 191: return container; } } @@ -5439,9 +5464,9 @@ var ts; case 146: node = node.parent; break; - case 232: - case 190: + case 233: case 191: + case 192: if (!stopOnFunctions) { continue; } @@ -5466,14 +5491,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 190 || func.kind === 191) { + if (func.kind === 191 || func.kind === 192) { var prev = func; var parent = func.parent; - while (parent.kind === 189) { + while (parent.kind === 190) { prev = parent; parent = parent.parent; } - if (parent.kind === 185 && parent.expression === prev) { + if (parent.kind === 186 && parent.expression === prev) { return parent; } } @@ -5481,13 +5506,13 @@ var ts; ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; function isSuperProperty(node) { var kind = node.kind; - return (kind === 183 || kind === 184) + return (kind === 184 || kind === 185) && node.expression.kind === 97; } ts.isSuperProperty = isSuperProperty; function isThisProperty(node) { var kind = node.kind; - return (kind === 183 || kind === 184) + return (kind === 184 || kind === 185) && node.expression.kind === 99; } ts.isThisProperty = isThisProperty; @@ -5495,7 +5520,7 @@ var ts; switch (node.kind) { case 161: return node.typeName; - case 205: + case 206: return isEntityNameExpression(node.expression) ? node.expression : undefined; @@ -5508,10 +5533,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 187: + case 188: return node.tag; + case 256: case 255: - case 254: return node.tagName; default: return node.expression; @@ -5520,21 +5545,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node, parent, grandparent) { switch (node.kind) { - case 233: + case 234: return true; case 151: - return parent.kind === 233; + return parent.kind === 234; case 155: case 156: case 153: return node.body !== undefined - && parent.kind === 233; + && parent.kind === 234; case 148: return parent.body !== undefined && (parent.kind === 154 || parent.kind === 153 || parent.kind === 156) - && grandparent.kind === 233; + && grandparent.kind === 234; } return false; } @@ -5550,7 +5575,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 233: + case 234: return ts.forEach(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); case 153: case 156: @@ -5560,9 +5585,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 255 || - parent.kind === 254 || - parent.kind === 256) { + if (parent.kind === 256 || + parent.kind === 255 || + parent.kind === 257) { return parent.tagName === node; } return false; @@ -5575,37 +5600,37 @@ var ts; case 101: case 86: case 12: - case 181: case 182: case 183: case 184: case 185: case 186: case 187: - case 206: case 188: case 207: case 189: + case 208: case 190: - case 203: case 191: - case 194: + case 204: case 192: + case 195: case 193: - case 196: + case 194: case 197: case 198: case 199: - case 202: case 200: - case 13: - case 204: - case 253: - case 254: - case 257: + case 203: case 201: - case 195: - case 208: + case 13: + case 205: + case 254: + case 255: + case 258: + case 202: + case 196: + case 209: return true; case 145: while (node.parent.kind === 145) { @@ -5628,47 +5653,47 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 230: + case 231: case 148: case 151: case 150: - case 271: - case 268: - case 180: + case 272: + case 269: + case 181: return parent.initializer === node; - case 214: case 215: case 216: case 217: - case 223: + case 218: case 224: case 225: - case 264: - case 227: + case 226: + case 265: + case 228: return parent.expression === node; - case 218: + case 219: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 231) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 232) || forStatement.condition === node || forStatement.incrementor === node; - case 219: case 220: + case 221: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 231) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 232) || forInStatement.expression === node; - case 188: - case 206: + case 189: + case 207: return node === parent.expression; - case 209: + case 210: return node === parent.expression; case 146: return node === parent.expression; case 149: + case 264: case 263: - case 262: - case 270: + case 271: return true; - case 205: + case 206: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: return isExpressionNode(parent); @@ -5676,7 +5701,7 @@ var ts; } ts.isInExpressionContext = isInExpressionContext; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 && node.moduleReference.kind === 252; + return node.kind === 242 && node.moduleReference.kind === 253; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5685,7 +5710,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 241 && node.moduleReference.kind !== 252; + return node.kind === 242 && node.moduleReference.kind !== 253; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -5713,7 +5738,7 @@ var ts; } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) { - if (callExpression.kind !== 185) { + if (callExpression.kind !== 186) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -5762,9 +5787,11 @@ var ts; function getJavascriptInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 190 || e.kind === 191 ? initializer : undefined; + return e.kind === 191 || e.kind === 192 ? initializer : undefined; } - if (initializer.kind === 190 || initializer.kind === 203) { + if (initializer.kind === 191 || + initializer.kind === 204 || + initializer.kind === 192) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -5836,7 +5863,7 @@ var ts; return 2; } else if (isEntityNameExpression(lhs.expression)) { - if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(expr.right)) { + if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) { return 6; } else if (isPrototypeAccess(lhs.expression)) { @@ -5857,24 +5884,31 @@ var ts; return 0; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; + function getInitializerOfBinaryExpression(expr) { + while (ts.isBinaryExpression(expr.right)) { + expr = expr.right; + } + return expr.right; + } + ts.getInitializerOfBinaryExpression = getInitializerOfBinaryExpression; function isPrototypePropertyAssignment(node) { return ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === 3; } ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJavaScriptFile(expr) && - expr.parent && expr.parent.kind === 214 && + expr.parent && expr.parent.kind === 215 && !!ts.getJSDocTypeTag(expr.parent); } ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration; function importFromModuleSpecifier(node) { switch (node.parent.kind) { - case 242: - case 248: + case 243: + case 249: return node.parent; - case 252: + case 253: return node.parent.parent; - case 185: + case 186: return node.parent; default: return ts.Debug.fail(ts.Debug.showSyntaxKind(node)); @@ -5883,11 +5917,13 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 242: - case 248: + case 243: + case 249: return node.moduleSpecifier; - case 241: - return node.moduleReference.kind === 252 ? node.moduleReference.expression : undefined; + case 242: + return node.moduleReference.kind === 253 ? node.moduleReference.expression : undefined; + case 178: + return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; default: return ts.Debug.assertNever(node); } @@ -5895,11 +5931,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 242: + case 243: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 241: + case 242: return node; - case 248: + case 249: return undefined; default: return ts.Debug.assertNever(node); @@ -5907,7 +5943,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 242 && node.importClause && !!node.importClause.name; + return node.kind === 243 && node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function hasQuestionToken(node) { @@ -5916,8 +5952,8 @@ var ts; case 148: case 153: case 152: + case 270: case 269: - case 268: case 151: case 150: return node.questionToken !== undefined; @@ -5927,7 +5963,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 280 && + return node.kind === 281 && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -5949,7 +5985,7 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 212: + case 213: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; case 151: @@ -5962,9 +5998,9 @@ var ts; node.declarationList.declarations[0]; } function getNestedModuleDeclaration(node) { - return node.kind === 237 && + return node.kind === 238 && node.body && - node.body.kind === 237 && + node.body.kind === 238 && node.body; } function getJSDocCommentsAndTags(node) { @@ -5973,7 +6009,10 @@ var ts; return result || ts.emptyArray; function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; - if (parent && (parent.kind === 268 || parent.kind === 151 || getNestedModuleDeclaration(parent))) { + if (parent && + (parent.kind === 269 || + parent.kind === 151 || + getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } if (parent && parent.parent && @@ -5985,7 +6024,8 @@ var ts; getJSDocCommentsAndTagsWorker(parent.parent.parent); } if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 || - node.kind === 183 && node.parent && node.parent.kind === 214) { + parent && ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 || + node.kind === 184 && node.parent && node.parent.kind === 215) { getJSDocCommentsAndTagsWorker(parent); } if (node.kind === 148) { @@ -6028,7 +6068,7 @@ var ts; } ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 282); + ts.Debug.assert(node.parent.kind === 283); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -6044,38 +6084,38 @@ var ts; } ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { - return node.dotDotDotToken !== undefined || node.type && node.type.kind === 281; + return node.dotDotDotToken !== undefined || node.type && node.type.kind === 282; } ts.isRestParameter = isRestParameter; function getAssignmentTargetKind(node) { var parent = node.parent; while (true) { switch (parent.kind) { - case 198: + case 199: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 58 ? 1 : 2 : 0; - case 196: case 197: + case 198: var unaryOperator = parent.operator; return unaryOperator === 43 || unaryOperator === 44 ? 2 : 0; - case 219: case 220: + case 221: return parent.initializer === node ? 1 : 0; - case 189: - case 181: - case 202: - case 207: + case 190: + case 182: + case 203: + case 208: node = parent; break; - case 269: + case 270: if (parent.name !== node) { return 0; } node = parent.parent; break; - case 268: + case 269: if (parent.name === node) { return 0; } @@ -6094,22 +6134,22 @@ var ts; ts.isAssignmentTarget = isAssignmentTarget; function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 211: case 212: - case 224: - case 215: + case 213: case 225: - case 239: - case 264: - case 265: + case 216: case 226: - case 218: + case 240: + case 265: + case 266: + case 227: case 219: case 220: - case 216: + case 221: case 217: - case 228: - case 267: + case 218: + case 229: + case 268: return true; } return false; @@ -6130,22 +6170,22 @@ var ts; } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 189); + return walkUp(node, 190); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; function skipParentheses(node) { - while (node.kind === 189) { + while (node.kind === 190) { node = node.expression; } return node; } ts.skipParentheses = skipParentheses; function isDeleteTarget(node) { - if (node.kind !== 183 && node.kind !== 184) { + if (node.kind !== 184 && node.kind !== 185) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 192; + return node && node.kind === 193; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -6191,36 +6231,36 @@ var ts; case 152: case 155: case 156: - case 271: - case 268: - case 183: + case 272: + case 269: + case 184: return parent.name === node; case 145: if (parent.right === node) { while (parent.kind === 145) { parent = parent.parent; } - return parent.kind === 164; + return parent.kind === 164 || parent.kind === 161; } return false; - case 180: - case 246: + case 181: + case 247: return parent.propertyName === node; - case 250: - case 260: + case 251: + case 261: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 241 || - node.kind === 240 || - node.kind === 243 && !!node.name || - node.kind === 244 || - node.kind === 246 || - node.kind === 250 || - node.kind === 247 && exportAssignmentIsAlias(node); + return node.kind === 242 || + node.kind === 241 || + node.kind === 244 && !!node.name || + node.kind === 245 || + node.kind === 247 || + node.kind === 251 || + node.kind === 248 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -6304,13 +6344,13 @@ var ts; } var flags = 0; switch (node.kind) { - case 232: - case 190: + case 233: + case 191: case 153: if (node.asteriskToken) { flags |= 1; } - case 191: + case 192: if (hasModifier(node, 256)) { flags |= 2; } @@ -6324,9 +6364,9 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 232: - case 190: + case 233: case 191: + case 192: case 153: return node.body !== undefined && node.asteriskToken === undefined @@ -6417,7 +6457,7 @@ var ts; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 180) { + while (node.kind === 181) { node = node.parent.parent; } return node; @@ -6426,14 +6466,14 @@ var ts; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; return kind === 154 - || kind === 190 - || kind === 232 || kind === 191 + || kind === 233 + || kind === 192 || kind === 153 || kind === 155 || kind === 156 - || kind === 237 - || kind === 272; + || kind === 238 + || kind === 273; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -6447,23 +6487,23 @@ var ts; ts.getOriginalSourceFile = getOriginalSourceFile; function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 186: + case 187: return hasArguments ? 0 : 1; - case 196: - case 193: + case 197: case 194: - case 192: case 195: - case 199: - case 201: + case 193: + case 196: + case 200: + case 202: return 1; - case 198: + case 199: switch (operator) { case 40: case 58: @@ -6487,15 +6527,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 186 && expression.arguments !== undefined; + var hasArguments = expression.kind === 187 && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 198) { + if (expression.kind === 199) { return expression.operatorToken.kind; } - else if (expression.kind === 196 || expression.kind === 197) { + else if (expression.kind === 197 || expression.kind === 198) { return expression.operator; } else { @@ -6505,15 +6545,15 @@ var ts; ts.getOperator = getOperator; function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 296: + case 297: return 0; - case 202: + case 203: return 1; - case 201: + case 202: return 2; - case 199: + case 200: return 4; - case 198: + case 199: switch (operatorKind) { case 26: return 0; @@ -6534,21 +6574,21 @@ var ts; default: return getBinaryOperatorPrecedence(operatorKind); } - case 196: - case 193: - case 194: - case 192: - case 195: - return 16; case 197: + case 194: + case 195: + case 193: + case 196: + return 16; + case 198: return 17; - case 185: - return 18; case 186: - return hasArguments ? 19 : 18; + return 18; case 187: - case 183: + return hasArguments ? 19 : 18; + case 188: case 184: + case 185: return 19; case 99: case 97: @@ -6558,19 +6598,19 @@ var ts; case 86: case 8: case 9: - case 181: case 182: - case 190: + case 183: case 191: - case 203: - case 253: + case 192: + case 204: case 254: - case 257: + case 255: + case 258: case 12: case 13: - case 200: - case 189: - case 204: + case 201: + case 190: + case 205: return 20; default: return -1; @@ -6624,17 +6664,12 @@ var ts; var filesWithDiagnostics = []; var fileDiagnostics = ts.createMap(); var hasReadNonFileDiagnostics = false; - var modificationCount = 0; return { add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount, reattachFileDiagnostics: reattachFileDiagnostics }; - function getModificationCount() { - return modificationCount; - } function reattachFileDiagnostics(newFile) { ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } @@ -6656,7 +6691,6 @@ var ts; diagnostics = nonFileDiagnostics; } ts.insertSorted(diagnostics, diagnostic, ts.compareDiagnostics); - modificationCount++; } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -7234,7 +7268,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 205 && + if (node.kind === 206 && node.parent.token === 85 && ts.isClassLike(node.parent.parent)) { return node.parent.parent; @@ -7252,8 +7286,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, true)) { var kind = node.left.kind; - return kind === 182 - || kind === 181; + return kind === 183 + || kind === 182; } return false; } @@ -7263,7 +7297,7 @@ var ts; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isExpressionWithTypeArgumentsInClassImplementsClause(node) { - return node.kind === 205 + return node.kind === 206 && isEntityNameExpression(node.expression) && node.parent && node.parent.token === 108 @@ -7285,16 +7319,16 @@ var ts; ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { return (node.parent.kind === 145 && node.parent.right === node) || - (node.parent.kind === 183 && node.parent.name === node); + (node.parent.kind === 184 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteral(expression) { - return expression.kind === 182 && + return expression.kind === 183 && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 181 && + return expression.kind === 182 && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -7574,8 +7608,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 236: case 237: + case 238: return parseNode === parseNode.parent.name; } } @@ -7637,20 +7671,20 @@ var ts; if (!parent) return 0; switch (parent.kind) { + case 198: case 197: - case 196: var operator = parent.operator; return operator === 43 || operator === 44 ? writeOrReadWrite() : 0; - case 198: + case 199: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? writeOrReadWrite() : 0; - case 183: + case 184: return parent.name !== node ? 0 : accessKind(parent); default: return 0; } function writeOrReadWrite() { - return parent.parent && parent.parent.kind === 214 ? 1 : 2; + return parent.parent && parent.parent.kind === 215 ? 1 : 2; } } function compareDataObjects(dst, src) { @@ -7907,7 +7941,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 147) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 234) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 235) { return current; } } @@ -7933,7 +7967,7 @@ var ts; } ts.isEmptyBindingElement = isEmptyBindingElement; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 180 || ts.isBindingPattern(node))) { + while (node && (node.kind === 181 || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -7941,14 +7975,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 230) { + if (node.kind === 231) { node = node.parent; } - if (node && node.kind === 231) { + if (node && node.kind === 232) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 212) { + if (node && node.kind === 213) { flags |= ts.getModifierFlags(node); } return flags; @@ -7957,14 +7991,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 230) { + if (node.kind === 231) { node = node.parent; } - if (node && node.kind === 231) { + if (node && node.kind === 232) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 212) { + if (node && node.kind === 213) { flags |= node.flags; } return flags; @@ -8068,17 +8102,17 @@ var ts; return getDeclarationIdentifier(hostNode); } switch (hostNode.kind) { - case 212: + case 213: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } return undefined; - case 214: + case 215: var expr = hostNode.expression; switch (expr.kind) { - case 183: - return expr.name; case 184: + return expr.name; + case 185: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; @@ -8087,10 +8121,10 @@ var ts; return undefined; case 1: return undefined; - case 189: { + case 190: { return getDeclarationIdentifier(hostNode.expression); } - case 226: { + case 227: { if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -8119,15 +8153,15 @@ var ts; switch (declaration.kind) { case 71: return declaration; - case 292: - case 287: { + case 293: + case 288: { var name = declaration.name; if (name.kind === 145) { return name.right; } break; } - case 198: { + case 199: { var expr = declaration; switch (ts.getSpecialPropertyAssignmentKind(expr)) { case 1: @@ -8139,9 +8173,9 @@ var ts; return undefined; } } - case 291: + case 292: return getNameOfJSDocTypedef(declaration); - case 247: { + case 248: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } @@ -8384,480 +8418,480 @@ var ts; } ts.isLiteralTypeNode = isLiteralTypeNode; function isObjectBindingPattern(node) { - return node.kind === 178; + return node.kind === 179; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 179; + return node.kind === 180; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 180; + return node.kind === 181; } ts.isBindingElement = isBindingElement; function isArrayLiteralExpression(node) { - return node.kind === 181; + return node.kind === 182; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 182; + return node.kind === 183; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 183; + return node.kind === 184; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 184; + return node.kind === 185; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 185; + return node.kind === 186; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 186; + return node.kind === 187; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 187; + return node.kind === 188; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertion(node) { - return node.kind === 188; + return node.kind === 189; } ts.isTypeAssertion = isTypeAssertion; function isParenthesizedExpression(node) { - return node.kind === 189; + return node.kind === 190; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295) { + while (node.kind === 296) { node = node.expression; } return node; } ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; function isFunctionExpression(node) { - return node.kind === 190; + return node.kind === 191; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 191; + return node.kind === 192; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 192; + return node.kind === 193; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 193; + return node.kind === 194; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 194; + return node.kind === 195; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 195; + return node.kind === 196; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 196; + return node.kind === 197; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 197; + return node.kind === 198; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 198; + return node.kind === 199; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 199; + return node.kind === 200; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 200; + return node.kind === 201; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 201; + return node.kind === 202; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 202; + return node.kind === 203; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 203; + return node.kind === 204; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 204; + return node.kind === 205; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 205; + return node.kind === 206; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 206; + return node.kind === 207; } ts.isAsExpression = isAsExpression; function isNonNullExpression(node) { - return node.kind === 207; + return node.kind === 208; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 208; + return node.kind === 209; } ts.isMetaProperty = isMetaProperty; function isTemplateSpan(node) { - return node.kind === 209; + return node.kind === 210; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 210; + return node.kind === 211; } ts.isSemicolonClassElement = isSemicolonClassElement; function isBlock(node) { - return node.kind === 211; + return node.kind === 212; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 212; + return node.kind === 213; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 213; + return node.kind === 214; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 214; + return node.kind === 215; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 215; + return node.kind === 216; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 216; + return node.kind === 217; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 217; + return node.kind === 218; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 218; + return node.kind === 219; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 219; + return node.kind === 220; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 220; + return node.kind === 221; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 221; + return node.kind === 222; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 222; + return node.kind === 223; } ts.isBreakStatement = isBreakStatement; function isBreakOrContinueStatement(node) { - return node.kind === 222 || node.kind === 221; + return node.kind === 223 || node.kind === 222; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isReturnStatement(node) { - return node.kind === 223; + return node.kind === 224; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 224; + return node.kind === 225; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 225; + return node.kind === 226; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 226; + return node.kind === 227; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 227; + return node.kind === 228; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 228; + return node.kind === 229; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 229; + return node.kind === 230; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 230; + return node.kind === 231; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 231; + return node.kind === 232; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 232; + return node.kind === 233; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 233; + return node.kind === 234; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 234; + return node.kind === 235; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 235; + return node.kind === 236; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 236; + return node.kind === 237; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 237; + return node.kind === 238; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 238; + return node.kind === 239; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 239; + return node.kind === 240; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 240; + return node.kind === 241; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 241; + return node.kind === 242; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 242; + return node.kind === 243; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 243; + return node.kind === 244; } ts.isImportClause = isImportClause; function isNamespaceImport(node) { - return node.kind === 244; + return node.kind === 245; } ts.isNamespaceImport = isNamespaceImport; function isNamedImports(node) { - return node.kind === 245; + return node.kind === 246; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 246; + return node.kind === 247; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 247; + return node.kind === 248; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 248; + return node.kind === 249; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 249; + return node.kind === 250; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 250; + return node.kind === 251; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 251; + return node.kind === 252; } ts.isMissingDeclaration = isMissingDeclaration; function isExternalModuleReference(node) { - return node.kind === 252; + return node.kind === 253; } ts.isExternalModuleReference = isExternalModuleReference; function isJsxElement(node) { - return node.kind === 253; + return node.kind === 254; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 254; + return node.kind === 255; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 255; + return node.kind === 256; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 256; + return node.kind === 257; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 257; + return node.kind === 258; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 258; + return node.kind === 259; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 259; + return node.kind === 260; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 260; + return node.kind === 261; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 261; + return node.kind === 262; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 262; + return node.kind === 263; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 263; + return node.kind === 264; } ts.isJsxExpression = isJsxExpression; function isCaseClause(node) { - return node.kind === 264; + return node.kind === 265; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 265; + return node.kind === 266; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 266; + return node.kind === 267; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 267; + return node.kind === 268; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 268; + return node.kind === 269; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 269; + return node.kind === 270; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 270; + return node.kind === 271; } ts.isSpreadAssignment = isSpreadAssignment; function isEnumMember(node) { - return node.kind === 271; + return node.kind === 272; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 272; + return node.kind === 273; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 273; + return node.kind === 274; } ts.isBundle = isBundle; function isJSDocTypeExpression(node) { - return node.kind === 274; + return node.kind === 275; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 275; + return node.kind === 276; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 276; + return node.kind === 277; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 277; + return node.kind === 278; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 278; + return node.kind === 279; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 279; + return node.kind === 280; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 280; + return node.kind === 281; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 281; + return node.kind === 282; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 282; + return node.kind === 283; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 285; + return node.kind === 286; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocClassTag(node) { - return node.kind === 286; + return node.kind === 287; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocParameterTag(node) { - return node.kind === 287; + return node.kind === 288; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 288; + return node.kind === 289; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 289; + return node.kind === 290; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 290; + return node.kind === 291; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 291; + return node.kind === 292; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 292; + return node.kind === 293; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 292 || node.kind === 287; + return node.kind === 293 || node.kind === 288; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 283; + return node.kind === 284; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); (function (ts) { function isSyntaxList(n) { - return n.kind === 293; + return n.kind === 294; } ts.isSyntaxList = isSyntaxList; function isNode(node) { @@ -8949,8 +8983,8 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 71 - || kind === 178 - || kind === 179; + || kind === 179 + || kind === 180; } ts.isBindingName = isBindingName; function isFunctionLike(node) { @@ -8963,13 +8997,13 @@ var ts; ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 232: + case 233: case 153: case 154: case 155: case 156: - case 190: case 191: + case 192: return true; default: return false; @@ -8982,7 +9016,7 @@ var ts; case 158: case 159: case 162: - case 280: + case 281: case 163: return true; default: @@ -9002,12 +9036,12 @@ var ts; || kind === 155 || kind === 156 || kind === 159 - || kind === 210 - || kind === 251; + || kind === 211 + || kind === 252; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 233 || node.kind === 203); + return node && (node.kind === 234 || node.kind === 204); } ts.isClassLike = isClassLike; function isAccessor(node) { @@ -9032,22 +9066,22 @@ var ts; || kind === 150 || kind === 152 || kind === 159 - || kind === 251; + || kind === 252; } ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 268 - || kind === 269 + return kind === 269 || kind === 270 + || kind === 271 || kind === 153 || kind === 155 || kind === 156 - || kind === 251; + || kind === 252; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { - return (kind >= 160 && kind <= 177) + return (kind >= 160 && kind <= 178) || kind === 119 || kind === 134 || kind === 135 @@ -9059,14 +9093,14 @@ var ts; || kind === 140 || kind === 95 || kind === 131 - || kind === 205 - || kind === 275 + || kind === 206 || kind === 276 || kind === 277 || kind === 278 || kind === 279 || kind === 280 - || kind === 281; + || kind === 281 + || kind === 282; } function isTypeNode(node) { return isTypeNodeKind(node.kind); @@ -9084,29 +9118,29 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 179 - || kind === 178; + return kind === 180 + || kind === 179; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 181 - || kind === 182; + return kind === 182 + || kind === 183; } ts.isAssignmentPattern = isAssignmentPattern; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 180 - || kind === 204; + return kind === 181 + || kind === 205; } ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 230: + case 231: case 148: - case 180: + case 181: return true; } return false; @@ -9119,8 +9153,8 @@ var ts; ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 178: - case 182: + case 179: + case 183: return true; } return false; @@ -9128,26 +9162,33 @@ var ts; ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 179: - case 181: + case 180: + case 182: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; + function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { + var kind = node.kind; + return kind === 184 + || kind === 145 + || kind === 178; + } + ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 183 + return kind === 184 || kind === 145; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { + case 256: case 255: - case 254: - case 185: case 186: case 187: + case 188: case 149: return true; default: @@ -9156,12 +9197,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 185 || node.kind === 186; + return node.kind === 186 || node.kind === 187; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 200 + return kind === 201 || kind === 13; } ts.isTemplateLiteral = isTemplateLiteral; @@ -9171,32 +9212,32 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 183: case 184: - case 186: case 185: - case 253: - case 254: - case 257: case 187: - case 181: - case 189: + case 186: + case 254: + case 255: + case 258: + case 188: case 182: - case 203: case 190: + case 183: + case 204: + case 191: case 71: case 12: case 8: case 9: case 13: - case 200: + case 201: case 86: case 95: case 99: case 101: case 97: - case 207: case 208: + case 209: case 91: return true; default: @@ -9209,13 +9250,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 196: case 197: - case 192: + case 198: case 193: case 194: case 195: - case 188: + case 196: + case 189: return true; default: return isLeftHandSideExpressionKind(kind); @@ -9223,9 +9264,9 @@ var ts; } function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 197: + case 198: return true; - case 196: + case 197: return expr.operator === 43 || expr.operator === 44; default: @@ -9239,15 +9280,15 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 199: - case 201: - case 191: - case 198: + case 200: case 202: - case 206: - case 204: + case 192: + case 199: + case 203: + case 207: + case 205: + case 297: case 296: - case 295: return true; default: return isUnaryExpressionKind(kind); @@ -9255,16 +9296,16 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 188 - || kind === 206; + return kind === 189 + || kind === 207; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 295; + return node.kind === 296; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 294; + return node.kind === 295; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -9274,20 +9315,20 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 218: case 219: case 220: - case 216: + case 221: case 217: + case 218: return true; - case 226: + case 227: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isForInOrOfStatement(node) { - return node.kind === 219 || node.kind === 220; + return node.kind === 220 || node.kind === 221; } ts.isForInOrOfStatement = isForInOrOfStatement; function isConciseBody(node) { @@ -9306,106 +9347,106 @@ var ts; ts.isForInitializer = isForInitializer; function isModuleBody(node) { var kind = node.kind; - return kind === 238 - || kind === 237 + return kind === 239 + || kind === 238 || kind === 71; } ts.isModuleBody = isModuleBody; function isNamespaceBody(node) { var kind = node.kind; - return kind === 238 - || kind === 237; + return kind === 239 + || kind === 238; } ts.isNamespaceBody = isNamespaceBody; function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 71 - || kind === 237; + || kind === 238; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 245 - || kind === 244; + return kind === 246 + || kind === 245; } ts.isNamedImportBindings = isNamedImportBindings; function isModuleOrEnumDeclaration(node) { - return node.kind === 237 || node.kind === 236; + return node.kind === 238 || node.kind === 237; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 191 - || kind === 180 - || kind === 233 - || kind === 203 - || kind === 154 - || kind === 236 - || kind === 271 - || kind === 250 - || kind === 232 - || kind === 190 - || kind === 155 - || kind === 243 - || kind === 241 - || kind === 246 + return kind === 192 + || kind === 181 || kind === 234 - || kind === 260 + || kind === 204 + || kind === 154 + || kind === 237 + || kind === 272 + || kind === 251 + || kind === 233 + || kind === 191 + || kind === 155 + || kind === 244 + || kind === 242 + || kind === 247 + || kind === 235 + || kind === 261 || kind === 153 || kind === 152 - || kind === 237 - || kind === 240 - || kind === 244 + || kind === 238 + || kind === 241 + || kind === 245 || kind === 148 - || kind === 268 + || kind === 269 || kind === 151 || kind === 150 || kind === 156 - || kind === 269 - || kind === 235 + || kind === 270 + || kind === 236 || kind === 147 - || kind === 230 - || kind === 291; + || kind === 231 + || kind === 292; } function isDeclarationStatementKind(kind) { - return kind === 232 - || kind === 251 - || kind === 233 + return kind === 233 + || kind === 252 || kind === 234 || kind === 235 || kind === 236 || kind === 237 + || kind === 238 + || kind === 243 || kind === 242 - || kind === 241 + || kind === 249 || kind === 248 - || kind === 247 - || kind === 240; + || kind === 241; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 222 - || kind === 221 - || kind === 229 - || kind === 216 - || kind === 214 - || kind === 213 - || kind === 219 - || kind === 220 - || kind === 218 - || kind === 215 - || kind === 226 - || kind === 223 - || kind === 225 - || kind === 227 - || kind === 228 - || kind === 212 + return kind === 223 + || kind === 222 + || kind === 230 || kind === 217 + || kind === 215 + || kind === 214 + || kind === 220 + || kind === 221 + || kind === 219 + || kind === 216 + || kind === 227 || kind === 224 - || kind === 294 - || kind === 298 - || kind === 297; + || kind === 226 + || kind === 228 + || kind === 229 + || kind === 213 + || kind === 218 + || kind === 225 + || kind === 295 + || kind === 299 + || kind === 298; } function isDeclaration(node) { if (node.kind === 147) { - return node.parent.kind !== 290 || ts.isInJavaScriptFile(node); + return node.parent.kind !== 291 || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -9426,10 +9467,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 211) + if (node.kind !== 212) return false; if (node.parent !== undefined) { - if (node.parent.kind === 228 || node.parent.kind === 267) { + if (node.parent.kind === 229 || node.parent.kind === 268) { return false; } } @@ -9437,7 +9478,7 @@ var ts; } function isModuleReference(node) { var kind = node.kind; - return kind === 252 + return kind === 253 || kind === 145 || kind === 71; } @@ -9446,52 +9487,52 @@ var ts; var kind = node.kind; return kind === 99 || kind === 71 - || kind === 183; + || kind === 184; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 253 - || kind === 263 - || kind === 254 + return kind === 254 + || kind === 264 + || kind === 255 || kind === 10 - || kind === 257; + || kind === 258; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 260 - || kind === 262; + return kind === 261 + || kind === 263; } ts.isJsxAttributeLike = isJsxAttributeLike; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 263; + || kind === 264; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 255 - || kind === 254; + return kind === 256 + || kind === 255; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 264 - || kind === 265; + return kind === 265 + || kind === 266; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isJSDocNode(node) { - return node.kind >= 274 && node.kind <= 292; + return node.kind >= 275 && node.kind <= 293; } ts.isJSDocNode = isJSDocNode; function isJSDocCommentContainingNode(node) { - return node.kind === 282 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); + return node.kind === 283 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; function isJSDocTag(node) { - return node.kind >= 284 && node.kind <= 292; + return node.kind >= 285 && node.kind <= 293; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -9529,19 +9570,19 @@ var ts; case 172: case 174: case 176: - case 188: - case 190: + case 189: case 191: - case 206: - case 230: - case 232: - case 235: - case 274: - case 277: + case 192: + case 207: + case 231: + case 233: + case 236: + case 275: case 278: case 279: case 280: case 281: + case 282: return true; } return false; @@ -9557,10 +9598,10 @@ var ts; ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { switch (node.kind) { - case 260: - case 262: - case 268: + case 261: + case 263: case 269: + case 270: case 153: case 155: case 156: @@ -9571,7 +9612,7 @@ var ts; } ts.isObjectLiteralElement = isObjectLiteralElement; function isTypeReferenceType(node) { - return node.kind === 161 || node.kind === 205; + return node.kind === 161 || node.kind === 206; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -11305,7 +11346,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 272) { + if (kind === 273) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71) { @@ -11355,14 +11396,14 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 269: + case 270: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 270: + case 271: return visitNode(cbNode, node.expression); case 148: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -11387,20 +11428,20 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 268: + case 269: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.initializer); - case 230: + case 231: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 180: + case 181: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || @@ -11422,9 +11463,9 @@ var ts; case 154: case 155: case 156: - case 190: - case 232: case 191: + case 233: + case 192: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -11459,6 +11500,10 @@ var ts; visitNode(cbNode, node.falseType); case 171: return visitNode(cbNode, node.typeParameter); + case 178: + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); case 172: case 174: return visitNode(cbNode, node.type); @@ -11472,145 +11517,138 @@ var ts; visitNode(cbNode, node.type); case 177: return visitNode(cbNode, node.literal); - case 178: case 179: - return visitNodes(cbNode, cbNodes, node.elements); - case 181: + case 180: return visitNodes(cbNode, cbNodes, node.elements); case 182: - return visitNodes(cbNode, cbNodes, node.properties); + return visitNodes(cbNode, cbNodes, node.elements); case 183: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.name); + return visitNodes(cbNode, cbNodes, node.properties); case 184: return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.argumentExpression); + visitNode(cbNode, node.name); case 185: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); case 186: + case 187: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNodes(cbNode, cbNodes, node.arguments); - case 187: + case 188: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 188: + case 189: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 189: - return visitNode(cbNode, node.expression); - case 192: + case 190: return visitNode(cbNode, node.expression); case 193: return visitNode(cbNode, node.expression); case 194: return visitNode(cbNode, node.expression); - case 196: - return visitNode(cbNode, node.operand); - case 201: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 195: return visitNode(cbNode, node.expression); case 197: return visitNode(cbNode, node.operand); + case 202: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 196: + return visitNode(cbNode, node.expression); case 198: + return visitNode(cbNode, node.operand); + case 199: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 206: + case 207: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 207: - return visitNode(cbNode, node.expression); case 208: + return visitNode(cbNode, node.expression); + case 209: return visitNode(cbNode, node.name); - case 199: + case 200: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 202: + case 203: return visitNode(cbNode, node.expression); - case 211: - case 238: + case 212: + case 239: return visitNodes(cbNode, cbNodes, node.statements); - case 272: + case 273: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 212: + case 213: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 231: + case 232: return visitNodes(cbNode, cbNodes, node.declarations); - case 214: - return visitNode(cbNode, node.expression); case 215: + return visitNode(cbNode, node.expression); + case 216: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 216: + case 217: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 217: + case 218: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218: + case 219: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 219: + case 220: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 220: + case 221: return visitNode(cbNode, node.awaitModifier) || visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 221: case 222: - return visitNode(cbNode, node.label); case 223: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.label); case 224: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression); case 225: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 226: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 239: + case 240: return visitNodes(cbNode, cbNodes, node.clauses); - case 264: + case 265: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 265: + case 266: return visitNodes(cbNode, cbNodes, node.statements); - case 226: + case 227: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 227: - return visitNode(cbNode, node.expression); case 228: + return visitNode(cbNode, node.expression); + case 229: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 267: + case 268: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 149: return visitNode(cbNode, node.expression); - case 233: - case 203: - return visitNodes(cbNode, cbNodes, node.decorators) || - 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 234: + case 204: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || @@ -11622,112 +11660,119 @@ var ts; visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); case 236: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 271: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); case 237: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + case 272: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 238: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 241: + case 242: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 242: + case 243: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 243: + case 244: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 240: - return visitNode(cbNode, node.name); - case 244: + case 241: return visitNode(cbNode, node.name); case 245: - case 249: + return visitNode(cbNode, node.name); + case 246: + case 250: return visitNodes(cbNode, cbNodes, node.elements); - case 248: + case 249: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 246: - case 250: + case 247: + case 251: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 247: + case 248: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 200: + case 201: return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); - case 209: + case 210: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 146: return visitNode(cbNode, node.expression); - case 266: + case 267: return visitNodes(cbNode, cbNodes, node.types); - case 205: + case 206: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); - case 252: - return visitNode(cbNode, node.expression); - case 251: - return visitNodes(cbNode, cbNodes, node.decorators); - case 296: - return visitNodes(cbNode, cbNodes, node.elements); case 253: + return visitNode(cbNode, node.expression); + case 252: + return visitNodes(cbNode, cbNodes, node.decorators); + case 297: + return visitNodes(cbNode, cbNodes, node.elements); + case 254: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 257: + case 258: return visitNode(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingFragment); - case 254: case 255: + case 256: return visitNode(cbNode, node.tagName) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.attributes); - case 261: + case 262: return visitNodes(cbNode, cbNodes, node.properties); - case 260: + case 261: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 262: - return visitNode(cbNode, node.expression); case 263: + return visitNode(cbNode, node.expression); + case 264: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 256: + case 257: return visitNode(cbNode, node.tagName); - case 274: - return visitNode(cbNode, node.type); - case 278: - return visitNode(cbNode, node.type); - case 277: + case 275: return visitNode(cbNode, node.type); case 279: return visitNode(cbNode, node.type); + case 278: + return visitNode(cbNode, node.type); case 280: + return visitNode(cbNode, node.type); + case 281: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 281: - return visitNode(cbNode, node.type); case 282: + return visitNode(cbNode, node.type); + case 283: return visitNodes(cbNode, cbNodes, node.tags); - case 287: - case 292: + case 288: + case 293: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -11736,17 +11781,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 288: - return visitNode(cbNode, node.typeExpression); case 289: return visitNode(cbNode, node.typeExpression); - case 285: - return visitNode(cbNode, node.class); case 290: - return visitNodes(cbNode, cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 286: + return visitNode(cbNode, node.class); case 291: + return visitNodes(cbNode, cbNodes, node.typeParameters); + case 292: if (node.typeExpression && - node.typeExpression.kind === 274) { + node.typeExpression.kind === 275) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -11754,7 +11799,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 283: + case 284: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -11762,7 +11807,7 @@ var ts; } } return; - case 295: + case 296: return visitNode(cbNode, node.expression); } } @@ -11963,7 +12008,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) { - var sourceFile = new SourceFileConstructor(272, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(273, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -12593,7 +12638,7 @@ var ts; case 155: case 156: case 151: - case 210: + case 211: return true; case 153: var methodDeclaration = node; @@ -12607,8 +12652,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 264: case 265: + case 266: return true; } } @@ -12617,42 +12662,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 232: + case 233: + case 213: case 212: - case 211: + case 216: case 215: - case 214: - case 227: + case 228: + case 224: + case 226: case 223: - case 225: case 222: + case 220: case 221: case 219: - case 220: case 218: - case 217: - case 224: - case 213: - case 228: - case 226: - case 216: + case 225: + case 214: case 229: + case 227: + case 217: + case 230: + case 243: case 242: - case 241: + case 249: case 248: - case 247: - case 237: - case 233: + case 238: case 234: - case 236: case 235: + case 237: + case 236: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 271; + return node.kind === 272; } function isReusableTypeMember(node) { if (node) { @@ -12668,7 +12713,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 230) { + if (node.kind !== 231) { return false; } var variableDeclarator = node; @@ -12797,7 +12842,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(200); + var template = createNode(201); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 14, "Template head has wrong token kind"); var list = []; @@ -12809,7 +12854,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(209); + var span = createNode(210); span.expression = allowInAnd(parseExpression); var literal; if (token() === 18) { @@ -12873,9 +12918,9 @@ var ts; return finishNode(node); } function parseJSDocAllType(postFixEquals) { - var result = createNode(275); + var result = createNode(276); if (postFixEquals) { - return createJSDocPostfixType(279, result); + return createJSDocPostfixType(280, result); } else { nextToken(); @@ -12883,7 +12928,7 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(278); + var result = createNode(279); nextToken(); result.type = parseNonArrayType(); return finishNode(result); @@ -12897,18 +12942,18 @@ var ts; token() === 29 || token() === 58 || token() === 49) { - var result = createNode(276, pos); + var result = createNode(277, pos); return finishNode(result); } else { - var result = createNode(277, pos); + var result = createNode(278, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNodeWithJSDoc(280); + var result = createNodeWithJSDoc(281); nextToken(); fillSignature(56, 4 | 32, result); return finishNode(result); @@ -12930,12 +12975,12 @@ var ts; var dotdotdot = parseOptionalToken(24); var type = parseType(); if (dotdotdot) { - var variadic = createNode(281, dotdotdot.pos); + var variadic = createNode(282, dotdotdot.pos); variadic.type = type; type = finishNode(variadic); } if (token() === 58) { - return createJSDocPostfixType(279, type); + return createJSDocPostfixType(280, type); } return type; } @@ -13235,7 +13280,7 @@ var ts; var node = createNode(177); var unaryMinusExpression; if (negative) { - unaryMinusExpression = createNode(196); + unaryMinusExpression = createNode(197); unaryMinusExpression.operator = 38; nextToken(); } @@ -13250,6 +13295,26 @@ var ts; node.literal = expression; return finishNode(node); } + function isStartOfTypeOfImportType() { + nextToken(); + return token() === 91; + } + function parseImportType() { + sourceFile.flags |= 524288; + var node = createNode(178); + if (parseOptional(103)) { + node.isTypeOf = true; + } + parseExpected(91); + parseExpected(19); + node.argument = parseType(); + parseExpected(20); + if (parseOptional(23)) { + node.qualifier = parseEntityName(true, ts.Diagnostics.Type_expected); + } + node.typeArguments = tryParseTypeArguments(); + return finishNode(node); + } function nextTokenIsNumericLiteral() { return nextToken() === 8; } @@ -13295,13 +13360,15 @@ var ts; } } case 103: - return parseTypeQuery(); + return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); case 17: return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); case 21: return parseTupleType(); case 19: return parseParenthesizedType(); + case 91: + return parseImportType(); default: return parseTypeReference(); } @@ -13336,6 +13403,7 @@ var ts; case 51: case 24: case 126: + case 91: return true; case 38: return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral); @@ -13354,13 +13422,13 @@ var ts; while (!scanner.hasPrecedingLineBreak()) { switch (token()) { case 51: - type = createJSDocPostfixType(278, type); + type = createJSDocPostfixType(279, type); break; case 55: if (!(contextFlags & 1048576) && lookAhead(nextTokenIsStartOfType)) { return type; } - type = createJSDocPostfixType(277, type); + type = createJSDocPostfixType(278, type); break; case 21: parseExpected(21); @@ -13630,7 +13698,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(201); + var node = createNode(202); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token() === 39 || isStartOfExpression())) { @@ -13646,11 +13714,11 @@ var ts; ts.Debug.assert(token() === 36, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(191, asyncModifier.pos); + node = createNode(192, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(191, identifier.pos); + node = createNode(192, identifier.pos); } var parameter = createNode(148, identifier.pos); parameter.name = identifier; @@ -13798,7 +13866,7 @@ var ts; return 0; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNodeWithJSDoc(191); + var node = createNodeWithJSDoc(192); node.modifiers = parseModifiersForArrowFunction(); var isAsync = ts.hasModifier(node, 256) ? 2 : 0; fillSignature(56, isAsync | (allowAmbiguity ? 0 : 8), node); @@ -13830,7 +13898,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(199, leftOperand.pos); + var node = createNode(200, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -13882,43 +13950,43 @@ var ts; return ts.getBinaryOperatorPrecedence(token()) > 0; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(198, left.pos); + var node = createNode(199, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(206, left.pos); + var node = createNode(207, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(196); + var node = createNode(197); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(192); - nextToken(); - node.expression = parseSimpleUnaryExpression(); - return finishNode(node); - } - function parseTypeOfExpression() { var node = createNode(193); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } - function parseVoidExpression() { + function parseTypeOfExpression() { var node = createNode(194); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } + function parseVoidExpression() { + var node = createNode(195); + nextToken(); + node.expression = parseSimpleUnaryExpression(); + return finishNode(node); + } function isAwaitExpression() { if (token() === 121) { if (inAwaitContext()) { @@ -13929,7 +13997,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(195); + var node = createNode(196); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -13946,7 +14014,7 @@ var ts; if (token() === 40) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 188) { + if (simpleUnaryExpression.kind === 189) { 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 { @@ -13999,7 +14067,7 @@ var ts; } function parseUpdateExpression() { if (token() === 43 || token() === 44) { - var node = createNode(196); + var node = createNode(197); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -14011,7 +14079,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 43 || token() === 44) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(197, expression.pos); + var node = createNode(198, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -14039,7 +14107,7 @@ var ts; if (token() === 19 || token() === 23 || token() === 21) { return expression; } - var node = createNode(183, expression.pos); + var node = createNode(184, expression.pos); node.expression = expression; parseExpectedToken(23, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -14061,8 +14129,8 @@ var ts; function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 255) { - var node = createNode(253, opening.pos); + if (opening.kind === 256) { + var node = createNode(254, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -14071,22 +14139,22 @@ var ts; } result = finishNode(node); } - else if (opening.kind === 258) { - var node = createNode(257, opening.pos); + else if (opening.kind === 259) { + var node = createNode(258, opening.pos); node.openingFragment = opening; node.children = parseJsxChildren(node.openingFragment); node.closingFragment = parseJsxClosingFragment(inExpressionContext); result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 254); + ts.Debug.assert(opening.kind === 255); result = opening; } if (inExpressionContext && token() === 27) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(198, result.pos); + var badNode = createNode(199, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -14142,7 +14210,7 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(261); + var jsxAttributes = createNode(262); jsxAttributes.properties = parseList(13, parseJsxAttribute); return finishNode(jsxAttributes); } @@ -14150,7 +14218,7 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(27); if (token() === 29) { - var node_1 = createNode(258, fullStart); + var node_1 = createNode(259, fullStart); scanJsxText(); return finishNode(node_1); } @@ -14159,7 +14227,7 @@ var ts; var attributes = parseJsxAttributes(); var node; if (token() === 29) { - node = createNode(255, fullStart); + node = createNode(256, fullStart); scanJsxText(); } else { @@ -14171,7 +14239,7 @@ var ts; parseExpected(29, undefined, false); scanJsxText(); } - node = createNode(254, fullStart); + node = createNode(255, fullStart); } node.tagName = tagName; node.typeArguments = typeArguments; @@ -14183,7 +14251,7 @@ var ts; var expression = token() === 99 ? parseTokenNode() : parseIdentifierName(); while (parseOptional(23)) { - var propertyAccess = createNode(183, expression.pos); + var propertyAccess = createNode(184, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -14191,7 +14259,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(263); + var node = createNode(264); if (!parseExpected(17)) { return undefined; } @@ -14213,7 +14281,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(260); + var node = createNode(261); node.name = parseIdentifierName(); if (token() === 58) { switch (scanJsxAttributeValue()) { @@ -14228,7 +14296,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(262); + var node = createNode(263); parseExpected(17); parseExpected(24); node.expression = parseExpression(); @@ -14236,7 +14304,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(256); + var node = createNode(257); parseExpected(28); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -14249,7 +14317,7 @@ var ts; return finishNode(node); } function parseJsxClosingFragment(inExpressionContext) { - var node = createNode(259); + var node = createNode(260); parseExpected(28); if (ts.tokenIsIdentifierOrKeyword(token())) { parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); @@ -14264,7 +14332,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(188); + var node = createNode(189); parseExpected(27); node.type = parseType(); parseExpected(29); @@ -14275,7 +14343,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(23); if (dotToken) { - var propertyAccess = createNode(183, expression.pos); + var propertyAccess = createNode(184, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -14283,13 +14351,13 @@ var ts; } if (token() === 51 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(207, expression.pos); + var nonNullExpression = createNode(208, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } if (!inDecoratorContext() && parseOptional(21)) { - var indexedAccess = createNode(184, expression.pos); + var indexedAccess = createNode(185, expression.pos); indexedAccess.expression = expression; if (token() !== 22) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -14303,7 +14371,7 @@ var ts; continue; } if (token() === 13 || token() === 14) { - var tagExpression = createNode(187, expression.pos); + var tagExpression = createNode(188, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 13 ? parseLiteralNode() @@ -14322,7 +14390,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(185, expression.pos); + var callExpr = createNode(186, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -14330,7 +14398,7 @@ var ts; continue; } else if (token() === 19) { - var callExpr = createNode(185, expression.pos); + var callExpr = createNode(186, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -14425,28 +14493,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNodeWithJSDoc(189); + var node = createNodeWithJSDoc(190); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); return finishNode(node); } function parseSpreadElement() { - var node = createNode(202); + var node = createNode(203); parseExpected(24); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 24 ? parseSpreadElement() : - token() === 26 ? createNode(204) : + token() === 26 ? createNode(205) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(181); + var node = createNode(182); parseExpected(21); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14458,7 +14526,7 @@ var ts; function parseObjectLiteralElement() { var node = createNodeWithJSDoc(0); if (parseOptionalToken(24)) { - node.kind = 270; + node.kind = 271; node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -14479,7 +14547,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 || token() === 18 || token() === 58); if (isShorthandPropertyAssignment) { - node.kind = 269; + node.kind = 270; var equalsToken = parseOptionalToken(58); if (equalsToken) { node.equalsToken = equalsToken; @@ -14487,14 +14555,14 @@ var ts; } } else { - node.kind = 268; + node.kind = 269; parseExpected(56); node.initializer = allowInAnd(parseAssignmentExpressionOrHigher); } return finishNode(node); } function parseObjectLiteralExpression() { - var node = createNode(182); + var node = createNode(183); parseExpected(17); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14508,7 +14576,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNodeWithJSDoc(190); + var node = createNodeWithJSDoc(191); node.modifiers = parseModifiers(); parseExpected(89); node.asteriskToken = parseOptionalToken(39); @@ -14533,12 +14601,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94); if (parseOptional(23)) { - var node_2 = createNode(208, fullStart); + var node_2 = createNode(209, fullStart); node_2.keywordToken = 94; node_2.name = parseIdentifierName(); return finishNode(node_2); } - var node = createNode(186, fullStart); + var node = createNode(187, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 19) { @@ -14547,7 +14615,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(211); + var node = createNode(212); if (parseExpected(17, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14578,12 +14646,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(213); + var node = createNode(214); parseExpected(25); return finishNode(node); } function parseIfStatement() { - var node = createNode(215); + var node = createNode(216); parseExpected(90); parseExpected(19); node.expression = allowInAnd(parseExpression); @@ -14593,7 +14661,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(216); + var node = createNode(217); parseExpected(81); node.statement = parseStatement(); parseExpected(106); @@ -14604,7 +14672,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(217); + var node = createNode(218); parseExpected(106); parseExpected(19); node.expression = allowInAnd(parseExpression); @@ -14628,7 +14696,7 @@ var ts; } var forOrForInOrForOfStatement; if (awaitToken ? parseExpected(144) : parseOptional(144)) { - var forOfStatement = createNode(220, pos); + var forOfStatement = createNode(221, pos); forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); @@ -14636,14 +14704,14 @@ var ts; forOrForInOrForOfStatement = forOfStatement; } else if (parseOptional(92)) { - var forInStatement = createNode(219, pos); + var forInStatement = createNode(220, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(20); forOrForInOrForOfStatement = forInStatement; } else { - var forStatement = createNode(218, pos); + var forStatement = createNode(219, pos); forStatement.initializer = initializer; parseExpected(25); if (token() !== 25 && token() !== 20) { @@ -14661,7 +14729,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 222 ? 72 : 77); + parseExpected(kind === 223 ? 72 : 77); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -14669,7 +14737,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(223); + var node = createNode(224); parseExpected(96); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -14678,7 +14746,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(224); + var node = createNode(225); parseExpected(107); parseExpected(19); node.expression = allowInAnd(parseExpression); @@ -14687,7 +14755,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(264); + var node = createNode(265); parseExpected(73); node.expression = allowInAnd(parseExpression); parseExpected(56); @@ -14695,7 +14763,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(265); + var node = createNode(266); parseExpected(79); parseExpected(56); node.statements = parseList(3, parseStatement); @@ -14705,12 +14773,12 @@ var ts; return token() === 73 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(225); + var node = createNode(226); parseExpected(98); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); - var caseBlock = createNode(239); + var caseBlock = createNode(240); parseExpected(17); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(18); @@ -14718,14 +14786,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(227); + var node = createNode(228); parseExpected(100); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(228); + var node = createNode(229); parseExpected(102); node.tryBlock = parseBlock(false); node.catchClause = token() === 74 ? parseCatchClause() : undefined; @@ -14736,7 +14804,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(267); + var result = createNode(268); parseExpected(74); if (parseOptional(19)) { result.variableDeclaration = parseVariableDeclaration(); @@ -14749,7 +14817,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(229); + var node = createNode(230); parseExpected(78); parseSemicolon(); return finishNode(node); @@ -14758,12 +14826,12 @@ var ts; var node = createNodeWithJSDoc(0); var expression = allowInAnd(parseExpression); if (expression.kind === 71 && parseOptional(56)) { - node.kind = 226; + node.kind = 227; node.label = expression; node.statement = parseStatement(); } else { - node.kind = 214; + node.kind = 215; node.expression = expression; parseSemicolon(); } @@ -14901,16 +14969,16 @@ var ts; case 17: return parseBlock(false); case 104: - return parseVariableStatement(createNodeWithJSDoc(230)); + return parseVariableStatement(createNodeWithJSDoc(231)); case 110: if (isLetDeclaration()) { - return parseVariableStatement(createNodeWithJSDoc(230)); + return parseVariableStatement(createNodeWithJSDoc(231)); } break; case 89: - return parseFunctionDeclaration(createNodeWithJSDoc(232)); + return parseFunctionDeclaration(createNodeWithJSDoc(233)); case 75: - return parseClassDeclaration(createNodeWithJSDoc(233)); + return parseClassDeclaration(createNodeWithJSDoc(234)); case 90: return parseIfStatement(); case 81: @@ -14920,9 +14988,9 @@ var ts; case 88: return parseForOrForInOrForOfStatement(); case 77: - return parseBreakOrContinueStatement(221); - case 72: return parseBreakOrContinueStatement(222); + case 72: + return parseBreakOrContinueStatement(223); case 96: return parseReturnStatement(); case 107: @@ -15016,7 +15084,7 @@ var ts; } default: if (node.decorators || node.modifiers) { - var missing = createMissingNode(251, true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(252, true, ts.Diagnostics.Declaration_expected); missing.pos = node.pos; missing.decorators = node.decorators; missing.modifiers = node.modifiers; @@ -15037,16 +15105,16 @@ var ts; } function parseArrayBindingElement() { if (token() === 26) { - return createNode(204); + return createNode(205); } - var node = createNode(180); + var node = createNode(181); node.dotDotDotToken = parseOptionalToken(24); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(180); + var node = createNode(181); node.dotDotDotToken = parseOptionalToken(24); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -15062,14 +15130,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(178); + var node = createNode(179); parseExpected(17); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(18); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(179); + var node = createNode(180); parseExpected(21); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(22); @@ -15091,7 +15159,7 @@ var ts; return parseVariableDeclaration(true); } function parseVariableDeclaration(allowExclamation) { - var node = createNode(230); + var node = createNode(231); node.name = parseIdentifierOrPattern(); if (allowExclamation && node.name.kind === 71 && token() === 51 && !scanner.hasPrecedingLineBreak()) { @@ -15104,7 +15172,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(231); + var node = createNode(232); switch (token()) { case 104: break; @@ -15133,13 +15201,13 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 20; } function parseVariableStatement(node) { - node.kind = 212; + node.kind = 213; node.declarationList = parseVariableDeclarationList(false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(node) { - node.kind = 232; + node.kind = 233; parseExpected(89); node.asteriskToken = parseOptionalToken(39); node.name = ts.hasModifier(node, 512) ? parseOptionalIdentifier() : parseIdentifier(); @@ -15282,7 +15350,7 @@ var ts; } function parseClassElement() { if (token() === 25) { - var result = createNode(210); + var result = createNode(211); nextToken(); return finishNode(result); } @@ -15315,10 +15383,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(createNodeWithJSDoc(0), 203); + return parseClassDeclarationOrExpression(createNodeWithJSDoc(0), 204); } function parseClassDeclaration(node) { - return parseClassDeclarationOrExpression(node, 233); + return parseClassDeclarationOrExpression(node, 234); } function parseClassDeclarationOrExpression(node, kind) { node.kind = kind; @@ -15352,7 +15420,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 || tok === 108) { - var node = createNode(266); + var node = createNode(267); node.token = tok; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -15361,7 +15429,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(205); + var node = createNode(206); node.expression = parseLeftHandSideExpressionOrHigher(); node.typeArguments = tryParseTypeArguments(); return finishNode(node); @@ -15378,7 +15446,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(node) { - node.kind = 234; + node.kind = 235; parseExpected(109); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -15387,7 +15455,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(node) { - node.kind = 235; + node.kind = 236; parseExpected(139); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); @@ -15397,13 +15465,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNodeWithJSDoc(271); + var node = createNodeWithJSDoc(272); node.name = parsePropertyName(); node.initializer = allowInAnd(parseInitializer); return finishNode(node); } function parseEnumDeclaration(node) { - node.kind = 236; + node.kind = 237; parseExpected(83); node.name = parseIdentifier(); if (parseExpected(17)) { @@ -15416,7 +15484,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(238); + var node = createNode(239); if (parseExpected(17)) { node.statements = parseList(1, parseStatement); parseExpected(18); @@ -15427,7 +15495,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(node, flags) { - node.kind = 237; + node.kind = 238; var namespaceFlag = flags & 16; node.flags |= flags; node.name = parseIdentifier(); @@ -15437,7 +15505,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(node) { - node.kind = 237; + node.kind = 238; if (token() === 143) { node.name = parseIdentifier(); node.flags |= 512; @@ -15481,7 +15549,7 @@ var ts; return nextToken() === 41; } function parseNamespaceExportDeclaration(node) { - node.kind = 240; + node.kind = 241; parseExpected(118); parseExpected(130); node.name = parseIdentifier(); @@ -15498,7 +15566,7 @@ var ts; return parseImportEqualsDeclaration(node, identifier); } } - node.kind = 242; + node.kind = 243; if (identifier || token() === 39 || token() === 17) { @@ -15510,7 +15578,7 @@ var ts; return finishNode(node); } function parseImportEqualsDeclaration(node, identifier) { - node.kind = 241; + node.kind = 242; node.name = identifier; parseExpected(58); node.moduleReference = parseModuleReference(); @@ -15518,13 +15586,13 @@ var ts; return finishNode(node); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(243, fullStart); + var importClause = createNode(244, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(26)) { - importClause.namedBindings = token() === 39 ? parseNamespaceImport() : parseNamedImportsOrExports(245); + importClause.namedBindings = token() === 39 ? parseNamespaceImport() : parseNamedImportsOrExports(246); } return finishNode(importClause); } @@ -15534,7 +15602,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(252); + var node = createNode(253); parseExpected(133); parseExpected(19); node.expression = parseModuleSpecifier(); @@ -15552,7 +15620,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(244); + var namespaceImport = createNode(245); parseExpected(39); parseExpected(118); namespaceImport.name = parseIdentifier(); @@ -15560,14 +15628,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 245 ? parseImportSpecifier : parseExportSpecifier, 17, 18); + node.elements = parseBracketedList(22, kind === 246 ? parseImportSpecifier : parseExportSpecifier, 17, 18); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(250); + return parseImportOrExportSpecifier(251); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(246); + return parseImportOrExportSpecifier(247); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -15586,19 +15654,19 @@ var ts; else { node.name = identifierName; } - if (kind === 246 && checkIdentifierIsKeyword) { + if (kind === 247 && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(node) { - node.kind = 248; + node.kind = 249; if (parseOptional(39)) { parseExpected(142); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(249); + node.exportClause = parseNamedImportsOrExports(250); if (token() === 142 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { parseExpected(142); node.moduleSpecifier = parseModuleSpecifier(); @@ -15608,7 +15676,7 @@ var ts; return finishNode(node); } function parseExportAssignment(node) { - node.kind = 247; + node.kind = 248; if (parseOptional(58)) { node.isExportEquals = true; } @@ -15622,10 +15690,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 241 && node.moduleReference.kind === 252 - || node.kind === 242 - || node.kind === 247 + || node.kind === 242 && node.moduleReference.kind === 253 + || node.kind === 243 || node.kind === 248 + || node.kind === 249 ? node : undefined; }); @@ -15644,7 +15712,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression(mayOmitBraces) { - var result = createNode(274, scanner.getTokenPos()); + var result = createNode(275, scanner.getTokenPos()); var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(17); result.type = doInsideOfContext(1048576, parseJSDocType); if (!mayOmitBraces || hasBrace) { @@ -15789,7 +15857,7 @@ var ts; } } function createJSDocComment() { - var result = createNode(282, start); + var result = createNode(283, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -15907,7 +15975,7 @@ var ts; return comments.length === 0 ? undefined : comments.join(""); } function parseUnknownTag(atToken, tagName) { - var result = createNode(284, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -15961,9 +16029,9 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 ? - createNode(287, atToken.pos) : - createNode(292, atToken.pos); - var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); + createNode(288, atToken.pos) : + createNode(293, atToken.pos); + var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; isNameFirst = true; @@ -15976,18 +16044,20 @@ var ts; result.isBracketed = isBracketed; return finishNode(result); } - function parseNestedTypeLiteral(typeExpression, name) { + function parseNestedTypeLiteral(typeExpression, name, target) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(274, scanner.getTokenPos()); + var typeLiteralExpression = createNode(275, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); var children = void 0; - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(1, name); })) { - children = ts.append(children, child); + while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, name); })) { + if (child.kind === 288 || child.kind === 293) { + children = ts.append(children, child); + } } if (children) { - jsdocTypeLiteral = createNode(283, start_2); + jsdocTypeLiteral = createNode(284, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 166) { jsdocTypeLiteral.isArrayType = true; @@ -15998,27 +16068,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 288; })) { - parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); - } - var result = createNode(288, atToken.pos); - result.atToken = atToken; - result.tagName = tagName; - result.typeExpression = tryParseTypeExpression(); - return finishNode(result); - } - function parseTypeTag(atToken, tagName) { if (ts.forEach(tags, function (t) { return t.kind === 289; })) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } var result = createNode(289, atToken.pos); result.atToken = atToken; result.tagName = tagName; + result.typeExpression = tryParseTypeExpression(); + return finishNode(result); + } + function parseTypeTag(atToken, tagName) { + if (ts.forEach(tags, function (t) { return t.kind === 290; })) { + parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); + } + var result = createNode(290, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(285, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -16026,7 +16096,7 @@ var ts; } function parseExpressionWithTypeArgumentsForAugments() { var usedBrace = parseOptional(17); - var node = createNode(205); + var node = createNode(206); node.expression = parsePropertyAccessEntityNameExpression(); node.typeArguments = tryParseTypeArguments(); var res = finishNode(node); @@ -16038,7 +16108,7 @@ var ts; function parsePropertyAccessEntityNameExpression() { var node = parseJSDocIdentifierName(true); while (parseOptional(23)) { - var prop = createNode(183, node.pos); + var prop = createNode(184, node.pos); prop.expression = node; prop.name = parseJSDocIdentifierName(); node = finishNode(prop); @@ -16046,7 +16116,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(286, atToken.pos); + var tag = createNode(287, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -16054,7 +16124,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(291, atToken.pos); + var typedefTag = createNode(292, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -16075,11 +16145,11 @@ var ts; var jsdocTypeLiteral = void 0; var childTypeTag = void 0; var start_3 = scanner.getStartPos(); - while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0); })) { + while (child = tryParse(function () { return parseChildPropertyTag(); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(283, start_3); + jsdocTypeLiteral = createNode(284, start_3); } - if (child.kind === 289) { + if (child.kind === 290) { if (childTypeTag) { break; } @@ -16105,7 +16175,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(23)) { - var jsDocNamespaceNode = createNode(237, pos); + var jsDocNamespaceNode = createNode(238, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -16129,6 +16199,9 @@ var ts; } return a.escapedText === b.escapedText; } + function parseChildPropertyTag() { + return parseChildParameterOrPropertyTag(0); + } function parseChildParameterOrPropertyTag(target, name) { var canParseTag = true; var seenAsterisk = false; @@ -16137,7 +16210,7 @@ var ts; case 57: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 287 && + if (child && child.kind === 288 && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -16221,7 +16294,7 @@ var ts; break; } } - var result = createNode(290, atToken.pos); + var result = createNode(291, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -17727,7 +17800,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 268) { + if (element.kind !== 269) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -17796,13 +17869,13 @@ var ts; case 8: reportInvalidOptionValue(option && option.type !== "number"); return Number(valueExpression.text); - case 196: + case 197: if (valueExpression.operator !== 38 || valueExpression.operand.kind !== 8) { break; } reportInvalidOptionValue(option && option.type !== "number"); return -Number(valueExpression.operand.text); - case 182: + case 183: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; if (option) { @@ -17812,7 +17885,7 @@ var ts; else { return convertObjectLiteralExpressionToJson(objectLiteralExpression, undefined, undefined, undefined); } - case 181: + case 182: reportInvalidOptionValue(option && option.type !== "list"); return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element); } @@ -17921,12 +17994,18 @@ var ts; function makePadding(paddingLength) { return Array(paddingLength + 1).join(" "); } + function isAllowedOption(_a) { + var category = _a.category, name = _a.name; + return category !== undefined + && category !== ts.Diagnostics.Command_line_Options + && (category !== ts.Diagnostics.Advanced_Options || compilerOptionsMap.has(name)); + } function writeConfigurations() { var categorizedOptions = ts.createMultiMap(); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; var category = option.category; - if (category !== undefined && category !== ts.Diagnostics.Command_line_Options && category !== ts.Diagnostics.Advanced_Options) { + if (isAllowedOption(option)) { categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); } } @@ -19053,6 +19132,7 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); } + ts.Debug.assert(host.fileExists(real), path + " linked to nonexistent file " + real); return real; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { diff --git a/lib/zh-CN/diagnosticMessages.generated.json b/lib/zh-CN/diagnosticMessages.generated.json index 8ac36006c92..87d654d7048 100644 --- a/lib/zh-CN/diagnosticMessages.generated.json +++ b/lib/zh-CN/diagnosticMessages.generated.json @@ -66,6 +66,7 @@ "A_rest_parameter_cannot_have_an_initializer_1048": "rest 参数不能具有初始化表达式。", "A_rest_parameter_must_be_last_in_a_parameter_list_1014": "rest 参数必须是参数列表中的最后一个参数。", "A_rest_parameter_must_be_of_an_array_type_2370": "rest 参数必须是数组类型。", + "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013": "Rest 参数或绑定模式可能不具有尾随逗号。", "A_return_statement_can_only_be_used_within_a_function_body_1108": "\"return\" 语句只能在函数体中使用。", "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167": "一系列条目,这些条目将重新映射导入内容,以查找与 \"baseUrl\" 有关的位置。", "A_set_accessor_cannot_have_a_return_type_annotation_1095": "\"set\" 访问器不能具有返回类型批注。", @@ -94,12 +95,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "访问器仅在面向 ECMAScript 5 和更高版本时可用。", "Accessors_must_both_be_abstract_or_non_abstract_2676": "两个取值函数必须都是抽象的或都是非抽象的。", "Add_0_to_existing_import_declaration_from_1_90015": "将“{0}”从“{1}”添加到现有导入声明", + "Add_all_missing_async_modifiers_95041": "添加所有缺失的 \"async\" 修饰符", + "Add_all_missing_members_95022": "添加所有缺少的成员", + "Add_all_missing_super_calls_95039": "添加所有缺失的超级调用", "Add_async_modifier_to_containing_function_90029": "将异步修饰符添加到包含函数", "Add_definite_assignment_assertion_to_property_0_95020": "向属性“{0}”添加明确的赋值断言", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "将明确赋值断言添加到未初始化的所有属性", "Add_index_signature_for_property_0_90017": "为属性“{0}”添加索引签名", "Add_initializer_to_property_0_95019": "向属性“{0}”添加初始值设定项", + "Add_initializers_to_all_uninitialized_properties_95027": "将初始化表达式添加到未初始化的所有属性", "Add_missing_super_call_90001": "添加缺失的 \"super()\" 调用", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "将 \"this.\" 添加到匹配成员名称的所有未解析变量", "Add_this_to_unresolved_variable_90008": "向未解析的变量添加 \"this.\"", + "Add_to_all_uncalled_decorators_95044": "将 \"()\" 添加到所有未调用的修饰器", + "Add_ts_ignore_to_all_error_messages_95042": "将 \"@ts-ignore\" 添加到所有错误消息", + "Add_undefined_type_to_all_uninitialized_properties_95029": "将未定义的类型添加到未初始化的所有属性", "Add_undefined_type_to_property_0_95018": "向属性“{0}”添加“未定义”类型", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "添加 tsconfig.json 文件有助于组织包含 TypeScript 和 JavaScript 文件的项目。有关详细信息,请访问 https://aka.ms/tsconfig。", "Additional_Checks_6176": "其他检查", @@ -156,6 +166,7 @@ "An_object_member_cannot_be_declared_optional_1162": "对象成员无法声明为可选。", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "重载签名无法声明为生成器。", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "乘方表达式的左侧不允许存在具有“{0}”运算符的一元表达式。请考虑用括号将表达式括起。", + "Annotate_everything_with_types_from_JSDoc_95043": "使用 JSDoc 中的类型批注所有内容", "Annotate_with_type_from_JSDoc_95009": "通过 JSDoc 类型批注", "Annotate_with_types_from_JSDoc_95010": "使用 JSDoc 中的类型批注", "Argument_expression_expected_1135": "应为参数表达式。", @@ -223,6 +234,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "Catch 子句变量不能有类型批注。", "Catch_clause_variable_cannot_have_an_initializer_1197": "Catch 子句变量不能有初始化表达式。", "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_extends_to_implements_90003": "将 \"extends\" 改为 \"implements\"", "Change_spelling_to_0_90022": "将拼写更改为“{0}”", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "检查“{0}”是否是“{1}”-“{2}”的最长匹配前缀。", @@ -256,6 +270,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "类“{0}”的构造函数是受保护的,仅可在类声明中访问。", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "派生类的构造函数必须包含 \"super\" 调用。", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "未指定包含文件,并且无法确定根目录,正在跳过在 \"node_modules\" 文件夹中查找。", + "Convert_all_constructor_functions_to_classes_95045": "将所有构造函数都转换为类", + "Convert_all_to_default_imports_95035": "全部转换为默认导入", "Convert_function_0_to_class_95002": "将函数“{0}”转换为类", "Convert_function_to_an_ES2015_class_95001": "将函数转换为 ES2015 类", "Convert_to_ES6_module_95017": "转换为 ES6 模块", @@ -274,6 +290,7 @@ "Decorators_are_not_valid_here_1206": "修饰器在此处无效。", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "不能向多个同名的 get/set 访问器应用修饰器。", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "模块的默认导出具有或正在使用专用名称“{0}”。", + "Delete_all_unused_declarations_95024": "删除未使用的所有声明", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[已弃用] 请改用 \"--jsxFactory\"。已 \"react\" JSX 发出设为目标时,请指定要为 createElement 调用的对象", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[已弃用] 请改用 \"--outFile\"。连接并发出到单个文件的输出", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[已弃用] 请改用 \"--skipLibCheck\"。请跳过默认库声明文件的类型检查。", @@ -388,6 +405,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "文件名“{0}”的扩展名为“{1}”,请去除它。", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "文件规范不能包含出现在递归目录通配符(\"*\"): “{0}”后的父目录(\"..\")。", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "文件规范不能以递归目录通配符结尾(\"**\"):“{0}”。", + "Fix_all_detected_spelling_errors_95026": "修复检测到的所有拼写错误", "Found_package_json_at_0_6099": "在“{0}”处找到了 \"package.json\"。", "Found_package_json_at_0_Package_ID_is_1_6190": "在“{0}”找到了 \"package.json\"。包 ID 为“{1}”。", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "面向 \"ES3\" 或 \"ES5\" 时,在严格模式下,块内不允许函数声明。", @@ -400,6 +418,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "函数缺少结束返回语句,返回类型不包括 \"undefined\"。", "Function_overload_must_be_static_2387": "函数重载必须为静态。", "Function_overload_must_not_be_static_2388": "函数重载不能为静态。", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "为每个相应的 \".d.ts\" 文件生成 sourcemap。", "Generates_corresponding_d_ts_file_6002": "生成相应的 \".d.ts\" 文件。", "Generates_corresponding_map_file_6043": "生成相应的 \".map\" 文件。", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "生成器隐式具有类型“{0}”,因为它不生成任何值。请考虑提供一个返回类型。", @@ -421,6 +440,8 @@ "Identifier_expected_1003": "应为标识符。", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "应为标识符。转换 ECMAScript 模块时,\"__esModule\" 保留为导出标记。", "Ignore_this_error_message_90019": "忽略此错误信息", + "Implement_all_inherited_abstract_classes_95040": "实现继承的所有抽象类", + "Implement_all_unimplemented_interfaces_95032": "实现未实现的所有接口", "Implement_inherited_abstract_class_90007": "实现已继承的抽象类", "Implement_interface_0_90006": "实现接口“{0}”", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "导出的类“{0}”的 Implements 子句具有或正在使用专用名称“{1}”。", @@ -441,6 +462,7 @@ "Index_signature_is_missing_in_type_0_2329": "类型“{0}”中缺少索引签名。", "Index_signatures_are_incompatible_2330": "索引签名不兼容。", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "合并声明“{0}”中的单独声明必须全为导出或全为局部声明。", + "Infer_all_types_from_usage_95023": "从使用情况推导所有类型", "Infer_parameter_types_from_usage_95012": "根据使用情况推断参数类型", "Infer_type_of_0_from_usage_95011": "根据使用情况推断“{0}”的类型", "Initialize_property_0_in_the_constructor_90020": "初始化构造函数中的属性“{0}”", @@ -452,6 +474,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "初始化 TypeScript 项目并创建 tsconfig.json 文件。", "Insert_command_line_options_and_files_from_a_file_6030": "从文件插入命令行选项和文件。", "Install_0_95014": "安装“{0}”", + "Install_all_missing_types_packages_95033": "安装缺少的所有类型包", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "接口“{0}”不能同时扩展类型“{1}”和“{2}”。", "Interface_0_incorrectly_extends_interface_1_2430": "接口“{0}”错误扩展接口“{1}”。", "Interface_declaration_cannot_have_implements_clause_1176": "接口声明不能有 \"implements\" 子句。", @@ -504,6 +527,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "区域设置必须采用 <语言> 或 <语言>-<区域> 形式。例如“{0}”或“{1}”。", "Longest_matching_prefix_for_0_is_1_6108": "“{0}”的最长匹配前缀为“{1}”。", "Looking_up_in_node_modules_folder_initial_location_0_6125": "正在在 \"node_modules\" 文件夹中查找,初始位置“{0}”。", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "让所有 \"super()\" 调用成为构造函数中的第一个语句", "Make_super_call_the_first_statement_in_the_constructor_90002": "在构造函数中,使 \"super()\" 调用第一个语句", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "映射的对象类型隐式地含有 \"any\" 模板类型。", "Member_0_implicitly_has_an_1_type_7008": "成员“{0}”隐式包含类型“{1}”。", @@ -514,6 +538,8 @@ "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101": "导出接口的方法“{0}”具有或正在使用私有模块“{2}”中的名称“{1}”。", "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102": "导出接口的方法“{0}”具有或正在使用专用名称“{1}”。", "Modifiers_cannot_appear_here_1184": "修饰符不能出现在此处。", + "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340": "模块“{0}”不引用类型,但在此处用作类型。", + "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339": "模块“{0}”不引用值,但在此处用作值。", "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "模块 {0} 已导出一个名为“{1}”的成员。请考虑重新显式导出以解决歧义。", "Module_0_has_no_default_export_1192": "模块“{0}”没有默认导出。", "Module_0_has_no_exported_member_1_2305": "模块“{0}”没有导出的成员“{1}”。", @@ -566,6 +592,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "仅当提供了选项 \"--inlineSourceMap\" 或选项 \"--sourceMap\" 时,才能使用选项“{0}”。", "Option_0_cannot_be_specified_with_option_1_5053": "选项“{0}”不能与选项“{1}”同时指定。", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "无法在不指定选项“{1}”的情况下指定选项“{0}”。", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "无法在不指定选项 {1} 或选项 {2} 的情况下指定选项 {0}。", "Option_0_should_have_array_of_strings_as_a_value_6103": "选项“{0}”应将字符串数组作为一个值。", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "选项 \"isolatedModules\" 只可在提供了选项 \"--module\" 或者选项 \"target\" 是 \"ES2015\" 或更高版本时使用。", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "在未指定 \"--baseUrl\" 选项的情况下,无法使用选项 \"paths\"。", @@ -610,6 +637,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "以严格模式进行分析,并为每个源文件发出 \"use strict\" 指令。", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "模式“{0}”最多只可具有一个 \"*\" 字符。", "Prefix_0_with_an_underscore_90025": "带下划线的前缀“{0}”", + "Prefix_all_unused_declarations_with_where_possible_95025": "尽可能在所有未使用的声明前添加前缀 \"_\"", "Print_names_of_files_part_of_the_compilation_6155": "属于编译一部分的文件的打印名称。", "Print_names_of_generated_files_part_of_the_compilation_6154": "属于编译一部分的已生成文件的打印名称。", "Print_the_compiler_s_version_6019": "打印编译器的版本。", @@ -708,6 +736,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "导出类中的公共静态方法的返回类型具有或正在使用专用名称“{0}”。", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "重用源自“{0}”的模块解析,因为解析在旧程序中未更改。", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "对文件“{1}”重用旧程序中模块 “{0}”的解析。", + "Rewrite_all_as_indexed_access_types_95034": "全部重写为索引访问类型", "Rewrite_as_the_indexed_access_type_0_90026": "重写为索引访问类型“{0}”", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "无法确定根目录,正在跳过主搜索路径。", "STRATEGY_6039": "策略", @@ -788,7 +817,7 @@ "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236": "属性修饰器函数的返回类型必须为 \"void\" 或 \"any\"。", "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058": "异步函数的返回类型必须是有效承诺,或不得包含可调用的 \"then\" 成员。 ", "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064": "异步函数或方法的返回类型必须为全局 Promise 类型。", - "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407": "\"for...in\" 语句右侧必须是 \"any\" 类型、对象类型或类型参数。", + "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_or_an_enum_type_2363": "算术运算右侧必须是 \"any\"、\"number\" 或枚举类型。", "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361": "\"in\" 表达式的右侧必须是 \"any\" 类型、对象类型或类型参数。", "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\" 接口类型的类型。", @@ -823,13 +852,17 @@ "Type_0_is_not_a_constructor_function_type_2507": "类型“{0}”不是构造函数类型。", "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055": "类型“{0}”不是 ES5/ES3 中的有效异步函数返回类型,因为其未引用与 Promise 相符的构造函数值。", "Type_0_is_not_an_array_type_2461": "类型“{0}”不是数组类型。", + "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568": "类型“{0}”不是数组类型。请使用编译器选项 \"--downlevelIteration\" 允许迭代器进行迭代。", "Type_0_is_not_an_array_type_or_a_string_type_2495": "类型“{0}”不是数组类型或字符串类型。", + "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569": "类型“{0}”不是数组类型或字符串类型。请使用编译器选项 \"--downlevelIteration\" 允许迭代器进行迭代。", "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549": "类型“{0}”不是数组类型或字符串类型,或者没有返回迭代器的 \"[Symbol.iterator]()\" 方法。", "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548": "类型“{0}”不是数组类型,或者没有返回迭代器的 \"[Symbol.iterator]()\" 方法。", "Type_0_is_not_assignable_to_type_1_2322": "不能将类型“{0}”分配给类型“{1}”。", "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719": "类型“{0}”无法分配给类型“{1}”。存在具有此名称的两种不同类型,但它们是不相关的。", "Type_0_is_not_comparable_to_type_1_2678": "类型“{0}”不可与类型“{1}”进行比较。", "Type_0_is_not_generic_2315": "类型“{0}”不是泛型类型。", + "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}”不匹配。", "Type_0_recursively_references_itself_as_a_base_type_2310": "类型“{0}”以递归方式将自身引用为基类。", "Type_alias_0_circularly_references_itself_2456": "类型别名“{0}”循环引用自身。", @@ -838,11 +871,10 @@ "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455": "候选类型参数“{1}”不是有效的类型参数,因为它不是候选“{0}”的超类型。", "Type_argument_expected_1140": "应为类型参数。", "Type_argument_list_cannot_be_empty_1099": "类型参数列表不能为空。", + "Type_arguments_cannot_be_used_here_1342": "无法在此处使用类型参数。", "Type_declaration_files_to_be_included_in_compilation_6124": "要包含在编译中类型声明文件。", "Type_expected_1110": "应为类型。", "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062": "类型在其自身的 \"then\" 方法的 fulfillment 回调中被直接或间接引用。", - "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "类型必须具有返回异步迭代器的 \"[Symbol.asyncIterator]()\" 方法。", - "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "类型必须具有返回迭代器的 \"[Symbol.iterator]()\" 方法。", "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320": "\"await\" 操作数的类型必须是有效承诺,或不得包含可调用的 \"then\" 成员。", "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "\"yield*\" 操作数的迭代元素的类型必须是有效承诺,或不得包含可调用的 \"then\" 成员。", "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "异步生成器中 \"yield\" 操作数的类型必须是有效承诺,或不得包含可调用的 \"then\" 成员。", diff --git a/lib/zh-TW/diagnosticMessages.generated.json b/lib/zh-TW/diagnosticMessages.generated.json index b3c6db2f4dc..3d7d54ab6bd 100644 --- a/lib/zh-TW/diagnosticMessages.generated.json +++ b/lib/zh-TW/diagnosticMessages.generated.json @@ -66,6 +66,7 @@ "A_rest_parameter_cannot_have_an_initializer_1048": "剩餘參數不得有初始設定式。", "A_rest_parameter_must_be_last_in_a_parameter_list_1014": "剩餘參數必須是參數清單中的最後一個參數。", "A_rest_parameter_must_be_of_an_array_type_2370": "剩餘參數必須為陣列類型。", + "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013": "A rest parameter or binding pattern may not have a trailing comma.", "A_return_statement_can_only_be_used_within_a_function_body_1108": "'return' 陳述式只可在函式主體內使用。", "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167": "一系列由重新對應匯入到 'baseUrl' 之相對查詢位置的項目。", "A_set_accessor_cannot_have_a_return_type_annotation_1095": "'set' 存取子不得有傳回型別註解。", @@ -94,12 +95,21 @@ "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056": "只有當目標為 ECMAScript 5 及更高版本時,才可使用存取子。", "Accessors_must_both_be_abstract_or_non_abstract_2676": "存取子必須兩者均為抽象或非抽象。", "Add_0_to_existing_import_declaration_from_1_90015": "從 \"{1}\" 將 '{0}' 新增至現有的匯入宣告", + "Add_all_missing_async_modifiers_95041": "Add all missing 'async' modifiers", + "Add_all_missing_members_95022": "Add all missing members", + "Add_all_missing_super_calls_95039": "Add all missing super calls", "Add_async_modifier_to_containing_function_90029": "將 async 修飾詞新增至包含的函式", "Add_definite_assignment_assertion_to_property_0_95020": "將明確指派判斷提示新增至屬性 '{0}'", + "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Add definite assignment assertions to all uninitialized properties", "Add_index_signature_for_property_0_90017": "為屬性 '{0}' 新增索引簽章", "Add_initializer_to_property_0_95019": "將初始設定式新增至屬性 '{0}'", + "Add_initializers_to_all_uninitialized_properties_95027": "Add initializers to all uninitialized properties", "Add_missing_super_call_90001": "新增遺漏的 'super()' 呼叫", + "Add_this_to_all_unresolved_variables_matching_a_member_name_95037": "Add 'this.' to all unresolved variables matching a member name", "Add_this_to_unresolved_variable_90008": "將 'this' 新增至未解析的變數", + "Add_to_all_uncalled_decorators_95044": "Add '()' to all uncalled decorators", + "Add_ts_ignore_to_all_error_messages_95042": "Add '@ts-ignore' to all error messages", + "Add_undefined_type_to_all_uninitialized_properties_95029": "Add undefined type to all uninitialized properties", "Add_undefined_type_to_property_0_95018": "將 'undefined' 類型新增至屬性 '{0}'", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "新增 tsconfig.json 檔案有助於組織同時包含 TypeScript 及 JavaScript 檔案的專案。若要深入了解,請前往 https://aka.ms/tsconfig。", "Additional_Checks_6176": "其他檢查", @@ -156,6 +166,7 @@ "An_object_member_cannot_be_declared_optional_1162": "不得將物件成員宣告為選擇性。", "An_overload_signature_cannot_be_declared_as_a_generator_1222": "不可將多載簽章宣告為產生器。", "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006": "乘冪運算式左邊不允許具 '{0}' 運算子的一元運算式。請考慮以括弧括住運算式。", + "Annotate_everything_with_types_from_JSDoc_95043": "Annotate everything with types from JSDoc", "Annotate_with_type_from_JSDoc_95009": "為來自 JSDoc 的類型標註", "Annotate_with_types_from_JSDoc_95010": "為來自 JSDoc 的類型標註", "Argument_expression_expected_1135": "必須是引數運算式。", @@ -223,6 +234,9 @@ "Catch_clause_variable_cannot_have_a_type_annotation_1196": "Catch 子句變數不得有類型註釋。", "Catch_clause_variable_cannot_have_an_initializer_1197": "Catch 子句變數不得有初始設定式。", "Change_0_to_1_90014": "將 '{0}' 變更為 '{1}'", + "Change_all_extended_interfaces_to_implements_95038": "Change all extended interfaces to 'implements'", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "Change all jsdoc-style types to TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)", "Change_extends_to_implements_90003": "將 [延伸] 變更至 [實作]5D;", "Change_spelling_to_0_90022": "將拼字變更為 '{0}'", "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104": "檢查 '{0}' 是否為 '{1}' - '{2}' 的最長相符前置詞。", @@ -256,6 +270,8 @@ "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674": "類別 '{0}' 的建構函式受到保護,並且只能在類別宣告內存取。", "Constructors_for_derived_classes_must_contain_a_super_call_2377": "衍生類別的建構函式必須包含 'super' 呼叫。", "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126": "未指定包含檔案,因此無法決定根目錄,而將略過 'node_modules' 中的查閱。", + "Convert_all_constructor_functions_to_classes_95045": "Convert all constructor functions to classes", + "Convert_all_to_default_imports_95035": "Convert all to default imports", "Convert_function_0_to_class_95002": "將函式 '{0}' 轉換為類別", "Convert_function_to_an_ES2015_class_95001": "將函式轉換為 ES2015 類別", "Convert_to_ES6_module_95017": "轉換為 ES6 模組", @@ -274,6 +290,7 @@ "Decorators_are_not_valid_here_1206": "裝飾項目在此處無效。", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "無法將裝飾項目套用至多個同名的 get/set 存取子。", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "模組的預設匯出具有或正在使用私用名稱 '{0}'。", + "Delete_all_unused_declarations_95024": "Delete all unused declarations", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[即將淘汰] 請改用 '--jsxFactory'。當目標為 'react' JSX 發出時,為 createElement 指定所叫用的物件", "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[即將淘汰] 請改用 '--outFile'。 串連輸出並將其發出到單一檔案", "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[即將淘汰] 請改用 '--skipLibCheck'。跳過預設程式庫宣告檔案的類型檢查。", @@ -388,6 +405,7 @@ "File_name_0_has_a_1_extension_stripping_it_6132": "檔案名稱 '{0}' 的副檔名為 '{1}'。正予以移除。", "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "檔案規格不得包含出現在遞迴目錄萬用字元 ('**') 之後的父目錄 ('..'): '{0}'。", "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010": "檔案規格不能以遞迴目錄萬用字元 ('**') 結尾: '{0}'。", + "Fix_all_detected_spelling_errors_95026": "Fix all detected spelling errors", "Found_package_json_at_0_6099": "在 '{0}' 找到 'package.json'。", "Found_package_json_at_0_Package_ID_is_1_6190": "於 '{0}' 找到 'package.json'。套件識別碼為 '{1}'。", "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250": "以 'ES3' 或 'ES5' 為目標時,strict 模式下的區塊中不允許函式宣告。", @@ -400,6 +418,7 @@ "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "函式缺少結束傳回陳述式,且傳回類型不包括 'undefined'。", "Function_overload_must_be_static_2387": "函式多載必須為靜態。", "Function_overload_must_not_be_static_2388": "函式多載不可為靜態。", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "為每個相對應的 '.d.ts' 檔案產生 sourcemap。", "Generates_corresponding_d_ts_file_6002": "產生對應的 '.d.ts' 檔案。", "Generates_corresponding_map_file_6043": "產生對應的 '.map' 檔案。", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "產生器因為沒有產生任何值,所以隱含有類型 '{0}'。請考慮提供傳回型別。", @@ -421,6 +440,8 @@ "Identifier_expected_1003": "必須是識別碼。", "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216": "必須有識別碼。'__esModule' 已保留為轉換 ECMAScript 模組時匯出的標記。", "Ignore_this_error_message_90019": "略過此錯誤訊息", + "Implement_all_inherited_abstract_classes_95040": "Implement all inherited abstract classes", + "Implement_all_unimplemented_interfaces_95032": "Implement all unimplemented interfaces", "Implement_inherited_abstract_class_90007": "實作已繼承的抽象類別", "Implement_interface_0_90006": "實作介面 '{0}'", "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "匯出類別 '{0}' 的 Implements 子句具有或使用私用名稱 '{1}'。", @@ -441,6 +462,7 @@ "Index_signature_is_missing_in_type_0_2329": "類型 '{0}' 中遺漏索引簽章。", "Index_signatures_are_incompatible_2330": "索引簽章不相容。", "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395": "合併宣告 '{0}' 中的個別宣告必須全部匯出或全在本機上。", + "Infer_all_types_from_usage_95023": "Infer all types from usage", "Infer_parameter_types_from_usage_95012": "從使用方式推斷參數類型", "Infer_type_of_0_from_usage_95011": "從使用方式推斷 '{0}' 的類型", "Initialize_property_0_in_the_constructor_90020": "將建構函式中的屬性 '{0}' 初始化", @@ -452,6 +474,7 @@ "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070": "初始化 TypeScript 專案並建立 tsconfig.json 檔案。", "Insert_command_line_options_and_files_from_a_file_6030": "從檔案插入命令列選項與檔案。", "Install_0_95014": "安裝 '{0}'", + "Install_all_missing_types_packages_95033": "Install all missing types packages", "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320": "介面 '{0}' 不能同時擴充類型 '{1}' 和 '{2}'。", "Interface_0_incorrectly_extends_interface_1_2430": "介面 '{0}' 不正確地擴充介面 '{1}'。", "Interface_declaration_cannot_have_implements_clause_1176": "介面宣告不能有 'implements' 子句。", @@ -504,6 +527,7 @@ "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048": "地區設定的格式必須是 <語言> 或 <語言>-<國家/地區>。例如 '{0}' 或 '{1}'。", "Longest_matching_prefix_for_0_is_1_6108": "符合 '{0}' 的前置詞最長為 '{1}'。", "Looking_up_in_node_modules_folder_initial_location_0_6125": "目前正在 'node_modules' 資料夾中查詢,初始位置為 '{0}'。", + "Make_all_super_calls_the_first_statement_in_their_constructor_95036": "Make all 'super()' calls the first statement in their constructor", "Make_super_call_the_first_statement_in_the_constructor_90002": "使 'super()' 呼叫成為建構函式中的第一個陳述式", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "對應的物件類型隱含具有 'any' 範本類型。", "Member_0_implicitly_has_an_1_type_7008": "成員 '{0}' 隱含了 '{1}' 類型。", @@ -514,6 +538,8 @@ "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101": "匯出介面的方法 '{0}' 具有或使用私用模組 '{2}' 的名稱 '{1}'。", "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102": "匯出介面的方法 '{0}' 具有或使用私用名稱 '{1}'。", "Modifiers_cannot_appear_here_1184": "此處不得出現修飾詞。", + "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340": "Module '{0}' does not refer to a type, but is used as a type here.", + "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339": "Module '{0}' does not refer to a value, but is used as a value here.", "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "模組 {0} 已匯出名為 '{1}' 的成員。請考慮明確重新匯出項目以解決模稜兩可的情形。", "Module_0_has_no_default_export_1192": "模組 '{0}' 沒有預設匯出。", "Module_0_has_no_exported_member_1_2305": "模組 '{0}' 沒有匯出的成員 '{1}'。", @@ -566,6 +592,7 @@ "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051": "只有在已提供選項 '--inlineSourceMap' 或選項 '--sourceMap' 時,才可使用選項 '{0}'。", "Option_0_cannot_be_specified_with_option_1_5053": "不得同時指定選項 '{0}' 與選項 '{1}'。", "Option_0_cannot_be_specified_without_specifying_option_1_5052": "必須指定選項 '{1}' 才可指定選項 '{0}'。", + "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "指定選項 '{0}' 時,必須指定選項 '{1}' 或選項 '{2}'。", "Option_0_should_have_array_of_strings_as_a_value_6103": "選項 '{0}' 應以字串陣列作為值。", "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "只有在提供選項 '--module' 或是 'target' 為 'ES2015' 或更高項目時,才可使用選項 'isolatedModules'。", "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "必須指定 '--baseUrl' 選項才能使用選項 'paths'。", @@ -610,6 +637,7 @@ "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "在 strict 模式中進行剖析,並為每個來源檔案發出 \"use strict\"。", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "模式 '{0}' 最多只可有一個 '*' 字元。", "Prefix_0_with_an_underscore_90025": "具有底線的前置詞 '{0}'", + "Prefix_all_unused_declarations_with_where_possible_95025": "Prefix all unused declarations with '_' where possible", "Print_names_of_files_part_of_the_compilation_6155": "列印編譯時檔案部分的名稱。", "Print_names_of_generated_files_part_of_the_compilation_6154": "列印編譯時所產生之檔案部分的名稱。", "Print_the_compiler_s_version_6019": "列印編譯器的版本。", @@ -708,6 +736,7 @@ "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "匯出類別中公用靜態方法的傳回型別具有或使用私用名稱 '{0}'。", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "因為舊程式中的解決方案並無任何變更,所以會重複使用 '{0}' 中的模組解決方案。", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "對檔案 '{1}' 重複用舊程式中模組 '{0}' 的解決方案。", + "Rewrite_all_as_indexed_access_types_95034": "Rewrite all as indexed access types", "Rewrite_as_the_indexed_access_type_0_90026": "重寫為索引存取類型 '{0}'", "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122": "無法判斷根目錄,將略過主要搜尋路徑。", "STRATEGY_6039": "策略", @@ -788,7 +817,7 @@ "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236": "屬性裝飾項目函式的傳回型別必須是 'void' 或 'any'。", "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058": "非同步函式的傳回型別必須是有效的 Promise,或不得包含可呼叫的 'then' 成員。", "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064": "非同步函式或方法的傳回類型必須為全域 Promise 類型。", - "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407": "'for...in' 陳述式的右側必須是類型 'any'、物件類型或型別參數。", + "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363": "算術運算的右側必須是 'any'、'number' 或列舉類型。", "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361": "'in' 運算式的右側必須是類型 'any'、物件類型或型別參數。", "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' 介面類型的類型。", @@ -823,13 +852,17 @@ "Type_0_is_not_a_constructor_function_type_2507": "類型 '{0}' 不是建構函式類型。", "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055": "類型 '{0}' 不是 ES5/ES3 中的有效非同步函式傳回型別,因為它不是指與 Promise 相容的建構函式值。", "Type_0_is_not_an_array_type_2461": "類型 '{0}' 不是陣列類型。", + "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568": "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_2495": "類型 '{0}' 不是陣列類型或字串類型。", + "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569": "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.", "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549": "類型 '{0}' 不是陣列類型或字串類型,或沒有會傳回迭代器的 '[Symbol.iterator]()' 方法。", "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548": "類型 '{0}' 不是陣列類型,或沒有會傳回迭代器的 '[Symbol.iterator]()' 方法。", "Type_0_is_not_assignable_to_type_1_2322": "類型 '{0}' 不可指派給類型 '{1}'。", "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719": "無法將類型 '{0}' 指派給類型 '{1}'。有兩種使用此名稱的不同類型存在,但彼此並不相關。", "Type_0_is_not_comparable_to_type_1_2678": "類型 '{0}' 無法和類型 '{1}' 比較。", "Type_0_is_not_generic_2315": "'{0}' 不是泛型類型。", + "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.", + "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator.", "Type_0_provides_no_match_for_the_signature_1_2658": "類型 '{0}' 沒有符合特徵標記 '{1}' 的項目。", "Type_0_recursively_references_itself_as_a_base_type_2310": "類型 '{0}' 將自己當做基底類型遞迴參考。", "Type_alias_0_circularly_references_itself_2456": "類型別名 '{0}' 會循環參考自己。", @@ -838,11 +871,10 @@ "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455": "因為型別引數候選項 '{1}' 不是候選項 '{0}' 的超級類型,所以不是有效的型別引數。", "Type_argument_expected_1140": "必須是型別引數。", "Type_argument_list_cannot_be_empty_1099": "型別引數清單不得為空白。", + "Type_arguments_cannot_be_used_here_1342": "Type arguments cannot be used here.", "Type_declaration_files_to_be_included_in_compilation_6124": "要包含在編譯內的類型宣告檔案。", "Type_expected_1110": "必須是類型。", "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062": "類型在其本身 'then' 方法的完成回撥中直接或間接受到參考。", - "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "類型必須有會傳回非同步迭代器的 '[Symbol.asyncIterator]()' 方法。", - "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "類型必須有傳回迭代器的 '[Symbol.iterator]()' 方法。", "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320": "'await' 運算元類型必須是有效的 Promise,或不得包含可呼叫的 'then' 成員。", "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "'yield*' 運算元的反覆項目類型必須是有效的 Promise,或不得包含可呼叫的 'then' 成員。", "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "非同步產生器中的 'yield' 運算元類型必須是有效的 Promise,或不得包含可呼叫的 'then' 成員。", diff --git a/package-lock.json b/package-lock.json index 990d3fbcb5a..2e1c6f6207e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,33 +1,16 @@ { "name": "typescript", - "version": "2.8.0", + "version": "2.9.0", "lockfileVersion": 1, "requires": true, "dependencies": { - "@browserify/acorn5-object-spread": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@browserify/acorn5-object-spread/-/acorn5-object-spread-5.0.1.tgz", - "integrity": "sha512-sFCUPzgeEjdq3rinwy4TFXtak2YZdhqpj6MdNusxkdTFr9TXAUEYK4YQSamR8Joqt/yii1drgl5hk8q/AtJDKA==", - "dev": true, - "requires": { - "acorn": "5.3.0" - }, - "dependencies": { - "acorn": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz", - "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==", - "dev": true - } - } - }, "@gulp-sourcemaps/identity-map": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@gulp-sourcemaps/identity-map/-/identity-map-1.0.1.tgz", "integrity": "sha1-z6I7xYQPkQTOMqZedNt+epdLvuE=", "dev": true, "requires": { - "acorn": "5.3.0", + "acorn": "5.5.3", "css": "2.2.1", "normalize-path": "2.1.1", "source-map": "0.5.7", @@ -35,9 +18,9 @@ }, "dependencies": { "acorn": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz", - "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", + "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", "dev": true } } @@ -55,7 +38,7 @@ "@types/browserify": { "version": "12.0.33", "resolved": "https://registry.npmjs.org/@types/browserify/-/browserify-12.0.33.tgz", - "integrity": "sha512-mY6dYfq1Ns3Xqz/JFUcyoWaXtm0XDoNhkU1vCwM/ULM5zqNL+SbtacJhce/JCgPeCdbqdVqq77tJ4HwdtypSxg==", + "integrity": "sha1-5hlxwPmFvx93CQSDJkk/ELDdeL0=", "dev": true, "requires": { "@types/insert-module-globals": "7.0.0", @@ -71,22 +54,22 @@ "@types/convert-source-map": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/@types/convert-source-map/-/convert-source-map-1.5.1.tgz", - "integrity": "sha512-laiDIXqqthjJlyAMYAXOtN3N8+UlbM+KvZi4BaY5ZOekmVkBs/UxfK5O0HWeJVG2eW8F+Mu2ww13fTX+kY1FlQ==", + "integrity": "sha1-1NGA3WrcXLaK2ZvVbgPWN4gfRhY=", "dev": true }, "@types/del": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/del/-/del-3.0.0.tgz", - "integrity": "sha512-18mSs54BvzV8+TTQxt0ancig6tsuPZySnhp3cQkWFFDmDMavU4pmWwR+bHHqRBWODYqpzIzVkqKLuk/fP6yypQ==", + "integrity": "sha1-HIzYtuONo7VyNSyo6vVSeTFCYog=", "dev": true, "requires": { "@types/glob": "5.0.35" } }, "@types/events": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-1.1.0.tgz", - "integrity": "sha512-y3bR98mzYOo0pAZuiLari+cQyiKk3UXRuT45h1RjhfeCzqkjaVsfZJNaxdgtk7/3tzOm1ozLTqEqMP3VbI48jw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", + "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==", "dev": true }, "@types/glob": { @@ -95,7 +78,7 @@ "integrity": "sha512-wc+VveszMLyMWFvXLkloixT4n0harUIVZjnpzztaZ0nKLuul7Z32iMt2fUFGAaZ4y1XWjFRMtCI5ewvyh4aIeg==", "dev": true, "requires": { - "@types/events": "1.1.0", + "@types/events": "1.2.0", "@types/minimatch": "3.0.3", "@types/node": "8.5.5" } @@ -103,7 +86,7 @@ "@types/gulp": { "version": "3.8.36", "resolved": "https://registry.npmjs.org/@types/gulp/-/gulp-3.8.36.tgz", - "integrity": "sha512-u6/zWPzYRNPAtvyFJ3/RSXjmBaBM1dVs5kW22/jU6J786ZGLfSndhLoNOpFI6FGQvqTA+QzFHjSMhpkAN+wxcQ==", + "integrity": "sha1-Eer1g78FNGabT/qb/tUVV/qgCkw=", "dev": true, "requires": { "@types/node": "8.5.5", @@ -114,7 +97,7 @@ "@types/gulp-concat": { "version": "0.0.32", "resolved": "https://registry.npmjs.org/@types/gulp-concat/-/gulp-concat-0.0.32.tgz", - "integrity": "sha512-CUCFADlITzzBfBa2bdGzhKtvBr4eFh+evb+4igVbvPoO5RyPfHifmyQlZl6lM7q19+OKncRlFXDU7B4X9Ayo2g==", + "integrity": "sha1-ckhgKLHPX6qUyMHPNMYmUxzsrNY=", "dev": true, "requires": { "@types/node": "8.5.5" @@ -123,7 +106,7 @@ "@types/gulp-help": { "version": "0.0.34", "resolved": "https://registry.npmjs.org/@types/gulp-help/-/gulp-help-0.0.34.tgz", - "integrity": "sha512-MkW7psZznxxJg2MBk2P2qHE+T8jEZVFz3FG/qGjUYazkyJt7hBJWx5Nuewmay5RVNtUvSWPrdZLr/WTXY3T/6A==", + "integrity": "sha1-Dm1mcYySiWZPLtdaIaDmXXqIM+w=", "dev": true, "requires": { "@types/gulp": "3.8.36", @@ -134,7 +117,7 @@ "@types/gulp-newer": { "version": "0.0.31", "resolved": "https://registry.npmjs.org/@types/gulp-newer/-/gulp-newer-0.0.31.tgz", - "integrity": "sha512-e7J/Zv5Wd7CC0WpuA2syWVitgwrkG0u221e41w7r07XUR6hMH6kHPkq9tUrusHkbeW8QbuLbis5fODOwQCyggQ==", + "integrity": "sha1-818j0eT+DXuP9pnknRwhdmy546c=", "dev": true, "requires": { "@types/node": "8.5.5" @@ -143,7 +126,7 @@ "@types/gulp-sourcemaps": { "version": "0.0.32", "resolved": "https://registry.npmjs.org/@types/gulp-sourcemaps/-/gulp-sourcemaps-0.0.32.tgz", - "integrity": "sha512-+7BAmptW2bxyJnJcCEuie7vLoop3FwWgCdBMzyv7MYXED/HeNMeQuX7uPCkp4vfU1TTu4CYFH0IckNPvo0VePA==", + "integrity": "sha1-557mF+DLFXKYdL5FM/5ZwHeToXU=", "dev": true, "requires": { "@types/node": "8.5.5" @@ -152,7 +135,7 @@ "@types/insert-module-globals": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@types/insert-module-globals/-/insert-module-globals-7.0.0.tgz", - "integrity": "sha512-zudCJPwluh1VUDB6Gl/OQdRp+fYy3+47huJB/JMQubMS2p+sH18MCVK4WUz3FqaWLB12yh5ELxVR/+tqwlm/qA==", + "integrity": "sha1-jRWN5KY4To2qE7PWPuurbV9nd30=", "dev": true, "requires": { "@types/node": "8.5.5" @@ -161,7 +144,7 @@ "@types/merge2": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/@types/merge2/-/merge2-1.1.4.tgz", - "integrity": "sha512-GjaXY4OultxbaOOk7lCLO7xvEcFpdjExC605YmfI6X29vhHKpJfMWKCDZd3x+BITrZaXKg97DgV/SdGVSwdzxA==", + "integrity": "sha1-CmUOHMIVove4BALqtraiNuYC96M=", "dev": true, "requires": { "@types/node": "8.5.5" @@ -182,7 +165,7 @@ "@types/mkdirp": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz", - "integrity": "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==", + "integrity": "sha1-UDqs/lzCcD1UhDJrGyfvpnoznB8=", "dev": true, "requires": { "@types/node": "8.5.5" @@ -197,29 +180,29 @@ "@types/node": { "version": "8.5.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.5.tgz", - "integrity": "sha512-JRnfoh0Ll4ElmIXKxbUfcOodkGvcNHljct6mO1X9hE/mlrMzAx0hYCLAD7sgT53YAY1HdlpzUcV0CkmDqUqTuA==", + "integrity": "sha1-b56BZK4aVam+sdJXHPt6z51yDGE=", "dev": true }, "@types/orchestrator": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/@types/orchestrator/-/orchestrator-0.3.2.tgz", - "integrity": "sha512-cKB4yTX0wGaRCSkdHDX2fkGQbMAA8UOshC2U7DQky1CE5o+5q2iQQ8VkbPbE/88uaTtsusvBPMcCX7dgmjxBhQ==", + "integrity": "sha1-zRXGzql4oyuY5QVCOcvMeOVWcfE=", "dev": true, "requires": { "@types/node": "8.5.5", - "@types/q": "1.0.7" + "@types/q": "1.5.0" } }, "@types/q": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@types/q/-/q-1.0.7.tgz", - "integrity": "sha512-0WS7XU7sXzQ7J1nbnMKKYdjrrFoO3YtZYgUzeV8JFXffPnHfvSJQleR70I8BOAsOm14i4dyaAZ3YzqIl1YhkXQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.0.tgz", + "integrity": "sha512-sWj7AMiG0fYmta6ug1ublLjtj/tqn+CnCZeo7yswR1ykxel0FOWFGdWviTcGSNAMmtLbycDqbg6w98VPFKJmbw==", "dev": true }, "@types/run-sequence": { "version": "0.0.30", "resolved": "https://registry.npmjs.org/@types/run-sequence/-/run-sequence-0.0.30.tgz", - "integrity": "sha512-XwGr1b4yCGUILKeBkzmeWcxmGHQ0vFFFpA6D6y1yLO6gKmYorF+PHqdU5KG+nWt38OvtrkDptmrSmlHX/XtpLw==", + "integrity": "sha1-s6kMn9KaXu3lgTXdAl6zrEu7Vg4=", "dev": true, "requires": { "@types/gulp": "3.8.36", @@ -238,7 +221,7 @@ "@types/vinyl": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.2.tgz", - "integrity": "sha512-2iYpNuOl98SrLPBZfEN9Mh2JCJ2EI9HU35SfgBEb51DcmaHkhp8cKMblYeBqMQiwXMgAD3W60DbQ4i/UdLiXhw==", + "integrity": "sha1-TzuNro9YKNOADvcJsM/0iO6FLeM=", "dev": true, "requires": { "@types/node": "8.5.5" @@ -247,7 +230,7 @@ "@types/xml2js": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.2.tgz", - "integrity": "sha512-8aKUBSj3oGcnuiBmDLm3BIk09RYg01mz9HlQ2u4aS17oJ25DxjQrEUVGFSBVNOfM45pQW4OjcBPplq6r/exJdA==", + "integrity": "sha1-pLhLOHn/1HEJU/2Syr/emopOhFY=", "dev": true, "requires": { "@types/node": "8.5.5" @@ -275,6 +258,24 @@ "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", "dev": true }, + "acorn-node": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.3.0.tgz", + "integrity": "sha512-efP54n3d1aLfjL2UMdaXa6DsswwzJeI5rqhbFvXMrKiJ6eJFpf+7R0zN7t8IC+XKn2YOAFAv6xbBNgHUkoHWLw==", + "dev": true, + "requires": { + "acorn": "5.5.3", + "xtend": "4.0.1" + }, + "dependencies": { + "acorn": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", + "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", + "dev": true + } + } + }, "align-text": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", @@ -345,6 +346,15 @@ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, "ansi-wrap": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", @@ -384,7 +394,7 @@ "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", "dev": true }, "arr-union": { @@ -426,7 +436,7 @@ "array-slice": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", - "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", + "integrity": "sha1-42jqFfibxwaff/uJrsOmx9SsItQ=", "dev": true }, "array-union": { @@ -457,9 +467,9 @@ "dev": true }, "asn1.js": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.2.tgz", - "integrity": "sha512-b/OsSjvWEo8Pi8H0zsDd2P6Uqo2TK2pH8gNLSJtNLM2Db0v2QaAZ0pBQJXVjAn4gBuugeVDr7s63ZogpUIwWDg==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", "dev": true, "requires": { "bn.js": "4.11.8", @@ -556,7 +566,7 @@ "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", "dev": true, "requires": { "cache-base": "1.0.1", @@ -569,9 +579,9 @@ } }, "base64-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.1.tgz", - "integrity": "sha512-dwVUVIXsBZXwTuwnXI9RK8sBmgq09NDHzyR9SAph9eqk76gKK2JSQmZARC2zRC81JC2QTtxD0ARU5qTS25gIGw==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.3.tgz", + "integrity": "sha512-MsAhsUW1GxCdgYSO6tAfZrNapmUKk7mWx/k5mFY/A1gBtkaCaNapTg+FExCw1r9yeaZhqx/xPg43xgTFH6KL5w==", "dev": true }, "beeper": { @@ -599,7 +609,7 @@ "braces": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.0.tgz", - "integrity": "sha512-P4O8UQRdGiMLWSizsApmXVQDBS6KCt7dSexgLKBmH5Hr1CZq7vsnscFh8oR1sP1ab1Zj0uCHCEzZeV6SfUf3rA==", + "integrity": "sha1-pGlBy1+0khVrPWplbgbDU2Tj5m4=", "dev": true, "requires": { "arr-flatten": "1.1.0", @@ -622,16 +632,17 @@ "dev": true }, "browser-pack": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.0.2.tgz", - "integrity": "sha1-+GzWzvT1MAyOY+B6TVEvZfv/RTE=", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz", + "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", "dev": true, "requires": { "JSONStream": "1.3.2", - "combine-source-map": "0.7.2", + "combine-source-map": "0.8.0", "defined": "1.0.0", + "safe-buffer": "5.1.1", "through2": "2.0.3", - "umd": "3.0.1" + "umd": "3.0.3" } }, "browser-resolve": { @@ -643,6 +654,12 @@ "resolve": "1.1.7" } }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, "browserify": { "version": "16.1.1", "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.1.1.tgz", @@ -651,10 +668,10 @@ "requires": { "JSONStream": "1.3.2", "assert": "1.4.1", - "browser-pack": "6.0.2", + "browser-pack": "6.1.0", "browser-resolve": "1.11.2", "browserify-zlib": "0.2.0", - "buffer": "5.0.8", + "buffer": "5.1.0", "cached-path-relative": "1.0.1", "concat-stream": "1.6.2", "console-browserify": "1.1.0", @@ -670,10 +687,10 @@ "htmlescape": "1.1.1", "https-browserify": "1.0.0", "inherits": "2.0.3", - "insert-module-globals": "7.0.1", - "labeled-stream-splicer": "2.0.0", + "insert-module-globals": "7.0.6", + "labeled-stream-splicer": "2.0.1", "mkdirp": "0.5.1", - "module-deps": "6.0.0", + "module-deps": "6.0.2", "os-browserify": "0.3.0", "parents": "1.0.1", "path-browserify": "0.0.0", @@ -686,10 +703,10 @@ "shasum": "1.0.2", "shell-quote": "1.6.1", "stream-browserify": "2.0.1", - "stream-http": "2.7.2", + "stream-http": "2.8.1", "string_decoder": "1.0.3", "subarg": "1.0.0", - "syntax-error": "1.3.0", + "syntax-error": "1.4.0", "through2": "2.0.3", "timers-browserify": "1.4.2", "tty-browserify": "0.0.1", @@ -697,78 +714,12 @@ "util": "0.10.3", "vm-browserify": "0.0.4", "xtend": "4.0.1" - }, - "dependencies": { - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "1.0.0", - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "typedarray": "0.0.6" - } - }, - "domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", - "dev": true - }, - "events": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/events/-/events-2.0.0.tgz", - "integrity": "sha512-r/M5YkNg9zwI8QbSf7tsDWWJvO3PGwZXyG7GpFAxtMASnHL2eblFd7iHiGPtyGKKFPZ59S63NeX10Ws6WqGDcg==", - "dev": true - }, - "module-deps": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.0.0.tgz", - "integrity": "sha512-BKsMhJJENEM4dTgqq2MDTTHXRHcNUFegoAwlG4HO4VMdUyMcJDKgfgI+MOv6tR5Iv8G3MKZFgsSiyP3ZoosRMw==", - "dev": true, - "requires": { - "JSONStream": "1.3.2", - "browser-resolve": "1.11.2", - "cached-path-relative": "1.0.1", - "concat-stream": "1.6.2", - "defined": "1.0.0", - "detective": "5.0.2", - "duplexer2": "0.1.4", - "inherits": "2.0.3", - "parents": "1.0.1", - "readable-stream": "2.3.3", - "resolve": "1.6.0", - "stream-combiner2": "1.1.1", - "subarg": "1.0.0", - "through2": "2.0.3", - "xtend": "4.0.1" - }, - "dependencies": { - "resolve": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.6.0.tgz", - "integrity": "sha512-mw7JQNu5ExIkcw4LPih0owX/TZXjD/ZUF/ZQ/pDnkw3ZKhDcZZw5klmBlj6gVMwjQ3Pz5Jgu7F3d0jcDVuEWdw==", - "dev": true, - "requires": { - "path-parse": "1.0.5" - } - } - } - }, - "tty-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", - "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", - "dev": true - } } }, "browserify-aes": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.1.1.tgz", - "integrity": "sha512-UGnTYAnB2a3YuYKIRy1/4FB2HdM866E0qC46JXvVTYKlBlZlnvfpSfY6OKfXZAkv70eJ2a1SqzpAo5CRhZGDFg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { "buffer-xor": "1.0.3", @@ -785,7 +736,7 @@ "integrity": "sha1-mYgkSHS/XtTijalWZtzWasj8Njo=", "dev": true, "requires": { - "browserify-aes": "1.1.1", + "browserify-aes": "1.2.0", "browserify-des": "1.0.0", "evp_bytestokey": "1.0.3" } @@ -808,7 +759,7 @@ "dev": true, "requires": { "bn.js": "4.11.8", - "randombytes": "2.0.5" + "randombytes": "2.0.6" } }, "browserify-sign": { @@ -836,13 +787,13 @@ } }, "buffer": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.0.8.tgz", - "integrity": "sha512-xXvjQhVNz50v2nPeoOsNqWCLGfiv4ji/gXZM28jnVwdLJxH4mFyqgqCKfaK9zf1KUbG6zTkjLOy7ou+jSMarGA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.1.0.tgz", + "integrity": "sha512-YkIRgwsZwJWTnyQrsBTWefizHh+8GYj3kbL1BTiAQ/9pwpino0G7B2gp5tx/FUBqUlvtxV85KNR3mwfAtv15Yw==", "dev": true, "requires": { - "base64-js": "1.2.1", - "ieee754": "1.1.8" + "base64-js": "1.2.3", + "ieee754": "1.1.11" } }, "buffer-crc32": { @@ -884,7 +835,7 @@ "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", "dev": true, "requires": { "collection-visit": "1.0.0", @@ -954,32 +905,6 @@ "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", "supports-color": "5.3.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", - "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", - "dev": true, - "requires": { - "has-flag": "3.0.0" - } - } } }, "check-error": { @@ -1063,7 +988,7 @@ "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", "dev": true, "requires": { "is-accessor-descriptor": "0.1.6", @@ -1074,7 +999,7 @@ "kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", "dev": true } } @@ -1157,13 +1082,13 @@ "color-support": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "integrity": "sha1-k4NDeaHMmgxh+C9S8NBDIiUb1aI=", "dev": true }, "combine-source-map": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.7.2.tgz", - "integrity": "sha1-CHAxKFazB6h8xKxIbzqaYq7MwJ4=", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", + "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", "dev": true, "requires": { "convert-source-map": "1.1.3", @@ -1199,36 +1124,15 @@ "dev": true }, "concat-stream": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.2.tgz", - "integrity": "sha1-cIl4Yk2FavQaWnQd790mHadSwmY=", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "dev": true, "requires": { + "buffer-from": "1.0.0", "inherits": "2.0.3", - "readable-stream": "2.0.6", + "readable-stream": "2.3.3", "typedarray": "0.0.6" - }, - "dependencies": { - "readable-stream": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", - "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "0.10.31", - "util-deprecate": "1.0.2" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - } } }, "concat-with-sourcemaps": { @@ -1292,7 +1196,7 @@ "cipher-base": "1.0.4", "inherits": "2.0.3", "ripemd160": "2.0.1", - "sha.js": "2.4.9" + "sha.js": "2.4.11" } }, "create-hmac": { @@ -1306,7 +1210,7 @@ "inherits": "2.0.3", "ripemd160": "2.0.1", "safe-buffer": "5.1.1", - "sha.js": "2.4.9" + "sha.js": "2.4.11" } }, "crypto-browserify": { @@ -1324,8 +1228,8 @@ "inherits": "2.0.3", "pbkdf2": "3.0.14", "public-encrypt": "4.0.0", - "randombytes": "2.0.5", - "randomfill": "1.0.3" + "randombytes": "2.0.6", + "randomfill": "1.0.4" } }, "css": { @@ -1381,7 +1285,7 @@ "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "dev": true, "requires": { - "es5-ext": "0.10.37" + "es5-ext": "0.10.42" } }, "date-now": { @@ -1399,20 +1303,20 @@ "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", "dev": true, "requires": { "ms": "2.0.0" } }, "debug-fabulous": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/debug-fabulous/-/debug-fabulous-1.0.0.tgz", - "integrity": "sha512-dsd50qQ1atDeurcxL7XOjPp4nZCGZzWIONDujDXzl1atSyC3hMbZD+v6440etw+Vt0Pr8ce4TQzHfX3KZM05Mw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/debug-fabulous/-/debug-fabulous-1.1.0.tgz", + "integrity": "sha512-GZqvGIgKNlUnHUPQhepnUZFIMoi3dgZKQBzKDeL2g7oJF9SNAji/AAu36dusFUas0O+pae74lNeoIPHqXWDkLg==", "dev": true, "requires": { "debug": "3.1.0", - "memoizee": "0.4.11", + "memoizee": "0.4.12", "object-assign": "4.1.1" }, "dependencies": { @@ -1443,7 +1347,7 @@ "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "integrity": "sha1-38lARACtHI/gI+faHfHBR8S0RN8=", "dev": true, "requires": { "type-detect": "4.0.5" @@ -1544,28 +1448,20 @@ "dev": true }, "detective": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/detective/-/detective-5.0.2.tgz", - "integrity": "sha512-NUsLoezj4wb9o7vpxS9F3L5vcO87ceyRBcl48op06YFNwkyIEY997JpSCA5lDlDuDc6JxOtaL5qfK3muoWxpMA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/detective/-/detective-5.1.0.tgz", + "integrity": "sha512-TFHMqfOvxlgrfVzTEkNBSh9SvSNX/HfF4OFI2QFGCyPm02EsyILqnUeb5P6q7JZ3SFNTBL5t2sePRgrN4epUWQ==", "dev": true, "requires": { - "@browserify/acorn5-object-spread": "5.0.1", - "acorn": "5.3.0", - "defined": "1.0.0" - }, - "dependencies": { - "acorn": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz", - "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==", - "dev": true - } + "acorn-node": "1.3.0", + "defined": "1.0.0", + "minimist": "1.2.0" } }, "diff": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", - "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, "diffie-hellman": { @@ -1576,9 +1472,15 @@ "requires": { "bn.js": "4.11.8", "miller-rabin": "4.0.1", - "randombytes": "2.0.5" + "randombytes": "2.0.6" } }, + "domain-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", + "dev": true + }, "duplexer2": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", @@ -1588,6 +1490,29 @@ "readable-stream": "2.3.3" } }, + "duplexify": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.4.tgz", + "integrity": "sha512-JzYSLYMhoVVBe8+mbHQ4KgpvHpm0DZpJuL8PY93Vyv1fW7jYJ90LoXa1di/CVbJM+TgMs91rbDapE/RNIfnJsA==", + "dev": true, + "requires": { + "end-of-stream": "1.4.1", + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "stream-shift": "1.0.0" + }, + "dependencies": { + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, + "requires": { + "once": "1.4.0" + } + } + } + }, "elliptic": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", @@ -1624,13 +1549,14 @@ } }, "es5-ext": { - "version": "0.10.37", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.37.tgz", - "integrity": "sha1-DudB0Ui4AGm6J9AgOTdWryV978M=", + "version": "0.10.42", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.42.tgz", + "integrity": "sha512-AJxO1rmPe1bDEfSR6TJ/FgMFYuTBhR5R57KW58iCkYACMyFbrkqVyzXSurYoScDGvgyMpk7uRF/lPUPPTmsRSA==", "dev": true, "requires": { "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1" + "es6-symbol": "3.1.1", + "next-tick": "1.0.0" } }, "es6-iterator": { @@ -1640,7 +1566,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.37", + "es5-ext": "0.10.42", "es6-symbol": "3.1.1" } }, @@ -1657,7 +1583,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.37" + "es5-ext": "0.10.42" } }, "es6-weak-map": { @@ -1667,7 +1593,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.37", + "es5-ext": "0.10.42", "es6-iterator": "2.0.3", "es6-symbol": "3.1.1" } @@ -1728,9 +1654,15 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.37" + "es5-ext": "0.10.42" } }, + "events": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/events/-/events-2.0.0.tgz", + "integrity": "sha512-r/M5YkNg9zwI8QbSf7tsDWWJvO3PGwZXyG7GpFAxtMASnHL2eblFd7iHiGPtyGKKFPZ59S63NeX10Ws6WqGDcg==", + "dev": true + }, "evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", @@ -1808,7 +1740,7 @@ "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", "dev": true, "requires": { "is-accessor-descriptor": "0.1.6", @@ -1819,7 +1751,7 @@ "kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", "dev": true } } @@ -1851,7 +1783,7 @@ "extglob": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.3.tgz", - "integrity": "sha512-AyptZexgu7qppEPq59DtN/XJGZDrLcVxSHai+4hdgMMS9EpF4GBvygcWWApno8lL9qSjVpYt7Raao28qzJX1ww==", + "integrity": "sha1-VeAZ0Mlb+HOUnHN7flFy26hOuyk=", "dev": true, "requires": { "array-unique": "0.3.2", @@ -2048,7 +1980,7 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -2161,7 +2093,7 @@ "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", "dev": true, "requires": { "global-prefix": "1.0.2", @@ -2443,7 +2375,7 @@ "acorn": "5.5.3", "convert-source-map": "1.5.1", "css": "2.2.1", - "debug-fabulous": "1.0.0", + "debug-fabulous": "1.1.0", "detect-newline": "2.1.0", "graceful-fs": "4.1.11", "source-map": "0.6.1", @@ -2472,9 +2404,9 @@ } }, "gulp-typescript": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/gulp-typescript/-/gulp-typescript-4.0.1.tgz", - "integrity": "sha512-BGdaBC1R4SJosXEkkEieeZ21qCZHnfSV78k7zzDljqAxvzDeGRTUqF4geckVclKEeiS3EYOBwNlxoHjJtn20vg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/gulp-typescript/-/gulp-typescript-4.0.2.tgz", + "integrity": "sha512-Hhbn5Aa2l3T+tnn0KqsG6RRJmcYEsr3byTL2nBpNBeAK8pqug9Od4AwddU4JEI+hRw7mzZyjRbB8DDWR6paGVA==", "dev": true, "requires": { "ansi-colors": "1.1.0", @@ -2509,12 +2441,6 @@ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, - "is-valid-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", - "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=", - "dev": true - }, "json-stable-stringify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", @@ -2539,16 +2465,6 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, - "to-absolute-glob": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", - "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", - "dev": true, - "requires": { - "is-absolute": "1.0.0", - "is-negated-glob": "1.0.0" - } - }, "unique-stream": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.2.1.tgz", @@ -2713,9 +2629,9 @@ "dev": true }, "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, "has-gulplog": { @@ -2823,9 +2739,9 @@ "dev": true }, "ieee754": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", - "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.11.tgz", + "integrity": "sha512-VhDzCKN7K8ufStx/CLj5/PDTMgph+qwN5Pkd5i0sGnVwk56zJ0lkT8Qzi1xqWLS0Wp29DgDtNeS7v8/wMoZeHg==", "dev": true }, "indexof": { @@ -2853,7 +2769,7 @@ "ini": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "integrity": "sha1-7uJfVtscnsYIXgwid4CD9Zar+Sc=", "dev": true }, "inline-source-map": { @@ -2866,16 +2782,17 @@ } }, "insert-module-globals": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.0.1.tgz", - "integrity": "sha1-wDv04BywhtW15azorQr+eInWOMM=", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.0.6.tgz", + "integrity": "sha512-R3sidKJr3SsggqQQ5cEwQb3pWG8RNx0UnpyeiOSR6jorRIeAOzH2gkTWnNdMnyRiVbjrG047K7UCtlMkQ1Mo9w==", "dev": true, "requires": { "JSONStream": "1.3.2", - "combine-source-map": "0.7.2", - "concat-stream": "1.5.2", + "combine-source-map": "0.8.0", + "concat-stream": "1.6.2", "is-buffer": "1.1.6", "lexical-scope": "1.2.0", + "path-is-absolute": "1.0.1", "process": "0.11.10", "through2": "2.0.3", "xtend": "4.0.1" @@ -2890,7 +2807,7 @@ "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "integrity": "sha1-OV4a6EsR8mrReV5zwXN45IowFXY=", "dev": true, "requires": { "is-relative": "1.0.0", @@ -2900,7 +2817,7 @@ "is-accessor-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", "dev": true, "requires": { "kind-of": "6.0.2" @@ -2909,13 +2826,13 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", "dev": true }, "is-data-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", "dev": true, "requires": { "kind-of": "6.0.2" @@ -2924,7 +2841,7 @@ "is-descriptor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", "dev": true, "requires": { "is-accessor-descriptor": "1.0.0", @@ -3015,7 +2932,7 @@ "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", "dev": true, "requires": { "isobject": "3.0.1" @@ -3030,7 +2947,7 @@ "is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "integrity": "sha1-obtpNc6MXboei5dUubLcwCDiJg0=", "dev": true, "requires": { "is-unc-path": "1.0.0" @@ -3039,7 +2956,7 @@ "is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "integrity": "sha1-1zHoiY7QkKEsNSrS6u1Qla0yLJ0=", "dev": true, "requires": { "unc-path-regex": "0.1.2" @@ -3051,6 +2968,12 @@ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, + "is-valid-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", + "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=", + "dev": true + }, "is-windows": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz", @@ -3180,7 +3103,7 @@ "js-yaml": { "version": "3.10.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", - "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "integrity": "sha1-LnhEFka9RoLpY/IrbpKCPDCcYtw=", "dev": true, "requires": { "argparse": "1.0.9", @@ -3190,7 +3113,7 @@ "esprima": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "integrity": "sha1-RJnt3NERDgshi6zy+n9/WfVcqAQ=", "dev": true } } @@ -3225,24 +3148,24 @@ "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "integrity": "sha1-ARRrNqYhjmTljzqNZt5df8b20FE=", "dev": true }, "labeled-stream-splicer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.0.tgz", - "integrity": "sha1-pS4dE4AkwAuGscDJH2d5GLiuClk=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.1.tgz", + "integrity": "sha512-MC94mHZRvJ3LfykJlTUipBqenZz1pacOZEMhhQ8dMGcDHs0SBE5GbsavUXV7YtP3icBW17W0Zy1I0lfASmo9Pg==", "dev": true, "requires": { "inherits": "2.0.3", - "isarray": "0.0.1", + "isarray": "2.0.4", "stream-splicer": "2.0.0" }, "dependencies": { "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.4.tgz", + "integrity": "sha512-GMxXOiUirWg1xTKRipM0Ek07rX+ubx4nNVElTJdNLYmNO/2YrDkgJGw9CljXn+r4EWiDQg/8lsRdHyg2PJuUaA==", "dev": true } } @@ -3458,13 +3381,13 @@ "integrity": "sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM=", "dev": true, "requires": { - "es5-ext": "0.10.37" + "es5-ext": "0.10.42" } }, "make-error": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.2.tgz", - "integrity": "sha512-l9ra35l5VWLF24y75Tg8XgfGLX0ueRhph118WKM6H5denx4bB5QF59+4UAm9oJ2qsPQZas/CQUDdtDdfvYHBdQ==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz", + "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==", "dev": true }, "make-iterator": { @@ -3525,19 +3448,19 @@ } }, "memoizee": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.11.tgz", - "integrity": "sha1-vemBdmPJ5A/bKk6hw2cpYIeujI8=", + "version": "0.4.12", + "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.12.tgz", + "integrity": "sha512-sprBu6nwxBWBvBOh5v2jcsGqiGLlL2xr2dLub3vR8dnE8YB17omwtm/0NSHl8jjNbcsJd5GMWJAnTSVe/O0Wfg==", "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.37", + "es5-ext": "0.10.42", "es6-weak-map": "2.0.2", "event-emitter": "0.3.5", "is-promise": "2.1.0", "lru-queue": "0.1.0", "next-tick": "1.0.0", - "timers-ext": "0.1.2" + "timers-ext": "0.1.5" } }, "merge2": { @@ -3592,7 +3515,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "dev": true, "requires": { "brace-expansion": "1.1.8" @@ -3607,7 +3530,7 @@ "mixin-deep": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.0.tgz", - "integrity": "sha512-dgaCvoh6i1nosAUBKb0l0pfJ78K8+S9fluyIR2YvAeUD/QuMahnFnF3xYty5eYXMjhGSsB0DsW6A0uAZyetoAg==", + "integrity": "sha1-R6hzK6l3mUV8jB7KKPlRMtfoFQo=", "dev": true, "requires": { "for-in": "1.0.2", @@ -3617,7 +3540,7 @@ "is-extendable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", "dev": true, "requires": { "is-plain-object": "2.0.4" @@ -3643,9 +3566,9 @@ } }, "mocha": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.0.4.tgz", - "integrity": "sha512-nMOpAPFosU1B4Ix1jdhx5e3q7XO55ic5a8cgYvW27CequcEY+BabS0kUVL1Cw1V5PuVHZWeNRWFLmEPexo79VA==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.0.5.tgz", + "integrity": "sha512-3MM3UjZ5p8EJrYpG7s+29HAI9G7sTzKEe4+w37Dg0QP7qL4XGsV+Q2xet2cE37AqdgN1OtYQB6Vl98YiPV3PgA==", "dev": true, "requires": { "browser-stdout": "1.3.1", @@ -3660,12 +3583,6 @@ "supports-color": "4.4.0" }, "dependencies": { - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -3675,10 +3592,10 @@ "ms": "2.0.0" } }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "dev": true }, "supports-color": { @@ -3698,6 +3615,40 @@ "integrity": "sha1-zK/w4ckc9Vf+d+B535lUuRt0d1Y=", "dev": true }, + "module-deps": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.0.2.tgz", + "integrity": "sha512-KWBI3009iRnHjRlxRhe8nJ6kdeBTg4sMi5N6AZgg5f1/v5S7EBCRBOY854I4P5Anl4kx6AJH+4bBBC2Gi3nkvg==", + "dev": true, + "requires": { + "JSONStream": "1.3.2", + "browser-resolve": "1.11.2", + "cached-path-relative": "1.0.1", + "concat-stream": "1.6.2", + "defined": "1.0.0", + "detective": "5.1.0", + "duplexer2": "0.1.4", + "inherits": "2.0.3", + "parents": "1.0.1", + "readable-stream": "2.3.3", + "resolve": "1.6.0", + "stream-combiner2": "1.1.1", + "subarg": "1.0.0", + "through2": "2.0.3", + "xtend": "4.0.1" + }, + "dependencies": { + "resolve": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.6.0.tgz", + "integrity": "sha512-mw7JQNu5ExIkcw4LPih0owX/TZXjD/ZUF/ZQ/pDnkw3ZKhDcZZw5klmBlj6gVMwjQ3Pz5Jgu7F3d0jcDVuEWdw==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + } + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -3778,7 +3729,7 @@ "natives": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.1.tgz", - "integrity": "sha512-8eRaxn8u/4wN8tGkhlc2cgwwvOLMLUMUn4IYTexMgWd+LyUDfeXVkk2ygQR0hvIHbJQXgHujia3ieUUDwNGkEA==", + "integrity": "sha1-ARrM4ffL2H97prMJPWzZOSvhxXQ=", "dev": true }, "next-tick": { @@ -3861,7 +3812,7 @@ "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", "dev": true, "requires": { "is-accessor-descriptor": "0.1.6", @@ -3872,7 +3823,7 @@ "kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", "dev": true } } @@ -4025,7 +3976,7 @@ "p-map": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", - "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "integrity": "sha1-5OlPMR6rvIYzoeeZCBZfyiYkG2s=", "dev": true }, "pako": { @@ -4049,8 +4000,8 @@ "integrity": "sha1-N8T5t+06tlx0gXtfJICTf7+XxxI=", "dev": true, "requires": { - "asn1.js": "4.9.2", - "browserify-aes": "1.1.1", + "asn1.js": "4.10.1", + "browserify-aes": "1.2.0", "create-hash": "1.1.3", "evp_bytestokey": "1.0.3", "pbkdf2": "3.0.14" @@ -4146,7 +4097,7 @@ "create-hmac": "1.1.6", "ripemd160": "2.0.1", "safe-buffer": "5.1.1", - "sha.js": "2.4.9" + "sha.js": "2.4.11" } }, "pify": { @@ -4262,7 +4213,7 @@ "browserify-rsa": "4.0.1", "create-hash": "1.1.3", "parse-asn1": "5.1.0", - "randombytes": "2.0.5" + "randombytes": "2.0.6" } }, "pump": { @@ -4295,29 +4246,6 @@ "duplexify": "3.5.4", "inherits": "2.0.3", "pump": "2.0.1" - }, - "dependencies": { - "duplexify": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.4.tgz", - "integrity": "sha512-JzYSLYMhoVVBe8+mbHQ4KgpvHpm0DZpJuL8PY93Vyv1fW7jYJ90LoXa1di/CVbJM+TgMs91rbDapE/RNIfnJsA==", - "dev": true, - "requires": { - "end-of-stream": "1.4.1", - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "stream-shift": "1.0.0" - } - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "1.4.0" - } - } } }, "punycode": { @@ -4345,21 +4273,21 @@ "dev": true }, "randombytes": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.5.tgz", - "integrity": "sha512-8T7Zn1AhMsQ/HI1SjcCfT/t4ii3eAqco3yOcSzS4mozsOz69lHLsoMXmF9nZgnFanYscnSlUSgs8uZyKzpE6kg==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", + "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", "dev": true, "requires": { "safe-buffer": "5.1.1" } }, "randomfill": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.3.tgz", - "integrity": "sha512-YL6GrhrWoic0Eq8rXVbMptH7dAxCs0J+mh5Y0euNekPPYaxEmdVGim6GdoxoRzKW2yJoU8tueifS7mYxvcFDEQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", "dev": true, "requires": { - "randombytes": "2.0.5", + "randombytes": "2.0.6", "safe-buffer": "5.1.1" } }, @@ -4375,7 +4303,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { "core-util-is": "1.0.2", @@ -4494,7 +4422,7 @@ "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "integrity": "sha1-LtgVDSShbqhlHm1u8PR8QVjOejY=", "dev": true, "requires": { "glob": "7.1.2" @@ -4513,7 +4441,7 @@ "run-sequence": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/run-sequence/-/run-sequence-2.2.1.tgz", - "integrity": "sha512-qkzZnQWMZjcKbh3CNly2srtrkaO/2H/SI5f2eliMCapdRD3UhMrwjfOAZJAnZ2H8Ju4aBzFZkBGXUqFs9V0yxw==", + "integrity": "sha1-HOZD2jb9jH6n4akynaM/wriJhJU=", "dev": true, "requires": { "chalk": "1.1.3", @@ -4551,7 +4479,7 @@ "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", "dev": true }, "sander": { @@ -4577,7 +4505,7 @@ "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "integrity": "sha1-KBYjTiN4vdxOU1T6tcqold9xANk=", "dev": true }, "semver": { @@ -4604,7 +4532,7 @@ "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "integrity": "sha1-ca5KiPD+77v1LR6mBPP7MV67YnQ=", "dev": true, "requires": { "extend-shallow": "2.0.1", @@ -4614,9 +4542,9 @@ } }, "sha.js": { - "version": "2.4.9", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.9.tgz", - "integrity": "sha512-G8zektVqbiPHrylgew9Zg1VRB1L/DtXNUVAM6q4QLy8NE3qtHlFXTf8VLL4k1Yl6c7NMjtZUTdXV+X44nFaT6A==", + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { "inherits": "2.0.3", @@ -4630,7 +4558,7 @@ "dev": true, "requires": { "json-stable-stringify": "0.0.1", - "sha.js": "2.4.9" + "sha.js": "2.4.11" } }, "shell-quote": { @@ -4719,7 +4647,7 @@ "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", "dev": true, "requires": { "is-accessor-descriptor": "0.1.6", @@ -4730,7 +4658,7 @@ "kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", "dev": true } } @@ -4738,7 +4666,7 @@ "snapdragon-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", "dev": true, "requires": { "define-property": "1.0.0", @@ -4749,7 +4677,7 @@ "snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", "dev": true, "requires": { "kind-of": "3.2.2" @@ -4787,7 +4715,7 @@ "source-map-resolve": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", - "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", + "integrity": "sha1-etD1k/IoFZjoVN+A8ZquS5LXoRo=", "dev": true, "requires": { "atob": "2.0.3", @@ -4838,7 +4766,7 @@ "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", "dev": true, "requires": { "extend-shallow": "3.0.2" @@ -4857,7 +4785,7 @@ "is-extendable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", "dev": true, "requires": { "is-plain-object": "2.0.4" @@ -4933,7 +4861,7 @@ "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", "dev": true, "requires": { "is-accessor-descriptor": "0.1.6", @@ -4944,7 +4872,7 @@ "kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", "dev": true } } @@ -4976,9 +4904,9 @@ "dev": true }, "stream-http": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.7.2.tgz", - "integrity": "sha512-c0yTD2rbQzXtSsFSVhtpvY/vS6u066PcXOX9kBB3mSO76RiUQzL340uJkGBWnlBg4/HZzqiUXtaVA7wcRcJgEw==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.1.tgz", + "integrity": "sha512-cQ0jo17BLca2r0GfRdZKYAGLU6JRoIWxqSOakUMuKOT6MOK7AAlE856L33QuDmAy/eeOrhLee3dZKX0Uadu93A==", "dev": true, "requires": { "builtin-status-codes": "3.0.0", @@ -5042,7 +4970,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -5082,13 +5010,22 @@ "minimist": "1.2.0" } }, - "syntax-error": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.3.0.tgz", - "integrity": "sha1-HtkmbE1AvnXcVb+bsct3Biu5bKE=", + "supports-color": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "acorn": "4.0.13" + "has-flag": "3.0.0" + } + }, + "syntax-error": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", + "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", + "dev": true, + "requires": { + "acorn-node": "1.3.0" } }, "through": { @@ -5142,15 +5079,25 @@ } }, "timers-ext": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.2.tgz", - "integrity": "sha1-YcxHp2wavTGV8UUn+XjViulMUgQ=", + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.5.tgz", + "integrity": "sha512-tsEStd7kmACHENhsUPaxb8Jf8/+GZZxyNFQbZD07HQOyooOa6At1rQqjffgvg7n+dxscQa9cjjMdWhJtsP2sxg==", "dev": true, "requires": { - "es5-ext": "0.10.37", + "es5-ext": "0.10.42", "next-tick": "1.0.0" } }, + "to-absolute-glob": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", + "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", + "dev": true, + "requires": { + "is-absolute": "1.0.0", + "is-negated-glob": "1.0.0" + } + }, "to-arraybuffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", @@ -5240,7 +5187,7 @@ "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", "dev": true, "requires": { "is-accessor-descriptor": "0.1.6", @@ -5251,7 +5198,7 @@ "kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", "dev": true } } @@ -5289,8 +5236,8 @@ "requires": { "arrify": "1.0.1", "chalk": "2.3.2", - "diff": "3.3.1", - "make-error": "1.3.2", + "diff": "3.5.0", + "make-error": "1.3.4", "minimist": "1.2.0", "mkdirp": "0.5.1", "source-map-support": "0.5.4", @@ -5298,9 +5245,9 @@ } }, "tslib": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz", - "integrity": "sha1-aUavLR1lGnsYY7Ux1uWvpBqkTqw=", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", + "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", "dev": true }, "tslint": { @@ -5313,14 +5260,14 @@ "builtin-modules": "1.1.1", "chalk": "2.3.2", "commander": "2.15.1", - "diff": "3.3.1", + "diff": "3.5.0", "glob": "7.1.2", "js-yaml": "3.10.0", "minimatch": "3.0.4", "resolve": "1.6.0", "semver": "5.5.0", - "tslib": "1.8.1", - "tsutils": "2.16.0" + "tslib": "1.9.0", + "tsutils": "2.26.1" }, "dependencies": { "commander": { @@ -5347,14 +5294,20 @@ } }, "tsutils": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.16.0.tgz", - "integrity": "sha512-9Ier/60O7OZRNPiw+or5QAtAY4kQA+WDiO/r6xOYATEyefH9bdfvTRLCxrYnFhQlZfET2vYXKfpr3Vw2BiArZw==", + "version": "2.26.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.26.1.tgz", + "integrity": "sha512-bnm9bcjOqOr1UljleL94wVCDlpa6KjfGaTkefeLch4GRafgDkROxPizbB/FxTEdI++5JqhxczRy/Qub0syNqZA==", "dev": true, "requires": { - "tslib": "1.8.1" + "tslib": "1.9.0" } }, + "tty-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", + "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", + "dev": true + }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -5367,7 +5320,7 @@ "type-detect": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz", - "integrity": "sha512-N9IvkQslUGYGC24RkJk1ba99foK6TkwC2FHAEBlQFBP0RxQZS8ZpJuAZcwiY/w9ZJHFQb1aOXBI60OdxhTrwEQ==", + "integrity": "sha1-1w5byB223io4G8rKDG4MvcdjXeI=", "dev": true }, "typedarray": { @@ -5377,9 +5330,9 @@ "dev": true }, "typescript": { - "version": "2.8.0-dev.20180322", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.0-dev.20180322.tgz", - "integrity": "sha512-dSYa9IAoj3CRAxtKx9+cSCQLetB7OLtHXhvQWeWY6PPIXvbpAC41ulQWX3TUAkMYU9NS/kGIU8TFM9VFpinJTg==", + "version": "2.9.0-dev.20180407", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.0-dev.20180407.tgz", + "integrity": "sha512-Tg0/hU2hSz+4pb5Lj5+bj1uLldN7C8NO5Ik19WfftMlpeXRyZQJzglV0oncmsXOfN9gG+JC0xnO58YspE6sZ1w==", "dev": true }, "uglify-js": { @@ -5402,9 +5355,9 @@ "optional": true }, "umd": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.1.tgz", - "integrity": "sha1-iuVW4RAR9jwllnCKiDclnwGz1g4=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", + "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", "dev": true }, "unc-path-regex": { @@ -5572,7 +5525,7 @@ "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", "dev": true, "requires": { "is-accessor-descriptor": "0.1.6", @@ -5583,7 +5536,7 @@ "kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", "dev": true } } @@ -5766,7 +5719,7 @@ "vlq": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", - "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==", + "integrity": "sha1-jz5DKM9jsVQMDWfhsneDhviXWyY=", "dev": true }, "vm-browserify": { @@ -5781,7 +5734,7 @@ "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", "dev": true, "requires": { "isexe": "2.0.0" @@ -5809,7 +5762,7 @@ "xml2js": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "integrity": "sha1-aGwg8hMgnpSr8NG88e+qKRx4J6c=", "dev": true, "requires": { "sax": "1.2.4", diff --git a/scripts/processDiagnosticMessages.ts b/scripts/processDiagnosticMessages.ts index dd66564b134..848a60cfb4f 100644 --- a/scripts/processDiagnosticMessages.ts +++ b/scripts/processDiagnosticMessages.ts @@ -1,9 +1,7 @@ -/// -/// - interface DiagnosticDetails { category: string; code: number; + reportsUnnecessary?: {}; isEarly?: boolean; } @@ -56,17 +54,17 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, inputFil let result = "// \r\n" + "// generated from '" + inputFilePathRel + "' by '" + thisFilePathRel + "'\r\n" + - "/// \r\n" + "/* @internal */\r\n" + "namespace ts {\r\n" + - " function diag(code: number, category: DiagnosticCategory, key: string, message: string): DiagnosticMessage {\r\n" + - " return { code, category, key, message };\r\n" + + " function diag(code: number, category: DiagnosticCategory, key: string, message: string, reportsUnnecessary?: {}): DiagnosticMessage {\r\n" + + " return { code, category, key, message, reportsUnnecessary };\r\n" + " }\r\n" + " // tslint:disable-next-line variable-name\r\n" + " export const Diagnostics = {\r\n"; - messageTable.forEach(({ code, category }, name) => { + messageTable.forEach(({ code, category, reportsUnnecessary }, name) => { const propName = convertPropertyName(name); - result += ` ${propName}: diag(${code}, DiagnosticCategory.${category}, "${createKey(propName, code)}", ${JSON.stringify(name)}),\r\n`; + const argReportsUnnecessary = reportsUnnecessary ? `, /*reportsUnnecessary*/ ${reportsUnnecessary}` : ""; + result += ` ${propName}: diag(${code}, DiagnosticCategory.${category}, "${createKey(propName, code)}", ${JSON.stringify(name)}${argReportsUnnecessary}),\r\n`; }); result += " };\r\n}"; diff --git a/scripts/processDiagnosticMessages.tsconfig.json b/scripts/processDiagnosticMessages.tsconfig.json new file mode 100644 index 00000000000..5675c8783b9 --- /dev/null +++ b/scripts/processDiagnosticMessages.tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "removeComments": false, + "outFile": "processDiagnosticMessages.js", + "target": "es5", + "declaration": false, + "lib": [ + "es6", + "scripthost" + ] + }, + "files": [ + "../src/compiler/types.ts", + "../src/compiler/performance.ts", + "../src/compiler/core.ts", + "../src/compiler/sys.ts", + + "processDiagnosticMessages.ts" + ] +} diff --git a/scripts/tslint/rules/booleanTriviaRule.ts b/scripts/tslint/rules/booleanTriviaRule.ts index dbfdc28438e..0224a0f08d8 100644 --- a/scripts/tslint/rules/booleanTriviaRule.ts +++ b/scripts/tslint/rules/booleanTriviaRule.ts @@ -28,13 +28,11 @@ function walk(ctx: Lint.WalkContext): void { function shouldIgnoreCalledExpression(expression: ts.Expression): boolean { if (expression.kind === ts.SyntaxKind.PropertyAccessExpression) { const methodName = (expression as ts.PropertyAccessExpression).name.text; - if (methodName.indexOf("set") === 0) { + if (methodName.startsWith("set") || methodName.startsWith("assert")) { return true; } switch (methodName) { case "apply": - case "assert": - case "assertEqual": case "call": case "equal": case "fail": @@ -46,11 +44,10 @@ function walk(ctx: Lint.WalkContext): void { } else if (expression.kind === ts.SyntaxKind.Identifier) { const functionName = (expression as ts.Identifier).text; - if (functionName.indexOf("set") === 0) { + if (functionName.startsWith("set") || functionName.startsWith("assert")) { return true; } switch (functionName) { - case "assert": case "contains": case "createAnonymousType": case "createImportSpecifier": diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 948cd3884b3..e6e3364840d 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,6 +1,3 @@ -/// -/// - /* @internal */ namespace ts { export const enum ModuleInstanceState { @@ -288,10 +285,6 @@ namespace ts { } Debug.fail("Unknown binary declaration kind"); break; - - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.ClassDeclaration: - return (hasModifier(node, ModifierFlags.Default) ? InternalSymbolName.Default : undefined); case SyntaxKind.JSDocFunctionType: return (isJSDocConstructSignature(node) ? InternalSymbolName.New : InternalSymbolName.Call); case SyntaxKind.Parameter: @@ -403,7 +396,7 @@ namespace 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 && - (isDefaultExport || (node.kind === SyntaxKind.ExportAssignment && !(node).isExportEquals))) { + (node.kind === SyntaxKind.ExportAssignment && !(node).isExportEquals)) { message = Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -459,6 +452,9 @@ namespace ts { if (node.kind === SyntaxKind.JSDocTypedefTag) Debug.assert(isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. const isJSDocTypedefInJSDocNamespace = isJSDocTypedefTag(node) && node.name && node.name.kind === SyntaxKind.Identifier && node.name.isInJSDocNamespace; if ((!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) || isJSDocTypedefInJSDocNamespace) { + if (hasModifier(node, ModifierFlags.Default) && !getDeclarationName(node)) { + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! + } const exportKind = symbolFlags & SymbolFlags.Value ? SymbolFlags.ExportValue : 0; const local = declareSymbol(container.locals, /*parent*/ undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index cc506852252..92e651061ed 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -1,5 +1,3 @@ -/// - /*@internal*/ namespace ts { /** diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 581aa05f12c..ac9f36b1258 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -1,4 +1,3 @@ -/// namespace ts { export interface EmitOutput { outputFiles: OutputFile[]; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ff2ba12783a..7ffe7126388 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /* @internal */ namespace ts { const ambientModuleSymbolRegex = /^".+"$/; @@ -65,7 +61,6 @@ namespace ts { const compilerOptions = host.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); const modulekind = getEmitModuleKind(compilerOptions); - const noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters; const allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions); const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks"); const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes"); @@ -214,7 +209,7 @@ namespace ts { return node ? getConstantValue(node) : undefined; }, isValidPropertyAccess: (node, propertyName) => { - node = getParseTreeNode(node, isPropertyAccessOrQualifiedName); + node = getParseTreeNode(node, isPropertyAccessOrQualifiedNameOrImportTypeNode); return !!node && isValidPropertyAccess(node, escapeLeadingUnderscores(propertyName)); }, isValidPropertyAccessForCompletions: (node, type, property) => { @@ -314,7 +309,22 @@ namespace ts { return node && getTypeArgumentConstraint(node); }, - getSuggestionDiagnostics: file => suggestionDiagnostics.get(file.fileName) || emptyArray, + getSuggestionDiagnostics: file => { + return (suggestionDiagnostics.get(file.fileName) || emptyArray).concat(getUnusedDiagnostics()); + function getUnusedDiagnostics(): ReadonlyArray { + if (file.isDeclarationFile) return emptyArray; + + checkSourceFile(file); + const diagnostics: Diagnostic[] = []; + Debug.assert(!!(getNodeLinks(file).flags & NodeCheckFlags.TypeChecked)); + checkUnusedIdentifiers(allPotentiallyUnusedIdentifiers.get(file.fileName)!, (kind, diag) => { + if (!unusedIsError(kind)) { + diagnostics.push({ ...diag, category: DiagnosticCategory.Suggestion }); + } + }); + return diagnostics; + } + }, }; const tupleTypes: GenericType[] = []; @@ -426,8 +436,9 @@ namespace ts { let deferredGlobalExtractSymbol: Symbol; let deferredNodes: Node[]; - let deferredUnusedIdentifierNodes: Node[]; - const seenDeferredUnusedIdentifiers = createMap(); // For assertion that we don't defer the same identifier twice + const allPotentiallyUnusedIdentifiers = createMap>(); // key is file name + let potentiallyUnusedIdentifiers: PotentiallyUnusedIdentifier[]; // Potentially unused identifiers in the source file currently being checked. + const seenPotentiallyUnusedIdentifiers = createMap(); // For assertion that we don't defer the same identifier twice let flowLoopStart = 0; let flowLoopCount = 0; @@ -459,17 +470,6 @@ namespace ts { const diagnostics = createDiagnosticCollection(); // Suggestion diagnostics must have a file. Keyed by source file name. const suggestionDiagnostics = createMultiMap(); - function addSuggestionDiagnostic(diag: Diagnostic): void { - suggestionDiagnostics.add(diag.file.fileName, { ...diag, category: DiagnosticCategory.Suggestion }); - } - function addErrorOrSuggestionDiagnostic(isError: boolean, diag: Diagnostic): void { - if (isError) { - diagnostics.add(diag); - } - else { - addSuggestionDiagnostic(diag); - } - } const enum TypeFacts { None = 0, @@ -628,6 +628,12 @@ namespace ts { resolvedMembers = "resolvedMembers" } + const enum UnusedKind { + Local, + Parameter, + } + type AddUnusedDiagnostic = (type: UnusedKind, diagnostic: Diagnostic) => void; + const builtinGlobals = createSymbolTable(); builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol); @@ -822,6 +828,18 @@ namespace ts { diagnostics.add(diagnostic); } + function addErrorOrSuggestion(isError: boolean, diagnostic: Diagnostic) { + if (isError) { + diagnostics.add(diagnostic); + } + else { + suggestionDiagnostics.add(diagnostic.file.fileName, { ...diagnostic, category: DiagnosticCategory.Suggestion }); + } + } + function errorOrSuggestion(isError: boolean, location: Node, message: DiagnosticMessage | DiagnosticMessageChain, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): void { + addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createDiagnosticForNodeFromMessageChain(location, message)); + } + function createSymbol(flags: SymbolFlags, name: __String, checkFlags?: CheckFlags) { symbolCount++; const symbol = (new Symbol(flags | SymbolFlags.Transient, name)); @@ -1295,7 +1313,7 @@ namespace ts { } } - if (result = lookup(moduleExports, name, meaning & SymbolFlags.ModuleMember)) { + if (name !== InternalSymbolName.Default && (result = lookup(moduleExports, name, meaning & SymbolFlags.ModuleMember))) { break loop; } break; @@ -1437,7 +1455,7 @@ namespace ts { // We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`. // If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself. // That means that this is a self-reference of `lastLocation`, and shouldn't count this when considering whether `lastLocation` is used. - if (isUse && result && noUnusedIdentifiers && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { + if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { result.isReferenced |= meaning; } @@ -1510,7 +1528,7 @@ namespace ts { } // If we're in an external module, we can't reference value symbols created from UMD export declarations - if (result && isInExternalModule && (meaning & SymbolFlags.Value) === SymbolFlags.Value) { + if (result && isInExternalModule && (meaning & SymbolFlags.Value) === SymbolFlags.Value && !(originalLocation.flags & NodeFlags.JSDoc)) { const decls = result.declarations; if (decls && decls.length === 1 && decls[0].kind === SyntaxKind.NamespaceExportDeclaration) { error(errorLocation, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name)); @@ -1937,9 +1955,11 @@ namespace ts { /** * Indicates that a symbol is an alias that does not merge with a local declaration. + * OR Is a JSContainer which may merge an alias with a local declaration */ function isNonLocalAlias(symbol: Symbol, excludes = SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace) { - return symbol && (symbol.flags & (SymbolFlags.Alias | excludes)) === SymbolFlags.Alias; + if (!symbol) return false; + return (symbol.flags & (SymbolFlags.Alias | excludes)) === SymbolFlags.Alias || (symbol.flags & SymbolFlags.Alias && symbol.flags & SymbolFlags.JSContainer); } function resolveSymbol(symbol: Symbol, dontResolveAlias?: boolean): Symbol { @@ -2065,6 +2085,10 @@ namespace ts { if (initializer) { namespace = getSymbolOfNode(initializer); } + // Currently, IIFEs may not have a symbol and we don't know about their contents. Give up in this case. + if (!namespace) { + return undefined; + } if (namespace.valueDeclaration && isVariableDeclaration(namespace.valueDeclaration) && namespace.valueDeclaration.initializer && @@ -2126,7 +2150,7 @@ namespace ts { if (sourceFile) { if (sourceFile.symbol) { if (resolvedModule.isExternalLibraryImport && !extensionIsTypeScript(resolvedModule.extension)) { - addSuggestionDiagnostic(createModuleImplicitlyAnyDiagnostic(errorNode, resolvedModule, moduleReference)); + errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference); } // merged symbol is module declaration symbol combined with all augmentations return getMergedSymbol(sourceFile.symbol); @@ -2152,7 +2176,7 @@ namespace ts { error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } else { - addErrorOrSuggestionDiagnostic(noImplicitAny && !!moduleNotFoundError, createModuleImplicitlyAnyDiagnostic(errorNode, resolvedModule, moduleReference)); + errorOnImplicitAnyModule(/*isError*/ noImplicitAny && !!moduleNotFoundError, errorNode, resolvedModule, moduleReference); } // Failed imports and untyped modules are both treated in an untyped manner; only difference is whether we give a diagnostic first. return undefined; @@ -2177,12 +2201,12 @@ namespace ts { return undefined; } - function createModuleImplicitlyAnyDiagnostic(errorNode: Node, { packageId, resolvedFileName }: ResolvedModuleFull, moduleReference: string): Diagnostic { + function errorOnImplicitAnyModule(isError: boolean, errorNode: Node, { packageId, resolvedFileName }: ResolvedModuleFull, moduleReference: string): void { const errorInfo = packageId && chainDiagnosticMessages( /*details*/ undefined, Diagnostics.Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0, getMangledNameForScopedPackage(packageId.name)); - return createDiagnosticForNodeFromMessageChain(errorNode, chainDiagnosticMessages( + errorOrSuggestion(isError, errorNode, chainDiagnosticMessages( errorInfo, Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, @@ -2192,7 +2216,22 @@ namespace ts { // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. function resolveExternalModuleSymbol(moduleSymbol: Symbol, dontResolveAlias?: boolean): Symbol { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get(InternalSymbolName.ExportEquals), dontResolveAlias)) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(getCommonJsExportEquals(moduleSymbol), dontResolveAlias)) || moduleSymbol; + } + + function getCommonJsExportEquals(moduleSymbol: Symbol): Symbol { + const exported = moduleSymbol.exports.get(InternalSymbolName.ExportEquals); + if (!exported || !exported.exports || moduleSymbol.exports.size === 1) { + return exported; + } + const merged = cloneSymbol(exported); + moduleSymbol.exports.forEach((s, name) => { + if (name === InternalSymbolName.ExportEquals) return; + if (!merged.exports.has(name)) { + merged.exports.set(name, s); + } + }); + return merged; } // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' @@ -2716,7 +2755,7 @@ namespace ts { } function hasVisibleDeclarations(symbol: Symbol, shouldComputeAliasToMakeVisible: boolean): SymbolVisibilityResult { - let aliasesToMakeVisible: AnyImportSyntax[]; + let aliasesToMakeVisible: LateVisibilityPaintedStatement[]; if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) { return undefined; } @@ -2730,15 +2769,13 @@ namespace ts { const anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && !hasModifier(anyImportSyntax, ModifierFlags.Export) && // import clause without export - isDeclarationVisible(anyImportSyntax.parent)) { - // In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types, - // we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time - // since we will do the emitting later in trackSymbol. - if (shouldComputeAliasToMakeVisible) { - getNodeLinks(declaration).isVisible = true; - aliasesToMakeVisible = appendIfUnique(aliasesToMakeVisible, anyImportSyntax); - } - return true; + isDeclarationVisible(anyImportSyntax.parent)) { + return addVisibleAlias(declaration, anyImportSyntax); + } + else if (isVariableDeclaration(declaration) && isVariableStatement(declaration.parent.parent) && + !hasModifier(declaration.parent.parent, ModifierFlags.Export) && // unexported variable statement + isDeclarationVisible(declaration.parent.parent.parent)) { + return addVisibleAlias(declaration, declaration.parent.parent); } // Declaration is not visible @@ -2747,6 +2784,17 @@ namespace ts { return true; } + + function addVisibleAlias(declaration: Declaration, aliasingStatement: LateVisibilityPaintedStatement) { + // In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types, + // we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time + // since we will do the emitting later in trackSymbol. + if (shouldComputeAliasToMakeVisible) { + getNodeLinks(declaration).isVisible = true; + aliasesToMakeVisible = appendIfUnique(aliasesToMakeVisible, aliasingStatement); + } + return true; + } } function isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult { @@ -3071,8 +3119,13 @@ namespace ts { function createAnonymousTypeNode(type: ObjectType): TypeNode { const symbol = type.symbol; if (symbol) { + if (isJavaScriptConstructor(symbol.valueDeclaration)) { + // Instance and static types share the same symbol; only add 'typeof' for the static side. + const isInstanceType = type === getInferredClassType(symbol) ? SymbolFlags.Type : SymbolFlags.Value; + return symbolToTypeNode(symbol, context, isInstanceType); + } // Always use 'typeof T' for type of class, enum, and module objects - if (symbol.flags & SymbolFlags.Class && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === SyntaxKind.ClassExpression && context.flags & NodeBuilderFlags.WriteClassExpressionAsTypeLiteral) || + else if (symbol.flags & SymbolFlags.Class && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === SyntaxKind.ClassExpression && context.flags & NodeBuilderFlags.WriteClassExpressionAsTypeLiteral) || symbol.flags & (SymbolFlags.Enum | SymbolFlags.ValueModule) || shouldWriteTypeOfFunctionSymbol()) { return symbolToTypeNode(symbol, context, SymbolFlags.Value); @@ -3809,7 +3862,7 @@ namespace ts { return symbolName(symbol); } - function isDeclarationVisible(node: Declaration | AnyImportSyntax): boolean { + function isDeclarationVisible(node: Node): boolean { if (node) { const links = getNodeLinks(node); if (links.isVisible === undefined) { @@ -3823,7 +3876,7 @@ namespace ts { function determineIfDeclarationIsVisible() { switch (node.kind) { case SyntaxKind.BindingElement: - return isDeclarationVisible(node.parent.parent); + return isDeclarationVisible(node.parent.parent); case SyntaxKind.VariableDeclaration: if (isBindingPattern((node as VariableDeclaration).name) && !((node as VariableDeclaration).name as BindingPattern).elements.length) { @@ -3849,7 +3902,7 @@ namespace ts { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent); + return isDeclarationVisible(parent); case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: @@ -3879,7 +3932,7 @@ namespace ts { case SyntaxKind.UnionType: case SyntaxKind.IntersectionType: case SyntaxKind.ParenthesizedType: - return isDeclarationVisible(node.parent); + return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible @@ -4124,14 +4177,17 @@ namespace ts { else { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) const name = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name)) { - // computed properties with non-literal names are treated as 'any' + const isLate = isLateBindableName(name); + const isWellKnown = isComputedPropertyName(name) && isWellKnownSymbolSyntactically(name.expression); + if (!isLate && !isWellKnown && isComputedNonLiteralName(name)) { return anyType; } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - const text = getTextOfPropertyName(name); + const text = isLate ? getLateBoundNameFromType(checkComputedPropertyName(name as ComputedPropertyName) as LiteralType | UniqueESSymbolType) : + isWellKnown ? getPropertyNameForKnownSymbolName(idText(((name as ComputedPropertyName).expression as PropertyAccessExpression).name)) : + getTextOfPropertyName(name); // Relax null check on ambient destructuring parameters, since the parameters have no implementation and are just documentation if (strictNullChecks && declaration.flags & NodeFlags.Ambient && isParameterDeclaration(declaration)) { @@ -4317,14 +4373,15 @@ namespace ts { for (const declaration of symbol.declarations) { let declarationInConstructor = false; const expression = declaration.kind === SyntaxKind.BinaryExpression ? declaration : - declaration.kind === SyntaxKind.PropertyAccessExpression ? getAncestor(declaration, SyntaxKind.BinaryExpression) : + declaration.kind === SyntaxKind.PropertyAccessExpression ? cast(declaration.parent, isBinaryExpression) : undefined; if (!expression) { return unknownType; } - if (isPropertyAccessExpression(expression.left) && expression.left.expression.kind === SyntaxKind.ThisKeyword) { + const special = getSpecialPropertyAssignmentKind(expression); + if (special === SpecialPropertyAssignmentKind.ThisProperty) { const thisContainer = getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. @@ -4354,7 +4411,33 @@ namespace ts { } else if (!jsDocType) { // If we don't have an explicit JSDoc type, get the type from the expression. - const type = getWidenedLiteralType(checkExpressionCached(expression.right)); + let type = getWidenedLiteralType(checkExpressionCached(expression.right)); + + if (getObjectFlags(type) & ObjectFlags.Anonymous && + special === SpecialPropertyAssignmentKind.ModuleExports && + symbol.escapedName === InternalSymbolName.ExportEquals) { + const exportedType = resolveStructuredTypeMembers(type as AnonymousType); + const members = createSymbolTable(); + copyEntries(exportedType.members, members); + symbol.exports.forEach((s, name) => { + if (members.has(name)) { + const exportedMember = exportedType.members.get(name); + const union = createSymbol(s.flags | exportedMember.flags, name); + union.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]); + members.set(name, union); + } + else { + members.set(name, s); + } + }); + type = createAnonymousType( + exportedType.symbol, + members, + exportedType.callSignatures, + exportedType.constructSignatures, + exportedType.stringIndexInfo, + exportedType.numberIndexInfo); + } let anyedType = type; if (isEmptyArrayLiteralType(type)) { anyedType = anyArrayType; @@ -6493,7 +6576,7 @@ namespace ts { (modifiers & ModifierFlags.Protected ? CheckFlags.ContainsProtected : 0) | (modifiers & ModifierFlags.Private ? CheckFlags.ContainsPrivate : 0) | (modifiers & ModifierFlags.Static ? CheckFlags.ContainsStatic : 0); - if (!isMethodLike(prop)) { + if (!isPrototypeProperty(prop)) { syntheticFlag = CheckFlags.SyntheticProperty; } } @@ -7122,15 +7205,15 @@ namespace ts { return symbol.members.get(InternalSymbolName.Index); } - function getIndexDeclarationOfSymbol(symbol: Symbol, kind: IndexKind): SignatureDeclaration { + function getIndexDeclarationOfSymbol(symbol: Symbol, kind: IndexKind): IndexSignatureDeclaration { const syntaxKind = kind === IndexKind.Number ? SyntaxKind.NumberKeyword : SyntaxKind.StringKeyword; const indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (const decl of indexSymbol.declarations) { - const node = decl; + const node = cast(decl, isIndexSignatureDeclaration); if (node.parameters.length === 1) { const parameter = node.parameters[0]; - if (parameter && parameter.type && parameter.type.kind === syntaxKind) { + if (parameter.type && parameter.type.kind === syntaxKind) { return node; } } @@ -7140,7 +7223,7 @@ namespace ts { return undefined; } - function createIndexInfo(type: Type, isReadonly: boolean, declaration?: SignatureDeclaration): IndexInfo { + function createIndexInfo(type: Type, isReadonly: boolean, declaration?: IndexSignatureDeclaration): IndexInfo { return { type, isReadonly, declaration }; } @@ -8108,12 +8191,16 @@ namespace ts { return links.resolvedType; } - function getIndexTypeForGenericType(type: InstantiableType | UnionOrIntersectionType) { - if (!type.resolvedIndexType) { - type.resolvedIndexType = createType(TypeFlags.Index); - type.resolvedIndexType.type = type; + function getIndexTypeForGenericType(type: InstantiableType | UnionOrIntersectionType, includeDeclaredTypes?: boolean) { + const cacheLocation = includeDeclaredTypes ? "resolvedDeclaredIndexType" : "resolvedIndexType"; + if (!type[cacheLocation]) { + type[cacheLocation] = createType(TypeFlags.Index); + type[cacheLocation].type = type; + if (includeDeclaredTypes) { + type[cacheLocation].isDeclaredType = true; + } } - return type.resolvedIndexType; + return type[cacheLocation]; } function getLiteralTypeFromPropertyName(prop: Symbol, include: TypeFlags) { @@ -8138,9 +8225,9 @@ namespace ts { return numberIndexInfo !== enumNumberIndexInfo ? numberIndexInfo : undefined; } - function getIndexType(type: Type): Type { - return type.flags & TypeFlags.Intersection ? getUnionType(map((type).types, t => getIndexType(t))) : - maybeTypeOfKind(type, TypeFlags.InstantiableNonPrimitive) ? getIndexTypeForGenericType(type) : + function getIndexType(type: Type, includeDeclaredTypes?: boolean): Type { + return type.flags & TypeFlags.Intersection ? getUnionType(map((type).types, t => getIndexType(t, includeDeclaredTypes))) : + maybeTypeOfKind(type, TypeFlags.InstantiableNonPrimitive) ? getIndexTypeForGenericType(type, includeDeclaredTypes) : getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(type) : type === wildcardType ? wildcardType : type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? keyofConstraintType : @@ -8567,7 +8654,7 @@ namespace ts { return links.resolvedType = unknownType; } const moduleSymbol = resolveExternalModuleSymbol(innerModuleSymbol, /*dontResolveAlias*/ false); - if (node.qualifier) { + if (!nodeIsMissing(node.qualifier)) { const nameStack: Identifier[] = getIdentifierChain(node.qualifier); let currentNamespace = moduleSymbol; let current: Identifier | undefined; @@ -8903,7 +8990,7 @@ namespace ts { return getTypeFromConditionalTypeNode(node); case SyntaxKind.InferType: return getTypeFromInferTypeNode(node); - case SyntaxKind.ImportTypeNode: + case SyntaxKind.ImportType: return getTypeFromImportTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode @@ -9130,6 +9217,11 @@ namespace ts { return type; } + function maybeTypeParameterReference(node: Node) { + return !(node.kind === SyntaxKind.QualifiedName || + node.parent.kind === SyntaxKind.TypeReference && (node.parent).typeArguments && node === (node.parent).typeName); + } + function isTypeParameterPossiblyReferenced(tp: TypeParameter, node: Node) { // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the @@ -9146,7 +9238,8 @@ namespace ts { case SyntaxKind.ThisType: return tp.isThisType; case SyntaxKind.Identifier: - return !tp.isThisType && isPartOfTypeNode(node) && getTypeFromTypeNode(node) === tp; + return !tp.isThisType && isPartOfTypeNode(node) && maybeTypeParameterReference(node) && + getTypeFromTypeNode(node) === tp; case SyntaxKind.TypeQuery: return true; } @@ -10340,7 +10433,7 @@ namespace ts { // constraint of T. const constraint = getConstraintForRelation((target).type); if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + if (result = isRelatedTo(source, getIndexType(constraint, (target as IndexType).isDeclaredType), reportErrors)) { return result; } } @@ -10536,8 +10629,7 @@ namespace ts { // related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice // that S and T are contra-variant whereas X and Y are co-variant. function mappedTypeRelatedTo(source: MappedType, target: MappedType, reportErrors: boolean): Ternary { - const modifiersRelated = relation === comparableRelation || ( - relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) : + const modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) : getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target)); if (modifiersRelated) { let result: Ternary; @@ -13816,7 +13908,8 @@ namespace ts { const assignmentKind = getAssignmentTargetKind(node); if (assignmentKind) { - if (!(localOrExportSymbol.flags & SymbolFlags.Variable)) { + if (!(localOrExportSymbol.flags & SymbolFlags.Variable) && + !(isInJavaScriptFile(node) && localOrExportSymbol.flags & SymbolFlags.ValueModule)) { error(node, Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable, symbolToString(symbol)); return unknownType; } @@ -16221,7 +16314,7 @@ namespace ts { const sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode); // Check if sourceAttributesType assignable to targetAttributesType though this check will allow excess properties - const isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); + const isSourceAttributeTypeAssignableToTarget = isTypeAssignableTo(sourceAttributesType, targetAttributesType); // After we check for assignability, we will do another pass to check that all explicitly specified attributes have correct name corresponding in targetAttributeType. // This will allow excess properties in spread type as it is very common pattern to spread outer attributes into React component in its render method. if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { @@ -16238,6 +16331,32 @@ namespace ts { } } } + else if (!isSourceAttributeTypeAssignableToTarget) { + // Assignability failure - check each prop individually, and if that fails, fall back on the bad error span + if (length(openingLikeElement.attributes.properties)) { + let reportedError = false; + for (const prop of openingLikeElement.attributes.properties) { + if (isJsxSpreadAttribute(prop)) continue; + const name = idText(prop.name); + const sourcePropType = getIndexedAccessType(sourceAttributesType, getLiteralType(name)); + const targetPropType = getIndexedAccessType(targetAttributesType, getLiteralType(name)); + const rootChain = () => chainDiagnosticMessages( + /*details*/ undefined, + Diagnostics.Types_of_property_0_are_incompatible, + name, + ); + if (!checkTypeAssignableTo(sourcePropType, targetPropType, prop, /*headMessage*/ undefined, rootChain)) { + reportedError = true; + } + } + + if (reportedError) { + return; + } + } + // Report fallback error on just the component name + checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.tagName); + } } function checkJsxExpression(node: JsxExpression, checkMode?: CheckMode) { @@ -16263,8 +16382,19 @@ namespace ts { return s.valueDeclaration ? getCombinedNodeFlags(s.valueDeclaration) : 0; } - function isMethodLike(symbol: Symbol) { - return !!(symbol.flags & SymbolFlags.Method || getCheckFlags(symbol) & CheckFlags.SyntheticMethod); + /** + * Return whether this symbol is a member of a prototype somewhere + * Note that this is not tracked well within the compiler, so the answer may be incorrect. + */ + function isPrototypeProperty(symbol: Symbol) { + if (symbol.flags & SymbolFlags.Method || getCheckFlags(symbol) & CheckFlags.SyntheticMethod) { + return true; + } + if (isInJavaScriptFile(symbol.valueDeclaration)) { + const parent = symbol.valueDeclaration.parent; + return parent && isBinaryExpression(parent) && + getSpecialPropertyAssignmentKind(parent) === SpecialPropertyAssignmentKind.PrototypeProperty; + } } /** @@ -16275,11 +16405,13 @@ namespace ts { * @param type The type of left. * @param prop The symbol for the right hand side of the property access. */ - function checkPropertyAccessibility(node: PropertyAccessExpression | QualifiedName | VariableLikeDeclaration, left: Expression | QualifiedName, type: Type, prop: Symbol): boolean { + function checkPropertyAccessibility(node: PropertyAccessExpression | QualifiedName | VariableLikeDeclaration | ImportTypeNode, left: Expression | QualifiedName | ImportTypeNode, type: Type, prop: Symbol): boolean { const flags = getDeclarationModifierFlagsFromSymbol(prop); const errorNode = node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.VariableDeclaration ? node.name : - (node).right; + node.kind === SyntaxKind.ImportType ? + node : + (node).right; if (getCheckFlags(prop) & CheckFlags.ContainsPrivate) { // Synthetic property with private constituent property @@ -16534,26 +16666,25 @@ namespace ts { if (!(prop.parent.flags & SymbolFlags.Class)) { return false; } - let classType = getTypeOfSymbol(prop.parent) as InterfaceType; + let classType = getTypeOfSymbol(prop.parent); while (true) { - classType = getSuperClass(classType); + classType = classType.symbol && getSuperClass(classType as InterfaceType); if (!classType) { return false; } - const superProperty = getPropertyOfObjectType(classType, prop.escapedName); + const superProperty = getPropertyOfType(classType, prop.escapedName); if (superProperty && superProperty.valueDeclaration) { return true; } } } - function getSuperClass(classType: InterfaceType): InterfaceType | undefined { + function getSuperClass(classType: InterfaceType): Type | undefined { const x = getBaseTypes(classType); if (x.length === 0) { return undefined; } - Debug.assert(x.length === 1); - return x[0] as InterfaceType; + return getIntersectionType(x); } function reportNonexistentProperty(propNode: Identifier, containingType: Type) { @@ -16566,12 +16697,18 @@ namespace ts { } } } - const suggestion = getSuggestionForNonexistentProperty(propNode, containingType); - if (suggestion !== undefined) { - errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, declarationNameToString(propNode), typeToString(containingType), suggestion); + const promisedType = getPromisedTypeOfPromise(containingType); + if (promisedType && getPropertyOfType(promisedType, propNode.escapedText)) { + errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await, declarationNameToString(propNode), typeToString(containingType)); } else { - errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(containingType)); + const suggestion = getSuggestionForNonexistentProperty(propNode, containingType); + if (suggestion !== undefined) { + errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, declarationNameToString(propNode), typeToString(containingType), suggestion); + } + else { + errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(containingType)); + } } diagnostics.add(createDiagnosticForNodeFromMessageChain(propNode, errorInfo)); } @@ -16700,7 +16837,7 @@ namespace ts { } function markPropertyAsReferenced(prop: Symbol, nodeForCheckWriteOnly: Node | undefined, isThisAccess: boolean) { - if (!prop || !noUnusedIdentifiers || !(prop.flags & SymbolFlags.ClassMember) || !prop.valueDeclaration || !hasModifier(prop.valueDeclaration, ModifierFlags.Private)) { + if (!prop || !(prop.flags & SymbolFlags.ClassMember) || !prop.valueDeclaration || !hasModifier(prop.valueDeclaration, ModifierFlags.Private)) { return; } if (nodeForCheckWriteOnly && isWriteOnlyAccess(nodeForCheckWriteOnly) && !(prop.flags & SymbolFlags.SetAccessor && !(prop.flags & SymbolFlags.GetAccessor))) { @@ -16718,13 +16855,19 @@ namespace ts { (getCheckFlags(prop) & CheckFlags.Instantiated ? getSymbolLinks(prop).target : prop).isReferenced = SymbolFlags.All; } - function isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: __String): boolean { - const left = node.kind === SyntaxKind.PropertyAccessExpression ? node.expression : node.left; - return isValidPropertyAccessWithType(node, left, propertyName, getWidenedType(checkExpression(left))); + function isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: __String): boolean { + switch (node.kind) { + case SyntaxKind.PropertyAccessExpression: + return isValidPropertyAccessWithType(node, node.expression, propertyName, getWidenedType(checkExpression(node.expression))); + case SyntaxKind.QualifiedName: + return isValidPropertyAccessWithType(node, node.left, propertyName, getWidenedType(checkExpression(node.left))); + case SyntaxKind.ImportType: + return isValidPropertyAccessWithType(node, node, propertyName, getTypeFromTypeNode(node)); + } } - function isValidPropertyAccessForCompletions(node: PropertyAccessExpression, type: Type, property: Symbol): boolean { - return isValidPropertyAccessWithType(node, node.expression, property.escapedName, type) + function isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode, type: Type, property: Symbol): boolean { + return isValidPropertyAccessWithType(node, node.kind === SyntaxKind.ImportType ? node : node.expression, property.escapedName, type) && (!(property.flags & SymbolFlags.Method) || isValidMethodAccess(property, type)); } function isValidMethodAccess(method: Symbol, actualThisType: Type): boolean { @@ -16746,8 +16889,8 @@ namespace ts { } function isValidPropertyAccessWithType( - node: PropertyAccessExpression | QualifiedName, - left: LeftHandSideExpression | QualifiedName, + node: PropertyAccessExpression | QualifiedName | ImportTypeNode, + left: LeftHandSideExpression | QualifiedName | ImportTypeNode, propertyName: __String, type: Type): boolean { @@ -17907,6 +18050,9 @@ namespace ts { function resolveCallExpression(node: CallExpression, candidatesOutArray: Signature[]): Signature { if (node.expression.kind === SyntaxKind.SuperKeyword) { const superType = checkSuperExpression(node.expression); + if (isTypeAny(superType)) { + return anySignature; + } if (superType !== unknownType) { // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated // with the type arguments specified in the extends clause. @@ -18974,6 +19120,9 @@ namespace ts { const links = getNodeLinks(node); const type = getTypeOfSymbol(node.symbol); + if (isTypeAny(type)) { + return type; + } // Check if function expression is contextually typed and assign parameter types if so. if (!(links.flags & NodeCheckFlags.ContextChecked)) { @@ -19054,7 +19203,6 @@ namespace ts { } } } - registerForUnusedIdentifiersCheck(node); } } @@ -19737,8 +19885,9 @@ namespace ts { // VarExpr = ValueExpr // requires VarExpr to be classified as a reference // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) - // and the type of the non - compound operation to be assignable to the type of VarExpr. - if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) { + // and the type of the non-compound operation to be assignable to the type of VarExpr. + if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access) + && (!isIdentifier(left) || unescapeLeadingUnderscores(left.escapedText) !== "exports")) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined); } @@ -20405,8 +20554,8 @@ namespace ts { checkAsyncFunctionReturnType(node); } } - if (noUnusedIdentifiers && !(node).body) { - checkUnusedTypeParameters(node); + if (node.kind !== SyntaxKind.IndexSignature && node.kind !== SyntaxKind.JSDocFunctionType) { + registerForUnusedIdentifiersCheck(node); } } } @@ -20607,7 +20756,6 @@ namespace ts { if (!checkGrammarConstructorTypeParameters(node)) checkGrammarConstructorTypeAnnotation(node); checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); const symbol = getSymbolOfNode(node); const firstDeclaration = getDeclarationOfKind(symbol, node.kind); @@ -20727,7 +20875,6 @@ namespace ts { } } checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); } function checkAccessorDeclarationTypesIdentical(first: AccessorDeclaration, second: AccessorDeclaration, getAnnotatedType: (a: AccessorDeclaration) => Type, message: DiagnosticMessage) { @@ -20850,7 +20997,7 @@ namespace ts { // Check if the index type is assignable to 'keyof T' for the object type. const objectType = (type).objectType; const indexType = (type).indexType; - if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + if (isTypeAssignableTo(indexType, getIndexType(objectType, /*includeDeclaredTypes*/ true))) { if (accessNode.kind === SyntaxKind.ElementAccessExpression && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & ObjectFlags.Mapped && getMappedTypeModifiers(objectType) & MappedTypeModifiers.IncludeReadonly) { error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); @@ -21759,6 +21906,10 @@ namespace ts { // and give a better error message when the host function mentions `arguments` // but the tag doesn't have an array type if (decl) { + const i = getJSDocTags(decl).filter(isJSDocParameterTag).indexOf(node); + if (i > -1 && i < decl.parameters.length && isBindingPattern(decl.parameters[i].name)) { + return; + } if (!containsArgumentsReference(decl)) { error(node.name, Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, @@ -21878,70 +22029,72 @@ namespace ts { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } } - - registerForUnusedIdentifiersCheck(node); } - function registerForUnusedIdentifiersCheck(node: Node) { - if (deferredUnusedIdentifierNodes) { + function registerForUnusedIdentifiersCheck(node: PotentiallyUnusedIdentifier): void { + // May be in a call such as getTypeOfNode that happened to call this. But potentiallyUnusedIdentifiers is only defined in the scope of `checkSourceFile`. + if (potentiallyUnusedIdentifiers) { // TODO: GH#22580 - // Debug.assert(addToSeen(seenDeferredUnusedIdentifiers, getNodeId(node)), "Deferring unused identifier check twice"); - deferredUnusedIdentifierNodes.push(node); + // Debug.assert(addToSeen(seenPotentiallyUnusedIdentifiers, getNodeId(node)), "Adding potentially-unused identifier twice"); + potentiallyUnusedIdentifiers.push(node); } } - function checkUnusedIdentifiers() { - if (deferredUnusedIdentifierNodes) { - for (const node of deferredUnusedIdentifierNodes) { - switch (node.kind) { - case SyntaxKind.SourceFile: - case SyntaxKind.ModuleDeclaration: - checkUnusedModuleMembers(node); - break; - case SyntaxKind.ClassDeclaration: - case SyntaxKind.ClassExpression: - checkUnusedClassMembers(node); - checkUnusedTypeParameters(node); - break; - case SyntaxKind.InterfaceDeclaration: - checkUnusedTypeParameters(node); - break; - case SyntaxKind.Block: - case SyntaxKind.CaseBlock: - case SyntaxKind.ForStatement: - case SyntaxKind.ForInStatement: - case SyntaxKind.ForOfStatement: - checkUnusedLocalsAndParameters(node); - break; - case SyntaxKind.Constructor: - case SyntaxKind.FunctionExpression: - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.ArrowFunction: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - if ((node).body) { - checkUnusedLocalsAndParameters(node); - } - checkUnusedTypeParameters(node); - break; - case SyntaxKind.MethodSignature: - case SyntaxKind.CallSignature: - case SyntaxKind.ConstructSignature: - case SyntaxKind.FunctionType: - case SyntaxKind.ConstructorType: - case SyntaxKind.TypeAliasDeclaration: - checkUnusedTypeParameters(node); - break; - default: - Debug.fail("Node should not have been registered for unused identifiers check"); - } + type PotentiallyUnusedIdentifier = + | SourceFile | ModuleDeclaration | ClassLikeDeclaration | InterfaceDeclaration + | Block | CaseBlock | ForStatement | ForInStatement | ForOfStatement + | Exclude | TypeAliasDeclaration; + + function checkUnusedIdentifiers(potentiallyUnusedIdentifiers: ReadonlyArray, addDiagnostic: AddUnusedDiagnostic) { + for (const node of potentiallyUnusedIdentifiers) { + switch (node.kind) { + case SyntaxKind.SourceFile: + case SyntaxKind.ModuleDeclaration: + checkUnusedModuleMembers(node, addDiagnostic); + break; + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: + checkUnusedClassMembers(node, addDiagnostic); + checkUnusedTypeParameters(node, addDiagnostic); + break; + case SyntaxKind.InterfaceDeclaration: + checkUnusedTypeParameters(node, addDiagnostic); + break; + case SyntaxKind.Block: + case SyntaxKind.CaseBlock: + case SyntaxKind.ForStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: + checkUnusedLocalsAndParameters(node, addDiagnostic); + break; + case SyntaxKind.Constructor: + case SyntaxKind.FunctionExpression: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ArrowFunction: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + if (node.body) { + checkUnusedLocalsAndParameters(node, addDiagnostic); + } + checkUnusedTypeParameters(node, addDiagnostic); + break; + case SyntaxKind.MethodSignature: + case SyntaxKind.CallSignature: + case SyntaxKind.ConstructSignature: + case SyntaxKind.FunctionType: + case SyntaxKind.ConstructorType: + case SyntaxKind.TypeAliasDeclaration: + checkUnusedTypeParameters(node, addDiagnostic); + break; + default: + Debug.assertNever(node, "Node should not have been registered for unused identifiers check"); } } } - function checkUnusedLocalsAndParameters(node: Node): void { - if (noUnusedIdentifiers && !(node.flags & NodeFlags.Ambient)) { + function checkUnusedLocalsAndParameters(node: Node, addDiagnostic: AddUnusedDiagnostic): void { + if (!(node.flags & NodeFlags.Ambient)) { node.locals.forEach(local => { // If it's purely a type parameter, ignore, will be checked in `checkUnusedTypeParameters`. // If it's a type parameter merged with a parameter, check if the parameter-side is used. @@ -21949,15 +22102,12 @@ namespace ts { if (local.valueDeclaration && getRootDeclaration(local.valueDeclaration).kind === SyntaxKind.Parameter) { const parameter = getRootDeclaration(local.valueDeclaration); const name = getNameOfDeclaration(local.valueDeclaration); - if (compilerOptions.noUnusedParameters && - !isParameterPropertyDeclaration(parameter) && - !parameterIsThisKeyword(parameter) && - !parameterNameStartsWithUnderscore(name)) { - error(name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(local)); + if (!isParameterPropertyDeclaration(parameter) && !parameterIsThisKeyword(parameter) && !parameterNameStartsWithUnderscore(name)) { + addDiagnostic(UnusedKind.Parameter, createDiagnosticForNode(name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(local))); } } - else if (compilerOptions.noUnusedLocals) { - forEach(local.declarations, d => errorUnusedLocal(d, symbolName(local))); + else { + forEach(local.declarations, d => errorUnusedLocal(d, symbolName(local), addDiagnostic)); } } }); @@ -21972,7 +22122,7 @@ namespace ts { return false; } - function errorUnusedLocal(declaration: Declaration, name: string) { + function errorUnusedLocal(declaration: Declaration, name: string, addDiagnostic: AddUnusedDiagnostic) { const node = getNameOfDeclaration(declaration) || declaration; if (isIdentifierThatStartsWithUnderScore(node)) { const declaration = getRootDeclaration(node.parent); @@ -21983,7 +22133,7 @@ namespace ts { } if (!isRemovedPropertyFromObjectSpread(node.kind === SyntaxKind.Identifier ? node.parent : node)) { - diagnostics.add(createDiagnosticForNodeSpan(getSourceFileOfNode(declaration), declaration, node, Diagnostics._0_is_declared_but_its_value_is_never_read, name)); + addDiagnostic(UnusedKind.Local, createDiagnosticForNodeSpan(getSourceFileOfNode(declaration), declaration, node, Diagnostics._0_is_declared_but_its_value_is_never_read, name)); } } @@ -21995,8 +22145,8 @@ namespace ts { return isIdentifier(node) && idText(node).charCodeAt(0) === CharacterCodes._; } - function checkUnusedClassMembers(node: ClassDeclaration | ClassExpression): void { - if (compilerOptions.noUnusedLocals && !(node.flags & NodeFlags.Ambient)) { + function checkUnusedClassMembers(node: ClassDeclaration | ClassExpression, addDiagnostic: AddUnusedDiagnostic): void { + if (!(node.flags & NodeFlags.Ambient)) { for (const member of node.members) { switch (member.kind) { case SyntaxKind.MethodDeclaration: @@ -22009,13 +22159,13 @@ namespace ts { } const symbol = getSymbolOfNode(member); if (!symbol.isReferenced && hasModifier(member, ModifierFlags.Private)) { - error(member.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)); + addDiagnostic(UnusedKind.Local, createDiagnosticForNode(member.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; case SyntaxKind.Constructor: for (const parameter of (member).parameters) { if (!parameter.symbol.isReferenced && hasModifier(parameter, ModifierFlags.Private)) { - error(parameter.name, Diagnostics.Property_0_is_declared_but_its_value_is_never_read, symbolName(parameter.symbol)); + addDiagnostic(UnusedKind.Local, createDiagnosticForNode(parameter.name, Diagnostics.Property_0_is_declared_but_its_value_is_never_read, symbolName(parameter.symbol))); } } break; @@ -22030,27 +22180,23 @@ namespace ts { } } - function checkUnusedTypeParameters(node: ClassDeclaration | ClassExpression | FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | ConstructorDeclaration | SignatureDeclaration | InterfaceDeclaration | TypeAliasDeclaration) { - if (compilerOptions.noUnusedParameters && !(node.flags & NodeFlags.Ambient)) { - if (node.typeParameters) { - // Only report errors on the last declaration for the type parameter container; - // this ensures that all uses have been accounted for. - const symbol = getSymbolOfNode(node); - const lastDeclaration = symbol && symbol.declarations && lastOrUndefined(symbol.declarations); - if (lastDeclaration !== node) { - return; - } - for (const typeParameter of node.typeParameters) { - if (!(getMergedSymbol(typeParameter.symbol).isReferenced & SymbolFlags.TypeParameter) && !isIdentifierThatStartsWithUnderScore(typeParameter.name)) { - error(typeParameter.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(typeParameter.symbol)); - } + function checkUnusedTypeParameters( + node: ClassDeclaration | ClassExpression | FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | ConstructorDeclaration | SignatureDeclaration | InterfaceDeclaration | TypeAliasDeclaration, + addDiagnostic: AddUnusedDiagnostic, + ): void { + // Only report errors on the last declaration for the type parameter container; + // this ensures that all uses have been accounted for. + if (!(node.flags & NodeFlags.Ambient) && node.typeParameters && last(getSymbolOfNode(node)!.declarations) === node) { + for (const typeParameter of node.typeParameters) { + if (!(getMergedSymbol(typeParameter.symbol).isReferenced & SymbolFlags.TypeParameter) && !isIdentifierThatStartsWithUnderScore(typeParameter.name)) { + addDiagnostic(UnusedKind.Parameter, createDiagnosticForNode(typeParameter.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(typeParameter.symbol))); } } } } - function checkUnusedModuleMembers(node: ModuleDeclaration | SourceFile): void { - if (compilerOptions.noUnusedLocals && !(node.flags & NodeFlags.Ambient)) { + function checkUnusedModuleMembers(node: ModuleDeclaration | SourceFile, addDiagnostic: AddUnusedDiagnostic): void { + if (!(node.flags & NodeFlags.Ambient)) { // Ideally we could use the ImportClause directly as a key, but must wait until we have full ES6 maps. So must store key along with value. const unusedImports = createMap<[ImportClause, ImportedDeclaration[]]>(); node.locals.forEach(local => { @@ -22069,7 +22215,7 @@ namespace ts { } } else { - errorUnusedLocal(declaration, symbolName(local)); + errorUnusedLocal(declaration, symbolName(local), addDiagnostic); } } }); @@ -22077,13 +22223,13 @@ namespace ts { unusedImports.forEach(([importClause, unuseds]) => { const importDecl = importClause.parent; if (forEachImportedDeclaration(importClause, d => !contains(unuseds, d))) { - for (const unused of unuseds) errorUnusedLocal(unused, idText(unused.name)); + for (const unused of unuseds) errorUnusedLocal(unused, idText(unused.name), addDiagnostic); } else if (unuseds.length === 1) { - error(importDecl, Diagnostics._0_is_declared_but_its_value_is_never_read, idText(first(unuseds).name)); + addDiagnostic(UnusedKind.Local, createDiagnosticForNode(importDecl, Diagnostics._0_is_declared_but_its_value_is_never_read, idText(first(unuseds).name))); } else { - error(importDecl, Diagnostics.All_imports_in_import_declaration_are_unused, showModuleSpecifier(importDecl)); + addDiagnostic(UnusedKind.Local, createDiagnosticForNode(importDecl, Diagnostics.All_imports_in_import_declaration_are_unused, showModuleSpecifier(importDecl))); } }); } @@ -23698,13 +23844,13 @@ namespace ts { continue; } - if (isMethodLike(base) && isMethodLike(derived) || base.flags & SymbolFlags.PropertyOrAccessor && derived.flags & SymbolFlags.PropertyOrAccessor) { + if (isPrototypeProperty(base) && isPrototypeProperty(derived) || base.flags & SymbolFlags.PropertyOrAccessor && derived.flags & SymbolFlags.PropertyOrAccessor) { // method is overridden with method or property/accessor is overridden with property/accessor - correct case continue; } let errorMessage: DiagnosticMessage; - if (isMethodLike(base)) { + if (isPrototypeProperty(base)) { if (derived.flags & SymbolFlags.Accessor) { errorMessage = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } @@ -23712,11 +23858,11 @@ namespace ts { errorMessage = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } - else if (base.flags & SymbolFlags.Property) { - errorMessage = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + else if (base.flags & SymbolFlags.Accessor) { + errorMessage = Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - errorMessage = Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + errorMessage = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } error(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); @@ -24518,7 +24664,7 @@ namespace ts { const exportEqualsSymbol = moduleSymbol.exports.get("export=" as __String); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; - if (!isTopLevelInExternalModuleAugmentation(declaration)) { + if (!isTopLevelInExternalModuleAugmentation(declaration) && !isInJavaScriptFile(declaration)) { error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); } } @@ -24599,7 +24745,6 @@ namespace ts { case SyntaxKind.ConstructorType: case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: - return checkSignatureDeclaration(node); case SyntaxKind.IndexSignature: return checkSignatureDeclaration(node); case SyntaxKind.MethodDeclaration: @@ -24633,7 +24778,7 @@ namespace ts { return checkConditionalType(node); case SyntaxKind.InferType: return checkInferType(node); - case SyntaxKind.ImportTypeNode: + case SyntaxKind.ImportType: return checkImportType(node); case SyntaxKind.JSDocAugmentsTag: return checkJSDocAugmentsTag(node as JSDocAugmentsTag); @@ -24719,8 +24864,6 @@ namespace ts { case SyntaxKind.ExportAssignment: return checkExportAssignment(node); case SyntaxKind.EmptyStatement: - checkGrammarStatementInAmbientContext(node); - return; case SyntaxKind.DebuggerStatement: checkGrammarStatementInAmbientContext(node); return; @@ -24841,6 +24984,17 @@ namespace ts { performance.measure("Check", "beforeCheck", "afterCheck"); } + function unusedIsError(kind: UnusedKind): boolean { + switch (kind) { + case UnusedKind.Local: + return compilerOptions.noUnusedLocals; + case UnusedKind.Parameter: + return compilerOptions.noUnusedParameters; + default: + return Debug.assertNever(kind); + } + } + // Fully type check a source file and collect the relevant diagnostics. function checkSourceFileWorker(node: SourceFile) { const links = getNodeLinks(node); @@ -24859,8 +25013,10 @@ namespace ts { clear(potentialNewTargetCollisions); deferredNodes = []; - deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; - flowAnalysisDisabled = false; + if (produceDiagnostics) { + Debug.assert(!allPotentiallyUnusedIdentifiers.has(node.fileName)); + allPotentiallyUnusedIdentifiers.set(node.fileName, potentiallyUnusedIdentifiers = []); + } forEach(node.statements, checkSourceElement); @@ -24870,13 +25026,17 @@ namespace ts { registerForUnusedIdentifiersCheck(node); } - if (!node.isDeclarationFile) { - checkUnusedIdentifiers(); + if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) { + checkUnusedIdentifiers(potentiallyUnusedIdentifiers, (kind, diag) => { + if (unusedIsError(kind)) { + diagnostics.add(diag); + } + }); } deferredNodes = undefined; - seenDeferredUnusedIdentifiers.clear(); - deferredUnusedIdentifierNodes = undefined; + seenPotentiallyUnusedIdentifiers.clear(); + potentiallyUnusedIdentifiers = undefined; if (isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); @@ -25151,7 +25311,7 @@ namespace ts { node = parent; parent = parent.parent; } - if (parent && parent.kind === SyntaxKind.ImportTypeNode && (parent as ImportTypeNode).qualifier === node) { + if (parent && parent.kind === SyntaxKind.ImportType && (parent as ImportTypeNode).qualifier === node) { return parent as ImportTypeNode; } return undefined; @@ -25372,6 +25532,8 @@ namespace ts { case SyntaxKind.FunctionKeyword: case SyntaxKind.EqualsGreaterThanToken: return getSymbolOfNode(node.parent); + case SyntaxKind.ImportType: + return isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined; default: return undefined; @@ -25379,9 +25541,6 @@ namespace ts { } function getShorthandAssignmentValueSymbol(location: Node): Symbol { - // The function returns a value symbol of an identifier in the short-hand property assignment. - // This is necessary as an identifier in short-hand property assignment can contains two meaning: - // property name and property value. if (location && location.kind === SyntaxKind.ShorthandPropertyAssignment) { return resolveEntityName((location).name, SymbolFlags.Value | SymbolFlags.Alias); } @@ -26670,7 +26829,9 @@ namespace ts { if (i !== (parameterCount - 1)) { return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); } - checkGrammarForDisallowedTrailingComma(parameters, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + if (!(parameter.flags & NodeFlags.Ambient)) { // Allow `...foo,` in ambient declarations; see GH#23070 + checkGrammarForDisallowedTrailingComma(parameters, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + } if (isBindingPattern(parameter.name)) { return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 86d4ffa1c3f..126c1529094 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1,9 +1,3 @@ -/// -/// -/// -/// -/// - namespace ts { /* @internal */ export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean" }; diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index f26a66701e4..de629cccfe1 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts { export interface CommentWriter { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ae7e8de2ae1..cdf68cb2dfa 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts { // WARNING: The script `configureNightly.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configureNightly` too. @@ -1268,10 +1265,7 @@ namespace ts { }); } - export function assign, T2, T3>(t: T1, arg1: T2, arg2: T3): T1 & T2 & T3; - export function assign, T2>(t: T1, arg1: T2): T1 & T2; - export function assign>(t: T1, ...args: any[]): any; - export function assign>(t: T1, ...args: any[]) { + export function assign(t: T, ...args: T[]) { for (const arg of args) { for (const p in arg) { if (hasProperty(arg, p)) { @@ -1317,12 +1311,13 @@ namespace ts { * the same key with the given 'makeKey' function, then the element with the higher * index in the array will be the one associated with the produced key. */ - export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string): Map; - export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string, makeValue: (value: T) => U): Map; - export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string, makeValue: (value: T) => T | U = identity): Map { + export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string | undefined): Map; + export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string | undefined, makeValue: (value: T) => U): Map; + export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string | undefined, makeValue: (value: T) => T | U = identity): Map { const result = createMap(); for (const value of array) { - result.set(makeKey(value), makeValue(value)); + const key = makeKey(value); + if (key !== undefined) result.set(key, makeValue(value)); } return result; } @@ -1343,8 +1338,9 @@ namespace ts { * @param array the array of input elements. */ export function arrayToSet(array: ReadonlyArray): Map; - export function arrayToSet(array: ReadonlyArray, makeKey: (value: T) => string): Map; - export function arrayToSet(array: ReadonlyArray, makeKey?: (value: any) => string): Map { + export function arrayToSet(array: ReadonlyArray, makeKey: (value: T) => string | undefined): Map; + export function arrayToSet(array: ReadonlyArray, makeKey: (value: T) => __String | undefined): UnderscoreEscapedMap; + export function arrayToSet(array: ReadonlyArray, makeKey?: (value: any) => string | __String | undefined): Map | UnderscoreEscapedMap { return arrayToMap(array, makeKey || (s => s), () => true); } @@ -1606,6 +1602,7 @@ namespace ts { messageText: text, category: message.category, code: message.code, + reportsUnnecessary: message.reportsUnnecessary, }; } @@ -1635,7 +1632,8 @@ namespace ts { messageText: text, category: message.category, - code: message.code + code: message.code, + reportsUnnecessary: message.reportsUnnecessary, }; } @@ -1647,7 +1645,7 @@ namespace ts { code: chain.code, category: chain.category, - messageText: chain.next ? chain : chain.messageText + messageText: chain.next ? chain : chain.messageText, }; } @@ -1725,6 +1723,10 @@ namespace ts { return compareComparableValues(a, b); } + export function min(a: T, b: T, compare: Comparer): T { + return compare(a, b) === Comparison.LessThan ? a : b; + } + /** * Compare two strings using a case-insensitive ordinal comparison. * @@ -2244,6 +2246,8 @@ namespace ts { * Adds a trailing directory separator to a path, if it does not already have one. * @param path The path. */ + export function ensureTrailingDirectorySeparator(path: Path): Path; + export function ensureTrailingDirectorySeparator(path: string): string; export function ensureTrailingDirectorySeparator(path: string) { if (path.charAt(path.length - 1) !== directorySeparator) { return path + directorySeparator; @@ -3118,8 +3122,8 @@ namespace ts { return (arg: T) => f(arg) && g(arg); } - export function or(f: (arg: T) => boolean, g: (arg: T) => boolean) { - return (arg: T) => f(arg) || g(arg); + export function or(f: (arg: T) => boolean, g: (arg: T) => boolean): (arg: T) => boolean { + return arg => f(arg) || g(arg); } export function assertTypeIsNever(_: never): void { } // tslint:disable-line no-empty diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 756247b7459..02f169c9087 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2012,7 +2012,10 @@ "category": "Error", "code": 2569 }, - + "Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?": { + "category": "Error", + "code": 2570 + }, "JSX element attributes type '{0}' may not be a union type.": { "category": "Error", "code": 2600 @@ -3282,7 +3285,8 @@ }, "'{0}' is declared but its value is never read.": { "category": "Error", - "code": 6133 + "code": 6133, + "reportsUnnecessary": true }, "Report errors on unused locals.": { "category": "Message", @@ -3302,7 +3306,8 @@ }, "Property '{0}' is declared but its value is never read.": { "category": "Error", - "code": 6138 + "code": 6138, + "reportsUnnecessary": true }, "Import emit helpers from 'tslib'.": { "category": "Message", @@ -3514,11 +3519,20 @@ }, "All imports in import declaration are unused.": { "category": "Error", - "code": 6192 + "code": 6192, + "reportsUnnecessary": true + }, + "Found 1 error.": { + "category": "Message", + "code": 6193 + }, + "Found {0} errors.": { + "category": "Message", + "code": 6194 }, "Resolve 'keyof' to string valued property names only (no numbers or symbols).": { "category": "Message", - "code": 6193 + "code": 6195 }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", @@ -3598,7 +3612,8 @@ }, "Unused label.": { "category": "Error", - "code": 7028 + "code": 7028, + "reportsUnnecessary": true }, "Fallthrough case in switch.": { "category": "Error", @@ -4150,5 +4165,9 @@ "Convert all constructor functions to classes": { "category": "Message", "code": 95045 + }, + "Generate 'get' and 'set' accessors": { + "category": "Message", + "code": 95046 } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index eb60f0a3f1e..289f332cd33 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1,8 +1,3 @@ -/// -/// -/// -/// - namespace ts { const brackets = createBracketsMap(); @@ -615,7 +610,7 @@ namespace ts { return emitMappedType(node); case SyntaxKind.LiteralType: return emitLiteralType(node); - case SyntaxKind.ImportTypeNode: + case SyntaxKind.ImportType: return emitImportTypeNode(node); case SyntaxKind.JSDocAllType: write("*"); diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index c99874329c1..765c3c9cb4a 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts { function createSynthesizedNode(kind: SyntaxKind): Node { const node = createNode(kind, -1, -1); @@ -592,7 +589,7 @@ namespace ts { : node; } - export function createCallSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined) { + export function createCallSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined) { return createSignatureDeclaration(SyntaxKind.CallSignature, typeParameters, parameters, type) as CallSignatureDeclaration; } @@ -600,7 +597,7 @@ namespace ts { return updateSignatureDeclaration(node, typeParameters, parameters, type); } - export function createConstructSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined) { + export function createConstructSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined) { return createSignatureDeclaration(SyntaxKind.ConstructSignature, typeParameters, parameters, type) as ConstructSignatureDeclaration; } @@ -636,7 +633,7 @@ namespace ts { } /* @internal */ - export function createSignatureDeclaration(kind: SyntaxKind, typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined, typeArguments?: TypeNode[] | undefined) { + export function createSignatureDeclaration(kind: SyntaxKind, typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined, typeArguments?: ReadonlyArray | undefined) { const node = createSynthesizedNode(kind) as SignatureDeclaration; node.typeParameters = asNodeArray(typeParameters); node.parameters = asNodeArray(parameters); @@ -687,7 +684,7 @@ namespace ts { : node; } - export function createFunctionTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined) { + export function createFunctionTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined) { return createSignatureDeclaration(SyntaxKind.FunctionType, typeParameters, parameters, type) as FunctionTypeNode; } @@ -695,7 +692,7 @@ namespace ts { return updateSignatureDeclaration(node, typeParameters, parameters, type); } - export function createConstructorTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined) { + export function createConstructorTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined) { return createSignatureDeclaration(SyntaxKind.ConstructorType, typeParameters, parameters, type) as ConstructorTypeNode; } @@ -751,7 +748,7 @@ namespace ts { : node; } - export function createUnionTypeNode(types: TypeNode[]): UnionTypeNode { + export function createUnionTypeNode(types: ReadonlyArray): UnionTypeNode { return createUnionOrIntersectionTypeNode(SyntaxKind.UnionType, types); } @@ -759,7 +756,7 @@ namespace ts { return updateUnionOrIntersectionTypeNode(node, types); } - export function createIntersectionTypeNode(types: TypeNode[]): IntersectionTypeNode { + export function createIntersectionTypeNode(types: ReadonlyArray): IntersectionTypeNode { return createUnionOrIntersectionTypeNode(SyntaxKind.IntersectionType, types); } @@ -810,7 +807,7 @@ namespace ts { } export function createImportTypeNode(argument: TypeNode, qualifier?: EntityName, typeArguments?: ReadonlyArray, isTypeOf?: boolean) { - const node = createSynthesizedNode(SyntaxKind.ImportTypeNode); + const node = createSynthesizedNode(SyntaxKind.ImportType); node.argument = argument; node.qualifier = qualifier; node.typeArguments = asNodeArray(typeArguments); @@ -2572,9 +2569,9 @@ namespace ts { // Compound nodes - export function createImmediatelyInvokedFunctionExpression(statements: Statement[]): CallExpression; - export function createImmediatelyInvokedFunctionExpression(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; - export function createImmediatelyInvokedFunctionExpression(statements: Statement[], param?: ParameterDeclaration, paramValue?: Expression) { + export function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray): CallExpression; + export function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; + export function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray, param?: ParameterDeclaration, paramValue?: Expression) { return createCall( createFunctionExpression( /*modifiers*/ undefined, @@ -2590,9 +2587,9 @@ namespace ts { ); } - export function createImmediatelyInvokedArrowFunction(statements: Statement[]): CallExpression; - export function createImmediatelyInvokedArrowFunction(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; - export function createImmediatelyInvokedArrowFunction(statements: Statement[], param?: ParameterDeclaration, paramValue?: Expression) { + export function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray): CallExpression; + export function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; + export function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray, param?: ParameterDeclaration, paramValue?: Expression) { return createCall( createArrowFunction( /*modifiers*/ undefined, @@ -3093,7 +3090,7 @@ namespace ts { return createCall(createPropertyAccess(array, "slice"), /*typeArguments*/ undefined, argumentsList); } - export function createArrayConcat(array: Expression, values: Expression[]) { + export function createArrayConcat(array: Expression, values: ReadonlyArray) { return createCall( createPropertyAccess(array, "concat"), /*typeArguments*/ undefined, @@ -3145,7 +3142,7 @@ namespace ts { ); } - export function createExpressionForJsxElement(jsxFactoryEntity: EntityName, reactNamespace: string, tagName: Expression, props: Expression, children: Expression[], parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression { + export function createExpressionForJsxElement(jsxFactoryEntity: EntityName, reactNamespace: string, tagName: Expression, props: Expression, children: ReadonlyArray, parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression { const argumentsList = [tagName]; if (props) { argumentsList.push(props); @@ -3177,7 +3174,7 @@ namespace ts { ); } - export function createExpressionForJsxFragment(jsxFactoryEntity: EntityName, reactNamespace: string, children: Expression[], parentElement: JsxOpeningFragment, location: TextRange): LeftHandSideExpression { + export function createExpressionForJsxFragment(jsxFactoryEntity: EntityName, reactNamespace: string, children: ReadonlyArray, parentElement: JsxOpeningFragment, location: TextRange): LeftHandSideExpression { const tagName = createPropertyAccess( createReactNamespace(reactNamespace, parentElement), "Fragment" @@ -3288,7 +3285,7 @@ namespace ts { };` }; - export function createSpreadHelper(context: TransformationContext, argumentList: Expression[], location?: TextRange) { + export function createSpreadHelper(context: TransformationContext, argumentList: ReadonlyArray, location?: TextRange) { context.requestEmitHelper(readHelper); context.requestEmitHelper(spreadHelper); return setTextRange( @@ -3458,7 +3455,7 @@ namespace ts { return { target, thisArg }; } - export function inlineExpressions(expressions: Expression[]) { + export function inlineExpressions(expressions: ReadonlyArray) { // Avoid deeply nested comma expressions as traversing them during emit can result in "Maximum call // stack size exceeded" errors. return expressions.length > 10 diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index a203b2bfaba..0027687c643 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts { /* @internal */ export function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void; @@ -117,7 +114,8 @@ namespace ts { } } - function readJson(path: string, host: ModuleResolutionHost): PackageJson { + /* @internal */ + export function readJson(path: string, host: { readFile(fileName: string): string | undefined }): object { try { const jsonText = host.readFile(path); return jsonText ? JSON.parse(jsonText) : {}; @@ -300,7 +298,7 @@ namespace ts { // `types-publisher` sometimes creates packages with `"typings": null` for packages that don't provide their own types. // See `createNotNeededPackageJSON` in the types-publisher` repo. // tslint:disable-next-line:no-null-keyword - const isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null; + const isNotNeededPackage = host.fileExists(packageJsonPath) && (readJson(packageJsonPath, host) as PackageJson).typings === null; if (!isNotNeededPackage) { // Return just the type directive names result.push(getBaseFileName(normalized)); @@ -983,7 +981,7 @@ namespace ts { const directoryExists = !onlyRecordFailures && directoryProbablyExists(nodeModuleDirectory, host); const packageJsonPath = pathToPackageJson(nodeModuleDirectory); if (directoryExists && host.fileExists(packageJsonPath)) { - const packageJsonContent = readJson(packageJsonPath, host); + const packageJsonContent = readJson(packageJsonPath, host) as PackageJson; if (subModuleName === "") { // looking up the root - need to handle types/typings/main redirects for subModuleName const path = tryReadPackageJsonFields(/*readTypes*/ true, packageJsonContent, nodeModuleDirectory, state); if (typeof path === "string") { @@ -1034,7 +1032,7 @@ namespace ts { const onlyRecordFailures = !directoryProbablyExists(getDirectoryPath(file), state.host); const fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state); if (fromFile) { - const resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile); + const resolved = resolvedIfExtensionMatches(extensions, fromFile); if (resolved) { return resolved; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 3c118d943a2..74d54ed28fb 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts { const enum SignatureFlags { None = 0, @@ -189,7 +186,7 @@ namespace ts { visitNode(cbNode, (node).falseType); case SyntaxKind.InferType: return visitNode(cbNode, (node).typeParameter); - case SyntaxKind.ImportTypeNode: + case SyntaxKind.ImportType: return visitNode(cbNode, (node).argument) || visitNode(cbNode, (node).qualifier) || visitNodes(cbNode, cbNodes, (node).typeArguments); @@ -2744,7 +2741,7 @@ namespace ts { function parseImportType(): ImportTypeNode { sourceFile.flags |= NodeFlags.PossiblyContainsDynamicImport; - const node = createNode(SyntaxKind.ImportTypeNode) as ImportTypeNode; + const node = createNode(SyntaxKind.ImportType) as ImportTypeNode; if (parseOptional(SyntaxKind.TypeOfKeyword)) { node.isTypeOf = true; } @@ -6361,8 +6358,8 @@ namespace ts { case "arg": case "argument": case "param": - tag = parseParameterOrPropertyTag(atToken, tagName, PropertyLikeParse.Parameter); - break; + addTag(parseParameterOrPropertyTag(atToken, tagName, PropertyLikeParse.Parameter, indent)); + return; case "return": case "returns": tag = parseReturnTag(atToken, tagName); @@ -6511,7 +6508,7 @@ namespace ts { } } - function parseParameterOrPropertyTag(atToken: AtToken, tagName: Identifier, target: PropertyLikeParse): JSDocParameterTag | JSDocPropertyTag { + function parseParameterOrPropertyTag(atToken: AtToken, tagName: Identifier, target: PropertyLikeParse, indent: number | undefined): JSDocParameterTag | JSDocPropertyTag { let typeExpression = tryParseTypeExpression(); let isNameFirst = !typeExpression; skipWhitespace(); @@ -6526,6 +6523,8 @@ namespace ts { const result = target === PropertyLikeParse.Parameter ? createNode(SyntaxKind.JSDocParameterTag, atToken.pos) : createNode(SyntaxKind.JSDocPropertyTag, atToken.pos); + let comment: string | undefined; + if (indent !== undefined) comment = parseTagComments(indent + scanner.getStartPos() - atToken.pos); const nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; @@ -6537,6 +6536,7 @@ namespace ts { result.name = name; result.isNameFirst = isNameFirst; result.isBracketed = isBracketed; + result.comment = comment; return finishNode(result); } @@ -6783,7 +6783,7 @@ namespace ts { if (target !== t) { return false; } - const tag = parseParameterOrPropertyTag(atToken, tagName, target); + const tag = parseParameterOrPropertyTag(atToken, tagName, target, /*indent*/ undefined); tag.comment = parseTagComments(tag.end - tag.pos); return tag; } @@ -7600,7 +7600,7 @@ namespace ts { const tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im; const singleLinePragmaRegEx = /^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im; function extractPragmas(pragmas: PragmaPsuedoMapEntry[], range: CommentRange, text: string) { - const tripleSlash = tripleSlashXMLCommentStartRegEx.exec(text); + const tripleSlash = range.kind === SyntaxKind.SingleLineCommentTrivia && tripleSlashXMLCommentStartRegEx.exec(text); if (tripleSlash) { const name = tripleSlash[1].toLowerCase() as keyof PragmaPsuedoMap; // Technically unsafe cast, but we do it so the below check to make it safe typechecks const pragma = commentPragmas[name] as PragmaDefinition; @@ -7637,15 +7637,17 @@ namespace ts { return; } - const singleLine = singleLinePragmaRegEx.exec(text); + const singleLine = range.kind === SyntaxKind.SingleLineCommentTrivia && singleLinePragmaRegEx.exec(text); if (singleLine) { return addPragmaForMatch(pragmas, range, PragmaKindFlags.SingleLine, singleLine); } - const multiLinePragmaRegEx = /\s*@(\S+)\s*(.*)\s*$/gim; // Defined inline since it uses the "g" flag, which keeps a persistent index (for iterating) - let multiLineMatch: RegExpExecArray; - while (multiLineMatch = multiLinePragmaRegEx.exec(text)) { - addPragmaForMatch(pragmas, range, PragmaKindFlags.MultiLine, multiLineMatch); + if (range.kind === SyntaxKind.MultiLineCommentTrivia) { + const multiLinePragmaRegEx = /\s*@(\S+)\s*(.*)\s*$/gim; // Defined inline since it uses the "g" flag, which keeps a persistent index (for iterating) + let multiLineMatch: RegExpExecArray; + while (multiLineMatch = multiLinePragmaRegEx.exec(text)) { + addPragmaForMatch(pragmas, range, PragmaKindFlags.MultiLine, multiLineMatch); + } } } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 31220c68d3c..514397debc1 100755 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1,7 +1,3 @@ -/// -/// -/// - namespace ts { const ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/; @@ -577,7 +573,6 @@ namespace ts { const packageIdToSourceFile = createMap(); // Maps from a SourceFile's `.path` to the name of the package it was imported with. let sourceFileToPackageName = createMap(); - // See `sourceFileIsRedirectedTo`. let redirectTargetsSet = createMap(); const filesByName = createMap(); diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 0946948f43d..c2b96649cf2 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { /** This is the cache of module/typedirectives resolution that can be retained across program */ diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 25608d0c77c..f2a01d22c24 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts { export type ErrorCallback = (message: DiagnosticMessage, length: number) => void; @@ -696,8 +693,6 @@ namespace ts { // If we are not reducing and we have a truthy result, return it. return accumulator; } - - hasPendingCommentRange = false; } pendingPos = startPos; diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 2e81da35cfd..6251f1963fa 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts { export interface SourceMapWriter { diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 8c2612155e4..c37315a2e56 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,5 +1,3 @@ -/// - declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; declare function clearTimeout(handle: any): void; diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index c187176d069..8cadba453d8 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -1,18 +1,3 @@ -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// - /* @internal */ namespace ts { function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory { diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index e4d586feac7..67e4fa31cb2 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, file: SourceFile | undefined): Diagnostic[] { @@ -27,10 +23,12 @@ namespace ts { let needsDeclare = true; let isBundledEmit = false; let resultHasExternalModuleIndicator = false; + let needsScopeFixMarker = false; + let resultHasScopeMarker = false; let enclosingDeclaration: Node; let necessaryTypeRefernces: Map; - let possibleImports: AnyImportSyntax[]; - let importDeclarationMap: Map; + let lateMarkedStatements: LateVisibilityPaintedStatement[]; + let lateStatementReplacementMap: Map; let suppressNewDiagnosticContexts: boolean; const symbolTracker: SymbolTracker = { @@ -63,12 +61,12 @@ namespace ts { if (symbolAccessibilityResult.accessibility === SymbolAccessibility.Accessible) { // Add aliases back onto the possible imports list if they're not there so we can try them again with updated visibility info if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { - if (!possibleImports) { - possibleImports = symbolAccessibilityResult.aliasesToMakeVisible; + if (!lateMarkedStatements) { + lateMarkedStatements = symbolAccessibilityResult.aliasesToMakeVisible; } else { for (const ref of symbolAccessibilityResult.aliasesToMakeVisible) { - pushIfUnique(possibleImports, ref); + pushIfUnique(lateMarkedStatements, ref); } } } @@ -142,10 +140,12 @@ namespace ts { hasNoDefaultLib = hasNoDefaultLib || sourceFile.hasNoDefaultLib; currentSourceFile = sourceFile; enclosingDeclaration = sourceFile; - possibleImports = undefined; + lateMarkedStatements = undefined; suppressNewDiagnosticContexts = false; - importDeclarationMap = createMap(); + lateStatementReplacementMap = createMap(); getSymbolAccessibilityDiagnostic = throwDiagnostic; + needsScopeFixMarker = false; + resultHasScopeMarker = false; collectReferences(sourceFile, refs); if (isExternalModule(sourceFile)) { resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) @@ -161,7 +161,7 @@ namespace ts { } needsDeclare = true; const updated = visitNodes(sourceFile.statements, visitDeclarationStatements); - return updateSourceFileNode(sourceFile, updated, /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false); + return updateSourceFileNode(sourceFile, filterCandidateImports(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false); } )); bundle.syntheticFileReferences = []; @@ -175,14 +175,16 @@ namespace ts { // Single source file needsDeclare = true; + needsScopeFixMarker = false; + resultHasScopeMarker = false; enclosingDeclaration = node; currentSourceFile = node; getSymbolAccessibilityDiagnostic = throwDiagnostic; isBundledEmit = false; resultHasExternalModuleIndicator = false; suppressNewDiagnosticContexts = false; - possibleImports = undefined; - importDeclarationMap = createMap(); + lateMarkedStatements = undefined; + lateStatementReplacementMap = createMap(); necessaryTypeRefernces = undefined; const refs = collectReferences(currentSourceFile, createMap()); const references: FileReference[] = []; @@ -192,7 +194,7 @@ namespace ts { const statements = visitNodes(node.statements, visitDeclarationStatements); let combinedStatements = setTextRange(createNodeArray(filterCandidateImports(statements)), node.statements); const emittedImports = filter(combinedStatements, isAnyImportSyntax); - if (isExternalModule(node) && !resultHasExternalModuleIndicator) { + if (isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) { combinedStatements = setTextRange(createNodeArray([...combinedStatements, createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([]), /*moduleSpecifier*/ undefined)]), combinedStatements); } const updated = updateSourceFileNode(node, combinedStatements, /*isDeclarationFile*/ true, references, getFileReferencesForUsedTypeReferences(), node.hasNoDefaultLib); @@ -452,7 +454,7 @@ namespace ts { function rewriteModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration | ImportTypeNode, input: T): T | StringLiteral { if (!input) return; - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== SyntaxKind.ModuleDeclaration && parent.kind !== SyntaxKind.ImportTypeNode); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== SyntaxKind.ModuleDeclaration && parent.kind !== SyntaxKind.ImportType); if (input.kind === SyntaxKind.StringLiteral && isBundledEmit) { const newName = getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); if (newName) { @@ -532,7 +534,7 @@ namespace ts { // Nothing visible } - function filterCandidateImports(statements: ReadonlyArray): ReadonlyArray { + function filterCandidateImports(statements: NodeArray): NodeArray { // This is a `while` loop because `handleSymbolAccessibilityError` can see additional import aliases marked as visible during // error handling which must now be included in the output and themselves checked for errors. // For example: @@ -547,45 +549,63 @@ namespace ts { // In such a scenario, only Q and D are initially visible, but we don't consider imports as private names - instead we say they if they are referenced they must // be recorded. So while checking D's visibility we mark C as visible, then we must check C which in turn marks B, completing the chain of // dependent imports and allowing a valid declaration file output. Today, this dependent alias marking only happens for internal import aliases. - const unconsideredImports: AnyImportSyntax[] = []; - while (length(possibleImports)) { - const i = possibleImports.shift(); + const unconsideredStatements: LateVisibilityPaintedStatement[] = []; + while (length(lateMarkedStatements)) { + const i = lateMarkedStatements.shift(); if ((isSourceFile(i.parent) ? i.parent : i.parent.parent) !== enclosingDeclaration) { // Filter to only declarations in the current scope - unconsideredImports.push(i); + unconsideredStatements.push(i); continue; } - // Eagerly transform import equals - if they're not visible, we'll get nothing, if they are, we'll immediately add them since it's complete - if (i.kind === SyntaxKind.ImportEqualsDeclaration) { - const result = transformImportEqualsDeclaration(i); - importDeclarationMap.set("" + getNodeId(i), result); - continue; + if (!isLateVisibilityPaintedStatement(i)) { + return Debug.fail(`Late replaced statement was foudn which is not handled by the declaration transformer!: ${(ts as any).SyntaxKind ? (ts as any).SyntaxKind[(i as any).kind] : (i as any).kind}`); + } + switch (i.kind) { + case SyntaxKind.ImportEqualsDeclaration: { + const result = transformImportEqualsDeclaration(i); + lateStatementReplacementMap.set("" + getNodeId(i), result); + break; + } + case SyntaxKind.ImportDeclaration: { + const result = transformImportDeclaration(i); + lateStatementReplacementMap.set("" + getNodeId(i), result); + break; + } + case SyntaxKind.VariableStatement: { + const result = transformVariableStatement(i, /*privateDeclaration*/ true); // Transform the statement (potentially again, possibly revealing more sub-nodes) + lateStatementReplacementMap.set("" + getNodeId(i), result); + break; + } + default: Debug.assertNever(i, "Unhandled late painted statement!"); } - // Import declarations, on the other hand, can be partially painted by multiple aliases; so we can see many indeterminate states - // until we've marked all possible visibility - const result = transformImportDeclaration(i); - importDeclarationMap.set("" + getNodeId(i), result); } // Filtering available imports is the last thing done within a scope, so the possible set becomes those which could not // be considered in the child scope - possibleImports = unconsideredImports; + lateMarkedStatements = unconsideredStatements; + // And lastly, we need to get the final form of all those indetermine import declarations from before and add them to the output list // (and remove them from the set to examine for outter declarations) - return mapDefined(statements, statement => { - if (isImportDeclaration(statement) || isImportEqualsDeclaration(statement)) { - const key = "" + getNodeId(statement); - if (importDeclarationMap.has(key)) { - const result = importDeclarationMap.get(key); - importDeclarationMap.delete(key); - return result; - } - else { - return undefined; + return visitNodes(statements, visitLateVisibilityMarkedStatements); + } + + function visitLateVisibilityMarkedStatements(statement: Statement) { + if (isLateVisibilityPaintedStatement(statement)) { + const key = "" + getNodeId(statement); + if (lateStatementReplacementMap.has(key)) { + const result = lateStatementReplacementMap.get(key); + lateStatementReplacementMap.delete(key); + if (result && isSourceFile(statement.parent) && !isAnyImportOrReExport(result) && !isExportAssignment(result) && !hasModifier(result, ModifierFlags.Export)) { + // Top-level declarations in .d.ts files are always considered exported even without a modifier unless there's an export assignment or specifier + needsScopeFixMarker = true; } + return result; } else { - return statement; + return getParseTreeNode(statement) ? undefined : statement; } - }); + } + else { + return statement; + } } function visitDeclarationSubtree(input: Node): VisitResult { @@ -765,7 +785,7 @@ namespace ts { case SyntaxKind.ConstructorType: { return cleanup(updateConstructorTypeNode(input, visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), visitNode(input.type, visitDeclarationSubtree))); } - case SyntaxKind.ImportTypeNode: { + case SyntaxKind.ImportType: { if (!isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(updateImportTypeNode( input, @@ -816,6 +836,7 @@ namespace ts { case SyntaxKind.ExportDeclaration: { if (isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; + resultHasScopeMarker = true; } // Always visible if the parent node isn't dropped for being not visible // Rewrite external module names if necessary @@ -825,6 +846,7 @@ namespace ts { // Always visible if the parent node isn't dropped for being not visible if (isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; + resultHasScopeMarker = true; } if (input.expression.kind === SyntaxKind.Identifier) { return input; @@ -844,8 +866,8 @@ namespace ts { case SyntaxKind.ImportDeclaration: { // Different parts of the import may be marked visible at different times (via visibility checking), so we defer our first look until later // to reduce the likelihood we need to rewrite it - possibleImports = possibleImports || []; - pushIfUnique(possibleImports, input); + lateMarkedStatements = lateMarkedStatements || []; + pushIfUnique(lateMarkedStatements, input); return input; } } @@ -866,7 +888,7 @@ namespace ts { if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(input as DeclarationDiagnosticProducing); } - let oldPossibleImports: typeof possibleImports; + let oldPossibleImports: typeof lateMarkedStatements; switch (input.kind) { case SyntaxKind.TypeAliasDeclaration: // Type aliases get `declare`d if need be (for legacy support), but that's all @@ -906,8 +928,8 @@ namespace ts { case SyntaxKind.ModuleDeclaration: { previousNeedsDeclare = needsDeclare; needsDeclare = false; - oldPossibleImports = possibleImports; - possibleImports = undefined; + oldPossibleImports = lateMarkedStatements; + lateMarkedStatements = undefined; const inner = input.body; if (inner && inner.kind === SyntaxKind.ModuleBlock) { const statements = visitNodes(inner.statements, visitDeclarationStatements); @@ -1029,10 +1051,9 @@ namespace ts { } } case SyntaxKind.VariableStatement: { - if (!forEach(input.declarationList.declarations, getBindingNameVisible)) return; - const nodes = visitNodes(input.declarationList.declarations, visitDeclarationSubtree); - if (!length(nodes)) return; - return cleanup(updateVariableStatement(input, createNodeArray(ensureModifiers(input)), updateVariableDeclarationList(input.declarationList, nodes))); + const result = transformVariableStatement(input); + lateStatementReplacementMap.set("" + getNodeId(input), result); // Don't actually elide yet; just leave as original node - will be elided/swapped by late pass + return cleanup(input); } case SyntaxKind.EnumDeclaration: { return cleanup(updateEnumDeclaration(input, /*decorators*/ undefined, createNodeArray(ensureModifiers(input)), input.name, createNodeArray(mapDefined(input.members, m => { @@ -1053,12 +1074,12 @@ namespace ts { } if (input.kind === SyntaxKind.ModuleDeclaration) { needsDeclare = previousNeedsDeclare; - possibleImports = concatenate(oldPossibleImports, possibleImports); + lateMarkedStatements = concatenate(oldPossibleImports, lateMarkedStatements); } if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (returnValue) { + if (returnValue && (!isLateVisibilityPaintedStatement(input) || lateStatementReplacementMap.get("" + getNodeId(input)))) { if (!resultHasExternalModuleIndicator && hasModifier(input, ModifierFlags.Export) && isSourceFile(input.parent)) { // Exported top-level member indicates moduleness resultHasExternalModuleIndicator = true; @@ -1071,6 +1092,13 @@ namespace ts { } } + function transformVariableStatement(input: VariableStatement, privateDeclaration?: boolean) { + if (!forEach(input.declarationList.declarations, getBindingNameVisible)) return; + const nodes = visitNodes(input.declarationList.declarations, visitDeclarationSubtree); + if (!length(nodes)) return; + return updateVariableStatement(input, createNodeArray(ensureModifiers(input, privateDeclaration)), updateVariableDeclarationList(input.declarationList, nodes)); + } + function recreateBindingPattern(d: BindingPattern): VariableDeclaration[] { return flatten(mapDefined(d.elements, e => recreateBindingElement(e))); } @@ -1122,21 +1150,21 @@ namespace ts { return false; } - function ensureModifiers(node: Node): ReadonlyArray { + function ensureModifiers(node: Node, privateDeclaration?: boolean): ReadonlyArray { const currentFlags = getModifierFlags(node); - const newFlags = ensureModifierFlags(node); + const newFlags = ensureModifierFlags(node, privateDeclaration); if (currentFlags === newFlags) { return node.modifiers; } return createModifiersFromModifierFlags(newFlags); } - function ensureModifierFlags(node: Node): ModifierFlags { + function ensureModifierFlags(node: Node, privateDeclaration?: boolean): ModifierFlags { let mask = ModifierFlags.All ^ (ModifierFlags.Public | ModifierFlags.Async); // No async modifiers in declaration files let additions = (needsDeclare && !isAlwaysType(node)) ? ModifierFlags.Ambient : ModifierFlags.None; const parentIsFile = node.parent.kind === SyntaxKind.SourceFile; if (!parentIsFile || (isBundledEmit && parentIsFile && isExternalModule(node.parent as SourceFile))) { - mask ^= ((isBundledEmit && parentIsFile ? 0 : ModifierFlags.Export) | ModifierFlags.Default | ModifierFlags.Ambient); + mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) ? 0 : ModifierFlags.Export) | ModifierFlags.Default | ModifierFlags.Ambient); additions = ModifierFlags.None; } return maskModifierFlags(node, mask, additions); @@ -1296,7 +1324,7 @@ namespace ts { case SyntaxKind.ConditionalType: case SyntaxKind.FunctionType: case SyntaxKind.ConstructorType: - case SyntaxKind.ImportTypeNode: + case SyntaxKind.ImportType: return true; } return false; diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index bafe43b0b15..35101d3be7f 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -1,6 +1,3 @@ -/// -/// - /*@internal*/ namespace ts { interface FlattenContext { diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 72068688f9d..0a607494bb5 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { const enum ES2015SubstitutionFlags { diff --git a/src/compiler/transformers/es2016.ts b/src/compiler/transformers/es2016.ts index a9468991776..22b2f11b612 100644 --- a/src/compiler/transformers/es2016.ts +++ b/src/compiler/transformers/es2016.ts @@ -1,6 +1,3 @@ -/// -/// - /*@internal*/ namespace ts { export function transformES2016(context: TransformationContext) { diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index f2a5aeb35d2..6689f83ed5b 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -1,6 +1,3 @@ -/// -/// - /*@internal*/ namespace ts { type SuperContainer = ClassDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration; diff --git a/src/compiler/transformers/es5.ts b/src/compiler/transformers/es5.ts index bc6ee13520f..92ecce6a15c 100644 --- a/src/compiler/transformers/es5.ts +++ b/src/compiler/transformers/es5.ts @@ -1,6 +1,3 @@ -/// -/// - /*@internal*/ namespace ts { /** diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index b9a73ea97c0..68861a5bb43 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { const enum ESNextSubstitutionFlags { @@ -304,6 +300,11 @@ namespace ts { bodyLocation = node.statement; statementsLocation = node.statement.statements; } + else if (node.statement) { + append(statements, node.statement); + bodyLocation = node.statement; + statementsLocation = node.statement; + } return updateForOf( node, node.awaitModifier, diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 82d8bc513f0..15f0d2d0f81 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -1,6 +1,3 @@ -/// -/// - // Transforms generator functions into a compatible ES5 representation with similar runtime // semantics. This is accomplished by first transforming the body of each generator // function into an intermediate representation that is the compiled into a JavaScript diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 07dc8f74db4..4acdf63b275 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { export function transformJsx(context: TransformationContext) { diff --git a/src/compiler/transformers/module/es2015.ts b/src/compiler/transformers/module/es2015.ts index 4f218e4fdcf..a3315852632 100644 --- a/src/compiler/transformers/module/es2015.ts +++ b/src/compiler/transformers/module/es2015.ts @@ -1,6 +1,3 @@ -/// -/// - /*@internal*/ namespace ts { export function transformES2015Module(context: TransformationContext) { diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 45d13357123..f9fb47f6a27 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { export function transformModule(context: TransformationContext) { diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index ca55cb3a9d1..5cde69e2ef6 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { export function transformSystemModule(context: TransformationContext) { diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index f22d8f02870..6cb4be16c74 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { /** diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 09b64701988..f16ca98c93d 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -1,7 +1,3 @@ -/// -/// -/// - namespace ts { interface Statistic { name: string; @@ -22,7 +18,7 @@ namespace ts { } let reportDiagnostic = createDiagnosticReporter(sys); - function udpateReportDiagnostic(options: CompilerOptions) { + function updateReportDiagnostic(options: CompilerOptions) { if (options.pretty) { reportDiagnostic = createDiagnosticReporter(sys, /*pretty*/ true); } @@ -111,7 +107,7 @@ namespace ts { const commandLineOptions = commandLine.options; if (configFileName) { const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic); - udpateReportDiagnostic(configParseResult.options); + updateReportDiagnostic(configParseResult.options); if (isWatchSet(configParseResult.options)) { reportWatchModeWithoutSysSupport(); createWatchOfConfigFile(configParseResult, commandLineOptions); @@ -121,7 +117,7 @@ namespace ts { } } else { - udpateReportDiagnostic(commandLineOptions); + updateReportDiagnostic(commandLineOptions); if (isWatchSet(commandLineOptions)) { reportWatchModeWithoutSysSupport(); createWatchOfFilesAndCompilerOptions(commandLine.fileNames, commandLineOptions); diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index 58626f2cdc1..46e5384434a 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -6,36 +6,38 @@ "declaration": true }, "files": [ - "core.ts", - "performance.ts", - "sys.ts", "types.ts", + "performance.ts", + "core.ts", + "sys.ts", + "diagnosticInformationMap.generated.ts", "scanner.ts", - "parser.ts", "utilities.ts", + "parser.ts", "binder.ts", "symbolWalker.ts", + "moduleNameResolver.ts", "checker.ts", "factory.ts", "visitor.ts", "transformers/utilities.ts", + "transformers/destructuring.ts", "transformers/ts.ts", - "transformers/jsx.ts", - "transformers/esnext.ts", "transformers/es2017.ts", + "transformers/esnext.ts", + "transformers/jsx.ts", "transformers/es2016.ts", "transformers/es2015.ts", "transformers/es5.ts", "transformers/generators.ts", - "transformers/destructuring.ts", "transformers/module/module.ts", "transformers/module/system.ts", "transformers/module/es2015.ts", "transformers/declarations/diagnostics.ts", "transformers/declarations.ts", "transformer.ts", - "comments.ts", "sourcemap.ts", + "comments.ts", "emitter.ts", "watchUtilities.ts", "program.ts", @@ -44,7 +46,6 @@ "resolutionCache.ts", "watch.ts", "commandLineParser.ts", - "tsc.ts", - "diagnosticInformationMap.generated.ts" + "tsc.ts" ] } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2e6ac6f3190..894c8d3c8e2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -284,7 +284,7 @@ namespace ts { IndexedAccessType, MappedType, LiteralType, - ImportTypeNode, + ImportType, // Binding patterns ObjectBindingPattern, ArrayBindingPattern, @@ -446,7 +446,7 @@ namespace ts { FirstFutureReservedWord = ImplementsKeyword, LastFutureReservedWord = YieldKeyword, FirstTypeNode = TypePredicate, - LastTypeNode = ImportTypeNode, + LastTypeNode = ImportType, FirstPunctuation = OpenBraceToken, LastPunctuation = CaretEqualsToken, FirstToken = Unknown, @@ -879,6 +879,7 @@ namespace ts { export interface PropertyDeclaration extends ClassElement, JSDocContainer { kind: SyntaxKind.PropertyDeclaration; + parent: ClassLikeDeclaration; name: PropertyName; questionToken?: QuestionToken; // Present for use with reporting a grammar error exclamationToken?: ExclamationToken; @@ -1069,7 +1070,7 @@ namespace ts { } export interface ImportTypeNode extends NodeWithTypeArguments { - kind: SyntaxKind.ImportTypeNode; + kind: SyntaxKind.ImportType; isTypeOf?: boolean; argument: TypeNode; qualifier?: EntityName; @@ -2527,7 +2528,7 @@ namespace ts { /** * If two source files are for the same version of the same package, one will redirect to the other. * (See `createRedirectSourceFile` in program.ts.) - * The redirect will have this set. The other will not have anything set, but see Program#sourceFileIsRedirectedTo. + * The redirect will have this set. The redirected-to source file will be in `redirectTargetsSet`. */ /* @internal */ redirectInfo?: RedirectInfo | undefined; @@ -2839,6 +2840,10 @@ namespace ts { getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol | undefined; getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; + /** + * The function returns the value (local variable) symbol of an identifier in the short-hand property assignment. + * This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value. + */ getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined; getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol | undefined; /** @@ -2890,9 +2895,9 @@ namespace ts { /* @internal */ getMergedSymbol(symbol: Symbol): Symbol; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; - isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean; /** Exclude accesses to private properties or methods with a `this` parameter that `type` doesn't satisfy. */ - /* @internal */ isValidPropertyAccessForCompletions(node: PropertyAccessExpression, type: Type, property: Symbol): boolean; + /* @internal */ isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode, type: Type, property: Symbol): boolean; /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; /** Follow a *single* alias to get the immediately aliased symbol. */ @@ -3193,10 +3198,13 @@ namespace ts { /* @internal */ export type RequireOrImportCall = CallExpression & { arguments: [StringLiteralLike] }; + /* @internal */ + export type LateVisibilityPaintedStatement = AnyImportSyntax | VariableStatement; + /* @internal */ export interface SymbolVisibilityResult { accessibility: SymbolAccessibility; - aliasesToMakeVisible?: AnyImportSyntax[]; // aliases that need to have this symbol visible + aliasesToMakeVisible?: LateVisibilityPaintedStatement[]; // aliases that need to have this symbol visible errorSymbolName?: string; // Optional symbol name that results in error errorNode?: Node; // optional node that results in error } @@ -3753,6 +3761,8 @@ namespace ts { /* @internal */ resolvedIndexType: IndexType; /* @internal */ + resolvedDeclaredIndexType: IndexType; + /* @internal */ resolvedBaseConstraint: Type; /* @internal */ couldContainTypeVariables: boolean; @@ -3839,6 +3849,8 @@ namespace ts { resolvedBaseConstraint?: Type; /* @internal */ resolvedIndexType?: IndexType; + /* @internal */ + resolvedDeclaredIndexType?: IndexType; } // Type parameters (TypeFlags.TypeParameter) @@ -3870,6 +3882,8 @@ namespace ts { // keyof T types (TypeFlags.Index) export interface IndexType extends InstantiableType { + /* @internal */ + isDeclaredType?: boolean; type: InstantiableType | UnionOrIntersectionType; } @@ -3962,7 +3976,7 @@ namespace ts { export interface IndexInfo { type: Type; isReadonly: boolean; - declaration?: SignatureDeclaration; + declaration?: IndexSignatureDeclaration; } /* @internal */ @@ -4063,6 +4077,7 @@ namespace ts { category: DiagnosticCategory; code: number; message: string; + reportsUnnecessary?: {}; } /** @@ -4084,6 +4099,8 @@ namespace ts { length: number | undefined; messageText: string | DiagnosticMessageChain; category: DiagnosticCategory; + /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ + reportsUnnecessary?: {}; code: number; source?: string; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index b8737960f47..f975e27dca3 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts { export const resolvingEmptyArray: never[] = [] as never[]; @@ -546,6 +544,17 @@ namespace ts { } } + export function isLateVisibilityPaintedStatement(node: Node): node is LateVisibilityPaintedStatement { + switch (node.kind) { + case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.VariableStatement: + return true; + default: + return false; + } + } + export function isAnyImportOrReExport(node: Node): node is AnyImportOrReExport { return isAnyImportSyntax(node) || isExportDeclaration(node); } @@ -735,7 +744,7 @@ namespace ts { } export function isLiteralImportTypeNode(n: Node): n is LiteralImportTypeNode { - return n.kind === SyntaxKind.ImportTypeNode && + return n.kind === SyntaxKind.ImportType && (n as ImportTypeNode).argument.kind === SyntaxKind.LiteralType && isStringLiteral(((n as ImportTypeNode).argument as LiteralTypeNode).literal); } @@ -811,6 +820,9 @@ namespace ts { if (parent.kind === SyntaxKind.TypeQuery) { return false; } + if (parent.kind === SyntaxKind.ImportType) { + return !(parent as ImportTypeNode).isTypeOf; + } // Do not recursively call isPartOfTypeNode on the parent. In the example: // // let a: A.B.C; @@ -1710,7 +1722,7 @@ namespace ts { return node.moduleSpecifier; case SyntaxKind.ImportEqualsDeclaration: return node.moduleReference.kind === SyntaxKind.ExternalModuleReference ? node.moduleReference.expression : undefined; - case SyntaxKind.ImportTypeNode: + case SyntaxKind.ImportType: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; default: return Debug.assertNever(node); @@ -1807,7 +1819,6 @@ namespace ts { if (parent && (parent.kind === SyntaxKind.PropertyAssignment || parent.kind === SyntaxKind.PropertyDeclaration || - isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== SpecialPropertyAssignmentKind.None || getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } @@ -1826,6 +1837,7 @@ namespace ts { getJSDocCommentsAndTagsWorker(parent.parent.parent); } if (isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== SpecialPropertyAssignmentKind.None || + parent && isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== SpecialPropertyAssignmentKind.None || node.kind === SyntaxKind.PropertyAccessExpression && node.parent && node.parent.kind === SyntaxKind.ExpressionStatement) { getJSDocCommentsAndTagsWorker(parent); } @@ -3025,6 +3037,10 @@ namespace ts { return (node as HasType).type || (isInJavaScriptFile(node) ? getJSDocType(node) : undefined); } + export function getTypeAnnotationNode(node: Node): TypeNode | undefined { + return (node as HasType).type; + } + /** * Gets the effective return type annotation of a signature. If the node was parsed in a * JavaScript file, gets the return type annotation from JSDoc. @@ -4259,8 +4275,9 @@ namespace ts { } } - export function isParameterPropertyDeclaration(node: Node): boolean { - return hasModifier(node, ModifierFlags.ParameterPropertyModifier) && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent); + export type ParameterPropertyDeclaration = ParameterDeclaration & { parent: ConstructorDeclaration, name: Identifier }; + export function isParameterPropertyDeclaration(node: Node): node is ParameterPropertyDeclaration { + return hasModifier(node, ModifierFlags.ParameterPropertyModifier) && node.parent.kind === SyntaxKind.Constructor; } export function isEmptyBindingPattern(node: BindingName): node is BindingPattern { @@ -4549,6 +4566,12 @@ namespace ts { return undefined; } switch (declaration.kind) { + case SyntaxKind.ClassExpression: + case SyntaxKind.FunctionExpression: + if (!(declaration as ClassExpression | FunctionExpression).name) { + return getAssignedName(declaration); + } + break; case SyntaxKind.Identifier: return declaration as Identifier; case SyntaxKind.JSDocPropertyTag: @@ -4581,6 +4604,23 @@ namespace ts { return (declaration as NamedDeclaration).name; } + function getAssignedName(node: Node): DeclarationName { + if (!node.parent) { + return undefined; + } + else if (isPropertyAssignment(node.parent) || isBindingElement(node.parent)) { + return node.parent.name; + } + else if (isBinaryExpression(node.parent) && node === node.parent.right) { + if (isIdentifier(node.parent.left)) { + return node.parent.left; + } + else if (isPropertyAccessExpression(node.parent.left)) { + return node.parent.left.name; + } + } + } + /** * Gets the JSDoc parameter tags for the node if present. * @@ -4595,11 +4635,21 @@ namespace ts { * parameters by name and binding patterns do not have a name. */ export function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray { - if (param.name && isIdentifier(param.name)) { - const name = param.name.escapedText; - return getJSDocTags(param.parent).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name); + if (param.name) { + if (isIdentifier(param.name)) { + const name = param.name.escapedText; + return getJSDocTags(param.parent).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name); + } + else { + const i = param.parent.parameters.indexOf(param); + Debug.assert(i > -1, "Parameters should always be in their parents' parameter list"); + const paramTags = getJSDocTags(param.parent).filter(isJSDocParameterTag); + if (i < paramTags.length) { + return [paramTags[i]]; + } + } } - // a binding pattern doesn't have a name, so it's not possible to match it a JSDoc parameter, which is identified by name + // return empty array for: out-of-order binding patterns and JSDoc function syntax, which has un-named parameters return emptyArray; } @@ -5592,6 +5642,10 @@ namespace ts { || kind === SyntaxKind.MissingDeclaration; } + export function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement { + return isTypeElement(node) || isClassElement(node); + } + export function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike { const kind = node.kind; return kind === SyntaxKind.PropertyAssignment @@ -5728,6 +5782,14 @@ namespace ts { return false; } + /* @internal */ + export function isPropertyAccessOrQualifiedNameOrImportTypeNode(node: Node): node is PropertyAccessExpression | QualifiedName | ImportTypeNode { + const kind = node.kind; + return kind === SyntaxKind.PropertyAccessExpression + || kind === SyntaxKind.QualifiedName + || kind === SyntaxKind.ImportType; + } + // Expression export function isPropertyAccessOrQualifiedName(node: Node): node is PropertyAccessExpression | QualifiedName { @@ -6266,4 +6328,9 @@ namespace ts { export function isStringLiteralLike(node: Node): node is StringLiteralLike { return node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NoSubstitutionTemplateLiteral; } + + /** @internal */ + export function isNamedImportsOrExports(node: Node): node is NamedImportsOrExports { + return node.kind === SyntaxKind.NamedImports || node.kind === SyntaxKind.NamedExports; + } } diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index 1d098d60eba..7a70eb02e8e 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -1,7 +1,3 @@ -/// -/// -/// - namespace ts { const isTypeNodeOrTypeParameterDeclaration = or(isTypeNode, isTypeParameterDeclaration); @@ -398,7 +394,7 @@ namespace ts { return updateInferTypeNode(node, visitNode((node).typeParameter, visitor, isTypeParameterDeclaration)); - case SyntaxKind.ImportTypeNode: + case SyntaxKind.ImportType: return updateImportTypeNode(node, visitNode((node).argument, visitor, isTypeNode), visitNode((node).qualifier, visitor, isEntityName), diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index ed5276e49a4..7f3d078b790 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { const sysFormatDiagnosticsHost: FormatDiagnosticsHost = sys ? { @@ -31,12 +27,19 @@ namespace ts { }; } + /** @internal */ + export const nonClearingMessageCodes: number[] = [ + Diagnostics.Compilation_complete_Watching_for_file_changes.code, + Diagnostics.Found_1_error.code, + Diagnostics.Found_0_errors.code + ]; + function clearScreenIfNotWatchingForFileChanges(system: System, diagnostic: Diagnostic, options: CompilerOptions) { if (system.clearScreen && !options.preserveWatchOutput && - diagnostic.code !== Diagnostics.Compilation_complete_Watching_for_file_changes.code && !options.extendedDiagnostics && - !options.diagnostics) { + !options.diagnostics && + !contains(nonClearingMessageCodes, diagnostic.code)) { system.clearScreen(); } } @@ -115,10 +118,12 @@ namespace ts { emit(): EmitResult; } + export type ReportEmitErrorSummary = (errorCount: number) => void; + /** * Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options */ - export function emitFilesAndReportErrors(program: ProgramToEmitFilesAndReportErrors, reportDiagnostic: DiagnosticReporter, writeFileName?: (s: string) => void) { + export function emitFilesAndReportErrors(program: ProgramToEmitFilesAndReportErrors, reportDiagnostic: DiagnosticReporter, writeFileName?: (s: string) => void, reportSummary?: ReportEmitErrorSummary) { // First get and report any syntactic errors. const diagnostics = program.getConfigFileParsingDiagnostics().slice(); const configFileParsingDiagnosticsLength = diagnostics.length; @@ -159,6 +164,10 @@ namespace ts { } } + if (reportSummary) { + reportSummary(diagnostics.filter(diagnostic => diagnostic.category === DiagnosticCategory.Error).length); + } + if (emitSkipped && diagnostics.length > 0) { // If the emitter didn't emit anything, then pass that value along. return ExitStatus.DiagnosticsPresent_OutputsSkipped; @@ -184,6 +193,7 @@ namespace ts { let host: DirectoryStructureHost = system; const useCaseSensitiveFileNames = () => system.useCaseSensitiveFileNames; const writeFileName = (s: string) => system.write(s + system.newLine); + const onWatchStatusChange = reportWatchStatus || createWatchStatusReporter(system); return { useCaseSensitiveFileNames, getNewLine: () => system.newLine, @@ -202,7 +212,7 @@ namespace ts { setTimeout: system.setTimeout ? ((callback, ms, ...args: any[]) => system.setTimeout.call(system, callback, ms, ...args)) : noop, clearTimeout: system.clearTimeout ? (timeoutId => system.clearTimeout(timeoutId)) : noop, trace: s => system.write(s), - onWatchStatusChange: reportWatchStatus || createWatchStatusReporter(system), + onWatchStatusChange, createDirectory: path => system.createDirectory(path), writeFile: (path, data, writeByteOrderMark) => system.writeFile(path, data, writeByteOrderMark), onCachedDirectoryStructureHostCreate: cacheHost => host = cacheHost || system, @@ -216,7 +226,19 @@ namespace ts { } function emitFilesAndReportErrorUsingBuilder(builderProgram: BuilderProgram) { - emitFilesAndReportErrors(builderProgram, reportDiagnostic, writeFileName); + const compilerOptions = builderProgram.getCompilerOptions(); + const newLine = getNewLineCharacter(compilerOptions, () => system.newLine); + + const reportSummary = (errorCount: number) => { + if (errorCount === 1) { + onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_1_error, errorCount), newLine, compilerOptions); + } + else { + onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_0_errors, errorCount, errorCount), newLine, compilerOptions); + } + }; + + emitFilesAndReportErrors(builderProgram, reportDiagnostic, writeFileName, reportSummary); } } diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index 12ed9f855df..4fa9b28e162 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts { /** diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 270b3d15d2d..b479b5596a8 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1081,8 +1081,20 @@ namespace FourSlash { } } + private verifyDocumentHighlightsRespectFilesList(files: ReadonlyArray): void { + const startFile = this.activeFile.fileName; + for (const fileName of files) { + const searchFileNames = startFile === fileName ? [startFile] : [startFile, fileName]; + const highlights = this.getDocumentHighlightsAtCurrentPosition(searchFileNames); + if (!highlights.every(dh => ts.contains(searchFileNames, dh.fileName))) { + this.raiseError(`When asking for document highlights only in files ${searchFileNames}, got document highlights in ${unique(highlights, dh => dh.fileName)}`); + } + } + } + public verifyReferencesOf(range: Range, references: Range[]) { this.goToRangeStart(range); + this.verifyDocumentHighlightsRespectFilesList(unique(references, e => e.fileName)); this.verifyReferencesAre(references); } @@ -1094,7 +1106,7 @@ namespace FourSlash { } } - public verifyReferenceGroups(starts: string | string[] | Range | Range[], parts: FourSlashInterface.ReferenceGroup[]): void { + public verifyReferenceGroups(starts: string | string[] | Range | Range[], parts: FourSlashInterface.ReferenceGroup[] | undefined): void { interface ReferenceGroupJson { definition: string | { text: string, range: ts.TextSpan }; references: ts.ReferenceEntry[]; @@ -1128,6 +1140,10 @@ namespace FourSlash { }; }); this.assertObjectsEqual(fullActual, fullExpected); + + if (parts) { + this.verifyDocumentHighlightsRespectFilesList(unique(ts.flatMap(parts, p => p.ranges), r => r.fileName)); + } } } @@ -2577,7 +2593,7 @@ Actual: ${stringify(fullActual)}`); } const range = ts.first(ranges); - const codeFixes = this.getCodeFixes(fileName, errorCode, preferences); + const codeFixes = this.getCodeFixes(fileName, errorCode, preferences).filter(f => f.fixId === undefined); // TODO: GH#20315 filter out those that use the import fix ID; if (codeFixes.length === 0) { if (expectedTextArray.length !== 0) { diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index c9521979776..3ad653403cf 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -13,130 +13,145 @@ ] }, "files": [ - "../compiler/core.ts", - "../compiler/performance.ts", - "../compiler/sys.ts", "../compiler/types.ts", + "../compiler/performance.ts", + "../compiler/core.ts", + "../compiler/sys.ts", + "../compiler/diagnosticInformationMap.generated.ts", "../compiler/scanner.ts", - "../compiler/parser.ts", "../compiler/utilities.ts", + "../compiler/parser.ts", "../compiler/binder.ts", "../compiler/symbolWalker.ts", + "../compiler/moduleNameResolver.ts", "../compiler/checker.ts", "../compiler/factory.ts", "../compiler/visitor.ts", "../compiler/transformers/utilities.ts", + "../compiler/transformers/destructuring.ts", "../compiler/transformers/ts.ts", - "../compiler/transformers/jsx.ts", - "../compiler/transformers/esnext.ts", "../compiler/transformers/es2017.ts", + "../compiler/transformers/esnext.ts", + "../compiler/transformers/jsx.ts", "../compiler/transformers/es2016.ts", "../compiler/transformers/es2015.ts", "../compiler/transformers/es5.ts", "../compiler/transformers/generators.ts", - "../compiler/transformers/es5.ts", - "../compiler/transformers/destructuring.ts", "../compiler/transformers/module/module.ts", "../compiler/transformers/module/system.ts", "../compiler/transformers/module/es2015.ts", "../compiler/transformers/declarations/diagnostics.ts", "../compiler/transformers/declarations.ts", "../compiler/transformer.ts", - "../compiler/comments.ts", "../compiler/sourcemap.ts", + "../compiler/comments.ts", "../compiler/emitter.ts", + "../compiler/watchUtilities.ts", "../compiler/program.ts", + "../compiler/builderState.ts", "../compiler/builder.ts", + "../compiler/resolutionCache.ts", + "../compiler/watch.ts", "../compiler/commandLineParser.ts", - "../compiler/diagnosticInformationMap.generated.ts", - "../services/breakpoints.ts", + + "../services/types.ts", + "../services/utilities.ts", + "../services/classifier.ts", + "../services/pathCompletions.ts", + "../services/completions.ts", + "../services/documentHighlights.ts", + "../services/documentRegistry.ts", + "../services/importTracker.ts", + "../services/findAllReferences.ts", + "../services/goToDefinition.ts", + "../services/jsDoc.ts", + "../services/semver.ts", + "../services/jsTyping.ts", "../services/navigateTo.ts", "../services/navigationBar.ts", + "../services/organizeImports.ts", "../services/outliningElementsCollector.ts", "../services/patternMatcher.ts", - "../services/services.ts", - "../services/shims.ts", + "../services/preProcess.ts", + "../services/rename.ts", "../services/signatureHelp.ts", - "../services/utilities.ts", - "../services/jsTyping.ts", - "../services/formatting/formatting.ts", + "../services/suggestionDiagnostics.ts", + "../services/symbolDisplay.ts", + "../services/transpile.ts", "../services/formatting/formattingContext.ts", "../services/formatting/formattingScanner.ts", "../services/formatting/rule.ts", "../services/formatting/rules.ts", "../services/formatting/rulesMap.ts", + "../services/formatting/formatting.ts", "../services/formatting/smartIndenter.ts", + "../services/textChanges.ts", "../services/codeFixProvider.ts", - "../services/codefixes/fixes.ts", - "../services/codefixes/helpers.ts", + "../services/refactorProvider.ts", + "../services/codefixes/addMissingInvocationForDecorator.ts", + "../services/codefixes/annotateWithTypeFromJSDoc.ts", + "../services/codefixes/convertFunctionToEs6Class.ts", + "../services/codefixes/convertToEs6Module.ts", + "../services/codefixes/correctQualifiedNameToIndexedAccessType.ts", + "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts", "../services/codefixes/importFixes.ts", + "../services/codefixes/fixSpelling.ts", + "../services/codefixes/fixAddMissingMember.ts", + "../services/codefixes/fixCannotFindModule.ts", + "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", + "../services/codefixes/fixForgottenThisPropertyAccess.ts", "../services/codefixes/fixUnusedIdentifier.ts", + "../services/codefixes/fixJSDocTypes.ts", + "../services/codefixes/fixAwaitInSyncFunction.ts", "../services/codefixes/disableJsDiagnostics.ts", + "../services/codefixes/helpers.ts", + "../services/codefixes/inferFromUsage.ts", + "../services/codefixes/fixInvalidImportSyntax.ts", + "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/useDefaultImport.ts", + "../services/refactors/extractSymbol.ts", + "../services/refactors/generateGetAccessorAndSetAccessor.ts", + "../services/sourcemaps.ts", + "../services/services.ts", + "../services/breakpoints.ts", + "../services/transform.ts", + "../services/shims.ts", + + "../server/typingsInstaller/typingsInstaller.ts", + + "../server/types.ts", + "../server/shared.ts", + "../server/utilities.ts", + "../server/protocol.ts", + "../server/scriptInfo.ts", + "../server/typingsCache.ts", + "../server/project.ts", + "../server/editorServices.ts", + "../server/session.ts", + "../server/scriptVersionCache.ts", - "harness.ts", "sourceMapRecorder.ts", - "harnessLanguageService.ts", - "fourslash.ts", "runnerbase.ts", - "compilerRunner.ts", - "typeWriter.ts", + "virtualFileSystem.ts", + "harness.ts", + "virtualFileSystemWithWatch.ts", + "harnessLanguageService.ts", "fourslashRunner.ts", + "fourslash.ts", + "typeWriter.ts", + "compilerRunner.ts", "projectsRunner.ts", "loggedIO.ts", "rwcRunner.ts", "externalCompileRunner.ts", "test262Runner.ts", - "./parallel/shared.ts", - "./parallel/host.ts", - "./parallel/worker.ts", - "runner.ts", - "virtualFileSystemWithWatch.ts", - "../server/protocol.ts", - "../server/session.ts", - "../server/client.ts", - "../server/editorServices.ts", - "./unittests/base64.ts", - "./unittests/incrementalParser.ts", - "./unittests/jsDocParsing.ts", - "./unittests/services/colorization.ts", - "./unittests/services/documentRegistry.ts", - "./unittests/services/preProcessFile.ts", - "./unittests/services/patternMatcher.ts", - "./unittests/session.ts", - "./unittests/symbolWalker.ts", - "./unittests/versionCache.ts", - "./unittests/convertToBase64.ts", - "./unittests/transpile.ts", - "./unittests/reuseProgramStructure.ts", - "./unittests/moduleResolution.ts", - "./unittests/tsconfigParsing.ts", - "./unittests/asserts.ts", - "./unittests/builder.ts", - "./unittests/commandLineParsing.ts", - "./unittests/configurationExtension.ts", - "./unittests/convertCompilerOptionsFromJson.ts", - "./unittests/convertTypeAcquisitionFromJson.ts", - "./unittests/tsserverProjectSystem.ts", - "./unittests/tscWatchMode.ts", - "./unittests/matchFiles.ts", - "./unittests/organizeImports.ts", - "./unittests/initializeTSConfig.ts", - "./unittests/compileOnSave.ts", - "./unittests/typingsInstaller.ts", - "./unittests/projectErrors.ts", - "./unittests/printer.ts", - "./unittests/transform.ts", - "./unittests/customTransforms.ts", - "./unittests/extractConstants.ts", - "./unittests/extractFunctions.ts", - "./unittests/extractRanges.ts", - "./unittests/extractTestHelpers.ts", - "./unittests/textChanges.ts", - "./unittests/telemetry.ts", - "./unittests/languageService.ts", - "./unittests/programMissingFiles.ts", - "./unittests/programNoParseFalsyFileNames.ts", - "./unittests/publicApi.ts", - "./unittests/hostNewLineSupport.ts" - ] + "parallel/host.ts", + "parallel/worker.ts", + "parallel/shared.ts", + "runner.ts" + ], + "include": ["unittests/**.ts"] } diff --git a/src/harness/unittests/jsDocParsing.ts b/src/harness/unittests/jsDocParsing.ts index 39416dc5776..fbd9e761625 100644 --- a/src/harness/unittests/jsDocParsing.ts +++ b/src/harness/unittests/jsDocParsing.ts @@ -305,6 +305,12 @@ namespace ts { * @param x hi < > still part of the previous comment */`); + + parsesCorrectly("Nested @param tags", +`/** +* @param {object} o Doc doc +* @param {string} o.f Doc for f +*/`); }); }); describe("getFirstToken", () => { diff --git a/src/harness/unittests/matchFiles.ts b/src/harness/unittests/matchFiles.ts index b2f41ba4fa2..458dddb2252 100644 --- a/src/harness/unittests/matchFiles.ts +++ b/src/harness/unittests/matchFiles.ts @@ -123,13 +123,14 @@ namespace ts { } { const actual = parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack); - expected.errors = expected.errors.map(error => ({ + expected.errors = expected.errors.map((error): Diagnostic => ({ category: error.category, code: error.code, file: undefined, length: undefined, messageText: error.messageText, start: undefined, + reportsUnnecessary: undefined, })); assertParsed(actual, expected); } diff --git a/src/harness/unittests/organizeImports.ts b/src/harness/unittests/organizeImports.ts index 3de5588af8e..7d496b97d99 100644 --- a/src/harness/unittests/organizeImports.ts +++ b/src/harness/unittests/organizeImports.ts @@ -247,6 +247,24 @@ import D from "lib"; }, libFile); + testOrganizeImports("Unused_false_positive_shorthand_assignment", + { + path: "/test.ts", + content: ` +import { x } from "a"; +const o = { x }; +` + }); + + testOrganizeImports("Unused_false_positive_export_shorthand", + { + path: "/test.ts", + content: ` +import { x } from "a"; +export { x }; +` + }); + testOrganizeImports("MoveToTop", { path: "/test.ts", diff --git a/src/harness/unittests/services/patternMatcher.ts b/src/harness/unittests/services/patternMatcher.ts index a3e2d1d5cff..64de3557da4 100644 --- a/src/harness/unittests/services/patternMatcher.ts +++ b/src/harness/unittests/services/patternMatcher.ts @@ -95,376 +95,245 @@ describe("PatternMatcher", () => { describe("SingleWordPattern", () => { it("PreferCaseSensitiveExact", () => { - const match = getFirstMatch("Foo", "Foo"); - - assert.equal(ts.PatternMatchKind.exact, match.kind); - assert.equal(true, match.isCaseSensitive); + assertSegmentMatch("Foo", "Foo", { kind: ts.PatternMatchKind.exact, isCaseSensitive: true }); }); it("PreferCaseSensitiveExactInsensitive", () => { - const match = getFirstMatch("foo", "Foo"); - - assert.equal(ts.PatternMatchKind.exact, match.kind); - assert.equal(false, match.isCaseSensitive); + assertSegmentMatch("foo", "Foo", { kind: ts.PatternMatchKind.exact, isCaseSensitive: false }); }); it("PreferCaseSensitivePrefix", () => { - const match = getFirstMatch("Foo", "Fo"); - - assert.equal(ts.PatternMatchKind.prefix, match.kind); - assert.equal(true, match.isCaseSensitive); + assertSegmentMatch("Foo", "Fo", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true }); }); it("PreferCaseSensitivePrefixCaseInsensitive", () => { - const match = getFirstMatch("Foo", "fo"); - - assert.equal(ts.PatternMatchKind.prefix, match.kind); - assert.equal(false, match.isCaseSensitive); + assertSegmentMatch("Foo", "fo", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false }); }); it("PreferCaseSensitiveCamelCaseMatchSimple", () => { - const match = getFirstMatch("FogBar", "FB"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(true, match.isCaseSensitive); + assertSegmentMatch("FogBar", "FB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true }); }); it("PreferCaseSensitiveCamelCaseMatchPartialPattern", () => { - const match = getFirstMatch("FogBar", "FoB"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(true, match.isCaseSensitive); + assertSegmentMatch("FogBar", "FoB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true }); }); it("PreferCaseSensitiveCamelCaseMatchToLongPattern1", () => { - const match = getFirstMatch("FogBar", "FBB"); - - assert.isTrue(match === undefined); + assertSegmentMatch("FogBar", "FBB", undefined); }); it("PreferCaseSensitiveCamelCaseMatchToLongPattern2", () => { - const match = getFirstMatch("FogBar", "FoooB"); - - assert.isTrue(match === undefined); + assertSegmentMatch("FogBar", "FoooB", undefined); }); it("CamelCaseMatchPartiallyUnmatched", () => { - const match = getFirstMatch("FogBarBaz", "FZ"); - - assert.isTrue(match === undefined); + assertSegmentMatch("FogBarBaz", "FZ", undefined); }); it("CamelCaseMatchCompletelyUnmatched", () => { - const match = getFirstMatch("FogBarBaz", "ZZ"); - - assert.isTrue(match === undefined); + assertSegmentMatch("FogBarBaz", "ZZ", undefined); }); it("TwoUppercaseCharacters", () => { - const match = getFirstMatch("SimpleUIElement", "SiUI"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(true, match.isCaseSensitive); + assertSegmentMatch("SimpleUIElement", "SiUI", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true }); }); it("PreferCaseSensitiveLowercasePattern", () => { - const match = getFirstMatch("FogBar", "b"); - - assert.equal(ts.PatternMatchKind.substring, match.kind); - assert.equal(false, match.isCaseSensitive); + assertSegmentMatch("FogBar", "b", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false }); }); it("PreferCaseSensitiveLowercasePattern2", () => { - const match = getFirstMatch("FogBar", "fB"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(false, match.isCaseSensitive); + assertSegmentMatch("FogBar", "fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false }); }); it("PreferCaseSensitiveTryUnderscoredName", () => { - const match = getFirstMatch("_fogBar", "_fB"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(true, match.isCaseSensitive); + assertSegmentMatch("_fogBar", "_fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true }); }); it("PreferCaseSensitiveTryUnderscoredName2", () => { - const match = getFirstMatch("_fogBar", "fB"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(true, match.isCaseSensitive); + assertSegmentMatch("_fogBar", "fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true }); }); it("PreferCaseSensitiveTryUnderscoredNameInsensitive", () => { - const match = getFirstMatch("_FogBar", "_fB"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(false, match.isCaseSensitive); + assertSegmentMatch("_FogBar", "_fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false }); }); it("PreferCaseSensitiveMiddleUnderscore", () => { - const match = getFirstMatch("Fog_Bar", "FB"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(true, match.isCaseSensitive); + assertSegmentMatch("Fog_Bar", "FB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true }); }); it("PreferCaseSensitiveMiddleUnderscore2", () => { - const match = getFirstMatch("Fog_Bar", "F_B"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(true, match.isCaseSensitive); + assertSegmentMatch("Fog_Bar", "F_B", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true }); }); it("PreferCaseSensitiveMiddleUnderscore3", () => { - const match = getFirstMatch("Fog_Bar", "F__B"); - - assert.isTrue(undefined === match); + assertSegmentMatch("Fog_Bar", "F__B", undefined); }); it("PreferCaseSensitiveMiddleUnderscore4", () => { - const match = getFirstMatch("Fog_Bar", "f_B"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(false, match.isCaseSensitive); + assertSegmentMatch("Fog_Bar", "f_B", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false }); }); it("PreferCaseSensitiveMiddleUnderscore5", () => { - const match = getFirstMatch("Fog_Bar", "F_b"); - - assert.equal(ts.PatternMatchKind.camelCase, match.kind); - assert.equal(false, match.isCaseSensitive); + assertSegmentMatch("Fog_Bar", "F_b", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false }); }); it("AllLowerPattern1", () => { - const match = getFirstMatch("FogBarChangedEventArgs", "changedeventargs"); - - assert.isTrue(undefined !== match); + assertSegmentMatch("FogBarChangedEventArgs", "changedeventargs", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false }); }); it("AllLowerPattern2", () => { - const match = getFirstMatch("FogBarChangedEventArgs", "changedeventarrrgh"); - - assert.isTrue(undefined === match); + assertSegmentMatch("FogBarChangedEventArgs", "changedeventarrrgh", undefined); }); it("AllLowerPattern3", () => { - const match = getFirstMatch("ABCDEFGH", "bcd"); - - assert.isTrue(undefined !== match); + assertSegmentMatch("ABCDEFGH", "bcd", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false }); }); it("AllLowerPattern4", () => { - const match = getFirstMatch("AbcdefghijEfgHij", "efghij"); - - assert.isTrue(undefined === match); + assertSegmentMatch("AbcdefghijEfgHij", "efghij", undefined); }); }); describe("MultiWordPattern", () => { it("ExactWithLowercase", () => { - const matches = getAllMatches("AddMetadataReference", "addmetadatareference"); - - assertContainsKind(ts.PatternMatchKind.exact, matches); + assertSegmentMatch("AddMetadataReference", "addmetadatareference", { kind: ts.PatternMatchKind.exact, isCaseSensitive: false }); }); it("SingleLowercasedSearchWord1", () => { - const matches = getAllMatches("AddMetadataReference", "add"); - - assertContainsKind(ts.PatternMatchKind.prefix, matches); + assertSegmentMatch("AddMetadataReference", "add", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false }); }); it("SingleLowercasedSearchWord2", () => { - const matches = getAllMatches("AddMetadataReference", "metadata"); - - assertContainsKind(ts.PatternMatchKind.substring, matches); + assertSegmentMatch("AddMetadataReference", "metadata", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false }); }); it("SingleUppercaseSearchWord1", () => { - const matches = getAllMatches("AddMetadataReference", "Add"); - - assertContainsKind(ts.PatternMatchKind.prefix, matches); + assertSegmentMatch("AddMetadataReference", "Add", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true }); }); it("SingleUppercaseSearchWord2", () => { - const matches = getAllMatches("AddMetadataReference", "Metadata"); - - assertContainsKind(ts.PatternMatchKind.substring, matches); + assertSegmentMatch("AddMetadataReference", "Metadata", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true }); }); it("SingleUppercaseSearchLetter1", () => { - const matches = getAllMatches("AddMetadataReference", "A"); - - assertContainsKind(ts.PatternMatchKind.prefix, matches); + assertSegmentMatch("AddMetadataReference", "A", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true }); }); it("SingleUppercaseSearchLetter2", () => { - const matches = getAllMatches("AddMetadataReference", "M"); - - assertContainsKind(ts.PatternMatchKind.substring, matches); + assertSegmentMatch("AddMetadataReference", "M", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true }); }); - it("TwoLowercaseWords", () => { - const matches = getAllMatches("AddMetadataReference", "add metadata"); - - assertContainsKind(ts.PatternMatchKind.prefix, matches); - assertContainsKind(ts.PatternMatchKind.substring, matches); + it("TwoLowercaseWords0", () => { + assertSegmentMatch("AddMetadataReference", "add metadata", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false }); }); - it("TwoLowercaseWords", () => { - const matches = getAllMatches("AddMetadataReference", "A M"); - - assertContainsKind(ts.PatternMatchKind.prefix, matches); - assertContainsKind(ts.PatternMatchKind.substring, matches); + it("TwoLowercaseWords1", () => { + assertSegmentMatch("AddMetadataReference", "A M", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true }); }); - it("TwoLowercaseWords", () => { - const matches = getAllMatches("AddMetadataReference", "AM"); - - assertContainsKind(ts.PatternMatchKind.camelCase, matches); + it("TwoLowercaseWords2", () => { + assertSegmentMatch("AddMetadataReference", "AM", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true }); }); - it("TwoLowercaseWords", () => { - const matches = getAllMatches("AddMetadataReference", "ref Metadata"); - - assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]); + it("TwoLowercaseWords3", () => { + assertSegmentMatch("AddMetadataReference", "ref Metadata", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true }); }); - it("TwoLowercaseWords", () => { - const matches = getAllMatches("AddMetadataReference", "ref M"); - - assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]); + it("TwoLowercaseWords4", () => { + assertSegmentMatch("AddMetadataReference", "ref M", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true }); }); it("MixedCamelCase", () => { - const matches = getAllMatches("AddMetadataReference", "AMRe"); - - assertContainsKind(ts.PatternMatchKind.camelCase, matches); + assertSegmentMatch("AddMetadataReference", "AMRe", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true }); }); it("BlankPattern", () => { - const matches = getAllMatches("AddMetadataReference", ""); - - assert.isTrue(matches === undefined); + assertInvalidPattern(""); }); it("WhitespaceOnlyPattern", () => { - const matches = getAllMatches("AddMetadataReference", " "); - - assert.isTrue(matches === undefined); + assertInvalidPattern(" "); }); it("EachWordSeparately1", () => { - const matches = getAllMatches("AddMetadataReference", "add Meta"); - - assertContainsKind(ts.PatternMatchKind.prefix, matches); - assertContainsKind(ts.PatternMatchKind.substring, matches); + assertSegmentMatch("AddMetadataReference", "add Meta", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false }); }); it("EachWordSeparately2", () => { - const matches = getAllMatches("AddMetadataReference", "Add meta"); - - assertContainsKind(ts.PatternMatchKind.prefix, matches); - assertContainsKind(ts.PatternMatchKind.substring, matches); + assertSegmentMatch("AddMetadataReference", "Add meta", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true }); }); it("EachWordSeparately3", () => { - const matches = getAllMatches("AddMetadataReference", "Add Meta"); - - assertContainsKind(ts.PatternMatchKind.prefix, matches); - assertContainsKind(ts.PatternMatchKind.substring, matches); + assertSegmentMatch("AddMetadataReference", "Add Meta", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true }); }); it("MixedCasing", () => { - const matches = getAllMatches("AddMetadataReference", "mEta"); - - assert.isTrue(matches === undefined); + assertSegmentMatch("AddMetadataReference", "mEta", undefined); }); it("MixedCasing2", () => { - const matches = getAllMatches("AddMetadataReference", "Data"); - - assert.isTrue(matches === undefined); + assertSegmentMatch("AddMetadataReference", "Data", undefined); }); it("AsteriskSplit", () => { - const matches = getAllMatches("GetKeyWord", "K*W"); - - assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]); + assertSegmentMatch("GetKeyWord", "K*W", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true }); }); it("LowercaseSubstring1", () => { - const matches = getAllMatches("Operator", "a"); - - assert.isTrue(matches === undefined); + assertSegmentMatch("Operator", "a", undefined); }); it("LowercaseSubstring2", () => { - const matches = getAllMatches("FooAttribute", "a"); - assertContainsKind(ts.PatternMatchKind.substring, matches); - assert.isFalse(matches[0].isCaseSensitive); + assertSegmentMatch("FooAttribute", "a", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false }); }); }); describe("DottedPattern", () => { it("DottedPattern1", () => { - const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.Q"); - - assert.equal(ts.PatternMatchKind.prefix, match.kind); - assert.equal(true, match.isCaseSensitive); + assertFullMatch("Foo.Bar.Baz", "Quux", "B.Q", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true }); }); it("DottedPattern2", () => { - const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "C.Q"); - assert.isTrue(match === undefined); + assertFullMatch("Foo.Bar.Baz", "Quux", "C.Q", undefined); }); it("DottedPattern3", () => { - const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.B.Q"); - assert.equal(ts.PatternMatchKind.prefix, match.kind); - assert.equal(true, match.isCaseSensitive); + assertFullMatch("Foo.Bar.Baz", "Quux", "B.B.Q", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true }); }); it("DottedPattern4", () => { - const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "Baz.Quux"); - assert.equal(ts.PatternMatchKind.exact, match.kind); - assert.equal(true, match.isCaseSensitive); + assertFullMatch("Foo.Bar.Baz", "Quux", "Baz.Quux", { kind: ts.PatternMatchKind.exact, isCaseSensitive: true }); }); it("DottedPattern5", () => { - const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.B.B.Quux"); - assert.equal(ts.PatternMatchKind.exact, match.kind); - assert.equal(true, match.isCaseSensitive); + assertFullMatch("Foo.Bar.Baz", "Quux", "F.B.B.Quux", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true }); }); it("DottedPattern6", () => { - const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.F.B.B.Quux"); - assert.isTrue(match === undefined); + assertFullMatch("Foo.Bar.Baz", "Quux", "F.F.B.B.Quux", undefined); }); it("DottedPattern7", () => { - let match = getFirstMatch("UIElement", "UIElement"); - match = getFirstMatch("GetKeyword", "UIElement"); - assert.isTrue(match === undefined); + assertSegmentMatch("UIElement", "UIElement", { kind: ts.PatternMatchKind.exact, isCaseSensitive: true }); + assertSegmentMatch("GetKeyword", "UIElement", undefined); }); }); - function getFirstMatch(candidate: string, pattern: string): ts.PatternMatch { - const matches = ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate); - return matches ? matches[0] : undefined; + function assertSegmentMatch(candidate: string, pattern: string, expected: ts.PatternMatch | undefined): void { + assert.deepEqual(ts.createPatternMatcher(pattern).getMatchForLastSegmentOfPattern(candidate), expected); } - function getAllMatches(candidate: string, pattern: string): ts.PatternMatch[] { - return ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate); + function assertInvalidPattern(pattern: string) { + assert.equal(ts.createPatternMatcher(pattern), undefined); } - function getFirstMatchForDottedPattern(dottedContainer: string, candidate: string, pattern: string): ts.PatternMatch { - const matches = ts.createPatternMatcher(pattern).getMatches(dottedContainer.split("."), candidate); - return matches ? matches[0] : undefined; + function assertFullMatch(dottedContainer: string, candidate: string, pattern: string, expected: ts.PatternMatch | undefined): void { + assert.deepEqual(ts.createPatternMatcher(pattern).getFullMatch(dottedContainer.split("."), candidate), expected); } function spanListToSubstrings(identifier: string, spans: ts.TextSpan[]) { - return ts.map(spans, s => identifier.substr(s.start, s.length)); + return spans.map(s => identifier.substr(s.start, s.length)); } function breakIntoCharacterSpans(identifier: string) { @@ -474,23 +343,12 @@ describe("PatternMatcher", () => { function breakIntoWordSpans(identifier: string) { return spanListToSubstrings(identifier, ts.breakIntoWordSpans(identifier)); } - function assertArrayEquals(array1: T[], array2: T[]) { - assert.equal(array1.length, array2.length); - - for (let i = 0; i < array1.length; i++) { - assert.equal(array1[i], array2[i]); - } - } function verifyBreakIntoCharacterSpans(original: string, ...parts: string[]): void { - assertArrayEquals(parts, breakIntoCharacterSpans(original)); + assert.deepEqual(parts, breakIntoCharacterSpans(original)); } function verifyBreakIntoWordSpans(original: string, ...parts: string[]): void { - assertArrayEquals(parts, breakIntoWordSpans(original)); - } - - function assertContainsKind(kind: ts.PatternMatchKind, results: ts.PatternMatch[]) { - assert.isTrue(ts.forEach(results, r => r.kind === kind)); + assert.deepEqual(parts, breakIntoWordSpans(original)); } }); diff --git a/src/harness/unittests/services/preProcessFile.ts b/src/harness/unittests/services/preProcessFile.ts index 1e13bc3e345..76b1e4f05a6 100644 --- a/src/harness/unittests/services/preProcessFile.ts +++ b/src/harness/unittests/services/preProcessFile.ts @@ -59,6 +59,32 @@ describe("PreProcessFile:", () => { }); }), + it("Do not return reference path of non-imports", () => { + test("Quill.import('delta');", + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [], + importedFiles: [], + typeReferenceDirectives: [], + ambientExternalModules: undefined, + isLibFile: false + }); + }), + + it("Do not return reference path of nested non-imports", () => { + test("a.b.import('c');", + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [], + importedFiles: [], + typeReferenceDirectives: [], + ambientExternalModules: undefined, + isLibFile: false + }); + }), + it("Correctly return imported files", () => { test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require (\"r5.ts\");", /*readImportFile*/ true, diff --git a/src/harness/unittests/tscWatchMode.ts b/src/harness/unittests/tscWatchMode.ts index f9bb0612f41..99bad3e3091 100644 --- a/src/harness/unittests/tscWatchMode.ts +++ b/src/harness/unittests/tscWatchMode.ts @@ -76,11 +76,11 @@ namespace ts.tscWatch { function checkOutputErrors( host: WatchedSystem, logsBeforeWatchDiagnostic: string[] | undefined, - preErrorsWatchDiagnostic: DiagnosticMessage, + preErrorsWatchDiagnostic: Diagnostic, logsBeforeErrors: string[] | undefined, errors: ReadonlyArray, disableConsoleClears?: boolean | undefined, - ...postErrorsWatchDiagnostics: DiagnosticMessage[] + ...postErrorsWatchDiagnostics: Diagnostic[] ) { let screenClears = 0; const outputs = host.getOutput(); @@ -109,9 +109,9 @@ namespace ts.tscWatch { index++; } - function assertWatchDiagnostic(diagnosticMessage: DiagnosticMessage) { - const expected = getWatchDiagnosticWithoutDate(diagnosticMessage); - if (!disableConsoleClears && diagnosticMessage.code !== Diagnostics.Compilation_complete_Watching_for_file_changes.code) { + function assertWatchDiagnostic(diagnostic: Diagnostic) { + const expected = getWatchDiagnosticWithoutDate(diagnostic); + if (!disableConsoleClears && !contains(nonClearingMessageCodes, diagnostic.code)) { assert.equal(host.screenClears[screenClears], index, `Expected screen clear at this diagnostic: ${expected}`); screenClears++; } @@ -120,24 +120,52 @@ namespace ts.tscWatch { } function getOutputAtFailedMessage(caption: string, expectedOutput: string) { - return `Expected ${caption}: ${expectedOutput} at ${index} in ${JSON.stringify(outputs)}`; + return `Expected ${caption}: ${JSON.stringify(expectedOutput)} at ${index} in ${JSON.stringify(outputs)}`; } - function getWatchDiagnosticWithoutDate(diagnosticMessage: DiagnosticMessage) { - return ` - ${flattenDiagnosticMessageText(getLocaleSpecificMessage(diagnosticMessage), host.newLine)}${host.newLine + host.newLine + host.newLine}`; + function getWatchDiagnosticWithoutDate(diagnostic: Diagnostic) { + return ` - ${flattenDiagnosticMessageText(diagnostic.messageText, host.newLine)}${host.newLine + host.newLine + host.newLine}`; } } + function createErrorsFoundCompilerDiagnostic(errors: ReadonlyArray) { + return errors.length === 1 + ? createCompilerDiagnostic(Diagnostics.Found_1_error) + : createCompilerDiagnostic(Diagnostics.Found_0_errors, errors.length); + } + function checkOutputErrorsInitial(host: WatchedSystem, errors: ReadonlyArray, disableConsoleClears?: boolean, logsBeforeErrors?: string[]) { - checkOutputErrors(host, /*logsBeforeWatchDiagnostic*/ undefined, Diagnostics.Starting_compilation_in_watch_mode, logsBeforeErrors, errors, disableConsoleClears, Diagnostics.Compilation_complete_Watching_for_file_changes); + checkOutputErrors( + host, + /*logsBeforeWatchDiagnostic*/ undefined, + createCompilerDiagnostic(Diagnostics.Starting_compilation_in_watch_mode), + logsBeforeErrors, + errors, + disableConsoleClears, + createErrorsFoundCompilerDiagnostic(errors), + createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes)); } function checkOutputErrorsIncremental(host: WatchedSystem, errors: ReadonlyArray, disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) { - checkOutputErrors(host, logsBeforeWatchDiagnostic, Diagnostics.File_change_detected_Starting_incremental_compilation, logsBeforeErrors, errors, disableConsoleClears, Diagnostics.Compilation_complete_Watching_for_file_changes); + checkOutputErrors( + host, + logsBeforeWatchDiagnostic, + createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation), + logsBeforeErrors, + errors, + disableConsoleClears, + createErrorsFoundCompilerDiagnostic(errors), + createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes)); } function checkOutputErrorsIncrementalWithExit(host: WatchedSystem, errors: ReadonlyArray, expectedExitCode: ExitStatus, disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) { - checkOutputErrors(host, logsBeforeWatchDiagnostic, Diagnostics.File_change_detected_Starting_incremental_compilation, logsBeforeErrors, errors, disableConsoleClears); + checkOutputErrors( + host, + logsBeforeWatchDiagnostic, + createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation), + logsBeforeErrors, + errors, + disableConsoleClears); assert.equal(host.exitCode, expectedExitCode); } diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index a3e86c208b4..b167ed21b94 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -1314,6 +1314,109 @@ namespace ts.projectSystem { }); + describe("ignoreConfigFiles", () => { + it("external project including config file", () => { + const file1 = { + path: "/a/b/f1.ts", + content: "let x =1;" + }; + const config1 = { + path: "/a/b/tsconfig.json", + content: JSON.stringify( + { + compilerOptions: {}, + files: ["f1.ts"] + } + ) + }; + + const externalProjectName = "externalproject"; + const host = createServerHost([file1, config1]); + const projectService = createProjectService(host, { useSingleInferredProject: true }, { syntaxOnly: true }); + projectService.openExternalProject({ + rootFiles: toExternalFiles([file1.path, config1.path]), + options: {}, + projectFileName: externalProjectName + }); + + checkNumberOfProjects(projectService, { externalProjects: 1 }); + const proj = projectService.externalProjects[0]; + assert.isDefined(proj); + + assert.isTrue(proj.fileExists(file1.path)); + }); + + it("loose file included in config file (openClientFile)", () => { + const file1 = { + path: "/a/b/f1.ts", + content: "let x =1;" + }; + const config1 = { + path: "/a/b/tsconfig.json", + content: JSON.stringify( + { + compilerOptions: {}, + files: ["f1.ts"] + } + ) + }; + + const host = createServerHost([file1, config1]); + const projectService = createProjectService(host, { useSingleInferredProject: true }, { syntaxOnly: true }); + projectService.openClientFile(file1.path, file1.content); + + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + const proj = projectService.inferredProjects[0]; + assert.isDefined(proj); + + assert.isTrue(proj.fileExists(file1.path)); + }); + + it("loose file included in config file (applyCodeChanges)", () => { + const file1 = { + path: "/a/b/f1.ts", + content: "let x =1;" + }; + const config1 = { + path: "/a/b/tsconfig.json", + content: JSON.stringify( + { + compilerOptions: {}, + files: ["f1.ts"] + } + ) + }; + + const host = createServerHost([file1, config1]); + const projectService = createProjectService(host, { useSingleInferredProject: true }, { syntaxOnly: true }); + projectService.applyChangesInOpenFiles([{ fileName: file1.path, content: file1.content }], [], []); + + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + const proj = projectService.inferredProjects[0]; + assert.isDefined(proj); + + assert.isTrue(proj.fileExists(file1.path)); + }); + }); + + it("disable inferred project", () => { + const file1 = { + path: "/a/b/f1.ts", + content: "let x =1;" + }; + + const host = createServerHost([file1]); + const projectService = createProjectService(host, { useSingleInferredProject: true }, { syntaxOnly: true }); + + projectService.openClientFile(file1.path, file1.content); + + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + const proj = projectService.inferredProjects[0]; + assert.isDefined(proj); + + assert.isFalse(proj.languageServiceEnabled); + }); + it("reload regular file after closing", () => { const f1 = { path: "/a/b/app.ts", @@ -3965,7 +4068,7 @@ namespace ts.projectSystem { const folderPath = "/a/b/projects/temp"; const file1: FileOrFolder = { path: `${folderPath}/a.ts`, - content: 'import f = require("pad")' + content: 'import f = require("pad"); f;' }; const files = [file1, libFile]; const host = createServerHost(files); @@ -4028,10 +4131,10 @@ namespace ts.projectSystem { checkErrorMessage(session, "semanticDiag", { file: file1.path, diagnostics: [] }); }); - it("info diagnostics", () => { + it("suggestion diagnostics", () => { const file: FileOrFolder = { path: "/a.js", - content: 'require("b")', + content: "function f(p) {}", }; const host = createServerHost([file]); @@ -4074,13 +4177,64 @@ namespace ts.projectSystem { checkErrorMessage(session, "suggestionDiag", { file: file.path, diagnostics: [ - createDiagnostic({ line: 1, offset: 1 }, { line: 1, offset: 13 }, Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module) + createDiagnostic({ line: 1, offset: 12 }, { line: 1, offset: 13 }, Diagnostics._0_is_declared_but_its_value_is_never_read, ["p"], "suggestion", /*reportsUnnecssary*/ true) ], }); checkCompleteEvent(session, 2, expectedSequenceId); session.clearMessages(); }); + it("disable suggestion diagnostics", () => { + const file: FileOrFolder = { + path: "/a.js", + content: 'require("b")', + }; + + const host = createServerHost([file]); + const session = createSession(host, { canUseEvents: true }); + const service = session.getProjectService(); + + session.executeCommandSeq({ + command: server.CommandNames.Open, + arguments: { file: file.path, fileContent: file.content }, + }); + + session.executeCommandSeq({ + command: server.CommandNames.Configure, + arguments: { + preferences: { disableSuggestions: true } + }, + }); + + checkNumberOfProjects(service, { inferredProjects: 1 }); + session.clearMessages(); + const expectedSequenceId = session.getNextSeq(); + host.checkTimeoutQueueLengthAndRun(2); + + checkProjectUpdatedInBackgroundEvent(session, [file.path]); + session.clearMessages(); + + session.executeCommandSeq({ + command: server.CommandNames.Geterr, + arguments: { + delay: 0, + files: [file.path], + } + }); + + host.checkTimeoutQueueLengthAndRun(1); + + checkErrorMessage(session, "syntaxDiag", { file: file.path, diagnostics: [] }, /*isMostRecent*/ true); + session.clearMessages(); + + host.runQueuedImmediateCallbacks(1); + + checkErrorMessage(session, "semanticDiag", { file: file.path, diagnostics: [] }); + // No suggestion event, we're done. + checkCompleteEvent(session, 2, expectedSequenceId); + session.clearMessages(); + }); + it("suppressed diagnostic events", () => { const file: FileOrFolder = { path: "/a.ts", @@ -4138,8 +4292,8 @@ namespace ts.projectSystem { session.clearMessages(); }); - function createDiagnostic(start: protocol.Location, end: protocol.Location, message: DiagnosticMessage, args: ReadonlyArray = []): protocol.Diagnostic { - return { start, end, text: formatStringFromArgs(message.message, args), code: message.code, category: diagnosticCategoryName(message), source: undefined }; + function createDiagnostic(start: protocol.Location, end: protocol.Location, message: DiagnosticMessage, args: ReadonlyArray = [], category = diagnosticCategoryName(message), reportsUnnecessary?: {}): protocol.Diagnostic { + return { start, end, text: formatStringFromArgs(message.message, args), code: message.code, category, reportsUnnecessary, source: undefined }; } }); diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index 0a27f860352..1a19c98f477 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -141,12 +141,15 @@ namespace ts.projectSystem { checkNumberOfProjects(projectService, { configuredProjects: 1 }); const p = configuredProjectAt(projectService, 0); checkProjectActualFiles(p, [file1.path, tsconfig.path]); + checkWatchedFiles(host, [tsconfig.path, libFile.path, packageJson.path, "/a/b/bower_components", "/a/b/node_modules"]); installer.installAll(/*expectedCount*/ 1); checkNumberOfProjects(projectService, { configuredProjects: 1 }); host.checkTimeoutQueueLengthAndRun(2); checkProjectActualFiles(p, [file1.path, jquery.path, tsconfig.path]); + // should not watch jquery + checkWatchedFiles(host, [tsconfig.path, libFile.path, packageJson.path, "/a/b/bower_components", "/a/b/node_modules"]); }); it("inferred project (typings installed)", () => { @@ -188,7 +191,7 @@ namespace ts.projectSystem { checkProjectActualFiles(p, [file1.path]); installer.installAll(/*expectedCount*/ 1); - + host.checkTimeoutQueueLengthAndRun(2); checkNumberOfProjects(projectService, { inferredProjects: 1 }); checkProjectActualFiles(p, [file1.path, jquery.path]); }); @@ -961,6 +964,7 @@ namespace ts.projectSystem { assert.isTrue(host.fileExists(node.path), "typings for 'node' should be created"); assert.isTrue(host.fileExists(commander.path), "typings for 'commander' should be created"); + host.checkTimeoutQueueLengthAndRun(2); checkProjectActualFiles(service.inferredProjects[0], [file.path, node.path, commander.path]); }); @@ -1106,7 +1110,7 @@ namespace ts.projectSystem { checkProjectActualFiles(p, [file1.path]); installer.installAll(/*expectedCount*/ 1); - + host.checkTimeoutQueueLengthAndRun(2); checkNumberOfProjects(projectService, { inferredProjects: 1 }); checkProjectActualFiles(p, [file1.path, jquery.path]); }); @@ -1589,4 +1593,32 @@ namespace ts.projectSystem { checkProjectActualFiles(projectService.inferredProjects[0], [f1.path]); }); }); + + describe("typing installer's npm installation command", () => { + const npmPath = "npm", tsVersion = "2.9.0-dev.20180410"; + const packageNames = ["@types/graphql@ts2.8", "@types/highlight.js@ts2.8", "@types/jest@ts2.8", "@types/mini-css-extract-plugin@ts2.8", "@types/mongoose@ts2.8", "@types/pg@ts2.8", "@types/webpack-bundle-analyzer@ts2.8", "@types/enhanced-resolve@ts2.8", "@types/eslint-plugin-prettier@ts2.8", "@types/friendly-errors-webpack-plugin@ts2.8", "@types/hammerjs@ts2.8", "@types/history@ts2.8", "@types/image-size@ts2.8", "@types/js-cookie@ts2.8", "@types/koa-compress@ts2.8", "@types/less@ts2.8", "@types/material-ui@ts2.8", "@types/mysql@ts2.8", "@types/nodemailer@ts2.8", "@types/prettier@ts2.8", "@types/query-string@ts2.8", "@types/react-places-autocomplete@ts2.8", "@types/react-router@ts2.8", "@types/react-router-config@ts2.8", "@types/react-select@ts2.8", "@types/react-transition-group@ts2.8", "@types/redux-form@ts2.8", "@types/abbrev@ts2.8", "@types/accepts@ts2.8", "@types/acorn@ts2.8", "@types/ansi-regex@ts2.8", "@types/ansi-styles@ts2.8", "@types/anymatch@ts2.8", "@types/apollo-codegen@ts2.8", "@types/are-we-there-yet@ts2.8", "@types/argparse@ts2.8", "@types/arr-union@ts2.8", "@types/array-find-index@ts2.8", "@types/array-uniq@ts2.8", "@types/array-unique@ts2.8", "@types/arrify@ts2.8", "@types/assert-plus@ts2.8", "@types/async@ts2.8", "@types/autoprefixer@ts2.8", "@types/aws4@ts2.8", "@types/babel-code-frame@ts2.8", "@types/babel-generator@ts2.8", "@types/babel-plugin-syntax-jsx@ts2.8", "@types/babel-template@ts2.8", "@types/babel-traverse@ts2.8", "@types/babel-types@ts2.8", "@types/babylon@ts2.8", "@types/base64-js@ts2.8", "@types/basic-auth@ts2.8", "@types/big.js@ts2.8", "@types/bl@ts2.8", "@types/bluebird@ts2.8", "@types/body-parser@ts2.8", "@types/bonjour@ts2.8", "@types/boom@ts2.8", "@types/brace-expansion@ts2.8", "@types/braces@ts2.8", "@types/brorand@ts2.8", "@types/browser-resolve@ts2.8", "@types/bson@ts2.8", "@types/buffer-equal@ts2.8", "@types/builtin-modules@ts2.8", "@types/bytes@ts2.8", "@types/callsites@ts2.8", "@types/camelcase@ts2.8", "@types/camelcase-keys@ts2.8", "@types/caseless@ts2.8", "@types/change-emitter@ts2.8", "@types/check-types@ts2.8", "@types/cheerio@ts2.8", "@types/chokidar@ts2.8", "@types/chownr@ts2.8", "@types/circular-json@ts2.8", "@types/classnames@ts2.8", "@types/clean-css@ts2.8", "@types/clone@ts2.8", "@types/co-body@ts2.8", "@types/color@ts2.8", "@types/color-convert@ts2.8", "@types/color-name@ts2.8", "@types/color-string@ts2.8", "@types/colors@ts2.8", "@types/combined-stream@ts2.8", "@types/common-tags@ts2.8", "@types/component-emitter@ts2.8", "@types/compressible@ts2.8", "@types/compression@ts2.8", "@types/concat-stream@ts2.8", "@types/connect-history-api-fallback@ts2.8", "@types/content-disposition@ts2.8", "@types/content-type@ts2.8", "@types/convert-source-map@ts2.8", "@types/cookie@ts2.8", "@types/cookie-signature@ts2.8", "@types/cookies@ts2.8", "@types/core-js@ts2.8", "@types/cosmiconfig@ts2.8", "@types/create-react-class@ts2.8", "@types/cross-spawn@ts2.8", "@types/cryptiles@ts2.8", "@types/css-modules-require-hook@ts2.8", "@types/dargs@ts2.8", "@types/dateformat@ts2.8", "@types/debug@ts2.8", "@types/decamelize@ts2.8", "@types/decompress@ts2.8", "@types/decompress-response@ts2.8", "@types/deep-equal@ts2.8", "@types/deep-extend@ts2.8", "@types/deepmerge@ts2.8", "@types/defined@ts2.8", "@types/del@ts2.8", "@types/depd@ts2.8", "@types/destroy@ts2.8", "@types/detect-indent@ts2.8", "@types/detect-newline@ts2.8", "@types/diff@ts2.8", "@types/doctrine@ts2.8", "@types/download@ts2.8", "@types/draft-js@ts2.8", "@types/duplexer2@ts2.8", "@types/duplexer3@ts2.8", "@types/duplexify@ts2.8", "@types/ejs@ts2.8", "@types/end-of-stream@ts2.8", "@types/entities@ts2.8", "@types/escape-html@ts2.8", "@types/escape-string-regexp@ts2.8", "@types/escodegen@ts2.8", "@types/eslint-scope@ts2.8", "@types/eslint-visitor-keys@ts2.8", "@types/esprima@ts2.8", "@types/estraverse@ts2.8", "@types/etag@ts2.8", "@types/events@ts2.8", "@types/execa@ts2.8", "@types/exenv@ts2.8", "@types/exit@ts2.8", "@types/exit-hook@ts2.8", "@types/expect@ts2.8", "@types/express@ts2.8", "@types/express-graphql@ts2.8", "@types/extend@ts2.8", "@types/extract-zip@ts2.8", "@types/fancy-log@ts2.8", "@types/fast-diff@ts2.8", "@types/fast-levenshtein@ts2.8", "@types/figures@ts2.8", "@types/file-type@ts2.8", "@types/filenamify@ts2.8", "@types/filesize@ts2.8", "@types/finalhandler@ts2.8", "@types/find-root@ts2.8", "@types/find-up@ts2.8", "@types/findup-sync@ts2.8", "@types/forever-agent@ts2.8", "@types/form-data@ts2.8", "@types/forwarded@ts2.8", "@types/fresh@ts2.8", "@types/from2@ts2.8", "@types/fs-extra@ts2.8", "@types/get-caller-file@ts2.8", "@types/get-stdin@ts2.8", "@types/get-stream@ts2.8", "@types/get-value@ts2.8", "@types/glob-base@ts2.8", "@types/glob-parent@ts2.8", "@types/glob-stream@ts2.8", "@types/globby@ts2.8", "@types/globule@ts2.8", "@types/got@ts2.8", "@types/graceful-fs@ts2.8", "@types/gulp-rename@ts2.8", "@types/gulp-sourcemaps@ts2.8", "@types/gulp-util@ts2.8", "@types/gzip-size@ts2.8", "@types/handlebars@ts2.8", "@types/has-ansi@ts2.8", "@types/hasha@ts2.8", "@types/he@ts2.8", "@types/hoek@ts2.8", "@types/html-entities@ts2.8", "@types/html-minifier@ts2.8", "@types/htmlparser2@ts2.8", "@types/http-assert@ts2.8", "@types/http-errors@ts2.8", "@types/http-proxy@ts2.8", "@types/http-proxy-middleware@ts2.8", "@types/indent-string@ts2.8", "@types/inflected@ts2.8", "@types/inherits@ts2.8", "@types/ini@ts2.8", "@types/inline-style-prefixer@ts2.8", "@types/inquirer@ts2.8", "@types/internal-ip@ts2.8", "@types/into-stream@ts2.8", "@types/invariant@ts2.8", "@types/ip@ts2.8", "@types/ip-regex@ts2.8", "@types/is-absolute-url@ts2.8", "@types/is-binary-path@ts2.8", "@types/is-finite@ts2.8", "@types/is-glob@ts2.8", "@types/is-my-json-valid@ts2.8", "@types/is-number@ts2.8", "@types/is-object@ts2.8", "@types/is-path-cwd@ts2.8", "@types/is-path-in-cwd@ts2.8", "@types/is-promise@ts2.8", "@types/is-scoped@ts2.8", "@types/is-stream@ts2.8", "@types/is-svg@ts2.8", "@types/is-url@ts2.8", "@types/is-windows@ts2.8", "@types/istanbul-lib-coverage@ts2.8", "@types/istanbul-lib-hook@ts2.8", "@types/istanbul-lib-instrument@ts2.8", "@types/istanbul-lib-report@ts2.8", "@types/istanbul-lib-source-maps@ts2.8", "@types/istanbul-reports@ts2.8", "@types/jest-diff@ts2.8", "@types/jest-docblock@ts2.8", "@types/jest-get-type@ts2.8", "@types/jest-matcher-utils@ts2.8", "@types/jest-validate@ts2.8", "@types/jpeg-js@ts2.8", "@types/js-base64@ts2.8", "@types/js-string-escape@ts2.8", "@types/js-yaml@ts2.8", "@types/jsbn@ts2.8", "@types/jsdom@ts2.8", "@types/jsesc@ts2.8", "@types/json-parse-better-errors@ts2.8", "@types/json-schema@ts2.8", "@types/json-stable-stringify@ts2.8", "@types/json-stringify-safe@ts2.8", "@types/json5@ts2.8", "@types/jsonfile@ts2.8", "@types/jsontoxml@ts2.8", "@types/jss@ts2.8", "@types/keygrip@ts2.8", "@types/keymirror@ts2.8", "@types/keyv@ts2.8", "@types/klaw@ts2.8", "@types/koa-send@ts2.8", "@types/leven@ts2.8", "@types/listr@ts2.8", "@types/load-json-file@ts2.8", "@types/loader-runner@ts2.8", "@types/loader-utils@ts2.8", "@types/locate-path@ts2.8", "@types/lodash-es@ts2.8", "@types/lodash.assign@ts2.8", "@types/lodash.camelcase@ts2.8", "@types/lodash.clonedeep@ts2.8", "@types/lodash.debounce@ts2.8", "@types/lodash.escape@ts2.8", "@types/lodash.flowright@ts2.8", "@types/lodash.get@ts2.8", "@types/lodash.isarguments@ts2.8", "@types/lodash.isarray@ts2.8", "@types/lodash.isequal@ts2.8", "@types/lodash.isobject@ts2.8", "@types/lodash.isstring@ts2.8", "@types/lodash.keys@ts2.8", "@types/lodash.memoize@ts2.8", "@types/lodash.merge@ts2.8", "@types/lodash.mergewith@ts2.8", "@types/lodash.pick@ts2.8", "@types/lodash.sortby@ts2.8", "@types/lodash.tail@ts2.8", "@types/lodash.template@ts2.8", "@types/lodash.throttle@ts2.8", "@types/lodash.unescape@ts2.8", "@types/lodash.uniq@ts2.8", "@types/log-symbols@ts2.8", "@types/log-update@ts2.8", "@types/loglevel@ts2.8", "@types/loud-rejection@ts2.8", "@types/lru-cache@ts2.8", "@types/make-dir@ts2.8", "@types/map-obj@ts2.8", "@types/media-typer@ts2.8", "@types/mem@ts2.8", "@types/mem-fs@ts2.8", "@types/memory-fs@ts2.8", "@types/meow@ts2.8", "@types/merge-descriptors@ts2.8", "@types/merge-stream@ts2.8", "@types/methods@ts2.8", "@types/micromatch@ts2.8", "@types/mime@ts2.8", "@types/mime-db@ts2.8", "@types/mime-types@ts2.8", "@types/minimatch@ts2.8", "@types/minimist@ts2.8", "@types/minipass@ts2.8", "@types/mkdirp@ts2.8", "@types/mongodb@ts2.8", "@types/morgan@ts2.8", "@types/move-concurrently@ts2.8", "@types/ms@ts2.8", "@types/msgpack-lite@ts2.8", "@types/multimatch@ts2.8", "@types/mz@ts2.8", "@types/negotiator@ts2.8", "@types/node-dir@ts2.8", "@types/node-fetch@ts2.8", "@types/node-forge@ts2.8", "@types/node-int64@ts2.8", "@types/node-ipc@ts2.8", "@types/node-notifier@ts2.8", "@types/nomnom@ts2.8", "@types/nopt@ts2.8", "@types/normalize-package-data@ts2.8", "@types/normalize-url@ts2.8", "@types/number-is-nan@ts2.8", "@types/object-assign@ts2.8", "@types/on-finished@ts2.8", "@types/on-headers@ts2.8", "@types/once@ts2.8", "@types/onetime@ts2.8", "@types/opener@ts2.8", "@types/opn@ts2.8", "@types/optimist@ts2.8", "@types/ora@ts2.8", "@types/os-homedir@ts2.8", "@types/os-locale@ts2.8", "@types/os-tmpdir@ts2.8", "@types/p-cancelable@ts2.8", "@types/p-each-series@ts2.8", "@types/p-event@ts2.8", "@types/p-lazy@ts2.8", "@types/p-limit@ts2.8", "@types/p-locate@ts2.8", "@types/p-map@ts2.8", "@types/p-map-series@ts2.8", "@types/p-reduce@ts2.8", "@types/p-timeout@ts2.8", "@types/p-try@ts2.8", "@types/pako@ts2.8", "@types/parse-glob@ts2.8", "@types/parse-json@ts2.8", "@types/parseurl@ts2.8", "@types/path-exists@ts2.8", "@types/path-is-absolute@ts2.8", "@types/path-parse@ts2.8", "@types/pg-pool@ts2.8", "@types/pg-types@ts2.8", "@types/pify@ts2.8", "@types/pixelmatch@ts2.8", "@types/pkg-dir@ts2.8", "@types/pluralize@ts2.8", "@types/pngjs@ts2.8", "@types/prelude-ls@ts2.8", "@types/pretty-bytes@ts2.8", "@types/pretty-format@ts2.8", "@types/progress@ts2.8", "@types/promise-retry@ts2.8", "@types/proxy-addr@ts2.8", "@types/pump@ts2.8", "@types/q@ts2.8", "@types/qs@ts2.8", "@types/range-parser@ts2.8", "@types/rc@ts2.8", "@types/rc-select@ts2.8", "@types/rc-slider@ts2.8", "@types/rc-tooltip@ts2.8", "@types/rc-tree@ts2.8", "@types/react-event-listener@ts2.8", "@types/react-side-effect@ts2.8", "@types/react-slick@ts2.8", "@types/read-chunk@ts2.8", "@types/read-pkg@ts2.8", "@types/read-pkg-up@ts2.8", "@types/recompose@ts2.8", "@types/recursive-readdir@ts2.8", "@types/relateurl@ts2.8", "@types/replace-ext@ts2.8", "@types/request@ts2.8", "@types/request-promise-native@ts2.8", "@types/require-directory@ts2.8", "@types/require-from-string@ts2.8", "@types/require-relative@ts2.8", "@types/resolve@ts2.8", "@types/resolve-from@ts2.8", "@types/retry@ts2.8", "@types/rx@ts2.8", "@types/rx-lite@ts2.8", "@types/rx-lite-aggregates@ts2.8", "@types/safe-regex@ts2.8", "@types/sane@ts2.8", "@types/sass-graph@ts2.8", "@types/sax@ts2.8", "@types/scriptjs@ts2.8", "@types/semver@ts2.8", "@types/send@ts2.8", "@types/serialize-javascript@ts2.8", "@types/serve-index@ts2.8", "@types/serve-static@ts2.8", "@types/set-value@ts2.8", "@types/shallowequal@ts2.8", "@types/shelljs@ts2.8", "@types/sockjs@ts2.8", "@types/sockjs-client@ts2.8", "@types/source-list-map@ts2.8", "@types/source-map-support@ts2.8", "@types/spdx-correct@ts2.8", "@types/spdy@ts2.8", "@types/split@ts2.8", "@types/sprintf@ts2.8", "@types/sprintf-js@ts2.8", "@types/sqlstring@ts2.8", "@types/sshpk@ts2.8", "@types/stack-utils@ts2.8", "@types/stat-mode@ts2.8", "@types/statuses@ts2.8", "@types/strict-uri-encode@ts2.8", "@types/string-template@ts2.8", "@types/strip-ansi@ts2.8", "@types/strip-bom@ts2.8", "@types/strip-json-comments@ts2.8", "@types/supports-color@ts2.8", "@types/svg2png@ts2.8", "@types/svgo@ts2.8", "@types/table@ts2.8", "@types/tapable@ts2.8", "@types/tar@ts2.8", "@types/temp@ts2.8", "@types/tempfile@ts2.8", "@types/through@ts2.8", "@types/through2@ts2.8", "@types/tinycolor2@ts2.8", "@types/tmp@ts2.8", "@types/to-absolute-glob@ts2.8", "@types/tough-cookie@ts2.8", "@types/trim@ts2.8", "@types/tryer@ts2.8", "@types/type-check@ts2.8", "@types/type-is@ts2.8", "@types/ua-parser-js@ts2.8", "@types/uglify-js@ts2.8", "@types/uglifyjs-webpack-plugin@ts2.8", "@types/underscore@ts2.8", "@types/uniq@ts2.8", "@types/uniqid@ts2.8", "@types/untildify@ts2.8", "@types/urijs@ts2.8", "@types/url-join@ts2.8", "@types/url-parse@ts2.8", "@types/url-regex@ts2.8", "@types/user-home@ts2.8", "@types/util-deprecate@ts2.8", "@types/util.promisify@ts2.8", "@types/utils-merge@ts2.8", "@types/uuid@ts2.8", "@types/vali-date@ts2.8", "@types/vary@ts2.8", "@types/verror@ts2.8", "@types/vinyl@ts2.8", "@types/vinyl-fs@ts2.8", "@types/warning@ts2.8", "@types/watch@ts2.8", "@types/watchpack@ts2.8", "@types/webpack-dev-middleware@ts2.8", "@types/webpack-sources@ts2.8", "@types/which@ts2.8", "@types/window-size@ts2.8", "@types/wrap-ansi@ts2.8", "@types/write-file-atomic@ts2.8", "@types/ws@ts2.8", "@types/xml2js@ts2.8", "@types/xmlbuilder@ts2.8", "@types/xtend@ts2.8", "@types/yallist@ts2.8", "@types/yargs@ts2.8", "@types/yauzl@ts2.8", "@types/yeoman-generator@ts2.8", "@types/zen-observable@ts2.8", "@types/react-content-loader@ts2.8"]; + const expectedCommands = [ + TI.getNpmCommandForInstallation(npmPath, tsVersion, packageNames, packageNames.length).command, + TI.getNpmCommandForInstallation(npmPath, tsVersion, packageNames, packageNames.length - Math.ceil(packageNames.length / 2)).command + ]; + it("works when the command is too long to install all packages at once", () => { + const commands: string[] = []; + const hasError = TI.installNpmPackages(npmPath, tsVersion, packageNames, command => { + commands.push(command); + return false; + }); + assert.isFalse(hasError); + assert.deepEqual(commands, expectedCommands, "commands"); + }); + + it("installs remaining packages when one of the partial command fails", () => { + const commands: string[] = []; + const hasError = TI.installNpmPackages(npmPath, tsVersion, packageNames, command => { + commands.push(command); + return commands.length === 1; + }); + assert.isTrue(hasError); + assert.deepEqual(commands, expectedCommands, "commands"); + }); + }); } diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index ea1af7c9519..1c51444fa55 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -3972,7 +3972,7 @@ interface Document extends Node, GlobalEventHandlers, ParentNode, DocumentEvent /** * Retrieves a value that indicates the current state of the object. */ - readonly readyState: string; + readonly readyState: DocumentReadyState; /** * Gets the URL of the location that referred the user to the current page. */ @@ -4231,6 +4231,7 @@ interface Document extends Node, GlobalEventHandlers, ParentNode, DocumentEvent */ queryCommandValue(commandId: string): string; releaseEvents(): void; + updateSettings(): void; webkitCancelFullScreen(): void; webkitExitFullscreen(): void; /** @@ -6255,7 +6256,7 @@ interface HTMLInputElement extends HTMLElement { /** * Returns a FileList object on a file type input object. */ - readonly files: FileList | null; + files: FileList | null; /** * Retrieves a reference to the form that the object is embedded in. */ @@ -12857,6 +12858,7 @@ interface SourceBuffer extends EventTarget { readonly audioTracks: AudioTrackList; readonly buffered: TimeRanges; mode: AppendMode; + readonly textTracks: TextTrackList; timestampOffset: number; readonly updating: boolean; readonly videoTracks: VideoTrackList; @@ -14797,6 +14799,8 @@ declare var WheelEvent: { interface WindowEventMap extends GlobalEventHandlersEventMap { "abort": UIEvent; + "afterprint": Event; + "beforeprint": Event; "beforeunload": BeforeUnloadEvent; "blur": FocusEvent; "canplay": Event; @@ -14928,6 +14932,8 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window readonly navigator: Navigator; offscreenBuffering: string | boolean; onabort: ((this: Window, ev: UIEvent) => any) | null; + onafterprint: ((this: Window, ev: Event) => any) | null; + onbeforeprint: ((this: Window, ev: Event) => any) | null; onbeforeunload: ((this: Window, ev: BeforeUnloadEvent) => any) | null; onblur: ((this: Window, ev: FocusEvent) => any) | null; oncanplay: ((this: Window, ev: Event) => any) | null; @@ -15738,6 +15744,8 @@ declare const name: never; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; declare var onabort: ((this: Window, ev: UIEvent) => any) | null; +declare var onafterprint: ((this: Window, ev: Event) => any) | null; +declare var onbeforeprint: ((this: Window, ev: Event) => any) | null; declare var onbeforeunload: ((this: Window, ev: BeforeUnloadEvent) => any) | null; declare var onblur: ((this: Window, ev: FocusEvent) => any) | null; declare var oncanplay: ((this: Window, ev: Event) => any) | null; @@ -15982,6 +15990,7 @@ type ChannelCountMode = "max" | "clamped-max" | "explicit"; type ChannelInterpretation = "speakers" | "discrete"; type DisplayCaptureSurfaceType = "monitor" | "window" | "application" | "browser"; type DistanceModelType = "linear" | "inverse" | "exponential"; +type DocumentReadyState = "loading" | "interactive" | "complete"; type EndOfStreamError = "network" | "decode"; type ExpandGranularity = "character" | "word" | "sentence" | "textedit"; type GamepadHand = "" | "left" | "right"; diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 9d38f3c2c7c..384d45cd75f 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -774,8 +774,7 @@ interface Date { interface DateConstructor { new(): Date; - new(value: number): Date; - new(value: string): Date; + new(value: number | string): Date; new(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; (): string; readonly prototype: Date; diff --git a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl index d9049756bd2..c2b2cf32cde 100644 --- a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -639,6 +639,15 @@ + + + + + + + + + @@ -897,18 +906,27 @@ + + + + + + + + + @@ -933,6 +951,9 @@ + + + @@ -960,6 +981,9 @@ + + + @@ -978,6 +1002,9 @@ + + + @@ -996,18 +1023,27 @@ + + + + + + + + + @@ -1518,6 +1554,9 @@ + + + @@ -2145,18 +2184,27 @@ + + + + + + + + + @@ -2469,12 +2517,18 @@ + + + + + + @@ -2658,6 +2712,9 @@ + + + @@ -3708,6 +3765,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -3819,6 +3897,15 @@ + + + + + + + + + @@ -4026,12 +4113,18 @@ + + + + + + @@ -4233,6 +4326,9 @@ + + + @@ -4350,6 +4446,9 @@ + + + @@ -4845,6 +4944,9 @@ + + + @@ -4941,6 +5043,24 @@ + + + + + + + + + + + + + + + + + + @@ -5835,6 +5955,9 @@ + + + @@ -5892,6 +6015,15 @@ + + + + + + + + + @@ -6738,6 +6870,9 @@ + + + @@ -7479,11 +7614,11 @@ - + - + - + @@ -7803,6 +7938,15 @@ + + + + + + + + + @@ -7812,6 +7956,15 @@ + + + + + + + + + @@ -7866,6 +8019,24 @@ + + + + + + + + + + + + + + + + + + @@ -7944,6 +8115,15 @@ + + + + + + + + + @@ -7971,24 +8151,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl index 8c72ca29d98..efac12c6e66 100644 --- a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -642,6 +642,9 @@ + + + @@ -903,18 +906,27 @@ + + + + + + + + + @@ -939,6 +951,9 @@ + + + @@ -966,6 +981,9 @@ + + + @@ -984,6 +1002,9 @@ + + + @@ -1002,18 +1023,27 @@ + + + + + + + + + @@ -1524,6 +1554,9 @@ + + + @@ -2151,18 +2184,27 @@ + + + + + + + + + @@ -2475,12 +2517,18 @@ + + + + + + @@ -2664,6 +2712,9 @@ + + + @@ -3714,6 +3765,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -3825,6 +3897,15 @@ + + + + + + + + + @@ -4032,12 +4113,18 @@ + + + + + + @@ -4239,6 +4326,9 @@ + + + @@ -4356,6 +4446,9 @@ + + + @@ -4851,6 +4944,9 @@ + + + @@ -4950,12 +5046,18 @@ + + + + + + @@ -5853,6 +5955,9 @@ + + + @@ -5910,6 +6015,15 @@ + + + + + + + + + @@ -6756,6 +6870,9 @@ + + + @@ -7500,6 +7617,9 @@ + + + @@ -7821,6 +7941,9 @@ + + + @@ -7836,6 +7959,9 @@ + + + @@ -7896,12 +8022,18 @@ + + + + + + @@ -7986,6 +8118,9 @@ + + + diff --git a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl index 445e24e307a..0ef1aeed0cc 100644 --- a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1,9449 +1,9611 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - or -. For example '{0}' or '{1}'.]]> - - nebo . Třeba {0} nebo {1}.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - type.]]> - - .]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ()' instead.]]> - - ().]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + or -. For example '{0}' or '{1}'.]]> + + nebo . Třeba {0} nebo {1}.]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + type.]]> + + .]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ()' instead.]]> + + ().]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl index 59a85c71fac..58326d7ccb6 100644 --- a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -639,6 +639,9 @@ + + + @@ -900,18 +903,27 @@ + + + + + + + + + @@ -936,6 +948,9 @@ + + + @@ -963,6 +978,9 @@ + + + @@ -981,6 +999,9 @@ + + + @@ -999,18 +1020,27 @@ + + + + + + + + + @@ -1521,6 +1551,9 @@ + + + @@ -2148,18 +2181,27 @@ + + + + + + + + + @@ -2472,12 +2514,18 @@ + + + + + + @@ -2661,6 +2709,9 @@ + + + @@ -3711,6 +3762,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -4029,12 +4101,18 @@ + + + + + + @@ -4236,6 +4314,9 @@ + + + @@ -4353,6 +4434,9 @@ + + + @@ -4848,6 +4932,9 @@ + + + @@ -4947,12 +5034,18 @@ + + + + + + @@ -5847,6 +5940,9 @@ + + + @@ -5904,6 +6000,12 @@ + + + + + + @@ -6750,6 +6852,9 @@ + + + @@ -7494,6 +7599,9 @@ + + + @@ -7815,6 +7923,9 @@ + + + @@ -7830,6 +7941,9 @@ + + + @@ -7890,12 +8004,18 @@ + + + + + + @@ -7980,6 +8100,9 @@ + + + diff --git a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl index f15d2bebcbd..259d4b3b90e 100644 --- a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -651,6 +651,9 @@ + + + @@ -912,18 +915,27 @@ + + + + + + + + + @@ -948,6 +960,9 @@ + + + @@ -975,6 +990,9 @@ + + + @@ -993,6 +1011,9 @@ + + + @@ -1011,18 +1032,27 @@ + + + + + + + + + @@ -1533,6 +1563,9 @@ + + + @@ -2160,18 +2193,27 @@ + + + + + + + + + @@ -2484,12 +2526,18 @@ + + + + + + @@ -2673,6 +2721,9 @@ + + + @@ -3723,6 +3774,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -3834,6 +3906,15 @@ + + + + + + + + + @@ -4041,12 +4122,18 @@ + + + + + + @@ -4248,6 +4335,9 @@ + + + @@ -4365,6 +4455,9 @@ + + + @@ -4860,6 +4953,9 @@ + + + @@ -4959,12 +5055,18 @@ + + + + + + @@ -5862,6 +5964,9 @@ + + + @@ -5919,6 +6024,15 @@ + + + + + + + + + @@ -6765,6 +6879,9 @@ + + + @@ -7509,6 +7626,9 @@ + + + @@ -7830,6 +7950,9 @@ + + + @@ -7845,6 +7968,9 @@ + + + @@ -7905,12 +8031,18 @@ + + + + + + @@ -7995,6 +8127,9 @@ + + + diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl index 7e2db8b9d73..52881bd0f4e 100644 --- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -651,6 +651,9 @@ + + + @@ -912,18 +915,27 @@ + + + + + + + + + @@ -948,6 +960,9 @@ + + + @@ -975,6 +990,9 @@ + + + @@ -993,6 +1011,9 @@ + + + @@ -1011,18 +1032,27 @@ + + + + + + + + + @@ -1533,6 +1563,9 @@ + + + @@ -2160,18 +2193,27 @@ + + + + + + + + + @@ -2484,12 +2526,18 @@ + + + + + + @@ -2673,6 +2721,9 @@ + + + @@ -3723,6 +3774,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -4041,12 +4113,18 @@ + + + + + + @@ -4248,6 +4326,9 @@ + + + @@ -4365,6 +4446,9 @@ + + + @@ -4860,6 +4944,9 @@ + + + @@ -4959,12 +5046,18 @@ + + + + + + @@ -5862,6 +5955,9 @@ + + + @@ -5919,6 +6015,12 @@ + + + + + + @@ -6765,6 +6867,9 @@ + + + @@ -7509,6 +7614,9 @@ + + + @@ -7830,6 +7938,9 @@ + + + @@ -7845,6 +7956,9 @@ + + + @@ -7905,12 +8019,18 @@ + + + + + + @@ -7995,6 +8115,9 @@ + + + diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl index 039d49348d2..f68671fdc91 100644 --- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1,9440 +1,9602 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - or -. For example '{0}' or '{1}'.]]> - - o -, ad esempio, '{0}' o '{1}'.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - type.]]> - - .]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ()' instead.]]> - - ()'.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + or -. For example '{0}' or '{1}'.]]> + + o -, ad esempio, '{0}' o '{1}'.]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + type.]]> + + .]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ()' instead.]]> + + ()'.]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 2b7d1bb6a4d..43d2f167e96 100644 --- a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -642,6 +642,9 @@ + + + @@ -903,18 +906,27 @@ + + + + + + + + + @@ -939,6 +951,9 @@ + + + @@ -966,6 +981,9 @@ + + + @@ -984,6 +1002,9 @@ + + + @@ -1002,18 +1023,27 @@ + + + + + + + + + @@ -1524,6 +1554,9 @@ + + + @@ -2151,18 +2184,27 @@ + + + + + + + + + @@ -2475,12 +2517,18 @@ + + + + + + @@ -2664,6 +2712,9 @@ + + + @@ -3714,6 +3765,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -3825,6 +3897,15 @@ + + + + + + + + + @@ -4032,12 +4113,18 @@ + + + + + + @@ -4239,6 +4326,9 @@ + + + @@ -4356,6 +4446,9 @@ + + + @@ -4851,6 +4944,9 @@ + + + @@ -4950,12 +5046,18 @@ + + + + + + @@ -5853,6 +5955,9 @@ + + + @@ -5910,6 +6015,15 @@ + + + + + + + + + @@ -6756,6 +6870,9 @@ + + + @@ -7500,6 +7617,9 @@ + + + @@ -7821,6 +7941,9 @@ + + + @@ -7836,6 +7959,9 @@ + + + @@ -7896,12 +8022,18 @@ + + + + + + @@ -7986,6 +8118,9 @@ + + + diff --git a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl index 4e6c5ceb1d7..4b42ff8b2bf 100644 --- a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -639,6 +639,15 @@ + + + + + + + + + @@ -897,18 +906,27 @@ + + + + + + + + + @@ -933,6 +951,9 @@ + + + @@ -960,6 +981,9 @@ + + + @@ -978,6 +1002,9 @@ + + + @@ -996,18 +1023,27 @@ + + + + + + + + + @@ -1518,6 +1554,9 @@ + + + @@ -2145,18 +2184,27 @@ + + + + + + + + + @@ -2469,12 +2517,18 @@ + + + + + + @@ -2658,6 +2712,9 @@ + + + @@ -3708,6 +3765,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -4026,12 +4104,18 @@ + + + + + + @@ -4233,6 +4317,9 @@ + + + @@ -4350,6 +4437,9 @@ + + + @@ -4845,6 +4935,9 @@ + + + @@ -4941,6 +5034,24 @@ + + + + + + + + + + + + + + + + + + @@ -5835,6 +5946,9 @@ + + + @@ -5892,6 +6006,12 @@ + + + + + + @@ -6738,6 +6858,9 @@ + + + @@ -7479,11 +7602,11 @@ - + - + - + @@ -7803,6 +7926,15 @@ + + + + + + + + + @@ -7812,6 +7944,15 @@ + + + + + + + + + @@ -7866,6 +8007,24 @@ + + + + + + + + + + + + + + + + + + @@ -7944,6 +8103,15 @@ + + + + + + + + + @@ -7971,24 +8139,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl index e6b0f9c5ea1..36e67c41077 100644 --- a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -629,6 +629,15 @@ + + + + + + + + + @@ -887,18 +896,27 @@ + + + + + + + + + @@ -923,6 +941,9 @@ + + + @@ -950,6 +971,9 @@ + + + @@ -968,6 +992,9 @@ + + + @@ -986,18 +1013,27 @@ + + + + + + + + + @@ -1508,6 +1544,9 @@ + + + @@ -2135,18 +2174,27 @@ + + + + + + + + + @@ -2459,12 +2507,18 @@ + + + + + + @@ -2648,6 +2702,9 @@ + + + @@ -3698,6 +3755,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -3809,6 +3887,15 @@ + + + + + + + + + @@ -4016,12 +4103,18 @@ + + + + + + @@ -4223,6 +4316,9 @@ + + + @@ -4340,6 +4436,9 @@ + + + @@ -4835,6 +4934,9 @@ + + + @@ -4931,6 +5033,24 @@ + + + + + + + + + + + + + + + + + + @@ -5822,6 +5942,9 @@ + + + @@ -5879,6 +6002,15 @@ + + + + + + + + + @@ -6725,6 +6857,9 @@ + + + @@ -7466,11 +7601,11 @@ - + - + - + @@ -7790,6 +7925,15 @@ + + + + + + + + + @@ -7799,6 +7943,15 @@ + + + + + + + + + @@ -7853,6 +8006,24 @@ + + + + + + + + + + + + + + + + + + @@ -7931,6 +8102,15 @@ + + + + + + + + + @@ -7958,24 +8138,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl index 1193ef96da0..473da1a4a01 100644 --- a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -632,6 +632,9 @@ + + + @@ -893,18 +896,27 @@ + + + + + + + + + @@ -929,6 +941,9 @@ + + + @@ -956,6 +971,9 @@ + + + @@ -974,6 +992,9 @@ + + + @@ -992,18 +1013,27 @@ + + + + + + + + + @@ -1514,6 +1544,9 @@ + + + @@ -2141,18 +2174,27 @@ + + + + + + + + + @@ -2465,12 +2507,18 @@ + + + + + + @@ -2654,6 +2702,9 @@ + + + @@ -3704,6 +3755,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -4022,12 +4094,18 @@ + + + + + + @@ -4229,6 +4307,9 @@ + + + @@ -4346,6 +4427,9 @@ + + + @@ -4841,6 +4925,9 @@ + + + @@ -4937,6 +5024,24 @@ + + + + + + + + + + + + + + + + + + @@ -5828,6 +5933,9 @@ + + + @@ -5885,6 +5993,12 @@ + + + + + + @@ -6731,6 +6845,9 @@ + + + @@ -7475,6 +7592,9 @@ + + + @@ -7796,6 +7916,9 @@ + + + @@ -7811,6 +7934,9 @@ + + + @@ -7871,12 +7997,18 @@ + + + + + + @@ -7958,6 +8090,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl index 6db9253c036..07d26979bf8 100644 --- a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -638,6 +638,15 @@ + + + + + + + + + @@ -896,18 +905,27 @@ + + + + + + + + + @@ -932,6 +950,9 @@ + + + @@ -959,6 +980,9 @@ + + + @@ -977,6 +1001,9 @@ + + + @@ -995,18 +1022,27 @@ + + + + + + + + + @@ -1517,6 +1553,9 @@ + + + @@ -2144,18 +2183,27 @@ + + + + + + + + + @@ -2468,12 +2516,18 @@ + + + + + + @@ -2657,6 +2711,9 @@ + + + @@ -3707,6 +3764,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -3818,6 +3896,15 @@ + + + + + + + + + @@ -4025,12 +4112,18 @@ + + + + + + @@ -4232,6 +4325,9 @@ + + + @@ -4349,6 +4445,9 @@ + + + @@ -4844,6 +4943,9 @@ + + + @@ -4940,6 +5042,24 @@ + + + + + + + + + + + + + + + + + + @@ -5834,6 +5954,9 @@ + + + @@ -5891,6 +6014,15 @@ + + + + + + + + + @@ -6737,6 +6869,9 @@ + + + @@ -7478,11 +7613,11 @@ - + - + - + @@ -7802,6 +7937,15 @@ + + + + + + + + + @@ -7811,6 +7955,15 @@ + + + + + + + + + @@ -7865,6 +8018,24 @@ + + + + + + + + + + + + + + + + + + @@ -7943,6 +8114,15 @@ + + + + + + + + + @@ -7970,24 +8150,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 5a9ac5ff177..1ac1d8a83e6 100644 --- a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -632,6 +632,15 @@ + + + + + + + + + @@ -890,18 +899,27 @@ + + + + + + + + + @@ -926,6 +944,9 @@ + + + @@ -953,6 +974,9 @@ + + + @@ -971,6 +995,9 @@ + + + @@ -989,18 +1016,27 @@ + + + + + + + + + @@ -1511,6 +1547,9 @@ + + + @@ -2138,18 +2177,27 @@ + + + + + + + + + @@ -2462,12 +2510,18 @@ + + + + + + @@ -2651,6 +2705,9 @@ + + + @@ -3701,6 +3758,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -4019,12 +4097,18 @@ + + + + + + @@ -4226,6 +4310,9 @@ + + + @@ -4343,6 +4430,9 @@ + + + @@ -4838,6 +4928,9 @@ + + + @@ -4934,6 +5027,24 @@ + + + + + + + + + + + + + + + + + + @@ -5828,6 +5939,9 @@ + + + @@ -5885,6 +5999,12 @@ + + + + + + @@ -6731,6 +6851,9 @@ + + + @@ -7472,11 +7595,11 @@ - + - + - + @@ -7796,6 +7919,15 @@ + + + + + + + + + @@ -7805,6 +7937,15 @@ + + + + + + + + + @@ -7859,6 +8000,24 @@ + + + + + + + + + + + + + + + + + + @@ -7937,6 +8096,15 @@ + + + + + + + + + @@ -7964,24 +8132,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/server/client.ts b/src/server/client.ts index 98fb130dbb3..2238734e90c 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -1,5 +1,3 @@ -/// - namespace ts.server { export interface SessionClientHost extends LanguageServiceHost { writeMessage(message: string): void; @@ -353,11 +351,11 @@ namespace ts.server { return this.getDiagnostics(file, CommandNames.SuggestionDiagnosticsSync); } - private getDiagnostics(file: string, command: CommandNames) { + private getDiagnostics(file: string, command: CommandNames): Diagnostic[] { const request = this.processRequest(command, { file, includeLinePosition: true }); const response = this.processResponse(request); - return (response.body).map(entry => { + return (response.body).map((entry): Diagnostic => { const category = firstDefined(Object.keys(DiagnosticCategory), id => isString(id) && entry.category === id.toLowerCase() ? (DiagnosticCategory)[id] : undefined); return { @@ -366,7 +364,8 @@ namespace ts.server { length: entry.length, messageText: entry.message, category: Debug.assertDefined(category, "convertDiagnostic: category should not be undefined"), - code: entry.code + code: entry.code, + reportsUnnecessary: entry.reportsUnnecessary, }; }); } @@ -557,7 +556,8 @@ namespace ts.server { const request = this.processRequest(CommandNames.GetCodeFixes, args); const response = this.processResponse(request); - return response.body.map(({ description, changes, fixId, fixAllDescription }) => ({ description, changes: this.convertChanges(changes, file), fixId, fixAllDescription })); + return response.body.map(({ fixName, description, changes, commands, fixId, fixAllDescription }) => + ({ fixName, description, changes: this.convertChanges(changes, file), commands: commands as CodeActionCommand[], fixId, fixAllDescription })); } getCombinedCodeFix = notImplemented; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 386aa262964..1f8f9d3b21b 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1,11 +1,3 @@ -/// -/// -/// -/// -/// -/// -/// - namespace ts.server { export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024; @@ -311,6 +303,7 @@ namespace ts.server { pluginProbeLocations?: ReadonlyArray; allowLocalPluginLoads?: boolean; typesMapLocation?: string; + syntaxOnly?: boolean; } function getDetailWatchInfo(watchType: WatchType, project: Project | undefined) { @@ -391,6 +384,7 @@ namespace ts.server { public readonly useSingleInferredProject: boolean; public readonly useInferredProjectPerProjectRoot: boolean; public readonly typingsInstaller: ITypingsInstaller; + private readonly globalCacheLocationDirectoryPath: Path; public readonly throttleWaitMilliseconds?: number; private readonly eventHandler?: ProjectServiceEventHandler; private readonly suppressDiagnosticEvents?: boolean; @@ -400,6 +394,8 @@ namespace ts.server { public readonly allowLocalPluginLoads: boolean; public readonly typesMapLocation: string | undefined; + public readonly syntaxOnly?: boolean; + /** Tracks projects that we have already sent telemetry for. */ private readonly seenProjects = createMap(); @@ -420,6 +416,7 @@ namespace ts.server { this.pluginProbeLocations = opts.pluginProbeLocations || emptyArray; this.allowLocalPluginLoads = !!opts.allowLocalPluginLoads; this.typesMapLocation = (opts.typesMapLocation === undefined) ? combinePaths(this.getExecutingFilePath(), "../typesMap.json") : opts.typesMapLocation; + this.syntaxOnly = opts.syntaxOnly; Debug.assert(!!this.host.createHash, "'ServerHost.createHash' is required for ProjectService"); if (this.host.realpath) { @@ -427,6 +424,8 @@ namespace ts.server { } this.currentDirectory = this.host.getCurrentDirectory(); this.toCanonicalFileName = createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); + this.globalCacheLocationDirectoryPath = this.typingsInstaller.globalTypingsCacheLocation && + ensureTrailingDirectorySeparator(this.toPath(this.typingsInstaller.globalTypingsCacheLocation)); this.throttledOperations = new ThrottledOperations(this.host, this.logger); if (this.typesMapLocation) { @@ -544,10 +543,11 @@ namespace ts.server { else { if (this.pendingEnsureProjectForOpenFiles) { this.ensureProjectForOpenFiles(); + + // Send the event to notify that there were background project updates + // send current list of open files + this.sendProjectsUpdatedInBackgroundEvent(); } - // Send the event to notify that there were background project updates - // send current list of open files - this.sendProjectsUpdatedInBackgroundEvent(); } }); } @@ -638,7 +638,6 @@ namespace ts.server { return undefined; } if (isInferredProjectName(projectName)) { - this.ensureProjectStructuresUptoDate(); return findProjectByName(projectName, this.inferredProjects); } return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(toNormalizedPath(projectName)); @@ -1197,6 +1196,11 @@ namespace ts.server { private forEachConfigFileLocation(info: ScriptInfo, action: (configFileName: NormalizedPath, canonicalConfigFilePath: string) => boolean | void, projectRootPath?: NormalizedPath) { + + if (this.syntaxOnly) { + return undefined; + } + let searchPath = asNormalizedPath(getDirectoryPath(info.fileName)); while (!projectRootPath || containsPath(projectRootPath, searchPath, this.currentDirectory, !this.host.useCaseSensitiveFileNames)) { @@ -1729,7 +1733,10 @@ namespace ts.server { private watchClosedScriptInfo(info: ScriptInfo) { Debug.assert(!info.fileWatcher); // do not watch files with mixed content - server doesn't know how to interpret it - if (!info.isDynamicOrHasMixedContent()) { + // do not watch files in the global cache location + if (!info.isDynamicOrHasMixedContent() && + (!this.globalCacheLocationDirectoryPath || + !startsWith(info.path, this.globalCacheLocationDirectoryPath))) { const { fileName } = info; info.fileWatcher = this.watchFactory.watchFilePath( this.host, @@ -1827,11 +1834,11 @@ namespace ts.server { this.logger.info(`Host information ${args.hostInfo}`); } if (args.formatOptions) { - mergeMapLikes(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); + this.hostConfiguration.formatCodeOptions = { ...this.hostConfiguration.formatCodeOptions, ...convertFormatOptions(args.formatOptions) }; this.logger.info("Format host information updated"); } if (args.preferences) { - mergeMapLikes(this.hostConfiguration.preferences, args.preferences); + this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences }; } if (args.extraFileExtensions) { this.hostConfiguration.extraFileExtensions = args.extraFileExtensions; @@ -1987,15 +1994,12 @@ namespace ts.server { return this.openClientFileWithNormalizedPath(toNormalizedPath(fileName), fileContent, scriptKind, /*hasMixedContent*/ false, projectRootPath ? toNormalizedPath(projectRootPath) : undefined); } - private findExternalProjetContainingOpenScriptInfo(info: ScriptInfo): ExternalProject { - for (const proj of this.externalProjects) { - // Ensure project structure is uptodate to check if info is present in external project + private findExternalProjectContainingOpenScriptInfo(info: ScriptInfo): ExternalProject | undefined { + return find(this.externalProjects, proj => { + // Ensure project structure is up-to-date to check if info is present in external project proj.updateGraph(); - if (proj.containsScriptInfo(info)) { - return proj; - } - } - return undefined; + return proj.containsScriptInfo(info); + }); } openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult { @@ -2003,8 +2007,8 @@ namespace ts.server { let configFileErrors: ReadonlyArray; const info = this.getOrCreateScriptInfoOpenedByClientForNormalizedPath(fileName, projectRootPath ? this.getNormalizedAbsolutePath(projectRootPath) : this.currentDirectory, fileContent, scriptKind, hasMixedContent); - let project: ConfiguredProject | ExternalProject = this.findExternalProjetContainingOpenScriptInfo(info); - if (!project) { + let project: ConfiguredProject | ExternalProject | undefined = this.findExternalProjectContainingOpenScriptInfo(info); + if (!project && !this.syntaxOnly) { // Checking syntaxOnly is an optimization configFileName = this.getConfigFileNameForFile(info, projectRootPath); if (configFileName) { project = this.findConfiguredProjectByProjectName(configFileName); @@ -2309,7 +2313,7 @@ namespace ts.server { for (const file of proj.rootFiles) { const normalized = toNormalizedPath(file.fileName); if (getBaseConfigFileName(normalized)) { - if (this.host.fileExists(normalized)) { + if (!this.syntaxOnly && this.host.fileExists(normalized)) { (tsConfigFiles || (tsConfigFiles = [])).push(normalized); } } diff --git a/src/server/project.ts b/src/server/project.ts index c7239fdc94d..1502d107dee 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1,10 +1,3 @@ -/// -/// -/// -/// -/// -/// - namespace ts.server { export enum ProjectKind { @@ -131,7 +124,7 @@ namespace ts.server { // wrapper over the real language service that will suppress all semantic operations protected languageService: LanguageService; - public languageServiceEnabled = true; + public languageServiceEnabled: boolean; readonly trace?: (s: string) => void; readonly realpath?: (path: string) => string; @@ -240,6 +233,8 @@ namespace ts.server { this.compilerOptions.allowNonTsExtensions = true; } + this.languageServiceEnabled = !projectService.syntaxOnly; + this.setInternalCompilerOptionsForEmittingJsFiles(); const host = this.projectService.host; if (this.projectService.logger.loggingEnabled()) { @@ -255,7 +250,7 @@ namespace ts.server { // Use the current directory as resolution root only if the project created using current directory string this.resolutionCache = createResolutionCache(this, currentDirectory && this.currentDirectory, /*logChangesWhenResolvingModule*/ true); - this.languageService = createLanguageService(this, this.documentRegistry); + this.languageService = createLanguageService(this, this.documentRegistry, projectService.syntaxOnly); if (lastFileExceededProgramSize) { this.disableLanguageService(lastFileExceededProgramSize); } @@ -506,7 +501,7 @@ namespace ts.server { } enableLanguageService() { - if (this.languageServiceEnabled) { + if (this.languageServiceEnabled || this.projectService.syntaxOnly) { return; } this.languageServiceEnabled = true; @@ -518,6 +513,7 @@ namespace ts.server { if (!this.languageServiceEnabled) { return; } + Debug.assert(!this.projectService.syntaxOnly); this.languageService.cleanupSemanticCache(); this.languageServiceEnabled = false; this.lastFileExceededProgramSize = lastFileExceededProgramSize; @@ -875,10 +871,12 @@ namespace ts.server { this.dirty = false; this.resolutionCache.finishCachingPerDirectoryResolution(); + Debug.assert(oldProgram === undefined || this.program !== undefined); + // bump up the version if // - oldProgram is not set - this is a first time updateGraph is called // - newProgram is different from the old program and structure of the old program was not reused. - const hasChanges = !oldProgram || (this.program !== oldProgram && !(oldProgram.structureIsReused & StructureIsReused.Completely)); + const hasChanges = this.program && (!oldProgram || (this.program !== oldProgram && !(oldProgram.structureIsReused & StructureIsReused.Completely))); this.hasChangedAutomaticTypeDirectiveNames = false; if (hasChanges) { if (oldProgram) { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 3f0ce3b6d40..7a258a904c2 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -455,6 +455,8 @@ namespace ts.server.protocol { endLocation: Location; category: string; code: number; + /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ + reportsUnnecessary?: {}; } /** @@ -1696,6 +1698,8 @@ namespace ts.server.protocol { } export interface CodeFixAction extends CodeAction { + /** Short name to identify the fix, for use by telemetry. */ + fixName: string; /** * If present, one may call 'getCombinedCodeFix' with this fixId. * This may be omitted to indicate that the code fix can't be applied in a group. @@ -2170,6 +2174,8 @@ namespace ts.server.protocol { */ category: string; + reportsUnnecessary?: {}; + /** * The error code of the diagnostic message. */ @@ -2636,6 +2642,7 @@ namespace ts.server.protocol { } export interface UserPreferences { + readonly disableSuggestions?: boolean; readonly quotePreference?: "double" | "single"; /** * If enabled, TypeScript will search through all external modules' exports and add them to the completions list. diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 843122e44c0..db56973d796 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -1,5 +1,3 @@ -/// - namespace ts.server { /* @internal */ @@ -397,15 +395,18 @@ namespace ts.server { if (formatSettings) { if (!this.formatSettings) { this.formatSettings = getDefaultFormatCodeSettings(this.host); + assign(this.formatSettings, formatSettings); + } + else { + this.formatSettings = { ...this.formatSettings, ...formatSettings }; } - mergeMapLikes(this.formatSettings, formatSettings); } if (preferences) { if (!this.preferences) { - this.preferences = clone(defaultPreferences); + this.preferences = defaultPreferences; } - mergeMapLikes(this.preferences, preferences); + this.preferences = { ...this.preferences, ...preferences }; } } diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index 8a3f43a5434..d57f296e7a7 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts.server { const lineCollectionCapacity = 4; diff --git a/src/server/server.ts b/src/server/server.ts index 4141a36161f..6eff3256349 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts.server { const childProcess: { fork(modulePath: string, args: string[], options?: { execArgv: string[], env?: MapLike }): NodeChildProcess; @@ -211,12 +208,6 @@ namespace ts.server { } } - // E.g. "12:34:56.789" - function nowString() { - const d = new Date(); - return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${d.getMilliseconds()}`; - } - interface QueuedOperation { operationId: string; operation: () => void; @@ -513,6 +504,7 @@ namespace ts.server { logger, canUseEvents: true, suppressDiagnosticEvents, + syntaxOnly, globalPlugins, pluginProbeLocations, allowLocalPluginLoads, @@ -594,11 +586,12 @@ namespace ts.server { const len = args.length - 1; for (let i = 0; i < len; i += 2) { const option = args[i]; - const value = args[i + 1]; + const { value, extraPartCounter } = getEntireValue(i + 1); + i += extraPartCounter; if (option && value) { switch (option) { case "-file": - logEnv.file = stripQuotes(value); + logEnv.file = value; break; case "-level": const level = getLogLevel(value); @@ -614,6 +607,21 @@ namespace ts.server { } } return logEnv; + + function getEntireValue(initialIndex: number) { + let pathStart = args[initialIndex]; + let extraPartCounter = 0; + if (pathStart.charCodeAt(0) === CharacterCodes.doubleQuote && + pathStart.charCodeAt(pathStart.length - 1) !== CharacterCodes.doubleQuote) { + for (let i = initialIndex + 1; i < args.length; i++) { + pathStart += " "; + pathStart += args[i]; + extraPartCounter++; + if (pathStart.charCodeAt(pathStart.length - 1) === CharacterCodes.doubleQuote) break; + } + } + return { value: stripQuotes(pathStart), extraPartCounter }; + } } function getLogLevel(level: string) { @@ -929,6 +937,7 @@ namespace ts.server { const useInferredProjectPerProjectRoot = hasArgument("--useInferredProjectPerProjectRoot"); const disableAutomaticTypingAcquisition = hasArgument("--disableAutomaticTypingAcquisition"); const suppressDiagnosticEvents = hasArgument("--suppressDiagnosticEvents"); + const syntaxOnly = hasArgument("--syntaxOnly"); const telemetryEnabled = hasArgument(Arguments.EnableTelemetry); logger.info(`Starting TS Server`); diff --git a/src/server/session.ts b/src/server/session.ts index 4d39b4d0cf9..1076d17e11f 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1,8 +1,3 @@ -/// -/// -/// -/// - namespace ts.server { interface StackTraceError extends Error { stack?: string; @@ -80,6 +75,7 @@ namespace ts.server { text: flattenDiagnosticMessageText(diag.messageText, "\n"), code: diag.code, category: diagnosticCategoryName(diag), + reportsUnnecessary: diag.reportsUnnecessary, source: diag.source }; } @@ -96,8 +92,8 @@ namespace ts.server { const text = flattenDiagnosticMessageText(diag.messageText, "\n"); const { code, source } = diag; const category = diagnosticCategoryName(diag); - return includeFileName ? { start, end, text, code, category, source, fileName: diag.file && diag.file.fileName } : - { start, end, text, code, category, source }; + return includeFileName ? { start, end, text, code, category, source, reportsUnnecessary: diag.reportsUnnecessary, fileName: diag.file && diag.file.fileName } : + { start, end, text, code, category, reportsUnnecessary: diag.reportsUnnecessary, source }; } export interface PendingErrorCheck { @@ -297,6 +293,7 @@ namespace ts.server { eventHandler?: ProjectServiceEventHandler; /** Has no effect if eventHandler is also specified. */ suppressDiagnosticEvents?: boolean; + syntaxOnly?: boolean; throttleWaitMilliseconds?: number; globalPlugins?: ReadonlyArray; @@ -359,7 +356,8 @@ namespace ts.server { suppressDiagnosticEvents: this.suppressDiagnosticEvents, globalPlugins: opts.globalPlugins, pluginProbeLocations: opts.pluginProbeLocations, - allowLocalPluginLoads: opts.allowLocalPluginLoads + allowLocalPluginLoads: opts.allowLocalPluginLoads, + syntaxOnly: opts.syntaxOnly, }; this.projectService = new ProjectService(settings); this.gcTimer = new GcTimer(this.host, /*delay*/ 7000, this.logger); @@ -482,7 +480,7 @@ namespace ts.server { this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag"); } - private infoCheck(file: NormalizedPath, project: Project) { + private suggestionCheck(file: NormalizedPath, project: Project) { this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag"); } @@ -525,12 +523,20 @@ namespace ts.server { return; } - next.immediate(() => { - this.infoCheck(fileName, project); + const goNext = () => { if (checkList.length > index) { next.delay(followMs, checkOne); } - }); + }; + if (this.getPreferences(fileName).disableSuggestions) { + goNext(); + } + else { + next.immediate(() => { + this.suggestionCheck(fileName, project); + goNext(); + }); + } }); }; @@ -1657,7 +1663,7 @@ namespace ts.server { } } - private getCodeFixes(args: protocol.CodeFixRequestArgs, simplifiedResult: boolean): ReadonlyArray | ReadonlyArray { + private getCodeFixes(args: protocol.CodeFixRequestArgs, simplifiedResult: boolean): ReadonlyArray | ReadonlyArray { if (args.errorCodes.length === 0) { return undefined; } @@ -1667,15 +1673,7 @@ namespace ts.server { const { startPosition, endPosition } = this.getStartAndEndPosition(args, scriptInfo); const codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes, this.getFormatOptions(file), this.getPreferences(file)); - if (!codeActions) { - return undefined; - } - if (simplifiedResult) { - return codeActions.map(codeAction => this.mapCodeAction(project, codeAction)); - } - else { - return codeActions; - } + return simplifiedResult ? codeActions.map(codeAction => this.mapCodeFixAction(project, codeAction)) : codeActions; } private getCombinedCodeFix({ scope, fixId }: protocol.GetCombinedCodeFixRequestArgs, simplifiedResult: boolean): protocol.CombinedCodeActions | CombinedCodeActions { @@ -1723,9 +1721,12 @@ namespace ts.server { return { startPosition, endPosition }; } - private mapCodeAction(project: Project, { description, changes: unmappedChanges, commands, fixId, fixAllDescription }: CodeFixAction): protocol.CodeFixAction { - const changes = unmappedChanges.map(change => this.mapTextChangesToCodeEditsUsingScriptinfo(change, project.getScriptInfoForNormalizedPath(toNormalizedPath(change.fileName)))); - return { description, changes, commands, fixId, fixAllDescription }; + private mapCodeAction(project: Project, { description, changes, commands }: CodeAction): protocol.CodeAction { + return { description, changes: this.mapTextChangesToCodeEdits(project, changes), commands }; + } + + private mapCodeFixAction(project: Project, { fixName, description, changes, commands, fixId, fixAllDescription }: CodeFixAction): protocol.CodeFixAction { + return { fixName, description, changes: this.mapTextChangesToCodeEdits(project, changes), commands, fixId, fixAllDescription }; } private mapTextChangesToCodeEdits(project: Project, textChanges: ReadonlyArray): protocol.FileCodeEdits[] { diff --git a/src/server/shared.ts b/src/server/shared.ts index e8b64ce06ec..a5528b7ba63 100644 --- a/src/server/shared.ts +++ b/src/server/shared.ts @@ -1,5 +1,3 @@ -/// - namespace ts.server { // tslint:disable variable-name export const ActionSet: ActionSet = "action::set"; @@ -33,4 +31,11 @@ namespace ts.server { ? sys.args[index + 1] : undefined; } -} \ No newline at end of file + + /*@internal*/ + export function nowString() { + // E.g. "12:34:56.789" + const d = new Date(); + return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${d.getMilliseconds()}`; + } +} diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index c838a7209d9..dc732604ab6 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -9,17 +9,123 @@ ] }, "files": [ - "../services/shims.ts", + "../compiler/types.ts", + "../compiler/performance.ts", + "../compiler/core.ts", + "../compiler/sys.ts", + "../compiler/diagnosticInformationMap.generated.ts", + "../compiler/scanner.ts", + "../compiler/utilities.ts", + "../compiler/parser.ts", + "../compiler/binder.ts", + "../compiler/symbolWalker.ts", + "../compiler/moduleNameResolver.ts", + "../compiler/checker.ts", + "../compiler/factory.ts", + "../compiler/visitor.ts", + "../compiler/transformers/utilities.ts", + "../compiler/transformers/destructuring.ts", + "../compiler/transformers/ts.ts", + "../compiler/transformers/es2017.ts", + "../compiler/transformers/esnext.ts", + "../compiler/transformers/jsx.ts", + "../compiler/transformers/es2016.ts", + "../compiler/transformers/es2015.ts", + "../compiler/transformers/es5.ts", + "../compiler/transformers/generators.ts", + "../compiler/transformers/module/module.ts", + "../compiler/transformers/module/system.ts", + "../compiler/transformers/module/es2015.ts", + "../compiler/transformers/declarations/diagnostics.ts", + "../compiler/transformers/declarations.ts", + "../compiler/transformer.ts", + "../compiler/sourcemap.ts", + "../compiler/comments.ts", + "../compiler/emitter.ts", + "../compiler/watchUtilities.ts", + "../compiler/program.ts", + "../compiler/builderState.ts", + "../compiler/builder.ts", + "../compiler/resolutionCache.ts", + "../compiler/watch.ts", + "../compiler/commandLineParser.ts", + + "../services/types.ts", "../services/utilities.ts", + "../services/classifier.ts", + "../services/pathCompletions.ts", + "../services/completions.ts", + "../services/documentHighlights.ts", + "../services/documentRegistry.ts", + "../services/importTracker.ts", + "../services/findAllReferences.ts", + "../services/goToDefinition.ts", + "../services/jsDoc.ts", + "../services/semver.ts", + "../services/jsTyping.ts", + "../services/navigateTo.ts", + "../services/navigationBar.ts", + "../services/organizeImports.ts", + "../services/outliningElementsCollector.ts", + "../services/patternMatcher.ts", + "../services/preProcess.ts", + "../services/rename.ts", + "../services/signatureHelp.ts", + "../services/suggestionDiagnostics.ts", + "../services/symbolDisplay.ts", + "../services/transpile.ts", + "../services/formatting/formattingContext.ts", + "../services/formatting/formattingScanner.ts", + "../services/formatting/rule.ts", + "../services/formatting/rules.ts", + "../services/formatting/rulesMap.ts", + "../services/formatting/formatting.ts", + "../services/formatting/smartIndenter.ts", + "../services/textChanges.ts", + "../services/codeFixProvider.ts", + "../services/refactorProvider.ts", + "../services/codefixes/addMissingInvocationForDecorator.ts", + "../services/codefixes/annotateWithTypeFromJSDoc.ts", + "../services/codefixes/convertFunctionToEs6Class.ts", + "../services/codefixes/convertToEs6Module.ts", + "../services/codefixes/correctQualifiedNameToIndexedAccessType.ts", + "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts", + "../services/codefixes/importFixes.ts", + "../services/codefixes/fixSpelling.ts", + "../services/codefixes/fixAddMissingMember.ts", + "../services/codefixes/fixCannotFindModule.ts", + "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", + "../services/codefixes/fixForgottenThisPropertyAccess.ts", + "../services/codefixes/fixUnusedIdentifier.ts", + "../services/codefixes/fixJSDocTypes.ts", + "../services/codefixes/fixAwaitInSyncFunction.ts", + "../services/codefixes/disableJsDiagnostics.ts", + "../services/codefixes/helpers.ts", + "../services/codefixes/inferFromUsage.ts", + "../services/codefixes/fixInvalidImportSyntax.ts", + "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/useDefaultImport.ts", + "../services/refactors/extractSymbol.ts", + "../services/refactors/generateGetAccessorAndSetAccessor.ts", + "../services/sourcemaps.ts", + "../services/services.ts", + "../services/breakpoints.ts", + "../services/transform.ts", + "../services/shims.ts", + + "types.ts", "shared.ts", "utilities.ts", - "scriptVersionCache.ts", + "protocol.ts", "scriptInfo.ts", "typingsCache.ts", "project.ts", "editorServices.ts", - "protocol.ts", "session.ts", + "scriptVersionCache.ts", "server.ts" ] } diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index aa3148d58a1..dd0196fab76 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -15,17 +15,122 @@ "types": [] }, "files": [ - "editorServices.ts", - "project.ts", + "../compiler/types.ts", + "../compiler/performance.ts", + "../compiler/core.ts", + "../compiler/sys.ts", + "../compiler/diagnosticInformationMap.generated.ts", + "../compiler/scanner.ts", + "../compiler/utilities.ts", + "../compiler/parser.ts", + "../compiler/binder.ts", + "../compiler/symbolWalker.ts", + "../compiler/moduleNameResolver.ts", + "../compiler/checker.ts", + "../compiler/factory.ts", + "../compiler/visitor.ts", + "../compiler/transformers/utilities.ts", + "../compiler/transformers/destructuring.ts", + "../compiler/transformers/ts.ts", + "../compiler/transformers/es2017.ts", + "../compiler/transformers/esnext.ts", + "../compiler/transformers/jsx.ts", + "../compiler/transformers/es2016.ts", + "../compiler/transformers/es2015.ts", + "../compiler/transformers/es5.ts", + "../compiler/transformers/generators.ts", + "../compiler/transformers/module/module.ts", + "../compiler/transformers/module/system.ts", + "../compiler/transformers/module/es2015.ts", + "../compiler/transformers/declarations/diagnostics.ts", + "../compiler/transformers/declarations.ts", + "../compiler/transformer.ts", + "../compiler/sourcemap.ts", + "../compiler/comments.ts", + "../compiler/emitter.ts", + "../compiler/watchUtilities.ts", + "../compiler/program.ts", + "../compiler/builderState.ts", + "../compiler/builder.ts", + "../compiler/resolutionCache.ts", + "../compiler/watch.ts", + "../compiler/commandLineParser.ts", + + "../services/types.ts", + "../services/utilities.ts", + "../services/classifier.ts", + "../services/pathCompletions.ts", + "../services/completions.ts", + "../services/documentHighlights.ts", + "../services/documentRegistry.ts", + "../services/importTracker.ts", + "../services/findAllReferences.ts", + "../services/goToDefinition.ts", + "../services/jsDoc.ts", + "../services/semver.ts", + "../services/jsTyping.ts", + "../services/navigateTo.ts", + "../services/navigationBar.ts", + "../services/organizeImports.ts", + "../services/outliningElementsCollector.ts", + "../services/patternMatcher.ts", + "../services/preProcess.ts", + "../services/rename.ts", + "../services/signatureHelp.ts", + "../services/suggestionDiagnostics.ts", + "../services/symbolDisplay.ts", + "../services/transpile.ts", + "../services/formatting/formattingContext.ts", + "../services/formatting/formattingScanner.ts", + "../services/formatting/rule.ts", + "../services/formatting/rules.ts", + "../services/formatting/rulesMap.ts", + "../services/formatting/formatting.ts", + "../services/formatting/smartIndenter.ts", + "../services/textChanges.ts", + "../services/codeFixProvider.ts", + "../services/refactorProvider.ts", + "../services/codefixes/addMissingInvocationForDecorator.ts", + "../services/codefixes/annotateWithTypeFromJSDoc.ts", + "../services/codefixes/convertFunctionToEs6Class.ts", + "../services/codefixes/convertToEs6Module.ts", + "../services/codefixes/correctQualifiedNameToIndexedAccessType.ts", + "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts", + "../services/codefixes/importFixes.ts", + "../services/codefixes/fixSpelling.ts", + "../services/codefixes/fixAddMissingMember.ts", + "../services/codefixes/fixCannotFindModule.ts", + "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", + "../services/codefixes/fixForgottenThisPropertyAccess.ts", + "../services/codefixes/fixUnusedIdentifier.ts", + "../services/codefixes/fixJSDocTypes.ts", + "../services/codefixes/fixAwaitInSyncFunction.ts", + "../services/codefixes/disableJsDiagnostics.ts", + "../services/codefixes/helpers.ts", + "../services/codefixes/inferFromUsage.ts", + "../services/codefixes/fixInvalidImportSyntax.ts", + "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/useDefaultImport.ts", + "../services/refactors/extractSymbol.ts", + "../services/refactors/generateGetAccessorAndSetAccessor.ts", + "../services/sourcemaps.ts", + "../services/services.ts", + "../services/breakpoints.ts", + "../services/transform.ts", + "../services/shims.ts", + + "types.ts", + "shared.ts", + "utilities.ts", "protocol.ts", "scriptInfo.ts", - "scriptVersionCache.ts", - "session.ts", - "shared.ts", - "types.ts", "typingsCache.ts", - "utilities.ts", - "../services/shims.ts", - "../services/utilities.ts" + "project.ts", + "editorServices.ts", + "session.ts", + "scriptVersionCache.ts" ] } diff --git a/src/server/types.ts b/src/server/types.ts index 617a3be419a..d4ddd81c53e 100644 --- a/src/server/types.ts +++ b/src/server/types.ts @@ -1,7 +1,3 @@ -/// -/// -/// - declare namespace ts.server { export interface CompressedData { length: number; diff --git a/src/server/typingsCache.ts b/src/server/typingsCache.ts index a1d8f65f6e0..f2642230f2d 100644 --- a/src/server/typingsCache.ts +++ b/src/server/typingsCache.ts @@ -1,5 +1,3 @@ -/// - namespace ts.server { export interface InstallPackageOptionsWithProject extends InstallPackageOptions { projectName: string; diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts index 018dac7ec10..35f926f1c14 100644 --- a/src/server/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts @@ -21,7 +21,7 @@ namespace ts.server.typingsInstaller { } writeLine = (text: string) => { try { - fs.appendFileSync(this.logFile, text + sys.newLine); + fs.appendFileSync(this.logFile, `[${nowString()}] ${text}${sys.newLine}`); } catch (e) { this.logEnabled = false; @@ -184,9 +184,8 @@ namespace ts.server.typingsInstaller { if (this.log.isEnabled()) { this.log.writeLine(`#${requestId} with arguments'${JSON.stringify(packageNames)}'.`); } - const command = `${this.npmPath} install --ignore-scripts ${packageNames.join(" ")} --save-dev --user-agent="typesInstaller/${version}"`; const start = Date.now(); - const hasError = this.execSyncAndLog(command, { cwd }); + const hasError = installNpmPackages(this.npmPath, version, packageNames, command => this.execSyncAndLog(command, { cwd })); if (this.log.isEnabled()) { this.log.writeLine(`npm install #${requestId} took: ${Date.now() - start} ms`); } diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts index f87e6d7e8ab..8d482241d1b 100644 --- a/src/server/typingsInstaller/typingsInstaller.ts +++ b/src/server/typingsInstaller/typingsInstaller.ts @@ -30,6 +30,31 @@ namespace ts.server.typingsInstaller { } } + /*@internal*/ + export function installNpmPackages(npmPath: string, tsVersion: string, packageNames: string[], install: (command: string) => boolean) { + let hasError = false; + for (let remaining = packageNames.length; remaining > 0;) { + const result = getNpmCommandForInstallation(npmPath, tsVersion, packageNames, remaining); + remaining = result.remaining; + hasError = install(result.command) || hasError; + } + return hasError; + } + + /*@internal*/ + export function getNpmCommandForInstallation(npmPath: string, tsVersion: string, packageNames: string[], remaining: number) { + const sliceStart = packageNames.length - remaining; + let command: string, toSlice = remaining; + while (true) { + command = `${npmPath} install --ignore-scripts ${(toSlice === packageNames.length ? packageNames : packageNames.slice(sliceStart, sliceStart + toSlice)).join(" ")} --save-dev --user-agent="typesInstaller/${tsVersion}"`; + if (command.length < 8000) { + break; + } + + toSlice = toSlice - Math.floor(toSlice / 2); + } + return { command, remaining: remaining - toSlice }; + } export type RequestCompletedAction = (success: boolean) => void; interface PendingRequest { diff --git a/src/server/utilities.ts b/src/server/utilities.ts index ff7fa25af0f..363393d401e 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts.server { export enum LogLevel { terse, @@ -83,14 +80,6 @@ namespace ts.server { }; } - export function mergeMapLikes(target: T, source: Partial): void { - for (const key in source) { - if (hasProperty(source, key)) { - target[key] = (source)[key]; - } - } - } - export type NormalizedPath = string & { __normalizedPathTag: any }; export function toNormalizedPath(fileName: string): NormalizedPath { diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index c608028b55f..faab2b08db6 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -1,8 +1,3 @@ -// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. -// See LICENSE.txt in the project root for complete license information. - -/// - /* @internal */ namespace ts.BreakpointResolver { /** diff --git a/src/services/codeFixProvider.ts b/src/services/codeFixProvider.ts index 291f8fd1d66..39f760ba04c 100644 --- a/src/services/codeFixProvider.ts +++ b/src/services/codeFixProvider.ts @@ -24,7 +24,7 @@ namespace ts { } export namespace codefix { - const codeFixRegistrations: CodeFixRegistration[][] = []; + const errorCodeToFixes = createMultiMap(); const fixIdToRegistration = createMap(); type DiagnosticAndArguments = DiagnosticMessage | [DiagnosticMessage, string] | [DiagnosticMessage, string, string]; @@ -34,26 +34,21 @@ namespace ts { : getLocaleSpecificMessage(diag); } - export function createCodeFixActionNoFixId(changes: FileTextChanges[], description: DiagnosticAndArguments) { - return createCodeFixActionWorker(diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined); + export function createCodeFixActionNoFixId(fixName: string, changes: FileTextChanges[], description: DiagnosticAndArguments) { + return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined); } - export function createCodeFixAction(changes: FileTextChanges[], description: DiagnosticAndArguments, fixId: {}, fixAllDescription: DiagnosticAndArguments, command?: CodeActionCommand): CodeFixAction { - return createCodeFixActionWorker(diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command); + export function createCodeFixAction(fixName: string, changes: FileTextChanges[], description: DiagnosticAndArguments, fixId: {}, fixAllDescription: DiagnosticAndArguments, command?: CodeActionCommand): CodeFixAction { + return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command); } - function createCodeFixActionWorker(description: string, changes: FileTextChanges[], fixId?: {}, fixAllDescription?: string, command?: CodeActionCommand): CodeFixAction { - return { description, changes, fixId, fixAllDescription, commands: command ? [command] : undefined }; + function createCodeFixActionWorker(fixName: string, description: string, changes: FileTextChanges[], fixId?: {}, fixAllDescription?: string, command?: CodeActionCommand): CodeFixAction { + return { fixName, description, changes, fixId, fixAllDescription, commands: command ? [command] : undefined }; } export function registerCodeFix(reg: CodeFixRegistration) { for (const error of reg.errorCodes) { - let registrations = codeFixRegistrations[error]; - if (!registrations) { - registrations = []; - codeFixRegistrations[error] = registrations; - } - registrations.push(reg); + errorCodeToFixes.add(String(error), reg); } if (reg.fixIds) { for (const fixId of reg.fixIds) { @@ -63,29 +58,12 @@ namespace ts { } } - export function getSupportedErrorCodes() { - return Object.keys(codeFixRegistrations); + export function getSupportedErrorCodes(): string[] { + return arrayFrom(errorCodeToFixes.keys()); } export function getFixes(context: CodeFixContext): CodeFixAction[] { - const fixes = codeFixRegistrations[context.errorCode]; - const allActions: CodeFixAction[] = []; - - forEach(fixes, f => { - const actions = f.getCodeActions(context); - if (actions && actions.length > 0) { - for (const action of actions) { - if (action === undefined) { - context.host.log(`Action for error code ${context.errorCode} added an invalid action entry; please log a bug`); - } - else { - allActions.push(action); - } - } - } - }); - - return allActions; + return flatMap(errorCodeToFixes.get(String(context.errorCode)) || emptyArray, f => f.getCodeActions(context)); } export function getAllFixes(context: CodeFixAllContext): CombinedCodeActions { diff --git a/src/services/codefixes/addMissingInvocationForDecorator.ts b/src/services/codefixes/addMissingInvocationForDecorator.ts index 7b8a7d05fe7..ead64f9a2ca 100644 --- a/src/services/codefixes/addMissingInvocationForDecorator.ts +++ b/src/services/codefixes/addMissingInvocationForDecorator.ts @@ -6,7 +6,7 @@ namespace ts.codefix { errorCodes, getCodeActions: (context) => { const changes = textChanges.ChangeTracker.with(context, t => makeChange(t, context.sourceFile, context.span.start)); - return [createCodeFixAction(changes, Diagnostics.Call_decorator_expression, fixId, Diagnostics.Add_to_all_uncalled_decorators)]; + return [createCodeFixAction(fixId, changes, Diagnostics.Call_decorator_expression, fixId, Diagnostics.Add_to_all_uncalled_decorators)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => makeChange(changes, diag.file!, diag.start!)), diff --git a/src/services/codefixes/annotateWithTypeFromJSDoc.ts b/src/services/codefixes/annotateWithTypeFromJSDoc.ts index c8a3977eb3b..5b809452677 100644 --- a/src/services/codefixes/annotateWithTypeFromJSDoc.ts +++ b/src/services/codefixes/annotateWithTypeFromJSDoc.ts @@ -8,7 +8,7 @@ namespace ts.codefix { const decl = getDeclaration(context.sourceFile, context.span.start); if (!decl) return; const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, decl)); - return [createCodeFixAction(changes, Diagnostics.Annotate_with_type_from_JSDoc, fixId, Diagnostics.Annotate_everything_with_types_from_JSDoc)]; + return [createCodeFixAction(fixId, changes, Diagnostics.Annotate_with_type_from_JSDoc, fixId, Diagnostics.Annotate_everything_with_types_from_JSDoc)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { diff --git a/src/services/codefixes/convertFunctionToEs6Class.ts b/src/services/codefixes/convertFunctionToEs6Class.ts index bb260463831..bf20aeda72b 100644 --- a/src/services/codefixes/convertFunctionToEs6Class.ts +++ b/src/services/codefixes/convertFunctionToEs6Class.ts @@ -6,7 +6,7 @@ namespace ts.codefix { errorCodes, getCodeActions(context: CodeFixContext) { const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, context.span.start, context.program.getTypeChecker())); - return [createCodeFixAction(changes, Diagnostics.Convert_function_to_an_ES2015_class, fixId, Diagnostics.Convert_all_constructor_functions_to_classes)]; + return [createCodeFixAction(fixId, changes, Diagnostics.Convert_function_to_an_ES2015_class, fixId, Diagnostics.Convert_all_constructor_functions_to_classes)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, err) => doChange(changes, err.file!, err.start, context.program.getTypeChecker())), diff --git a/src/services/codefixes/convertToEs6Module.ts b/src/services/codefixes/convertToEs6Module.ts index b8c78d57827..8ffba3218c0 100644 --- a/src/services/codefixes/convertToEs6Module.ts +++ b/src/services/codefixes/convertToEs6Module.ts @@ -13,7 +13,7 @@ namespace ts.codefix { } }); // No support for fix-all since this applies to the whole file at once anyway. - return [createCodeFixActionNoFixId(changes, Diagnostics.Convert_to_ES6_module)]; + return [createCodeFixActionNoFixId("convertToEs6Module", changes, Diagnostics.Convert_to_ES6_module)]; }, }); @@ -114,8 +114,8 @@ namespace ts.codefix { return false; } case SyntaxKind.BinaryExpression: { - const { left, operatorToken, right } = expression as BinaryExpression; - return operatorToken.kind === SyntaxKind.EqualsToken && convertAssignment(sourceFile, checker, statement as ExpressionStatement, left, right, changes, exports); + const { operatorToken } = expression as BinaryExpression; + return operatorToken.kind === SyntaxKind.EqualsToken && convertAssignment(sourceFile, checker, expression as BinaryExpression, changes, exports); } } } @@ -144,7 +144,7 @@ namespace ts.codefix { return convertPropertyAccessImport(name, initializer.name.text, initializer.expression.arguments[0], identifiers); } else { - // Move it out to its own variable statement. + // Move it out to its own variable statement. (This will not be used if `!foundImport`) return createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList([decl], declarationList.flags)); } }); @@ -177,12 +177,11 @@ namespace ts.codefix { function convertAssignment( sourceFile: SourceFile, checker: TypeChecker, - statement: ExpressionStatement, - left: Expression, - right: Expression, + assignment: BinaryExpression, changes: textChanges.ChangeTracker, exports: ExportRenames, ): ModuleExportsChanged { + const { left, right } = assignment; if (!isPropertyAccessExpression(left)) { return false; } @@ -190,7 +189,7 @@ namespace ts.codefix { if (isExportsOrModuleExportsOrAlias(sourceFile, left)) { if (isExportsOrModuleExportsOrAlias(sourceFile, right)) { // `const alias = module.exports;` or `module.exports = alias;` can be removed. - changes.deleteNode(sourceFile, statement); + changes.deleteNode(sourceFile, assignment.parent); } else { let newNodes = isObjectLiteralExpression(right) ? tryChangeModuleExportsObject(right) : undefined; @@ -198,12 +197,12 @@ namespace ts.codefix { if (!newNodes) { ([newNodes, changedToDefaultExport] = convertModuleExportsToExportDefault(right, checker)); } - changes.replaceNodeWithNodes(sourceFile, statement, newNodes); + changes.replaceNodeWithNodes(sourceFile, assignment.parent, newNodes); return changedToDefaultExport; } } else if (isExportsOrModuleExportsOrAlias(sourceFile, left.expression)) { - convertNamedExport(sourceFile, statement, left.name, right, changes, exports); + convertNamedExport(sourceFile, assignment as BinaryExpression & { left: PropertyAccessExpression }, changes, exports); } return false; @@ -223,7 +222,7 @@ namespace ts.codefix { case SyntaxKind.SpreadAssignment: return undefined; case SyntaxKind.PropertyAssignment: - return !isIdentifier(prop.name) ? undefined : convertExportsDotXEquals(prop.name.text, prop.initializer); + return !isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer); case SyntaxKind.MethodDeclaration: return !isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [createToken(SyntaxKind.ExportKeyword)], prop); default: @@ -234,14 +233,12 @@ namespace ts.codefix { function convertNamedExport( sourceFile: SourceFile, - statement: Statement, - propertyName: Identifier, - right: Expression, + assignment: BinaryExpression & { left: PropertyAccessExpression }, changes: textChanges.ChangeTracker, exports: ExportRenames, ): void { // If "originalKeywordKind" was set, this is e.g. `exports. - const { text } = propertyName; + const { text } = assignment.left.name; const rename = exports.get(text); if (rename !== undefined) { /* @@ -249,13 +246,13 @@ namespace ts.codefix { export { _class as class }; */ const newNodes = [ - makeConst(/*modifiers*/ undefined, rename, right), + makeConst(/*modifiers*/ undefined, rename, assignment.right), makeExportDeclaration([createExportSpecifier(rename, text)]), ]; - changes.replaceNodeWithNodes(sourceFile, statement, newNodes); + changes.replaceNodeWithNodes(sourceFile, assignment.parent, newNodes); } else { - changes.replaceNode(sourceFile, statement, convertExportsDotXEquals(text, right)); + convertExportsPropertyAssignment(assignment, sourceFile, changes); } } @@ -303,7 +300,27 @@ namespace ts.codefix { return makeExportDeclaration([createExportSpecifier(/*propertyName*/ undefined, "default")], moduleSpecifier); } - function convertExportsDotXEquals(name: string | undefined, exported: Expression): Statement { + function convertExportsPropertyAssignment({ left, right, parent }: BinaryExpression & { left: PropertyAccessExpression }, sourceFile: SourceFile, changes: textChanges.ChangeTracker): void { + const name = left.name.text; + if ((isFunctionExpression(right) || isArrowFunction(right) || isClassExpression(right)) && (!right.name || right.name.text === name)) { + // `exports.f = function() {}` -> `export function f() {}` -- Replace `exports.f = ` with `export `, and insert the name after `function`. + changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, createToken(SyntaxKind.ExportKeyword), { suffix: " " }); + + if (!right.name) changes.insertName(sourceFile, right, name); + + const semi = findChildOfKind(parent, SyntaxKind.SemicolonToken, sourceFile); + if (semi) changes.deleteNode(sourceFile, semi, { useNonAdjustedEndPosition: true }); + } + else { + // `exports.f = function g() {}` -> `export const f = function g() {}` -- just replace `exports.` with `export const ` + changes.replaceNodeRangeWithNodes(sourceFile, left.expression, findChildOfKind(left, SyntaxKind.DotToken, sourceFile)!, + [createToken(SyntaxKind.ExportKeyword), createToken(SyntaxKind.ConstKeyword)], + { joiner: " ", suffix: " " }); + } + } + + // TODO: GH#22492 this will cause an error if a change has been made inside the body of the node. + function convertExportsDotXEquals_replaceNode(name: string | undefined, exported: Expression): Statement { const modifiers = [createToken(SyntaxKind.ExportKeyword)]; switch (exported.kind) { case SyntaxKind.FunctionExpression: { diff --git a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts index f47b65aad90..54fe1823863 100644 --- a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts +++ b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts @@ -9,7 +9,7 @@ namespace ts.codefix { if (!qualifiedName) return undefined; const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, qualifiedName)); const newText = `${qualifiedName.left.text}["${qualifiedName.right.text}"]`; - return [createCodeFixAction(changes, [Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId, Diagnostics.Rewrite_all_as_indexed_access_types)]; + return [createCodeFixAction(fixId, changes, [Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId, Diagnostics.Rewrite_all_as_indexed_access_types)]; }, fixIds: [fixId], getAllCodeActions: (context) => codeFixAll(context, errorCodes, (changes, diag) => { diff --git a/src/services/codefixes/disableJsDiagnostics.ts b/src/services/codefixes/disableJsDiagnostics.ts index c53c35c5f81..b5d3059dd42 100644 --- a/src/services/codefixes/disableJsDiagnostics.ts +++ b/src/services/codefixes/disableJsDiagnostics.ts @@ -1,5 +1,6 @@ /* @internal */ namespace ts.codefix { + const fixName = "disableJsDiagnostics"; const fixId = "disableJsDiagnostics"; const errorCodes = mapDefined(Object.keys(Diagnostics) as ReadonlyArray, key => { const diag = Diagnostics[key]; @@ -18,6 +19,7 @@ namespace ts.codefix { const fixes: CodeFixAction[] = [ // fixId unnecessary because adding `// @ts-nocheck` even once will ignore every error in the file. createCodeFixActionNoFixId( + fixName, [createFileTextChanges(sourceFile.fileName, [ createTextChange(sourceFile.checkJsDirective ? createTextSpanFromBounds(sourceFile.checkJsDirective.pos, sourceFile.checkJsDirective.end) @@ -27,7 +29,7 @@ namespace ts.codefix { ]; if (textChanges.isValidLocationToAddComment(sourceFile, span.start)) { - fixes.unshift(createCodeFixAction(textChanges.ChangeTracker.with(context, t => makeChange(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId, Diagnostics.Add_ts_ignore_to_all_error_messages)); + fixes.unshift(createCodeFixAction(fixName, textChanges.ChangeTracker.with(context, t => makeChange(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId, Diagnostics.Add_ts_ignore_to_all_error_messages)); } return fixes; diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts index 9a3b4854351..940201d7008 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -1,5 +1,6 @@ /* @internal */ namespace ts.codefix { + const fixName = "addMissingMember"; const errorCodes = [ Diagnostics.Property_0_does_not_exist_on_type_1.code, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, @@ -75,7 +76,7 @@ namespace ts.codefix { function getActionsForAddMissingMemberInJavaScriptFile(context: CodeFixContext, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, tokenName: string, makeStatic: boolean): CodeFixAction | undefined { const changes = textChanges.ChangeTracker.with(context, t => addMissingMemberInJs(t, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic)); return changes.length === 0 ? undefined - : createCodeFixAction(changes, [makeStatic ? Diagnostics.Initialize_static_property_0 : Diagnostics.Initialize_property_0_in_the_constructor, tokenName], fixId, Diagnostics.Add_all_missing_members); + : createCodeFixAction(fixName, changes, [makeStatic ? Diagnostics.Initialize_static_property_0 : Diagnostics.Initialize_property_0_in_the_constructor, tokenName], fixId, Diagnostics.Add_all_missing_members); } function addMissingMemberInJs(changeTracker: textChanges.ChangeTracker, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, tokenName: string, makeStatic: boolean): void { @@ -120,7 +121,7 @@ namespace ts.codefix { function createAddPropertyDeclarationAction(context: CodeFixContext, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, makeStatic: boolean, tokenName: string, typeNode: TypeNode): CodeFixAction { const changes = textChanges.ChangeTracker.with(context, t => addPropertyDeclaration(t, classDeclarationSourceFile, classDeclaration, tokenName, typeNode, makeStatic)); - return createCodeFixAction(changes, [makeStatic ? Diagnostics.Declare_static_property_0 : Diagnostics.Declare_property_0, tokenName], fixId, Diagnostics.Add_all_missing_members); + return createCodeFixAction(fixName, changes, [makeStatic ? Diagnostics.Declare_static_property_0 : Diagnostics.Declare_property_0, tokenName], fixId, Diagnostics.Add_all_missing_members); } function addPropertyDeclaration(changeTracker: textChanges.ChangeTracker, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, tokenName: string, typeNode: TypeNode, makeStatic: boolean): void { @@ -153,7 +154,7 @@ namespace ts.codefix { const changes = textChanges.ChangeTracker.with(context, t => t.insertNodeAtClassStart(classDeclarationSourceFile, classDeclaration, indexSignature)); // No fixId here because code-fix-all currently only works on adding individual named properties. - return createCodeFixActionNoFixId(changes, [Diagnostics.Add_index_signature_for_property_0, tokenName]); + return createCodeFixActionNoFixId(fixName, changes, [Diagnostics.Add_index_signature_for_property_0, tokenName]); } function getActionForMethodDeclaration( @@ -167,7 +168,7 @@ namespace ts.codefix { preferences: UserPreferences, ): CodeFixAction | undefined { const changes = textChanges.ChangeTracker.with(context, t => addMethodDeclaration(t, classDeclarationSourceFile, classDeclaration, token, callExpression, makeStatic, inJs, preferences)); - return createCodeFixAction(changes, [makeStatic ? Diagnostics.Declare_static_method_0 : Diagnostics.Declare_method_0, token.text], fixId, Diagnostics.Add_all_missing_members); + return createCodeFixAction(fixName, changes, [makeStatic ? Diagnostics.Declare_static_method_0 : Diagnostics.Declare_method_0, token.text], fixId, Diagnostics.Add_all_missing_members); } function addMethodDeclaration( diff --git a/src/services/codefixes/fixAwaitInSyncFunction.ts b/src/services/codefixes/fixAwaitInSyncFunction.ts index 804910e9a22..fd00498573c 100644 --- a/src/services/codefixes/fixAwaitInSyncFunction.ts +++ b/src/services/codefixes/fixAwaitInSyncFunction.ts @@ -12,7 +12,7 @@ namespace ts.codefix { const nodes = getNodes(sourceFile, span.start); if (!nodes) return undefined; const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, nodes)); - return [createCodeFixAction(changes, Diagnostics.Add_async_modifier_to_containing_function, fixId, Diagnostics.Add_all_missing_async_modifiers)]; + return [createCodeFixAction(fixId, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId, Diagnostics.Add_all_missing_async_modifiers)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { diff --git a/src/services/codefixes/fixCannotFindModule.ts b/src/services/codefixes/fixCannotFindModule.ts index 89f7a3f7793..9699cd3ceb4 100644 --- a/src/services/codefixes/fixCannotFindModule.ts +++ b/src/services/codefixes/fixCannotFindModule.ts @@ -8,7 +8,7 @@ namespace ts.codefix { const { host, sourceFile, span: { start } } = context; const packageName = getTypesPackageNameToInstall(host, sourceFile, start); return packageName === undefined ? [] - : [createCodeFixAction(/*changes*/ [], [Diagnostics.Install_0, packageName], fixId, Diagnostics.Install_all_missing_types_packages, getCommand(sourceFile.fileName, packageName))]; + : [createCodeFixAction(fixId, /*changes*/ [], [Diagnostics.Install_0, packageName], fixId, Diagnostics.Install_all_missing_types_packages, getCommand(sourceFile.fileName, packageName))]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (_, diag, commands) => { diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 3a1443c04bb..a931f849cb2 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -11,7 +11,7 @@ namespace ts.codefix { const { program, sourceFile, span } = context; const changes = textChanges.ChangeTracker.with(context, t => addMissingMembers(getClass(sourceFile, span.start), sourceFile, program.getTypeChecker(), t, context.preferences)); - return changes.length === 0 ? undefined : [createCodeFixAction(changes, Diagnostics.Implement_inherited_abstract_class, fixId, Diagnostics.Implement_all_inherited_abstract_classes)]; + return changes.length === 0 ? undefined : [createCodeFixAction(fixId, changes, Diagnostics.Implement_inherited_abstract_class, fixId, Diagnostics.Implement_all_inherited_abstract_classes)]; }, fixIds: [fixId], getAllCodeActions: context => { diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 91815edb775..4e0b5745149 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -11,7 +11,7 @@ namespace ts.codefix { const checker = program.getTypeChecker(); return mapDefined(getClassImplementsHeritageClauseElements(classDeclaration), implementedTypeNode => { const changes = textChanges.ChangeTracker.with(context, t => addMissingDeclarations(checker, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences)); - return changes.length === 0 ? undefined : createCodeFixAction(changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId, Diagnostics.Implement_all_unimplemented_interfaces); + return changes.length === 0 ? undefined : createCodeFixAction(fixId, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId, Diagnostics.Implement_all_unimplemented_interfaces); }); }, fixIds: [fixId], diff --git a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts index d9c98747286..af38b8e9025 100644 --- a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts +++ b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts @@ -10,7 +10,7 @@ namespace ts.codefix { if (!nodes) return undefined; const { constructor, superCall } = nodes; const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, constructor, superCall)); - return [createCodeFixAction(changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)]; + return [createCodeFixAction(fixId, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)]; }, fixIds: [fixId], getAllCodeActions(context) { diff --git a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts index 31aa4fcedae..2aed263ee83 100644 --- a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts +++ b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts @@ -8,7 +8,7 @@ namespace ts.codefix { const { sourceFile, span } = context; const ctr = getNode(sourceFile, span.start); const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, ctr)); - return [createCodeFixAction(changes, Diagnostics.Add_missing_super_call, fixId, Diagnostics.Add_all_missing_super_calls)]; + return [createCodeFixAction(fixId, changes, Diagnostics.Add_missing_super_call, fixId, Diagnostics.Add_all_missing_super_calls)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index 381a8228c0d..c3f406b8475 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -10,7 +10,7 @@ namespace ts.codefix { if (!nodes) return undefined; const { extendsToken, heritageClauses } = nodes; const changes = textChanges.ChangeTracker.with(context, t => doChanges(t, sourceFile, extendsToken, heritageClauses)); - return [createCodeFixAction(changes, Diagnostics.Change_extends_to_implements, fixId, Diagnostics.Change_all_extended_interfaces_to_implements)]; + return [createCodeFixAction(fixId, changes, Diagnostics.Change_extends_to_implements, fixId, Diagnostics.Change_all_extended_interfaces_to_implements)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { diff --git a/src/services/codefixes/fixForgottenThisPropertyAccess.ts b/src/services/codefixes/fixForgottenThisPropertyAccess.ts index 2cf7e2143a3..b26e4c7cdca 100644 --- a/src/services/codefixes/fixForgottenThisPropertyAccess.ts +++ b/src/services/codefixes/fixForgottenThisPropertyAccess.ts @@ -11,7 +11,7 @@ namespace ts.codefix { return undefined; } const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, token)); - return [createCodeFixAction(changes, Diagnostics.Add_this_to_unresolved_variable, fixId, Diagnostics.Add_this_to_all_unresolved_variables_matching_a_member_name)]; + return [createCodeFixAction(fixId, changes, Diagnostics.Add_this_to_unresolved_variable, fixId, Diagnostics.Add_this_to_all_unresolved_variables_matching_a_member_name)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { diff --git a/src/services/codefixes/fixInvalidImportSyntax.ts b/src/services/codefixes/fixInvalidImportSyntax.ts index 84bd9867c70..50bf41360bc 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -1,5 +1,7 @@ /* @internal */ namespace ts.codefix { + const fixName = "invalidImportSyntax"; + registerCodeFix({ errorCodes: [Diagnostics.A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime.code], getCodeActions: getActionsForInvalidImport @@ -43,7 +45,7 @@ namespace ts.codefix { function createAction(context: CodeFixContext, sourceFile: SourceFile, node: Node, replacement: Node): CodeFixAction { const changes = textChanges.ChangeTracker.with(context, t => t.replaceNode(sourceFile, node, replacement)); - return createCodeFixActionNoFixId(changes, [Diagnostics.Replace_import_with_0, changes[0].textChanges[0].newText]); + return createCodeFixActionNoFixId("invalidImportSyntax", changes, [Diagnostics.Replace_import_with_0, changes[0].textChanges[0].newText]); } registerCodeFix({ @@ -72,7 +74,7 @@ namespace ts.codefix { addRange(fixes, getCodeFixesForImportDeclaration(context, relatedImport)); } const changes = textChanges.ChangeTracker.with(context, t => t.replaceNode(sourceFile, expr, createPropertyAccess(expr, "default"), {})); - fixes.push(createCodeFixActionNoFixId(changes, Diagnostics.Use_synthetic_default_member)); + fixes.push(createCodeFixActionNoFixId(fixName, changes, Diagnostics.Use_synthetic_default_member)); return fixes; } } diff --git a/src/services/codefixes/fixJSDocTypes.ts b/src/services/codefixes/fixJSDocTypes.ts index 848666b67f0..1919b0742f0 100644 --- a/src/services/codefixes/fixJSDocTypes.ts +++ b/src/services/codefixes/fixJSDocTypes.ts @@ -22,7 +22,7 @@ namespace ts.codefix { function fix(type: Type, fixId: string, fixAllDescription: DiagnosticMessage): CodeFixAction { const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, typeNode, type, checker)); - return createCodeFixAction(changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type)], fixId, fixAllDescription); + return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type)], fixId, fixAllDescription); } }, fixIds: [fixIdPlain, fixIdNullable], diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index 851b749d29b..252b08b356a 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -13,13 +13,15 @@ namespace ts.codefix { const info = getInfo(sourceFile, context.span.start, context); if (!info) return undefined; const { node, suggestion } = info; - const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, node, suggestion)); - return [createCodeFixAction(changes, [Diagnostics.Change_spelling_to_0, suggestion], fixId, Diagnostics.Fix_all_detected_spelling_errors)]; + const { target } = context.host.getCompilationSettings(); + const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, node, suggestion, target)); + return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, suggestion], fixId, Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { const info = getInfo(diag.file!, diag.start!, context); - if (info) doChange(changes, context.sourceFile, info.node, info.suggestion); + const { target } = context.host.getCompilationSettings(); + if (info) doChange(changes, context.sourceFile, info.node, info.suggestion, target); }), }); @@ -54,8 +56,13 @@ namespace ts.codefix { return suggestion === undefined ? undefined : { node, suggestion }; } - function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, node: Node, suggestion: string) { - changes.replaceNode(sourceFile, node, createIdentifier(suggestion)); + function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, node: Node, suggestion: string, target: ScriptTarget) { + if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) { + changes.replaceNode(sourceFile, node.parent, createElementAccess(node.parent.expression, createLiteral(suggestion))); + } + else { + changes.replaceNode(sourceFile, node, createIdentifier(suggestion)); + } } function convertSemanticMeaningToSymbolFlags(meaning: SemanticMeaning): SymbolFlags { diff --git a/src/services/codefixes/fixStrictClassInitialization.ts b/src/services/codefixes/fixStrictClassInitialization.ts index 2f51cedbe82..8d4e457662f 100644 --- a/src/services/codefixes/fixStrictClassInitialization.ts +++ b/src/services/codefixes/fixStrictClassInitialization.ts @@ -1,5 +1,6 @@ /* @internal */ namespace ts.codefix { + const fixName = "strictClassInitialization"; const fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions"; const fixIdAddUndefinedType = "addMissingPropertyUndefinedType"; const fixIdAddInitializer = "addMissingPropertyInitializer"; @@ -53,7 +54,7 @@ namespace ts.codefix { function getActionForAddMissingDefiniteAssignmentAssertion (context: CodeFixContext, propertyDeclaration: PropertyDeclaration): CodeFixAction { const changes = textChanges.ChangeTracker.with(context, t => addDefiniteAssignmentAssertion(t, context.sourceFile, propertyDeclaration)); - return createCodeFixAction(changes, [Diagnostics.Add_definite_assignment_assertion_to_property_0, propertyDeclaration.getText()], fixIdAddDefiniteAssignmentAssertions, Diagnostics.Add_definite_assignment_assertions_to_all_uninitialized_properties); + return createCodeFixAction(fixName, changes, [Diagnostics.Add_definite_assignment_assertion_to_property_0, propertyDeclaration.getText()], fixIdAddDefiniteAssignmentAssertions, Diagnostics.Add_definite_assignment_assertions_to_all_uninitialized_properties); } function addDefiniteAssignmentAssertion(changeTracker: textChanges.ChangeTracker, propertyDeclarationSourceFile: SourceFile, propertyDeclaration: PropertyDeclaration): void { @@ -71,7 +72,7 @@ namespace ts.codefix { function getActionForAddMissingUndefinedType (context: CodeFixContext, propertyDeclaration: PropertyDeclaration): CodeFixAction { const changes = textChanges.ChangeTracker.with(context, t => addUndefinedType(t, context.sourceFile, propertyDeclaration)); - return createCodeFixAction(changes, [Diagnostics.Add_undefined_type_to_property_0, propertyDeclaration.name.getText()], fixIdAddUndefinedType, Diagnostics.Add_undefined_type_to_all_uninitialized_properties); + return createCodeFixAction(fixName, changes, [Diagnostics.Add_undefined_type_to_property_0, propertyDeclaration.name.getText()], fixIdAddUndefinedType, Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker: textChanges.ChangeTracker, propertyDeclarationSourceFile: SourceFile, propertyDeclaration: PropertyDeclaration): void { @@ -86,7 +87,7 @@ namespace ts.codefix { if (!initializer) return undefined; const changes = textChanges.ChangeTracker.with(context, t => addInitializer(t, context.sourceFile, propertyDeclaration, initializer)); - return createCodeFixAction(changes, [Diagnostics.Add_initializer_to_property_0, propertyDeclaration.name.getText()], fixIdAddInitializer, Diagnostics.Add_initializers_to_all_uninitialized_properties); + return createCodeFixAction(fixName, changes, [Diagnostics.Add_initializer_to_property_0, propertyDeclaration.name.getText()], fixIdAddInitializer, Diagnostics.Add_initializers_to_all_uninitialized_properties); } function addInitializer (changeTracker: textChanges.ChangeTracker, propertyDeclarationSourceFile: SourceFile, propertyDeclaration: PropertyDeclaration, initializer: Expression): void { @@ -116,13 +117,13 @@ namespace ts.codefix { else if (type.flags & TypeFlags.Boolean) { return createFalse(); } - else if (type.flags & TypeFlags.Literal) { - return createLiteral((type).value); + else if (type.isLiteral()) { + return createLiteral(type.value); } - else if (type.flags & TypeFlags.Union) { - return firstDefined((type).types, t => getDefaultValueFromType(checker, t)); + else if (type.isUnion()) { + return firstDefined(type.types, t => getDefaultValueFromType(checker, t)); } - else if (getObjectFlags(type) & ObjectFlags.Class) { + else if (type.isClass()) { const classDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); if (!classDeclaration || hasModifier(classDeclaration, ModifierFlags.Abstract)) return undefined; diff --git a/src/services/codefixes/fixUnusedIdentifier.ts b/src/services/codefixes/fixUnusedIdentifier.ts index 1fe0107dafb..a37435cd109 100644 --- a/src/services/codefixes/fixUnusedIdentifier.ts +++ b/src/services/codefixes/fixUnusedIdentifier.ts @@ -1,5 +1,6 @@ /* @internal */ namespace ts.codefix { + const fixName = "unusedIdentifier"; const fixIdPrefix = "unusedIdentifier_prefix"; const fixIdDelete = "unusedIdentifier_delete"; const errorCodes = [ @@ -14,7 +15,7 @@ namespace ts.codefix { const importDecl = tryGetFullImport(sourceFile, context.span.start); if (importDecl) { const changes = textChanges.ChangeTracker.with(context, t => t.deleteNode(sourceFile, importDecl)); - return [createCodeFixAction(changes, [Diagnostics.Remove_import_from_0, showModuleSpecifier(importDecl)], fixIdDelete, Diagnostics.Delete_all_unused_declarations)]; + return [createCodeFixAction(fixName, changes, [Diagnostics.Remove_import_from_0, showModuleSpecifier(importDecl)], fixIdDelete, Diagnostics.Delete_all_unused_declarations)]; } const token = getToken(sourceFile, textSpanEnd(context.span)); @@ -22,12 +23,12 @@ namespace ts.codefix { const deletion = textChanges.ChangeTracker.with(context, t => tryDeleteDeclaration(t, sourceFile, token)); if (deletion.length) { - result.push(createCodeFixAction(deletion, [Diagnostics.Remove_declaration_for_Colon_0, token.getText(sourceFile)], fixIdDelete, Diagnostics.Delete_all_unused_declarations)); + result.push(createCodeFixAction(fixName, deletion, [Diagnostics.Remove_declaration_for_Colon_0, token.getText(sourceFile)], fixIdDelete, Diagnostics.Delete_all_unused_declarations)); } const prefix = textChanges.ChangeTracker.with(context, t => tryPrefixDeclaration(t, errorCode, sourceFile, token)); if (prefix.length) { - result.push(createCodeFixAction(prefix, [Diagnostics.Prefix_0_with_an_underscore, token.getText(sourceFile)], fixIdPrefix, Diagnostics.Prefix_all_unused_declarations_with_where_possible)); + result.push(createCodeFixAction(fixName, prefix, [Diagnostics.Prefix_0_with_an_underscore, token.getText(sourceFile)], fixIdPrefix, Diagnostics.Prefix_all_unused_declarations_with_where_possible)); } return result; diff --git a/src/services/codefixes/fixes.ts b/src/services/codefixes/fixes.ts deleted file mode 100644 index 50a0afd3925..00000000000 --- a/src/services/codefixes/fixes.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 35e75d831fd..cd3c5339a29 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -25,8 +25,7 @@ namespace ts.codefix { } const declaration = declarations[0]; - // Clone name to remove leading trivia. - const name = getSynthesizedDeepClone(getNameOfDeclaration(declaration)) as PropertyName; + const name = getSynthesizedDeepClone(getNameOfDeclaration(declaration), /*includeTrivia*/ false) as PropertyName; const visibilityModifier = createVisibilityModifier(getModifierFlags(declaration)); const modifiers = visibilityModifier ? createNodeArray([visibilityModifier]) : undefined; const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); @@ -69,7 +68,7 @@ namespace ts.codefix { for (const signature of signatures) { // Need to ensure nodes are fresh each time so they can have different positions. - outputMethod(signature, getSynthesizedDeepClones(modifiers), getSynthesizedDeepClone(name)); + outputMethod(signature, getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), getSynthesizedDeepClone(name, /*includeTrivia*/ false)); } if (declarations.length > signatures.length) { @@ -103,10 +102,6 @@ namespace ts.codefix { return signatureDeclaration; } - function getSynthesizedDeepClones(nodes: NodeArray | undefined): NodeArray | undefined { - return nodes && createNodeArray(nodes.map(getSynthesizedDeepClone)); - } - export function createMethodFromCallExpression( { typeArguments, arguments: args }: CallExpression, methodName: string, diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 95cd84ee620..ddd530e4246 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -35,7 +35,7 @@ namespace ts.codefix { function createCodeAction(descriptionDiagnostic: DiagnosticMessage, diagnosticArgs: [string, string], changes: FileTextChanges[]): CodeFixAction { // TODO: GH#20315 - return createCodeFixActionNoFixId(changes, [descriptionDiagnostic, ...diagnosticArgs] as [DiagnosticMessage, string, string]); + return createCodeFixActionNoFixId("import", changes, [descriptionDiagnostic, ...diagnosticArgs] as [DiagnosticMessage, string, string]); } function convertToImportCodeFixContext(context: CodeFixContext, symbolToken: Node, symbolName: string): ImportCodeFixContext { @@ -98,18 +98,18 @@ namespace ts.codefix { symbolToken: Node | undefined, preferences: UserPreferences, ): { readonly moduleSpecifier: string, readonly codeAction: CodeAction } { - const exportInfos = getAllReExportingModules(exportedSymbol, checker, allSourceFiles); + const exportInfos = getAllReExportingModules(exportedSymbol, symbolName, checker, allSourceFiles); Debug.assert(exportInfos.some(info => info.moduleSymbol === moduleSymbol)); // We sort the best codefixes first, so taking `first` is best for completions. const moduleSpecifier = first(getNewImportInfos(program, sourceFile, exportInfos, compilerOptions, getCanonicalFileName, host, preferences)).moduleSpecifier; const ctx: ImportCodeFixContext = { host, program, checker, compilerOptions, sourceFile, formatContext, symbolName, getCanonicalFileName, symbolToken, preferences }; return { moduleSpecifier, codeAction: first(getCodeActionsForImport(exportInfos, ctx)) }; } - function getAllReExportingModules(exportedSymbol: Symbol, checker: TypeChecker, allSourceFiles: ReadonlyArray): ReadonlyArray { + function getAllReExportingModules(exportedSymbol: Symbol, symbolName: string, checker: TypeChecker, allSourceFiles: ReadonlyArray): ReadonlyArray { const result: SymbolExportInfo[] = []; forEachExternalModule(checker, allSourceFiles, moduleSymbol => { for (const exported of checker.getExportsOfModule(moduleSymbol)) { - if (skipAlias(exported, checker) === exportedSymbol) { + if (exported.escapedName === InternalSymbolName.Default || exported.name === symbolName && skipAlias(exported, checker) === exportedSymbol) { const isDefaultExport = checker.tryGetMemberInModuleExports(InternalSymbolName.Default, moduleSymbol) === exported; result.push({ moduleSymbol, importKind: isDefaultExport ? ImportKind.Default : ImportKind.Named }); } @@ -240,6 +240,7 @@ namespace ts.codefix { preferences: UserPreferences, ): ReadonlyArray { const { baseUrl, paths, rootDirs } = compilerOptions; + const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions); const addJsExtension = usesJsExtensionOnImports(sourceFile); const choicesForEachExportingModule = flatMap(moduleSymbols, ({ moduleSymbol, importKind }) => { const modulePathsGroups = getAllModulePaths(program, moduleSymbol.valueDeclaration.getSourceFile()).map(moduleFileName => { @@ -252,7 +253,7 @@ namespace ts.codefix { return [global]; } - const relativePath = removeExtensionAndIndexPostFix(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName), compilerOptions, addJsExtension); + const relativePath = removeExtensionAndIndexPostFix(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName), moduleResolutionKind, addJsExtension); if (!baseUrl || preferences.importModuleSpecifierPreference === "relative") { return [relativePath]; } @@ -262,7 +263,7 @@ namespace ts.codefix { return [relativePath]; } - const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, compilerOptions, addJsExtension); + const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, moduleResolutionKind, addJsExtension); if (paths) { const fromPaths = tryGetModuleNameFromPaths(removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths); if (fromPaths) { @@ -390,7 +391,8 @@ namespace ts.codefix { return firstDefined(roots, unNormalizedTypeRoot => { const typeRoot = toPath(unNormalizedTypeRoot, /*basePath*/ undefined, getCanonicalFileName); if (startsWith(moduleFileName, typeRoot)) { - return removeExtensionAndIndexPostFix(moduleFileName.substring(typeRoot.length + 1), options, addJsExtension); + // For a type definition, we can strip `/index` even with classic resolution. + return removeExtensionAndIndexPostFix(moduleFileName.substring(typeRoot.length + 1), ModuleResolutionKind.NodeJs, addJsExtension); } }); } @@ -527,11 +529,11 @@ namespace ts.codefix { }); } - function removeExtensionAndIndexPostFix(fileName: string, options: CompilerOptions, addJsExtension: boolean): string { + function removeExtensionAndIndexPostFix(fileName: string, moduleResolutionKind: ModuleResolutionKind, addJsExtension: boolean): string { const noExtension = removeFileExtension(fileName); return addJsExtension ? noExtension + ".js" - : getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeJs + : moduleResolutionKind === ModuleResolutionKind.NodeJs ? removeSuffix(noExtension, "/index") : noExtension; } diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index 99556fc84de..8b36d3e5d51 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -34,7 +34,7 @@ namespace ts.codefix { let declaration!: Declaration; const changes = textChanges.ChangeTracker.with(context, changes => { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken); }); return changes.length === 0 ? undefined - : [createCodeFixAction(changes, [getDiagnostic(errorCode, token), getNameOfDeclaration(declaration).getText(sourceFile)], fixId, Diagnostics.Infer_all_types_from_usage)]; + : [createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), getNameOfDeclaration(declaration).getText(sourceFile)], fixId, Diagnostics.Infer_all_types_from_usage)]; }, fixIds: [fixId], getAllCodeActions(context) { diff --git a/src/services/codefixes/useDefaultImport.ts b/src/services/codefixes/useDefaultImport.ts index 7a6a0acfc30..632cfc97e00 100644 --- a/src/services/codefixes/useDefaultImport.ts +++ b/src/services/codefixes/useDefaultImport.ts @@ -9,7 +9,7 @@ namespace ts.codefix { const info = getInfo(sourceFile, start); if (!info) return undefined; const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, info)); - return [createCodeFixAction(changes, Diagnostics.Convert_to_default_import, fixId, Diagnostics.Convert_all_to_default_imports)]; + return [createCodeFixAction(fixId, changes, Diagnostics.Convert_to_default_import, fixId, Diagnostics.Convert_all_to_default_imports)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { diff --git a/src/services/completions.ts b/src/services/completions.ts index 8c34e7e7de6..3100e4a13a9 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts.Completions { export type Log = (message: string) => void; @@ -202,26 +200,24 @@ namespace ts.Completions { let insertText: string | undefined; let replacementSpan: TextSpan | undefined; - if (preferences.includeCompletionsWithInsertText) { - if (origin && origin.type === "this-type") { - insertText = needsConvertPropertyAccess ? `this[${quote(name, preferences)}]` : `this.${name}`; - } - // We should only have needsConvertPropertyAccess if there's a property access to convert. But see #21790. - // Somehow there was a global with a non-identifier name. Hopefully someone will complain about getting a "foo bar" global completion and provide a repro. - else if ((origin && origin.type === "symbol-member" || needsConvertPropertyAccess) && propertyAccessToConvert) { - insertText = needsConvertPropertyAccess ? `[${quote(name, preferences)}]` : `[${name}]`; - const dot = findChildOfKind(propertyAccessToConvert!, SyntaxKind.DotToken, sourceFile)!; - // If the text after the '.' starts with this name, write over it. Else, add new text. - const end = startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; - replacementSpan = createTextSpanFromBounds(dot.getStart(sourceFile), end); - } + if (origin && origin.type === "this-type") { + insertText = needsConvertPropertyAccess ? `this[${quote(name, preferences)}]` : `this.${name}`; + } + // We should only have needsConvertPropertyAccess if there's a property access to convert. But see #21790. + // Somehow there was a global with a non-identifier name. Hopefully someone will complain about getting a "foo bar" global completion and provide a repro. + else if ((origin && origin.type === "symbol-member" || needsConvertPropertyAccess) && propertyAccessToConvert) { + insertText = needsConvertPropertyAccess ? `[${quote(name, preferences)}]` : `[${name}]`; + const dot = findChildOfKind(propertyAccessToConvert!, SyntaxKind.DotToken, sourceFile)!; + // If the text after the '.' starts with this name, write over it. Else, add new text. + const end = startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; + replacementSpan = createTextSpanFromBounds(dot.getStart(sourceFile), end); + } - if (isJsxInitializer) { - if (insertText === undefined) insertText = name; - insertText = `{${insertText}}`; - if (typeof isJsxInitializer !== "boolean") { - replacementSpan = createTextSpanFromNode(isJsxInitializer, sourceFile); - } + if (isJsxInitializer) { + if (insertText === undefined) insertText = name; + insertText = `{${insertText}}`; + if (typeof isJsxInitializer !== "boolean") { + replacementSpan = createTextSpanFromNode(isJsxInitializer, sourceFile); } } @@ -380,7 +376,7 @@ namespace ts.Completions { // } // let x: Foo["/*completion position*/"] return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode((node.parent.parent as IndexedAccessTypeNode).objectType)); - case SyntaxKind.ImportTypeNode: + case SyntaxKind.ImportType: return { kind: StringLiteralCompletionKind.Paths, paths: PathCompletions.getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) }; default: return undefined; @@ -474,10 +470,10 @@ namespace ts.Completions { function getStringLiteralTypes(type: Type | undefined, typeChecker: TypeChecker, uniques = createMap()): ReadonlyArray | undefined { if (!type) return emptyArray; type = skipConstraint(type); - return type.flags & TypeFlags.Union - ? flatMap((type).types, t => getStringLiteralTypes(t, typeChecker, uniques)) - : type.flags & TypeFlags.StringLiteral && !(type.flags & TypeFlags.EnumLiteral) && addToSeen(uniques, (type as StringLiteralType).value) - ? [type as StringLiteralType] + return type.isUnion() + ? flatMap(type.types, t => getStringLiteralTypes(t, typeChecker, uniques)) + : type.isStringLiteral() && !(type.flags & TypeFlags.EnumLiteral) && addToSeen(uniques, type.value) + ? [type] : emptyArray; } @@ -846,7 +842,7 @@ namespace ts.Completions { // Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS| // Skip this partial identifier and adjust the contextToken to the token that precedes it. - if (contextToken && position <= contextToken.end && isWord(contextToken.kind)) { + if (contextToken && position <= contextToken.end && (isIdentifier(contextToken) || isKeyword(contextToken.kind))) { const start = timestamp(); contextToken = findPrecedingToken(contextToken.getFullStart(), sourceFile, /*startNode*/ undefined, insideJsDocTagTypeExpression); log("getCompletionData: Get previous token 2: " + (timestamp() - start)); @@ -881,6 +877,9 @@ namespace ts.Completions { case SyntaxKind.QualifiedName: node = (parent as QualifiedName).left; break; + case SyntaxKind.ImportType: + node = parent; + break; default: // There is nothing that precedes the dot, so this likely just a stray character // or leading into a '...' token. Just bail out instead. @@ -943,7 +942,8 @@ namespace ts.Completions { isJsxInitializer = true; break; case SyntaxKind.Identifier: - if (previousToken !== (parent as JsxAttribute).name) { + // For `
typeChecker.isValidPropertyAccess((node.parent), symbol.name); + const isValidValueAccess = (symbol: Symbol) => typeChecker.isValidPropertyAccess(isImportType ? node : (node.parent), symbol.name); const isValidTypeAccess = (symbol: Symbol) => symbolCanBeReferencedAtTypeLocation(symbol); const isValidAccess = allowTypeOrValue ? // Any kind is allowed when dotting off namespace in internal import equals declaration @@ -1063,7 +1064,7 @@ namespace ts.Completions { } else { for (const symbol of type.getApparentProperties()) { - if (typeChecker.isValidPropertyAccessForCompletions((node.parent), type, symbol)) { + if (typeChecker.isValidPropertyAccessForCompletions(node.kind === SyntaxKind.ImportType ? node : node.parent, type, symbol)) { addPropertySymbol(symbol); } } @@ -1552,32 +1553,22 @@ namespace ts.Completions { * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(): GlobalsSearch { - const namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken); - if (!namedImportsOrExports) return undefined; + // `import { |` or `import { a as 0, | }` + const namedImportsOrExports = contextToken && (contextToken.kind === SyntaxKind.OpenBraceToken || contextToken.kind === SyntaxKind.CommaToken) + ? tryCast(contextToken.parent, isNamedImportsOrExports) : undefined; + if (!namedImportsOrExports) return GlobalsSearch.Continue; // cursor is in an import clause // try to show exported member for imported module - const declarationKind = namedImportsOrExports.kind === SyntaxKind.NamedImports ? - SyntaxKind.ImportDeclaration : - SyntaxKind.ExportDeclaration; - const importOrExportDeclaration = getAncestor(namedImportsOrExports, declarationKind); - const moduleSpecifier = importOrExportDeclaration.moduleSpecifier; - - if (!moduleSpecifier) { - return GlobalsSearch.Fail; - } + const { moduleSpecifier } = namedImportsOrExports.kind === SyntaxKind.NamedImports ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent; + const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); + if (!moduleSpecifierSymbol) return GlobalsSearch.Fail; completionKind = CompletionKind.MemberLike; isNewIdentifierLocation = false; - - const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); - if (!moduleSpecifierSymbol) { - symbols = emptyArray; - return GlobalsSearch.Fail; - } - const exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol); - symbols = filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements); + const existing = arrayToSet(namedImportsOrExports.elements, n => isCurrentlyEditingNode(n) ? undefined : (n.propertyName || n.name).escapedText); + symbols = exports.filter(e => e.escapedName !== InternalSymbolName.Default && !existing.get(e.escapedName)); return GlobalsSearch.Success; } @@ -1645,26 +1636,6 @@ namespace ts.Completions { return undefined; } - /** - * Returns the containing list of named imports or exports of a context token, - * on the condition that one exists and that the context implies completion should be given. - */ - function tryGetNamedImportsOrExportsForCompletion(contextToken: Node): NamedImportsOrExports { - if (contextToken) { - switch (contextToken.kind) { - case SyntaxKind.OpenBraceToken: // import { | - case SyntaxKind.CommaToken: // import { a as 0, | - switch (contextToken.parent.kind) { - case SyntaxKind.NamedImports: - case SyntaxKind.NamedExports: - return contextToken.parent; - } - } - } - - return undefined; - } - function isConstructorParameterCompletion(node: Node): boolean { return !!node.parent && isParameter(node.parent) && isConstructorDeclaration(node.parent.parent) && (isParameterPropertyModifier(node.kind) || isDeclarationName(node)); @@ -1908,31 +1879,6 @@ namespace ts.Completions { return false; } - /** - * Filters out completion suggestions for named imports or exports. - * - * @param exportsOfModule The list of symbols which a module exposes. - * @param namedImportsOrExports The list of existing import/export specifiers in the import/export clause. - * - * @returns Symbols to be suggested at an import/export clause, barring those whose named imports/exports - * do not occur at the current position and have not otherwise been typed. - */ - function filterNamedImportOrExportCompletionItems(exportsOfModule: Symbol[], namedImportsOrExports: ReadonlyArray): Symbol[] { - const existingImportsOrExports = createUnderscoreEscapedMap(); - - for (const element of namedImportsOrExports) { - // If this is the current item we are editing right now, do not filter it out - if (isCurrentlyEditingNode(element)) { - continue; - } - - const name = element.propertyName || element.name; - existingImportsOrExports.set(name.escapedText, true); - } - - return exportsOfModule.filter(e => e.escapedName !== InternalSymbolName.Default && !existingImportsOrExports.get(e.escapedName)); - } - /** * Filters out completion suggestions for named imports or exports. * @@ -2198,13 +2144,12 @@ namespace ts.Completions { * excludes array-like types or callable/constructable types. */ function getPropertiesForCompletion(type: Type, checker: TypeChecker, isForAccess: boolean): Symbol[] { - if (!(type.flags & TypeFlags.Union)) { + if (!(type.isUnion())) { return Debug.assertEachDefined(type.getApparentProperties(), "getApparentProperties() should all be defined"); } - const { types } = type as UnionType; // If we're providing completions for an object literal, skip primitive, array-like, or callable types since those shouldn't be implemented by object literals. - const filteredTypes = isForAccess ? types : types.filter(memberType => + const filteredTypes = isForAccess ? type.types : type.types.filter(memberType => !(memberType.flags & TypeFlags.Primitive || checker.isArrayLikeType(memberType) || typeHasCallOrConstructSignatures(memberType, checker))); return Debug.assertEachDefined(checker.getAllPossiblePropertiesOfTypes(filteredTypes), "getAllPossiblePropertiesOfTypes() should all be defined"); } @@ -2246,7 +2191,7 @@ namespace ts.Completions { // TODO: GH#19856 Would like to return `node is Node & { parent: (ClassElement | TypeElement) & { parent: ObjectTypeDeclaration } }` but then compilation takes > 10 minutes function isFromObjectTypeDeclaration(node: Node): boolean { - return node.parent && (isClassElement(node.parent) || isTypeElement(node.parent)) && isObjectTypeDeclaration(node.parent.parent); + return node.parent && isClassOrTypeElement(node.parent) && isObjectTypeDeclaration(node.parent.parent); } function hasIndexSignature(type: Type): boolean { diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index 8d48d526a4b..69c75548fe5 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -1,7 +1,7 @@ /* @internal */ namespace ts.DocumentHighlights { export function getDocumentHighlights(program: Program, cancellationToken: CancellationToken, sourceFile: SourceFile, position: number, sourceFilesToSearch: ReadonlyArray): DocumentHighlights[] | undefined { - const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true); + const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); if (node.parent && (isJsxOpeningElement(node.parent) && node.parent.tagName === node || isJsxClosingElement(node.parent))) { // For a JSX element, just highlight the matching tag, not all references. @@ -22,10 +22,20 @@ namespace ts.DocumentHighlights { } function getSemanticDocumentHighlights(position: number, node: Node, program: Program, cancellationToken: CancellationToken, sourceFilesToSearch: ReadonlyArray): DocumentHighlights[] | undefined { - const referenceEntries = FindAllReferences.getReferenceEntriesForNode(position, node, program, sourceFilesToSearch, cancellationToken); + const sourceFilesSet = arrayToSet(sourceFilesToSearch, f => f.fileName); + const referenceEntries = FindAllReferences.getReferenceEntriesForNode(position, node, program, sourceFilesToSearch, cancellationToken, /*options*/ undefined, sourceFilesSet); if (!referenceEntries) return undefined; const map = arrayToMultiMap(referenceEntries.map(FindAllReferences.toHighlightSpan), e => e.fileName, e => e.span); - return arrayFrom(map.entries(), ([fileName, highlightSpans]) => ({ fileName, highlightSpans })); + return arrayFrom(map.entries(), ([fileName, highlightSpans]) => { + if (!sourceFilesSet.has(fileName)) { + Debug.assert(program.redirectTargetsSet.has(fileName)); + const redirectTarget = program.getSourceFile(fileName); + const redirect = find(sourceFilesToSearch, f => f.redirectInfo && f.redirectInfo.redirectTarget === redirectTarget)!; + fileName = redirect.fileName; + Debug.assert(sourceFilesSet.has(fileName)); + } + return { fileName, highlightSpans }; + }); } function getSyntacticDocumentHighlights(node: Node, sourceFile: SourceFile): DocumentHighlights[] { diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index ac3745a7926..7c5922035ea 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts.FindAllReferences { export interface SymbolAndEntries { @@ -43,7 +41,7 @@ namespace ts.FindAllReferences { export function findReferencedSymbols(program: Program, cancellationToken: CancellationToken, sourceFiles: ReadonlyArray, sourceFile: SourceFile, position: number): ReferencedSymbol[] | undefined { const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); - const referencedSymbols = Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, /*options*/ {}); + const referencedSymbols = Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken); const checker = program.getTypeChecker(); return !referencedSymbols || !referencedSymbols.length ? undefined : mapDefined(referencedSymbols, ({ definition, references }) => // Only include referenced symbols that have a valid definition. @@ -88,8 +86,8 @@ namespace ts.FindAllReferences { return map(flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options)), toReferenceEntry); } - export function getReferenceEntriesForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken, options: Options = {}): Entry[] | undefined { - return flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options)); + export function getReferenceEntriesForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken, options: Options = {}, sourceFilesSet: ReadonlyMap = arrayToSet(sourceFiles, f => f.fileName)): Entry[] | undefined { + return flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet)); } function flattenEntries(referenceSymbols: SymbolAndEntries[]): Entry[] { @@ -231,10 +229,10 @@ namespace ts.FindAllReferences { /* @internal */ namespace ts.FindAllReferences.Core { /** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */ - export function getReferencedSymbolsForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken, options: Options = {}): SymbolAndEntries[] | undefined { + export function getReferencedSymbolsForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken, options: Options = {}, sourceFilesSet: ReadonlyMap = arrayToSet(sourceFiles, f => f.fileName)): SymbolAndEntries[] | undefined { if (isSourceFile(node)) { const reference = GoToDefinition.getReferenceAtPosition(node, position, program); - return reference && getReferencedSymbolsForModule(program, program.getTypeChecker().getMergedSymbol(reference.file.symbol), sourceFiles); + return reference && getReferencedSymbolsForModule(program, program.getTypeChecker().getMergedSymbol(reference.file.symbol), sourceFiles, sourceFilesSet); } if (!options.implementations) { @@ -254,10 +252,10 @@ namespace ts.FindAllReferences.Core { } if (symbol.flags & SymbolFlags.Module && isModuleReferenceLocation(node)) { - return getReferencedSymbolsForModule(program, symbol, sourceFiles); + return getReferencedSymbolsForModule(program, symbol, sourceFiles, sourceFilesSet); } - return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options); + return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options); } function isModuleReferenceLocation(node: Node): boolean { @@ -277,7 +275,7 @@ namespace ts.FindAllReferences.Core { } } - function getReferencedSymbolsForModule(program: Program, symbol: Symbol, sourceFiles: ReadonlyArray): SymbolAndEntries[] { + function getReferencedSymbolsForModule(program: Program, symbol: Symbol, sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap): SymbolAndEntries[] { Debug.assert(!!symbol.valueDeclaration); const references = findModuleReferences(program, sourceFiles, symbol).map(reference => { @@ -299,7 +297,9 @@ namespace ts.FindAllReferences.Core { // 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 SyntaxKind.ModuleDeclaration: - references.push({ type: "node", node: (decl as ModuleDeclaration).name }); + if (sourceFilesSet.has(decl.getSourceFile().fileName)) { + references.push({ type: "node", node: (decl as ModuleDeclaration).name }); + } break; default: Debug.fail("Expected a module symbol to be declared by a SourceFile or ModuleDeclaration."); @@ -339,14 +339,14 @@ namespace ts.FindAllReferences.Core { } /** Core find-all-references algorithm for a normal symbol. */ - function getReferencedSymbolsForSymbol(symbol: Symbol, node: Node, sourceFiles: ReadonlyArray, checker: TypeChecker, cancellationToken: CancellationToken, options: Options): SymbolAndEntries[] { + function getReferencedSymbolsForSymbol(symbol: Symbol, node: Node, sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap, checker: TypeChecker, cancellationToken: CancellationToken, options: Options): SymbolAndEntries[] { symbol = skipPastExportOrImportSpecifierOrUnion(symbol, node, checker) || symbol; // Compute the meaning from the location and the symbol it references const searchMeaning = getIntersectingMeaningFromDeclarations(node, symbol); const result: SymbolAndEntries[] = []; - const state = new State(sourceFiles, getSpecialSearchKind(node), checker, cancellationToken, searchMeaning, options, result); + const state = new State(sourceFiles, sourceFilesSet, getSpecialSearchKind(node), checker, cancellationToken, searchMeaning, options, result); if (node.kind === SyntaxKind.DefaultKeyword) { addReference(node, symbol, state); @@ -469,10 +469,9 @@ namespace ts.FindAllReferences.Core { */ readonly markSeenReExportRHS = nodeSeenTracker(); - private readonly includedSourceFiles: Map; - constructor( readonly sourceFiles: ReadonlyArray, + readonly sourceFilesSet: ReadonlyMap, /** True if we're searching for constructor references. */ readonly specialSearchKind: SpecialSearchKind, readonly checker: TypeChecker, @@ -480,17 +479,16 @@ namespace ts.FindAllReferences.Core { readonly searchMeaning: SemanticMeaning, readonly options: Options, private readonly result: Push) { - this.includedSourceFiles = arrayToSet(sourceFiles, s => s.fileName); } includesSourceFile(sourceFile: SourceFile): boolean { - return this.includedSourceFiles.has(sourceFile.fileName); + return this.sourceFilesSet.has(sourceFile.fileName); } private importTracker: ImportTracker | undefined; /** Gets every place to look for references of an exported symbols. See `ImportsResult` in `importTracker.ts` for more documentation. */ getImportSearches(exportSymbol: Symbol, exportInfo: ExportInfo): ImportsResult { - if (!this.importTracker) this.importTracker = createImportTracker(this.sourceFiles, this.checker, this.cancellationToken); + if (!this.importTracker) this.importTracker = createImportTracker(this.sourceFiles, this.sourceFilesSet, this.checker, this.cancellationToken); return this.importTracker(exportSymbol, exportInfo, this.options.isForRename); } @@ -706,12 +704,19 @@ namespace ts.FindAllReferences.Core { export function isSymbolReferencedInFile(definition: Identifier, checker: TypeChecker, sourceFile: SourceFile) { const symbol = checker.getSymbolAtLocation(definition); if (!symbol) return true; // Be lenient with invalid code. - return getPossibleSymbolReferencePositions(sourceFile, symbol.name).some(position => { - const token = tryCast(getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true), isIdentifier); - return token && token !== definition && token.escapedText === definition.escapedText && checker.getSymbolAtLocation(token) === symbol; + return getPossibleSymbolReferenceNodes(sourceFile, symbol.name).some(token => { + if (!isIdentifier(token) || token === definition || token.escapedText !== definition.escapedText) return false; + const referenceSymbol = checker.getSymbolAtLocation(token); + return referenceSymbol === symbol + || checker.getShorthandAssignmentValueSymbol(token.parent) === symbol + || isExportSpecifier(token.parent) && getLocalSymbolForExportSpecifier(token, referenceSymbol, token.parent, checker) === symbol; }); } + function getPossibleSymbolReferenceNodes(sourceFile: SourceFile, symbolName: string, container: Node = sourceFile): ReadonlyArray { + return getPossibleSymbolReferencePositions(sourceFile, symbolName, container).map(pos => getTouchingPropertyName(sourceFile, pos, /*includeJsDocComment*/ true)); + } + function getPossibleSymbolReferencePositions(sourceFile: SourceFile, symbolName: string, container: Node = sourceFile): ReadonlyArray { const positions: number[] = []; @@ -750,11 +755,9 @@ namespace ts.FindAllReferences.Core { function getLabelReferencesInNode(container: Node, targetLabel: Identifier): SymbolAndEntries[] { const sourceFile = container.getSourceFile(); const labelName = targetLabel.text; - const references = mapDefined(getPossibleSymbolReferencePositions(sourceFile, labelName, container), position => { - const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false); + const references = mapDefined(getPossibleSymbolReferenceNodes(sourceFile, labelName, container), node => // Only pick labels that are either the target label, or have a target that is the target label - return node && (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) ? nodeEntry(node) : undefined; - }); + node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel) ? nodeEntry(node) : undefined); return [{ definition: { type: "label", node: targetLabel }, references }]; } @@ -784,10 +787,8 @@ namespace ts.FindAllReferences.Core { function getAllReferencesForKeyword(sourceFiles: ReadonlyArray, keywordKind: SyntaxKind, cancellationToken: CancellationToken): SymbolAndEntries[] { const references = flatMap(sourceFiles, sourceFile => { cancellationToken.throwIfCancellationRequested(); - return mapDefined(getPossibleSymbolReferencePositions(sourceFile, tokenToString(keywordKind), sourceFile), position => { - const referenceLocation = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); - return referenceLocation.kind === keywordKind ? nodeEntry(referenceLocation) : undefined; - }); + return mapDefined(getPossibleSymbolReferenceNodes(sourceFile, tokenToString(keywordKind), sourceFile), referenceLocation => + referenceLocation.kind === keywordKind ? nodeEntry(referenceLocation) : undefined); }); return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references }] : undefined; } @@ -1132,8 +1133,8 @@ namespace ts.FindAllReferences.Core { if (componentType.symbol && componentType.symbol.getFlags() & (SymbolFlags.Class | SymbolFlags.Interface)) { result.push(componentType.symbol); } - if (componentType.getFlags() & TypeFlags.UnionOrIntersection) { - getSymbolsForClassAndInterfaceComponents(componentType, result); + if (componentType.isUnionOrIntersection()) { + getSymbolsForClassAndInterfaceComponents(componentType, result); } } return result; @@ -1251,9 +1252,8 @@ namespace ts.FindAllReferences.Core { } const sourceFile = searchSpaceNode.getSourceFile(); - const references = mapDefined(getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode), position => { - const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false); - if (!node || node.kind !== SyntaxKind.SuperKeyword) { + const references = mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), node => { + if (node.kind !== SyntaxKind.SuperKeyword) { return; } @@ -1303,12 +1303,30 @@ namespace ts.FindAllReferences.Core { return undefined; } - const references: Entry[] = []; - for (const sourceFile of searchSpaceNode.kind === SyntaxKind.SourceFile ? sourceFiles : [searchSpaceNode.getSourceFile()]) { + const references = flatMap(searchSpaceNode.kind === SyntaxKind.SourceFile ? sourceFiles : [searchSpaceNode.getSourceFile()], sourceFile => { cancellationToken.throwIfCancellationRequested(); - const positions = getPossibleSymbolReferencePositions(sourceFile, "this", isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode); - getThisReferencesInFile(sourceFile, searchSpaceNode.kind === SyntaxKind.SourceFile ? sourceFile : searchSpaceNode, positions, staticFlag, references); - } + return getPossibleSymbolReferenceNodes(sourceFile, "this", isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(node => { + if (!isThis(node)) { + return false; + } + const container = getThisContainer(node, /* includeArrowFunctions */ false); + switch (searchSpaceNode.kind) { + case SyntaxKind.FunctionExpression: + case SyntaxKind.FunctionDeclaration: + return searchSpaceNode.symbol === container.symbol; + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + return isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; + case SyntaxKind.ClassExpression: + case SyntaxKind.ClassDeclaration: + // Make sure the container belongs to the same class + // and has the appropriate static modifier from the original container. + return container.parent && searchSpaceNode.symbol === container.parent.symbol && (getModifierFlags(container) & ModifierFlags.Static) === staticFlag; + case SyntaxKind.SourceFile: + return container.kind === SyntaxKind.SourceFile && !isExternalModule(container); + } + }); + }).map(n => nodeEntry(n)); return [{ definition: { type: "this", node: thisOrSuperKeyword }, @@ -1316,52 +1334,11 @@ namespace ts.FindAllReferences.Core { }]; } - function getThisReferencesInFile(sourceFile: SourceFile, searchSpaceNode: Node, possiblePositions: ReadonlyArray, staticFlag: ModifierFlags, result: Push): void { - forEach(possiblePositions, position => { - const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false); - if (!node || !isThis(node)) { - return; - } - - const container = getThisContainer(node, /* includeArrowFunctions */ false); - - switch (searchSpaceNode.kind) { - case SyntaxKind.FunctionExpression: - case SyntaxKind.FunctionDeclaration: - if (searchSpaceNode.symbol === container.symbol) { - result.push(nodeEntry(node)); - } - break; - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - if (isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(nodeEntry(node)); - } - break; - case SyntaxKind.ClassExpression: - case SyntaxKind.ClassDeclaration: - // Make sure the container belongs to the same class - // and has the appropriate static modifier from the original container. - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (getModifierFlags(container) & ModifierFlags.Static) === staticFlag) { - result.push(nodeEntry(node)); - } - break; - case SyntaxKind.SourceFile: - if (container.kind === SyntaxKind.SourceFile && !isExternalModule(container)) { - result.push(nodeEntry(node)); - } - break; - } - }); - } - function getReferencesForStringLiteral(node: StringLiteral, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken): SymbolAndEntries[] { const references = flatMap(sourceFiles, sourceFile => { cancellationToken.throwIfCancellationRequested(); - return mapDefined(getPossibleSymbolReferencePositions(sourceFile, node.text), position => { - const ref = tryCast(getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false), isStringLiteral); - return ref && ref.text === node.text ? nodeEntry(ref, /*isInString*/ true) : undefined; - }); + return mapDefined(getPossibleSymbolReferenceNodes(sourceFile, node.text), ref => + isStringLiteral(ref) && ref.text === node.text ? nodeEntry(ref, /*isInString*/ true) : undefined); }); return [{ @@ -1373,27 +1350,32 @@ namespace ts.FindAllReferences.Core { // For certain symbol kinds, we need to include other symbols in the search set. // This is not needed when searching for re-exports. function populateSearchSymbolSet(symbol: Symbol, location: Node, checker: TypeChecker, implementations: boolean): Symbol[] { - // The search set contains at least the current symbol const result: Symbol[] = []; + forEachRelatedSymbol(symbol, location, checker, + (sym, root, base) => { result.push(base || root || sym); }, + /*allowBaseTypes*/ () => !implementations); + return result; + } + function forEachRelatedSymbol( + symbol: Symbol, location: Node, checker: TypeChecker, + cbSymbol: (symbol: Symbol, rootSymbol?: Symbol, baseSymbol?: Symbol) => T | undefined, + allowBaseTypes: (rootSymbol: Symbol) => boolean, + ): T | undefined { const containingObjectLiteralElement = getContainingObjectLiteralElement(location); if (containingObjectLiteralElement) { - // If the location is name of property symbol from object literal destructuring pattern - // Search the property symbol - // for ( { property: p2 } of elems) { } - if (containingObjectLiteralElement.kind !== SyntaxKind.ShorthandPropertyAssignment) { - const propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); - if (propertySymbol) { - result.push(propertySymbol); - } - } - // If the location is in a context sensitive location (i.e. in an object literal) try // to get a contextual type for it, and add the property symbol from the contextual // type to the search set - for (const contextualSymbol of getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker)) { - addRootSymbols(contextualSymbol); - } + const res = firstDefined(getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker), fromRoot); + if (res) return res; + + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + const propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); + const res1 = propertySymbol && cbSymbol(propertySymbol); + if (res1) return res1; /* Because in short-hand property assignment, location has two meaning : property name and as value of the property * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of @@ -1407,49 +1389,41 @@ namespace ts.FindAllReferences.Core { * will be included correctly. */ const shorthandValueSymbol = checker.getShorthandAssignmentValueSymbol(location.parent); - if (shorthandValueSymbol) { - result.push(shorthandValueSymbol); - } + const res2 = shorthandValueSymbol && cbSymbol(shorthandValueSymbol); + if (res2) return res2; } - // If the symbol.valueDeclaration is a property parameter declaration, - // we should include both parameter declaration symbol and property declaration symbol - // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. - // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members - addRange(result, getParameterPropertySymbols(symbol, checker)); + const res = fromRoot(symbol); + if (res) return res; + + if (symbol.valueDeclaration && isParameterPropertyDeclaration(symbol.valueDeclaration)) { + // For a parameter property, now try on the other symbol (property if this was a parameter, parameter if this was a property). + const paramProps = checker.getSymbolsOfParameterPropertyDeclaration(cast(symbol.valueDeclaration, isParameter), symbol.name); + Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & SymbolFlags.FunctionScopedVariable) && !!(paramProps[1].flags & SymbolFlags.Property)); // is [parameter, property] + return fromRoot(symbol.flags & SymbolFlags.FunctionScopedVariable ? paramProps[1] : paramProps[0]); + } // If this is symbol of binding element without propertyName declaration in Object binding pattern // Include the property in the search const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker); - if (bindingElementPropertySymbol) { - result.push(bindingElementPropertySymbol); - addRootSymbols(bindingElementPropertySymbol); - } - - addRootSymbols(symbol); - - return result; - - function addRootSymbols(sym: Symbol): void { - // If this is a union property, add all the symbols from all its source symbols in all unioned types. - // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list - for (const rootSymbol of checker.getRootSymbols(sym)) { - result.push(rootSymbol); + return bindingElementPropertySymbol && fromRoot(bindingElementPropertySymbol); + function fromRoot(sym: Symbol): T | undefined { + // If this is a union property: + // - In populateSearchSymbolsSet we will add all the symbols from all its source symbols in all unioned types. + // - In findRelatedSymbol, we will just use the union symbol if any source symbol is included in the search. + // If the symbol is an instantiation from a another symbol (e.g. widened symbol): + // - In populateSearchSymbolsSet, add the root the list + // - In findRelatedSymbol, return the source symbol if that is in the search. (Do not return the instantiation symbol.) + return firstDefined(checker.getRootSymbols(sym), rootSymbol => + cbSymbol(sym, rootSymbol) // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions - if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, result); - } - } + || (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface) && allowBaseTypes(rootSymbol) + ? getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, base => cbSymbol(sym, rootSymbol, base)) + : undefined)); } } - function getParameterPropertySymbols(symbol: Symbol, checker: TypeChecker): Symbol[] { - return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isParameterPropertyDeclaration(symbol.valueDeclaration) - ? checker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name) - : undefined; - } - /** * Find symbol of the given property-name and add the symbol to the given result array * @param symbol a symbol to start searching for the given propertyName @@ -1458,107 +1432,35 @@ namespace ts.FindAllReferences.Core { * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. * The value of previousIterationSymbol is undefined when the function is first called. */ - function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, checker: TypeChecker, result: Symbol[] = []): Symbol[] { + function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, checker: TypeChecker, cb: (symbol: Symbol) => T | undefined): T | undefined { const seen = createMap(); - recur(symbol); - return result; + return recur(symbol); - function recur(symbol: Symbol): void { + function recur(symbol: Symbol): T | undefined { // Use `addToSeen` to ensure we don't infinitely recurse in this situation: // interface C extends C { // /*findRef*/propName: string; // } if (!(symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) || !addToSeen(seen, getSymbolId(symbol))) return; - for (const declaration of symbol.declarations) { - for (const typeReference of getAllSuperTypeNodes(declaration)) { - const type = checker.getTypeAtLocation(typeReference); - if (!(type && type.symbol)) continue; - - const propertySymbol = checker.getPropertyOfType(type, propertyName); - if (propertySymbol) { - result.push(...checker.getRootSymbols(propertySymbol)); - } - - // Visit the typeReference as well to see if it directly or indirectly use that property - recur(type.symbol); - } - } + return firstDefined(symbol.declarations, declaration => firstDefined(getAllSuperTypeNodes(declaration), typeReference => { + const type = checker.getTypeAtLocation(typeReference); + const propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName); + // Visit the typeReference as well to see if it directly or indirectly uses that property + return propertySymbol && (firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol)); + })); } } function getRelatedSymbol(search: Search, referenceSymbol: Symbol, referenceLocation: Node, state: State): Symbol | undefined { const { checker } = state; - if (search.includes(referenceSymbol)) { - return referenceSymbol; - } - - if (referenceSymbol.flags & SymbolFlags.FunctionScopedVariable) { - Debug.assert(!(referenceSymbol.flags & SymbolFlags.Property)); - const paramProps = getParameterPropertySymbols(referenceSymbol, checker); - if (paramProps) { - return getRelatedSymbol(search, find(paramProps, x => !!(x.flags & SymbolFlags.Property))!, referenceLocation, state); - } - } - - // If the reference location is in an object literal, try to get the contextual type for the - // object literal, lookup the property symbol in the contextual type, and use this symbol to - // compare to our searchSymbol - const containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); - if (containingObjectLiteralElement) { - const contextualSymbol = firstDefined(getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker), findRootSymbol); - if (contextualSymbol) { - return contextualSymbol; - } - - // If the reference location is the name of property from object literal destructuring pattern - // Get the property symbol from the object literal's type and look if thats the search symbol - // In below eg. get 'property' from type of elems iterating type - // for ( { property: p2 } of elems) { } - const propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, checker); - if (propertySymbol && search.includes(propertySymbol)) { - return propertySymbol; - } - } - - // If the reference location is the binding element and doesn't have property name - // then include the binding element in the related symbols - // let { a } : { a }; - const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, checker); - if (bindingElementPropertySymbol) { - const fromBindingElement = findRootSymbol(bindingElementPropertySymbol); - if (fromBindingElement) return fromBindingElement; - } - - return findRootSymbol(referenceSymbol); - - function findRootSymbol(sym: Symbol): Symbol | undefined { - // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) - // Or a union property, use its underlying unioned symbols - return firstDefined(checker.getRootSymbols(sym), rootSymbol => { - // if it is in the list, then we are done - if (search.includes(rootSymbol)) { - // For a root symbol that is a component of a union or intersection, use the original (union/intersection) symbol. - // That we when a symbol references the whole union we avoid claiming it references some particular member of the union. - // For a transient symbol we want to use the root symbol instead. - return getCheckFlags(sym) & CheckFlags.Synthetic ? sym : rootSymbol; - } - - // Finally, try all properties with the same name in any type the containing type extended or implemented, and - // see if any is in the list. If we were passed a parent symbol, only include types that are subtypes of the - // parent symbol - if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { - // Parents will only be defined if implementations is true - if (search.parents && !some(search.parents, parent => explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker))) { - return undefined; - } - - return getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker).some(search.includes) ? rootSymbol : undefined; - } - - return undefined; - }); - } + return forEachRelatedSymbol(referenceSymbol, referenceLocation, checker, + (sym, rootSymbol, baseSymbol) => search.includes(baseSymbol || rootSymbol || sym) + // For a base type, use the symbol for the derived type. For a synthetic (e.g. union) property, use the union symbol. + ? rootSymbol && !(getCheckFlags(sym) & CheckFlags.Synthetic) ? rootSymbol : sym + : undefined, + /*allowBaseTypes*/ rootSymbol => + !(search.parents && !some(search.parents, parent => explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker)))); } /** Gets all symbols for one property. Does not get symbols for every property. */ @@ -1567,7 +1469,7 @@ namespace ts.FindAllReferences.Core { const name = getNameFromPropertyName(node.name); const symbol = contextualType && name && contextualType.getProperty(name); return symbol ? [symbol] : - contextualType && contextualType.flags & TypeFlags.Union ? mapDefined((contextualType).types, t => t.getProperty(name)) : emptyArray; + contextualType && contextualType.isUnion() ? mapDefined(contextualType.types, t => t.getProperty(name)) : emptyArray; } /** @@ -1650,8 +1552,8 @@ namespace ts.FindAllReferences.Core { const localParentType = propertyAccessExpression && checker.getTypeAtLocation(propertyAccessExpression.expression); return localParentType && localParentType.symbol && localParentType.symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) && localParentType.symbol !== symbol.parent ? [localParentType.symbol] - : localParentType && localParentType.flags & TypeFlags.UnionOrIntersection - ? getSymbolsForClassAndInterfaceComponents(localParentType) + : localParentType && localParentType.isUnionOrIntersection() + ? getSymbolsForClassAndInterfaceComponents(localParentType) : undefined; } } diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index debec04536a..494a811c238 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -1,8 +1,3 @@ -/// -/// -/// -/// - /* @internal */ namespace ts.formatting { export interface FormatContext { diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 9b9c956f670..a53a1e5ce26 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -1,6 +1,3 @@ -/// -/// - /* @internal */ namespace ts.formatting { const standardScanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false, LanguageVariant.Standard); diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 815237df228..36ea7de23b4 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -198,7 +198,7 @@ namespace ts.formatting { rule("NoSpaceAfterCloseAngularBracket", SyntaxKind.GreaterThanToken, [SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.GreaterThanToken, SyntaxKind.CommaToken], - [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], + [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/], RuleAction.Delete), // decorators @@ -542,6 +542,10 @@ namespace ts.formatting { return false; } + function isNotFunctionDeclContext(context: FormattingContext): boolean { + return !isFunctionDeclContext(context); + } + function isFunctionDeclarationOrFunctionExpressionContext(context: FormattingContext): boolean { return context.contextNode.kind === SyntaxKind.FunctionDeclaration || context.contextNode.kind === SyntaxKind.FunctionExpression; } diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts index 75cc68cb268..b10d163343e 100644 --- a/src/services/formatting/rulesMap.ts +++ b/src/services/formatting/rulesMap.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts.formatting { export function getFormatContext(options: FormatCodeSettings): FormatContext { diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 08478344428..226fe74ef10 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -1,6 +1,6 @@ /* @internal */ namespace ts.GoToDefinition { - export function getDefinitionAtPosition(program: Program, sourceFile: SourceFile, position: number): DefinitionInfo[] { + export function getDefinitionAtPosition(program: Program, sourceFile: SourceFile, position: number): DefinitionInfo[] | undefined { const reference = getReferenceAtPosition(sourceFile, position, program); if (reference) { return [getDefinitionInfoForFileReference(reference.fileName, reference.file.fileName)]; @@ -29,7 +29,7 @@ namespace ts.GoToDefinition { // Could not find a symbol e.g. node is string or number keyword, // or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol if (!symbol) { - return undefined; + return getDefinitionInfoForIndexSignatures(node, typeChecker); } // If this is an alias, and the request came at the declaration location @@ -131,8 +131,8 @@ namespace ts.GoToDefinition { return undefined; } - if (type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Enum)) { - return flatMap((type).types, t => t.symbol && getDefinitionFromSymbol(typeChecker, t.symbol, node)); + if (type.isUnion() && !(type.flags & TypeFlags.Enum)) { + return flatMap(type.types, t => t.symbol && getDefinitionFromSymbol(typeChecker, t.symbol, node)); } return type.symbol && getDefinitionFromSymbol(typeChecker, type.symbol, node); @@ -157,6 +157,16 @@ namespace ts.GoToDefinition { return { definitions, textSpan }; } + // At 'x.foo', see if the type of 'x' has an index signature, and if so find its declarations. + function getDefinitionInfoForIndexSignatures(node: Node, checker: TypeChecker): DefinitionInfo[] | undefined { + if (!isPropertyAccessExpression(node.parent) || node.parent.name !== node) return; + const type = checker.getTypeAtLocation(node.parent.expression); + return mapDefined(type.isUnionOrIntersection() ? type.types : [type], nonUnionType => { + const info = checker.getIndexInfoOfType(nonUnionType, IndexKind.String); + return info && info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration); + }); + } + // Go to the original declaration for cases: // // (1) when the aliased symbol was declared in the location(parent). diff --git a/src/services/importTracker.ts b/src/services/importTracker.ts index de8a49243fa..82f9fc00af6 100644 --- a/src/services/importTracker.ts +++ b/src/services/importTracker.ts @@ -12,10 +12,10 @@ namespace ts.FindAllReferences { export type ImportTracker = (exportSymbol: Symbol, exportInfo: ExportInfo, isForRename: boolean) => ImportsResult; /** Creates the imports map and returns an ImportTracker that uses it. Call this lazily to avoid calling `getDirectImportsMap` unnecessarily. */ - export function createImportTracker(sourceFiles: ReadonlyArray, checker: TypeChecker, cancellationToken: CancellationToken): ImportTracker { + export function createImportTracker(sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap, checker: TypeChecker, cancellationToken: CancellationToken): ImportTracker { const allDirectImports = getDirectImportsMap(sourceFiles, checker, cancellationToken); return (exportSymbol, exportInfo, isForRename) => { - const { directImports, indirectUsers } = getImportersForExport(sourceFiles, allDirectImports, exportInfo, checker, cancellationToken); + const { directImports, indirectUsers } = getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, exportInfo, checker, cancellationToken); return { indirectUsers, ...getSearchesFromDirectImports(directImports, exportSymbol, exportInfo.exportKind, checker, isForRename) }; }; } @@ -39,6 +39,7 @@ namespace ts.FindAllReferences { /** Returns import statements that directly reference the exporting module, and a list of files that may access the module through a namespace. */ function getImportersForExport( sourceFiles: ReadonlyArray, + sourceFilesSet: ReadonlyMap, allDirectImports: Map, { exportingModuleSymbol, exportKind }: ExportInfo, checker: TypeChecker, @@ -62,7 +63,7 @@ namespace ts.FindAllReferences { // Module augmentations may use this module's exports without importing it. for (const decl of exportingModuleSymbol.declarations) { - if (isExternalModuleAugmentation(decl)) { + if (isExternalModuleAugmentation(decl) && sourceFilesSet.has(decl.getSourceFile().fileName)) { addIndirectUser(decl); } } diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts index 393b8ca34e0..6b4f7f2e1d4 100644 --- a/src/services/jsTyping.ts +++ b/src/services/jsTyping.ts @@ -1,11 +1,3 @@ -// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. -// See LICENSE.txt in the project root for complete license information. - -/// -/// -/// -/// - /* @internal */ namespace ts.JsTyping { diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 1a556cf33c0..84c299abf61 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -10,6 +10,7 @@ namespace ts.NavigateTo { export function getNavigateToItems(sourceFiles: ReadonlyArray, checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number, excludeDtsFiles: boolean): NavigateToItem[] { const patternMatcher = createPatternMatcher(searchValue); + if (!patternMatcher) return emptyArray; let rawItems: RawNavigateToItem[] = []; // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] @@ -35,28 +36,24 @@ namespace ts.NavigateTo { function getItemsFromNamedDeclaration(patternMatcher: PatternMatcher, name: string, declarations: ReadonlyArray, checker: TypeChecker, fileName: string, rawItems: Push): void { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - const matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); - - if (!matches) { + const match = patternMatcher.getMatchForLastSegmentOfPattern(name); + if (!match) { return; // continue to next named declarations } for (const declaration of declarations) { - if (!shouldKeepItem(declaration, checker)) { - continue; - } + if (!shouldKeepItem(declaration, checker)) continue; - // It was a match! If the pattern has dots in it, then also see if the - // declaration container matches as well. - let containerMatches = matches; if (patternMatcher.patternContainsDots) { - containerMatches = patternMatcher.getMatches(getContainers(declaration), name); - if (!containerMatches) { - continue; + const fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name); + if (fullMatch) { + rawItems.push({ name, fileName, matchKind: fullMatch.kind, isCaseSensitive: fullMatch.isCaseSensitive, declaration }); } } - - rawItems.push({ name, fileName, matchKind: Math.min(...matches.map(m => m.kind)), isCaseSensitive: matches.every(m => m.isCaseSensitive), declaration }); + else { + // If the pattern has dots in it, then also see if the declaration container matches as well. + rawItems.push({ name, fileName, matchKind: match.kind, isCaseSensitive: match.isCaseSensitive, declaration }); + } } } diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index e2176d2c1c9..b029796e718 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts.NavigationBar { /** diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 52f9a50366f..5109b050b6b 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -131,9 +131,7 @@ namespace ts.OrganizeImports { } function getExternalModuleName(specifier: Expression) { - return isStringLiteral(specifier) || isNoSubstitutionTemplateLiteral(specifier) - ? specifier.text - : undefined; + return isStringLiteralLike(specifier) ? specifier.text : undefined; } /* @internal */ // Internal for testing diff --git a/src/services/pathCompletions.ts b/src/services/pathCompletions.ts index 976449efee5..99ce0afb36c 100644 --- a/src/services/pathCompletions.ts +++ b/src/services/pathCompletions.ts @@ -137,8 +137,9 @@ namespace ts.Completions.PathCompletions { if (directories) { for (const directory of directories) { const directoryName = getBaseFileName(normalizePath(directory)); - - result.push(nameAndKind(directoryName, ScriptElementKind.directory)); + if (directoryName !== "@types") { + result.push(nameAndKind(directoryName, ScriptElementKind.directory)); + } } } } @@ -177,19 +178,33 @@ namespace ts.Completions.PathCompletions { } } - if (compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs) { - forEachAncestorDirectory(scriptPath, ancestor => { - const nodeModules = combinePaths(ancestor, "node_modules"); - if (host.directoryExists(nodeModules)) { - getCompletionEntriesForDirectoryFragment(fragment, nodeModules, fileExtensions, /*includeExtensions*/ false, host, /*exclude*/ undefined, result); - } - }); + const fragmentDirectory = containsSlash(fragment) ? getDirectoryPath(fragment) : undefined; + for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) { + result.push(nameAndKind(ambientName, ScriptElementKind.externalModuleName)); } getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, result); - for (const moduleName of enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host)) { - result.push(nameAndKind(moduleName, ScriptElementKind.externalModuleName)); + if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeJs) { + // If looking for a global package name, don't just include everything in `node_modules` because that includes dependencies' own dependencies. + // (But do if we didn't find anything, e.g. 'package.json' missing.) + let foundGlobal = false; + if (fragmentDirectory === undefined) { + for (const moduleName of enumerateNodeModulesVisibleToScript(host, scriptPath)) { + if (!result.some(entry => entry.name === moduleName)) { + foundGlobal = true; + result.push(nameAndKind(moduleName, ScriptElementKind.externalModuleName)); + } + } + } + if (!foundGlobal) { + forEachAncestorDirectory(scriptPath, ancestor => { + const nodeModules = combinePaths(ancestor, "node_modules"); + if (tryDirectoryExists(host, nodeModules)) { + getCompletionEntriesForDirectoryFragment(fragment, nodeModules, fileExtensions, /*includeExtensions*/ false, host, /*exclude*/ undefined, result); + } + }); + } } return result; @@ -228,7 +243,7 @@ namespace ts.Completions.PathCompletions { const normalizedPrefixDirectory = getDirectoryPath(normalizedPrefix); const normalizedPrefixBase = getBaseFileName(normalizedPrefix); - const fragmentHasPath = stringContains(fragment, directorySeparator); + const fragmentHasPath = containsSlash(fragment); // Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call const expandedPrefixDirectory = fragmentHasPath ? combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + getDirectoryPath(fragment)) : normalizedPrefixDirectory; @@ -262,45 +277,19 @@ namespace ts.Completions.PathCompletions { return path[0] === directorySeparator ? path.slice(1) : path; } - function enumeratePotentialNonRelativeModules(fragment: string, scriptPath: string, options: CompilerOptions, typeChecker: TypeChecker, host: LanguageServiceHost): string[] { - // Check If this is a nested module - const isNestedModule = stringContains(fragment, directorySeparator); - const moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(directorySeparator)) : undefined; - + function getAmbientModuleCompletions(fragment: string, fragmentDirectory: string | undefined, checker: TypeChecker): ReadonlyArray { // Get modules that the type checker picked up - const ambientModules = map(typeChecker.getAmbientModules(), sym => stripQuotes(sym.name)); - let nonRelativeModuleNames = filter(ambientModules, moduleName => startsWith(moduleName, fragment)); + const ambientModules = checker.getAmbientModules().map(sym => stripQuotes(sym.name)); + const nonRelativeModuleNames = ambientModules.filter(moduleName => startsWith(moduleName, fragment)); // Nested modules of the form "module-name/sub" need to be adjusted to only return the string // after the last '/' that appears in the fragment because that's where the replacement span // starts - if (isNestedModule) { - const moduleNameWithSeperator = ensureTrailingDirectorySeparator(moduleNameFragment); - nonRelativeModuleNames = map(nonRelativeModuleNames, nonRelativeModuleName => { - return removePrefix(nonRelativeModuleName, moduleNameWithSeperator); - }); + if (fragmentDirectory !== undefined) { + const moduleNameWithSeperator = ensureTrailingDirectorySeparator(fragmentDirectory); + return nonRelativeModuleNames.map(nonRelativeModuleName => removePrefix(nonRelativeModuleName, moduleNameWithSeperator)); } - - - if (!options.moduleResolution || options.moduleResolution === ModuleResolutionKind.NodeJs) { - for (const visibleModule of enumerateNodeModulesVisibleToScript(host, scriptPath)) { - if (!isNestedModule) { - nonRelativeModuleNames.push(visibleModule.moduleName); - } - else if (startsWith(visibleModule.moduleName, moduleNameFragment)) { - const nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, supportedTypeScriptExtensions, /*exclude*/ undefined, /*include*/ ["./*"]); - if (nestedFiles) { - for (let f of nestedFiles) { - f = normalizePath(f); - const nestedModule = removeFileExtension(getBaseFileName(f)); - nonRelativeModuleNames.push(nestedModule); - } - } - } - } - } - - return deduplicate(nonRelativeModuleNames, equateStringsCaseSensitive, compareStringsCaseSensitive); + return nonRelativeModuleNames; } export function getTripleSlashReferenceCompletion(sourceFile: SourceFile, position: number, compilerOptions: CompilerOptions, host: LanguageServiceHost): ReadonlyArray | undefined { @@ -390,48 +379,16 @@ namespace ts.Completions.PathCompletions { return paths; } - function enumerateNodeModulesVisibleToScript(host: LanguageServiceHost, scriptPath: string) { - const result: VisibleModuleInfo[] = []; + function enumerateNodeModulesVisibleToScript(host: LanguageServiceHost, scriptPath: string): ReadonlyArray { + if (!host.readFile || !host.fileExists) return emptyArray; - if (host.readFile && host.fileExists) { - for (const packageJson of findPackageJsons(scriptPath, host)) { - const contents = tryReadingPackageJson(packageJson); - if (!contents) { - return; - } - - const nodeModulesDir = combinePaths(getDirectoryPath(packageJson), "node_modules"); - const foundModuleNames: string[] = []; - - // Provide completions for all non @types dependencies - for (const key of nodeModulesDependencyKeys) { - addPotentialPackageNames(contents[key], foundModuleNames); - } - - for (const moduleName of foundModuleNames) { - const moduleDir = combinePaths(nodeModulesDir, moduleName); - result.push({ - moduleName, - moduleDir - }); - } - } - } - - return result; - - function tryReadingPackageJson(filePath: string) { - try { - const fileText = tryReadFile(host, filePath); - return fileText ? JSON.parse(fileText) : undefined; - } - catch (e) { - return undefined; - } - } - - function addPotentialPackageNames(dependencies: any, result: string[]) { - if (dependencies) { + const result: string[] = []; + for (const packageJson of findPackageJsons(scriptPath, host)) { + const contents = readJson(packageJson, host as { readFile: (filename: string) => string | undefined }); // Cast to assert that readFile is defined + // Provide completions for all non @types dependencies + for (const key of nodeModulesDependencyKeys) { + const dependencies: object | undefined = (contents as any)[key]; + if (!dependencies) continue; for (const dep in dependencies) { if (dependencies.hasOwnProperty(dep) && !startsWith(dep, "@types/")) { result.push(dep); @@ -439,6 +396,7 @@ namespace ts.Completions.PathCompletions { } } } + return result; } // Replace everything after the last directory seperator that appears @@ -484,11 +442,6 @@ namespace ts.Completions.PathCompletions { */ const tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*, candidate: string): PatternMatch | undefined; // Whether or not the pattern contained dots or not. Clients can use this to determine // If they should call getMatches, or if getMatchesForLastSegmentOfPattern is sufficient. @@ -97,31 +97,25 @@ namespace ts { }; } - export function createPatternMatcher(pattern: string): PatternMatcher { + export function createPatternMatcher(pattern: string): PatternMatcher | undefined { // We'll often see the same candidate string many times when searching (For example, when // we see the name of a module that is used everywhere, or the name of an overload). As // such, we cache the information we compute about the candidate for the life of this // pattern matcher so we don't have to compute it multiple times. const stringToWordSpans = createMap(); - pattern = pattern.trim(); - - const dotSeparatedSegments = pattern.split(".").map(p => createSegment(p.trim())); - const invalidPattern = dotSeparatedSegments.length === 0 || forEach(dotSeparatedSegments, segmentIsInvalid); + const dotSeparatedSegments = pattern.trim().split(".").map(p => createSegment(p.trim())); + // A segment is considered invalid if we couldn't find any words in it. + if (dotSeparatedSegments.some(segment => !segment.subWordTextChunks.length)) return undefined; return { - getMatches: (containers, candidate) => skipMatch(candidate) ? undefined : getMatches(containers, candidate, dotSeparatedSegments, stringToWordSpans), - getMatchesForLastSegmentOfPattern: candidate => skipMatch(candidate) ? undefined : matchSegment(candidate, lastOrUndefined(dotSeparatedSegments), stringToWordSpans), + getFullMatch: (containers, candidate) => getFullMatch(containers, candidate, dotSeparatedSegments, stringToWordSpans), + getMatchForLastSegmentOfPattern: candidate => matchSegment(candidate, last(dotSeparatedSegments), stringToWordSpans), patternContainsDots: dotSeparatedSegments.length > 1 }; - - // Quick checks so we can bail out when asked to match a candidate. - function skipMatch(candidate: string) { - return invalidPattern || !candidate; - } } - function getMatches(candidateContainers: ReadonlyArray, candidate: string, dotSeparatedSegments: ReadonlyArray, stringToWordSpans: Map): PatternMatch[] | undefined { + function getFullMatch(candidateContainers: ReadonlyArray, candidate: string, dotSeparatedSegments: ReadonlyArray, stringToWordSpans: Map): PatternMatch | undefined { // First, check that the last part of the dot separated pattern matches the name of the // candidate. If not, then there's no point in proceeding and doing the more // expensive work. @@ -140,29 +134,13 @@ namespace ts { return undefined; } - // So far so good. Now break up the container for the candidate and check if all - // the dotted parts match up correctly. - const totalMatch = candidateMatch; - + let bestMatch: PatternMatch | undefined; for (let i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { - - const segment = dotSeparatedSegments[i]; - const containerName = candidateContainers[j]; - - const containerMatch = matchSegment(containerName, segment, stringToWordSpans); - if (!containerMatch) { - // This container didn't match the pattern piece. So there's no match at all. - return undefined; - } - - addRange(totalMatch, containerMatch); + bestMatch = betterMatch(bestMatch, matchSegment(candidateContainers[j], dotSeparatedSegments[i], stringToWordSpans)); } - - // Success, this symbol's full name matched against the dotted name the user was asking - // about. - return totalMatch; + return bestMatch; } function getWordSpans(word: string, stringToWordSpans: Map): TextSpan[] { @@ -225,18 +203,7 @@ namespace ts { } } - function containsSpaceOrAsterisk(text: string): boolean { - for (let i = 0; i < text.length; i++) { - const ch = text.charCodeAt(i); - if (ch === CharacterCodes.space || ch === CharacterCodes.asterisk) { - return true; - } - } - - return false; - } - - function matchSegment(candidate: string, segment: Segment, stringToWordSpans: Map): PatternMatch[] { + function matchSegment(candidate: string, segment: Segment, stringToWordSpans: Map): PatternMatch { // First check if the segment matches as is. This is also useful if the segment contains // characters we would normally strip when splitting into parts that we also may want to // match in the candidate. For example if the segment is "@int" and the candidate is @@ -244,11 +211,9 @@ namespace ts { // // Note: if the segment contains a space or an asterisk then we must assume that it's a // multi-word segment. - if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { + if (every(segment.totalTextChunk.text, ch => ch !== CharacterCodes.space && ch !== CharacterCodes.asterisk)) { const match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans); - if (match) { - return [match]; - } + if (match) return match; } // The logic for pattern matching is now as follows: @@ -288,51 +253,28 @@ namespace ts { // Only if all words have some sort of match is the pattern considered matched. const subWordTextChunks = segment.subWordTextChunks; - let matches: PatternMatch[]; - + let bestMatch: PatternMatch | undefined; for (const subWordTextChunk of subWordTextChunks) { - // Try to match the candidate with this word - const result = matchTextChunk(candidate, subWordTextChunk, stringToWordSpans); - if (!result) { - return undefined; - } - - matches = matches || []; - matches.push(result); + bestMatch = betterMatch(bestMatch, matchTextChunk(candidate, subWordTextChunk, stringToWordSpans)); } - - return matches; + return bestMatch; } - function partStartsWith(candidate: string, candidateSpan: TextSpan, pattern: string, ignoreCase: boolean, patternSpan?: TextSpan): boolean { - const patternPartStart = patternSpan ? patternSpan.start : 0; - const patternPartLength = patternSpan ? patternSpan.length : pattern.length; + function betterMatch(a: PatternMatch | undefined, b: PatternMatch | undefined): PatternMatch { + return min(a, b, compareMatches); + } + function compareMatches(a: PatternMatch | undefined, b: PatternMatch | undefined): Comparison { + return a === undefined ? Comparison.GreaterThan : b === undefined ? Comparison.LessThan + : compareValues(a.kind, b.kind) || compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); + } - if (patternPartLength > candidateSpan.length) { - // Pattern part is longer than the candidate part. There can never be a match. - return false; - } + function partStartsWith(candidate: string, candidateSpan: TextSpan, pattern: string, ignoreCase: boolean, patternSpan: TextSpan = { start: 0, length: pattern.length }): boolean { + return patternSpan.length <= candidateSpan.length // If pattern part is longer than the candidate part there can never be a match. + && everyInRange(0, patternSpan.length, i => equalChars(pattern.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase)); + } - if (ignoreCase) { - for (let i = 0; i < patternPartLength; i++) { - const ch1 = pattern.charCodeAt(patternPartStart + i); - const ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (toLowerCase(ch1) !== toLowerCase(ch2)) { - return false; - } - } - } - else { - for (let i = 0; i < patternPartLength; i++) { - const ch1 = pattern.charCodeAt(patternPartStart + i); - const ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (ch1 !== ch2) { - return false; - } - } - } - - return true; + function equalChars(ch1: number, ch2: number, ignoreCase: boolean): boolean { + return ignoreCase ? toLowerCase(ch1) === toLowerCase(ch2) : ch1 === ch2; } function tryCamelCaseMatch(candidate: string, candidateParts: TextSpan[], chunk: TextChunk, ignoreCase: boolean): boolean { @@ -414,11 +356,6 @@ namespace ts { }; } - // A segment is considered invalid if we couldn't find any words in it. - function segmentIsInvalid(segment: Segment) { - return segment.subWordTextChunks.length === 0; - } - function isUpperCaseLetter(ch: number) { // Fast check for the ascii range. if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) { @@ -455,29 +392,15 @@ namespace ts { // Assumes 'value' is already lowercase. function indexOfIgnoringCase(str: string, value: string): number { const n = str.length - value.length; - for (let i = 0; i <= n; i++) { - if (startsWithIgnoringCase(str, value, i)) { - return i; + for (let start = 0; start <= n; start++) { + if (every(value, (valueChar, i) => toLowerCase(str.charCodeAt(i + start)) === valueChar)) { + return start; } } return -1; } - // Assumes 'value' is already lowercase. - function startsWithIgnoringCase(str: string, value: string, start: number): boolean { - for (let i = 0; i < value.length; i++) { - const ch1 = toLowerCase(str.charCodeAt(i + start)); - const ch2 = value.charCodeAt(i); - - if (ch1 !== ch2) { - return false; - } - } - - return true; - } - function toLowerCase(ch: number): number { // Fast convert for the ascii range. if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) { @@ -557,7 +480,7 @@ namespace ts { const currentIsDigit = isDigit(identifier.charCodeAt(i)); const hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); - const hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + const hasTransitionFromUpperToLower = word && transitionFromUpperToLower(identifier, i, wordStart); if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || @@ -612,52 +535,29 @@ namespace ts { } function isAllPunctuation(identifier: string, start: number, end: number): boolean { - for (let i = start; i < end; i++) { - const ch = identifier.charCodeAt(i); - - // We don't consider _ or $ as punctuation as there may be things with that name. - if (!charIsPunctuation(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$) { - return false; - } - } - - return true; + return every(identifier, ch => charIsPunctuation(ch) && ch !== CharacterCodes._, start, end); } - function transitionFromUpperToLower(identifier: string, word: boolean, index: number, wordStart: number): boolean { - if (word) { - // Cases this supports: - // 1) IDisposable -> I, Disposable - // 2) UIElement -> UI, Element - // 3) HTMLDocument -> HTML, Document - // - // etc. - if (index !== wordStart && - index + 1 < identifier.length) { - const currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - const nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); - - if (currentIsUpper && nextIsLower) { - // We have a transition from an upper to a lower letter here. But we only - // want to break if all the letters that preceded are uppercase. i.e. if we - // have "Foo" we don't want to break that into "F, oo". But if we have - // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, - // Foo". i.e. the last uppercase letter belongs to the lowercase letters - // that follows. Note: this will make the following not split properly: - // "HELLOthere". However, these sorts of names do not show up in .Net - // programs. - for (let i = wordStart; i < index; i++) { - if (!isUpperCaseLetter(identifier.charCodeAt(i))) { - return false; - } - } - - return true; - } - } - } - - return false; + function transitionFromUpperToLower(identifier: string, index: number, wordStart: number): boolean { + // Cases this supports: + // 1) IDisposable -> I, Disposable + // 2) UIElement -> UI, Element + // 3) HTMLDocument -> HTML, Document + // + // etc. + // We have a transition from an upper to a lower letter here. But we only + // want to break if all the letters that preceded are uppercase. i.e. if we + // have "Foo" we don't want to break that into "F, oo". But if we have + // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, + // Foo". i.e. the last uppercase letter belongs to the lowercase letters + // that follows. Note: this will make the following not split properly: + // "HELLOthere". However, these sorts of names do not show up in .Net + // programs. + return index !== wordStart + && index + 1 < identifier.length + && isUpperCaseLetter(identifier.charCodeAt(index)) + && isLowerCaseLetter(identifier.charCodeAt(index + 1)) + && every(identifier, isUpperCaseLetter, wordStart, index); } function transitionFromLowerToUpper(identifier: string, word: boolean, index: number): boolean { @@ -677,9 +577,19 @@ namespace ts { // on characters would be: A M // // We break the search string on characters. But we break the symbol name on words. - const transition = word - ? (currentIsUpper && !lastIsUpper) - : currentIsUpper; - return transition; + return currentIsUpper && (!word || !lastIsUpper); + } + + function everyInRange(start: number, end: number, pred: (n: number) => boolean): boolean { + for (let i = start; i < end; i++) { + if (!pred(i)) { + return false; + } + } + return true; + } + + function every(s: string, pred: (ch: number, index: number) => boolean, start = 0, end = s.length): boolean { + return everyInRange(start, end, i => pred(s.charCodeAt(i), i)); } } \ No newline at end of file diff --git a/src/services/preProcess.ts b/src/services/preProcess.ts index fb138a87866..6c5f6c1b2ff 100644 --- a/src/services/preProcess.ts +++ b/src/services/preProcess.ts @@ -12,20 +12,23 @@ namespace ts { }; const importedFiles: FileReference[] = []; let ambientExternalModules: { ref: FileReference, depth: number }[]; + let lastToken: SyntaxKind; + let currentToken: SyntaxKind; let braceNesting = 0; // assume that text represent an external module if it contains at least one top level import/export // ambient modules that are found inside external modules are interpreted as module augmentations let externalModule = false; function nextToken() { - const token = scanner.scan(); - if (token === SyntaxKind.OpenBraceToken) { + lastToken = currentToken; + currentToken = scanner.scan(); + if (currentToken === SyntaxKind.OpenBraceToken) { braceNesting++; } - else if (token === SyntaxKind.CloseBraceToken) { + else if (currentToken === SyntaxKind.CloseBraceToken) { braceNesting--; } - return token; + return currentToken; } function getFileReference() { @@ -77,6 +80,9 @@ namespace ts { * Returns true if at least one token was consumed from the stream */ function tryConsumeImport(): boolean { + if (lastToken === SyntaxKind.DotToken) { + return false; + } let token = scanner.getToken(); if (token === SyntaxKind.ImportKeyword) { token = nextToken(); @@ -293,6 +299,10 @@ namespace ts { // export import i = require("mod") // (for JavaScript files) require("mod") + // Do not look for: + // AnySymbol.import("mod") + // AnySymbol.nested.import("mod") + while (true) { if (scanner.getToken() === SyntaxKind.EndOfFileToken) { break; diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 7144265d11a..5805a986180 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1,6 +1,3 @@ -/// -/// - /* @internal */ namespace ts.refactor.extractSymbol { const refactorName = "Extract Symbol"; @@ -701,14 +698,6 @@ namespace ts.refactor.extractSymbol { Global, } - function getUniqueName(baseName: string, fileText: string): string { - let nameText = baseName; - for (let i = 1; stringContains(fileText, nameText); i++) { - nameText = `${baseName}_${i}`; - } - return nameText; - } - /** * Result of 'extractRange' operation for a specific scope. * Stores either a list of changes that should be applied to extract a range or a list of errors @@ -1129,37 +1118,6 @@ namespace ts.refactor.extractSymbol { } } - /** - * @return The index of the (only) reference to the extracted symbol. We want the cursor - * to be on the reference, rather than the declaration, because it's closer to where the - * user was before extracting it. - */ - function getRenameLocation(edits: ReadonlyArray, renameFilename: string, functionNameText: string, isDeclaredBeforeUse: boolean): number { - let delta = 0; - let lastPos = -1; - for (const { fileName, textChanges } of edits) { - Debug.assert(fileName === renameFilename); - for (const change of textChanges) { - const { span, newText } = change; - const index = newText.indexOf(functionNameText); - if (index !== -1) { - lastPos = span.start + delta + index; - - // If the reference comes first, return immediately. - if (!isDeclaredBeforeUse) { - return lastPos; - } - } - delta += newText.length - span.length; - } - } - - // If the declaration comes first, return the position of the last occurrence. - Debug.assert(isDeclaredBeforeUse); - Debug.assert(lastPos >= 0); - return lastPos; - } - function getFirstDeclaration(type: Type): Declaration | undefined { let firstDeclaration; @@ -1600,8 +1558,8 @@ namespace ts.refactor.extractSymbol { const {visitedTypes} = symbolWalker.walkType(type); for (const visitedType of visitedTypes) { - if (visitedType.flags & TypeFlags.TypeParameter) { - allTypeParameterUsages.set(visitedType.id.toString(), visitedType as TypeParameter); + if (visitedType.isTypeParameter()) { + allTypeParameterUsages.set(visitedType.id.toString(), visitedType); } } } diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts new file mode 100644 index 00000000000..33ecbbaab66 --- /dev/null +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -0,0 +1,202 @@ +/* @internal */ +namespace ts.refactor.generateGetAccessorAndSetAccessor { + const actionName = "Generate 'get' and 'set' accessors"; + const actionDescription = Diagnostics.Generate_get_and_set_accessors.message; + registerRefactor(actionName, { getEditsForAction, getAvailableActions }); + + type AcceptedDeclaration = ParameterPropertyDeclaration | PropertyDeclaration | PropertyAssignment; + type AcceptedNameType = Identifier | StringLiteral; + type ContainerDeclaration = ClassLikeDeclaration | ObjectLiteralExpression; + + interface Info { + container: ContainerDeclaration; + isStatic: boolean; + type: TypeNode | undefined; + declaration: AcceptedDeclaration; + fieldName: AcceptedNameType; + accessorName: AcceptedNameType; + } + + function getAvailableActions(context: RefactorContext): ApplicableRefactorInfo[] | undefined { + const { file, startPosition } = context; + if (!getConvertibleFieldAtPosition(file, startPosition)) return undefined; + + return [{ + name: actionName, + description: actionDescription, + actions: [ + { + name: actionName, + description: actionDescription + } + ] + }]; + } + + function getEditsForAction(context: RefactorContext, _actionName: string): RefactorEditInfo | undefined { + const { file, startPosition } = context; + + const fieldInfo = getConvertibleFieldAtPosition(file, startPosition); + if (!fieldInfo) return undefined; + + const isJS = isSourceFileJavaScript(file); + const changeTracker = textChanges.ChangeTracker.fromContext(context); + const { isStatic, fieldName, accessorName, type, container, declaration } = fieldInfo; + + const isInClassLike = isClassLike(container); + const accessorModifiers = isInClassLike + ? !declaration.modifiers || getModifierFlags(declaration) & ModifierFlags.Private ? getModifiers(isJS, isStatic, SyntaxKind.PublicKeyword) : declaration.modifiers + : undefined; + const fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, SyntaxKind.PrivateKeyword) : undefined; + + updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers, container); + + const getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); + const setAccessor = generateSetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); + + insertAccessor(changeTracker, file, getAccessor, declaration, container); + insertAccessor(changeTracker, file, setAccessor, declaration, container); + + const edits = changeTracker.getChanges(); + const renameFilename = file.fileName; + const renameLocationOffset = isIdentifier(fieldName) ? 0 : -1; + const renameLocation = renameLocationOffset + getRenameLocation(edits, renameFilename, fieldName.text, /*isDeclaredBeforeUse*/ false); + return { renameFilename, renameLocation, edits }; + } + + function isConvertableName (name: DeclarationName): name is AcceptedNameType { + return isIdentifier(name) || isStringLiteral(name); + } + + function isAcceptedDeclaration(node: Node): node is AcceptedDeclaration { + return isParameterPropertyDeclaration(node) || isPropertyDeclaration(node) || isPropertyAssignment(node); + } + + function createPropertyName (name: string, originalName: AcceptedNameType) { + return isIdentifier(originalName) ? createIdentifier(name) : createLiteral(name); + } + + function createAccessorAccessExpression (fieldName: AcceptedNameType, isStatic: boolean, container: ContainerDeclaration) { + const leftHead = isStatic ? (container).name : createThis(); + return isIdentifier(fieldName) ? createPropertyAccess(leftHead, fieldName) : createElementAccess(leftHead, createLiteral(fieldName)); + } + + function getModifiers(isJS: boolean, isStatic: boolean, accessModifier: SyntaxKind.PublicKeyword | SyntaxKind.PrivateKeyword): NodeArray { + const modifiers = append( + !isJS ? [createToken(accessModifier) as Token | Token] : undefined, + isStatic ? createToken(SyntaxKind.StaticKeyword) : undefined + ); + return modifiers && createNodeArray(modifiers); + } + + function getConvertibleFieldAtPosition(file: SourceFile, startPosition: number): Info | undefined { + const node = getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false); + const declaration = findAncestor(node.parent, isAcceptedDeclaration); + // make sure propertyDeclaration have AccessibilityModifier or Static Modifier + const meaning = ModifierFlags.AccessibilityModifier | ModifierFlags.Static; + if (!declaration || !isConvertableName(declaration.name) || (getModifierFlags(declaration) | meaning) !== meaning) return undefined; + + const fieldName = createPropertyName(getUniqueName(`_${declaration.name.text}`, file.text), declaration.name); + const accessorName = createPropertyName(declaration.name.text, declaration.name); + suppressLeadingAndTrailingTrivia(fieldName); + suppressLeadingAndTrailingTrivia(declaration); + return { + isStatic: hasStaticModifier(declaration), + type: getTypeAnnotationNode(declaration), + container: declaration.kind === SyntaxKind.Parameter ? declaration.parent.parent : declaration.parent, + declaration, + fieldName, + accessorName, + }; + } + + function generateGetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode, modifiers: ModifiersArray | undefined, isStatic: boolean, container: ContainerDeclaration) { + return createGetAccessor( + /*decorators*/ undefined, + modifiers, + accessorName, + /*parameters*/ undefined, + type, + createBlock([ + createReturn( + createAccessorAccessExpression(fieldName, isStatic, container) + ) + ], /*multiLine*/ true) + ); + } + + function generateSetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode, modifiers: ModifiersArray | undefined, isStatic: boolean, container: ContainerDeclaration) { + return createSetAccessor( + /*decorators*/ undefined, + modifiers, + accessorName, + [createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, + createIdentifier("value"), + /*questionToken*/ undefined, + type + )], + createBlock([ + createStatement( + createAssignment( + createAccessorAccessExpression(fieldName, isStatic, container), + createIdentifier("value") + ) + ) + ], /*multiLine*/ true) + ); + } + + function updatePropertyDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: PropertyDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined) { + const property = updateProperty( + declaration, + declaration.decorators, + modifiers, + fieldName, + declaration.questionToken || declaration.exclamationToken, + declaration.type, + declaration.initializer + ); + + changeTracker.replaceNode(file, declaration, property); + } + + function updateParameterPropertyDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: ParameterDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined, classLikeContainer: ClassLikeDeclaration) { + const property = createProperty( + declaration.decorators, + modifiers, + fieldName, + declaration.questionToken, + declaration.type, + declaration.initializer + ); + + changeTracker.insertNodeAtClassStart(file, classLikeContainer, property); + changeTracker.deleteNodeInList(file, declaration); + } + + function updatePropertyAssignmentDeclaration (changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: PropertyAssignment, fieldName: AcceptedNameType) { + const assignment = updatePropertyAssignment(declaration, fieldName, declaration.initializer); + changeTracker.replacePropertyAssignment(file, declaration, assignment); + } + + function updateFieldDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: AcceptedDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined, container: ContainerDeclaration) { + if (isPropertyDeclaration(declaration)) { + updatePropertyDeclaration(changeTracker, file, declaration, fieldName, modifiers); + } + else if (isPropertyAssignment(declaration)) { + updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName); + } + else { + updateParameterPropertyDeclaration(changeTracker, file, declaration, fieldName, modifiers, container); + } + } + + function insertAccessor(changeTracker: textChanges.ChangeTracker, file: SourceFile, accessor: AccessorDeclaration, declaration: AcceptedDeclaration, container: ContainerDeclaration) { + isParameterPropertyDeclaration(declaration) + ? changeTracker.insertNodeAtClassStart(file, container, accessor) + : changeTracker.insertNodeAfter(file, declaration, accessor); + } +} diff --git a/src/services/refactors/refactors.ts b/src/services/refactors/refactors.ts deleted file mode 100644 index da2f08a8e9f..00000000000 --- a/src/services/refactors/refactors.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/src/services/rename.ts b/src/services/rename.ts index c40f7908776..2f9de0c0cad 100644 --- a/src/services/rename.ts +++ b/src/services/rename.ts @@ -2,7 +2,7 @@ namespace ts.Rename { export function getRenameInfo(typeChecker: TypeChecker, defaultLibFileName: string, getCanonicalFileName: GetCanonicalFileName, sourceFile: SourceFile, position: number): RenameInfo { const getCanonicalDefaultLibName = memoize(() => getCanonicalFileName(normalizePath(defaultLibFileName))); - const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true); + const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); const renameInfo = node && nodeIsEligibleForRename(node) ? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) : undefined; diff --git a/src/services/services.ts b/src/services/services.ts index 7165c7ad4bb..bed301e452f 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1,37 +1,3 @@ -/// -/// - -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// - namespace ts { /** The version of the language service API */ export const servicesVersion = "0.8"; @@ -431,9 +397,7 @@ namespace ts { return this.checker.getIndexTypeOfType(this, IndexKind.Number); } getBaseTypes(): BaseType[] | undefined { - return this.flags & TypeFlags.Object && this.objectFlags & (ObjectFlags.Class | ObjectFlags.Interface) - ? this.checker.getBaseTypes(this) - : undefined; + return this.isClassOrInterface() ? this.checker.getBaseTypes(this) : undefined; } getNonNullableType(): Type { return this.checker.getNonNullableType(this); @@ -444,6 +408,34 @@ namespace ts { getDefault(): Type | undefined { return this.checker.getDefaultFromTypeParameter(this); } + + isUnion(): this is UnionType { + return !!(this.flags & TypeFlags.Union); + } + isIntersection(): this is IntersectionType { + return !!(this.flags & TypeFlags.Intersection); + } + isUnionOrIntersection(): this is UnionOrIntersectionType { + return !!(this.flags & TypeFlags.UnionOrIntersection); + } + isLiteral(): this is LiteralType { + return !!(this.flags & TypeFlags.Literal); + } + isStringLiteral(): this is StringLiteralType { + return !!(this.flags & TypeFlags.StringLiteral); + } + isNumberLiteral(): this is NumberLiteralType { + return !!(this.flags & TypeFlags.NumberLiteral); + } + isTypeParameter(): this is TypeParameter { + return !!(this.flags & TypeFlags.TypeParameter); + } + isClassOrInterface(): this is InterfaceType { + return !!(getObjectFlags(this) & ObjectFlags.ClassOrInterface); + } + isClass(): this is InterfaceType { + return !!(getObjectFlags(this) & ObjectFlags.Class); + } } class SignatureObject implements Signature { @@ -1126,8 +1118,10 @@ namespace ts { }; } - export function createLanguageService(host: LanguageServiceHost, - documentRegistry: DocumentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory())): LanguageService { + export function createLanguageService( + host: LanguageServiceHost, + documentRegistry: DocumentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()), + syntaxOnly = false): LanguageService { const syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host); let program: Program; @@ -1162,6 +1156,8 @@ namespace ts { } function synchronizeHostData(): void { + Debug.assert(!syntaxOnly); + // perform fast check if host supports it if (host.getProjectVersion) { const hostProjectVersion = host.getProjectVersion(); @@ -1337,6 +1333,11 @@ namespace ts { } function getProgram(): Program { + if (syntaxOnly) { + Debug.assert(program === undefined); + return undefined; + } + synchronizeHostData(); return program; @@ -1662,20 +1663,17 @@ namespace ts { /// References and Occurrences function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] { - const canonicalFileName = getCanonicalFileName(normalizeSlashes(fileName)); - return flatMap(getDocumentHighlights(fileName, position, [fileName]), entry => entry.highlightSpans.map(highlightSpan => { - Debug.assert(getCanonicalFileName(normalizeSlashes(entry.fileName)) === canonicalFileName); // Get occurrences only supports reporting occurrences for the file queried. - return { - fileName: entry.fileName, - textSpan: highlightSpan.textSpan, - isWriteAccess: highlightSpan.kind === HighlightSpanKind.writtenReference, - isDefinition: false, - isInString: highlightSpan.isInString, - }; - })); + return flatMap(getDocumentHighlights(fileName, position, [fileName]), entry => entry.highlightSpans.map(highlightSpan => ({ + fileName: entry.fileName, + textSpan: highlightSpan.textSpan, + isWriteAccess: highlightSpan.kind === HighlightSpanKind.writtenReference, + isDefinition: false, + isInString: highlightSpan.isInString, + }))); } function getDocumentHighlights(fileName: string, position: number, filesToSearch: ReadonlyArray): DocumentHighlights[] { + Debug.assert(contains(filesToSearch, fileName)); synchronizeHostData(); const sourceFilesToSearch = map(filesToSearch, f => Debug.assertDefined(program.getSourceFile(f))); const sourceFile = getValidSourceFile(fileName); diff --git a/src/services/shims.ts b/src/services/shims.ts index 42311843ea1..b8beccab20b 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -13,8 +13,6 @@ // limitations under the License. // -/// - /* @internal */ let debugObjectHost: { CollectGarbage(): void } = (function (this: any) { return this; })(); @@ -588,6 +586,7 @@ namespace ts { length: number; category: string; code: number; + unused?: {}; } export function realizeDiagnostics(diagnostics: ReadonlyArray, newLine: string): RealizedDiagnostic[] { return diagnostics.map(d => realizeDiagnostic(d, newLine)); @@ -1197,7 +1196,7 @@ namespace ts { this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } const hostAdapter = new LanguageServiceShimHostAdapter(host); - const languageService = createLanguageService(hostAdapter, this.documentRegistry); + const languageService = createLanguageService(hostAdapter, this.documentRegistry, /*syntaxOnly*/ false); return new LanguageServiceShimObject(this, host, languageService); } catch (err) { diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 250127ecfc6..156539557a3 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -1,4 +1,3 @@ -/// /* @internal */ namespace ts.SignatureHelp { export const enum ArgumentListKind { diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index c88202b8dbe..4693a5089f1 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -201,7 +201,7 @@ namespace ts.SymbolDisplay { // If it is call or construct signature of lambda's write type name displayParts.push(punctuationPart(SyntaxKind.ColonToken)); displayParts.push(spacePart()); - if (!(type.flags & TypeFlags.Object && (type).objectFlags & ObjectFlags.Anonymous) && type.symbol) { + if (!(getObjectFlags(type) & ObjectFlags.Anonymous) && type.symbol) { addRange(displayParts, symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.AllowAnyNodeKind | SymbolFormatFlags.WriteTypeParametersOrArguments)); displayParts.push(lineBreakPart()); } diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 0a48bcf6228..b54caf402b1 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -100,6 +100,10 @@ namespace ts.textChanges { preserveLeadingWhitespace?: boolean; } + export interface ReplaceWithMultipleNodesOptions extends InsertNodeOptions { + readonly joiner?: string; + } + enum ChangeKind { Remove, ReplaceWithSingleNode, @@ -130,7 +134,7 @@ namespace ts.textChanges { interface ReplaceWithMultipleNodes extends BaseChange { readonly kind: ChangeKind.ReplaceWithMultipleNodes; readonly nodes: ReadonlyArray; - readonly options?: InsertNodeOptions; + readonly options?: ReplaceWithMultipleNodesOptions; } interface ChangeText extends BaseChange { @@ -303,7 +307,7 @@ namespace ts.textChanges { this.replaceRange(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNode, options); } - private replaceRangeWithNodes(sourceFile: SourceFile, range: TextRange, newNodes: ReadonlyArray, options: InsertNodeOptions = {}) { + private replaceRangeWithNodes(sourceFile: SourceFile, range: TextRange, newNodes: ReadonlyArray, options: ReplaceWithMultipleNodesOptions & ConfigurableStartEnd = {}) { this.changes.push({ kind: ChangeKind.ReplaceWithMultipleNodes, sourceFile, range, options, nodes: newNodes }); return this; } @@ -312,15 +316,21 @@ namespace ts.textChanges { return this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNodes, options); } - public replaceNodeRangeWithNodes(sourceFile: SourceFile, startNode: Node, endNode: Node, newNodes: ReadonlyArray, options: ChangeNodeOptions = useNonAdjustedPositions) { + public replaceNodeRangeWithNodes(sourceFile: SourceFile, startNode: Node, endNode: Node, newNodes: ReadonlyArray, options: ReplaceWithMultipleNodesOptions & ConfigurableStartEnd = useNonAdjustedPositions) { return this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options); } + public replacePropertyAssignment(sourceFile: SourceFile, oldNode: PropertyAssignment, newNode: PropertyAssignment) { + return this.replaceNode(sourceFile, oldNode, newNode, { + suffix: "," + this.newLineCharacter + }); + } + private insertNodeAt(sourceFile: SourceFile, pos: number, newNode: Node, options: InsertNodeOptions = {}) { this.replaceRange(sourceFile, createTextRange(pos), newNode, options); } - private insertNodesAt(sourceFile: SourceFile, pos: number, newNodes: ReadonlyArray, options: InsertNodeOptions = {}): void { + private insertNodesAt(sourceFile: SourceFile, pos: number, newNodes: ReadonlyArray, options: ReplaceWithMultipleNodesOptions = {}): void { this.changes.push({ kind: ChangeKind.ReplaceWithMultipleNodes, sourceFile, options, nodes: newNodes, range: { pos, end: pos } }); } @@ -447,10 +457,7 @@ namespace ts.textChanges { } public insertNodeAfter(sourceFile: SourceFile, after: Node, newNode: Node): this { - if (isStatementButNotDeclaration(after) || - after.kind === SyntaxKind.PropertyDeclaration || - after.kind === SyntaxKind.PropertySignature || - after.kind === SyntaxKind.MethodSignature) { + if (needSemicolonBetween(after, newNode)) { // check if previous statement ends with semicolon // if not - insert semicolon to preserve the code from changing the meaning due to ASI if (sourceFile.text.charCodeAt(after.end - 1) !== CharacterCodes.semicolon) { @@ -465,18 +472,50 @@ namespace ts.textChanges { if (isClassDeclaration(node) || isModuleDeclaration(node)) { return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; } - else if (isStatement(node) || isClassElement(node) || isTypeElement(node)) { + else if (isStatement(node) || isClassOrTypeElement(node)) { return { suffix: this.newLineCharacter }; } else if (isVariableDeclaration(node)) { return { prefix: ", " }; } + else if (isPropertyAssignment(node)) { + return { suffix: "," + this.newLineCharacter }; + } else if (isParameter(node)) { return {}; } return Debug.failBadSyntaxKind(node); // We haven't handled this kind of node yet -- add it } + public insertName(sourceFile: SourceFile, node: FunctionExpression | ClassExpression | ArrowFunction, name: string): void { + Debug.assert(!node.name); + if (node.kind === SyntaxKind.ArrowFunction) { + const arrow = findChildOfKind(node, SyntaxKind.EqualsGreaterThanToken, sourceFile)!; + const lparen = findChildOfKind(node, SyntaxKind.OpenParenToken, sourceFile); + if (lparen) { + // `() => {}` --> `function f() {}` + this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [createToken(SyntaxKind.FunctionKeyword), createIdentifier(name)], { joiner: " " }); + this.deleteNode(sourceFile, arrow); + } + else { + // `x => {}` -> `function f(x) {}` + this.insertText(sourceFile, first(node.parameters).getStart(sourceFile), `function ${name}(`); + // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` + this.replaceRange(sourceFile, arrow, createToken(SyntaxKind.CloseParenToken)); + } + + if (node.body.kind !== SyntaxKind.Block) { + // `() => 0` => `function f() { return 0; }` + this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [createToken(SyntaxKind.OpenBraceToken), createToken(SyntaxKind.ReturnKeyword)], { joiner: " ", suffix: " " }); + this.insertNodesAt(sourceFile, node.body.end, [createToken(SyntaxKind.SemicolonToken), createToken(SyntaxKind.CloseBraceToken)], { joiner: " " }); + } + } + else { + const pos = findChildOfKind(node, node.kind === SyntaxKind.FunctionExpression ? SyntaxKind.FunctionKeyword : SyntaxKind.ClassKeyword, sourceFile)!.end; + this.insertNodeAt(sourceFile, pos, createIdentifier(name), { prefix: " " }); + } + } + /** * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range, * i.e. arguments in arguments lists, parameters in parameter lists etc. @@ -646,7 +685,7 @@ namespace ts.textChanges { const { options = {}, range: { pos } } = change; const format = (n: Node) => getFormattedTextOfNode(n, sourceFile, pos, options, newLineCharacter, formatContext, validate); const text = change.kind === ChangeKind.ReplaceWithMultipleNodes - ? change.nodes.map(n => removeSuffix(format(n), newLineCharacter)).join(newLineCharacter) + ? change.nodes.map(n => removeSuffix(format(n), newLineCharacter)).join(change.options.joiner || newLineCharacter) : format(change.node); // strip initial indentation (spaces or tabs) if text will be inserted in the middle of the line const noIndent = (options.preserveLeadingWhitespace || options.indentation !== undefined || getLineStartPositionForPosition(pos, sourceFile) === pos) ? text : text.replace(/^\s+/, ""); @@ -893,4 +932,9 @@ namespace ts.textChanges { export function isValidLocationToAddComment(sourceFile: SourceFile, position: number) { return !isInComment(sourceFile, position) && !isInString(sourceFile, position) && !isInTemplateString(sourceFile, position); } + + function needSemicolonBetween(a: Node, b: Node): boolean { + return (isPropertySignature(a) || isPropertyDeclaration(a)) && isClassOrTypeElement(b) && b.name.kind === SyntaxKind.ComputedPropertyName + || isStatementButNotDeclaration(a) && isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` + } } diff --git a/src/services/transform.ts b/src/services/transform.ts index 07fc3c759e2..200fb9aacb2 100644 --- a/src/services/transform.ts +++ b/src/services/transform.ts @@ -1,5 +1,3 @@ -/// -/// namespace ts { /** * Transform one or more nodes using the supplied transformers. diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 4f838df6341..31b35a44271 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -6,81 +6,111 @@ "declaration": true }, "files": [ - "../compiler/core.ts", - "../compiler/performance.ts", - "../compiler/sys.ts", "../compiler/types.ts", + "../compiler/performance.ts", + "../compiler/core.ts", + "../compiler/sys.ts", + "../compiler/diagnosticInformationMap.generated.ts", "../compiler/scanner.ts", - "../compiler/parser.ts", "../compiler/utilities.ts", + "../compiler/parser.ts", "../compiler/binder.ts", "../compiler/symbolWalker.ts", + "../compiler/moduleNameResolver.ts", "../compiler/checker.ts", "../compiler/factory.ts", "../compiler/visitor.ts", "../compiler/transformers/utilities.ts", + "../compiler/transformers/destructuring.ts", "../compiler/transformers/ts.ts", - "../compiler/transformers/jsx.ts", - "../compiler/transformers/esnext.ts", "../compiler/transformers/es2017.ts", + "../compiler/transformers/esnext.ts", + "../compiler/transformers/jsx.ts", "../compiler/transformers/es2016.ts", "../compiler/transformers/es2015.ts", "../compiler/transformers/es5.ts", "../compiler/transformers/generators.ts", - "../compiler/transformers/destructuring.ts", "../compiler/transformers/module/module.ts", "../compiler/transformers/module/system.ts", "../compiler/transformers/module/es2015.ts", "../compiler/transformers/declarations/diagnostics.ts", "../compiler/transformers/declarations.ts", "../compiler/transformer.ts", - "../compiler/comments.ts", "../compiler/sourcemap.ts", + "../compiler/comments.ts", "../compiler/emitter.ts", + "../compiler/watchUtilities.ts", "../compiler/program.ts", "../compiler/builderState.ts", "../compiler/builder.ts", "../compiler/resolutionCache.ts", "../compiler/watch.ts", - "../compiler/watchUtilities.ts", "../compiler/commandLineParser.ts", - "../compiler/diagnosticInformationMap.generated.ts", + "types.ts", "utilities.ts", - "breakpoints.ts", "classifier.ts", + "pathCompletions.ts", "completions.ts", "documentHighlights.ts", "documentRegistry.ts", - "findAllReferences.ts", "importTracker.ts", + "findAllReferences.ts", "goToDefinition.ts", "jsDoc.ts", + "semver.ts", "jsTyping.ts", "navigateTo.ts", "navigationBar.ts", "organizeImports.ts", "outliningElementsCollector.ts", - "pathCompletions.ts", "patternMatcher.ts", "preProcess.ts", "rename.ts", - "services.ts", - "transform.ts", - "transpile.ts", - "semver.ts", - "shims.ts", "signatureHelp.ts", "suggestionDiagnostics.ts", - "sourcemaps.ts", "symbolDisplay.ts", + "transpile.ts", + "formatting/formattingContext.ts", + "formatting/formattingScanner.ts", + "formatting/rule.ts", + "formatting/rules.ts", + "formatting/rulesMap.ts", + "formatting/formatting.ts", + "formatting/smartIndenter.ts", "textChanges.ts", + "codeFixProvider.ts", "refactorProvider.ts", - "codeFixProvider.ts" - ], - "include": [ - "formatting/*", - "codefixes/*", - "refactors/*" + "codefixes/addMissingInvocationForDecorator.ts", + "codefixes/annotateWithTypeFromJSDoc.ts", + "codefixes/convertFunctionToEs6Class.ts", + "codefixes/convertToEs6Module.ts", + "codefixes/correctQualifiedNameToIndexedAccessType.ts", + "codefixes/fixClassIncorrectlyImplementsInterface.ts", + "codefixes/importFixes.ts", + "codefixes/fixSpelling.ts", + "codefixes/fixAddMissingMember.ts", + "codefixes/fixCannotFindModule.ts", + "codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "codefixes/fixExtendsInterfaceBecomesImplements.ts", + "codefixes/fixForgottenThisPropertyAccess.ts", + "codefixes/fixUnusedIdentifier.ts", + "codefixes/fixJSDocTypes.ts", + "codefixes/fixAwaitInSyncFunction.ts", + "codefixes/disableJsDiagnostics.ts", + "codefixes/helpers.ts", + "codefixes/inferFromUsage.ts", + "codefixes/fixInvalidImportSyntax.ts", + "codefixes/fixStrictClassInitialization.ts", + "codefixes/useDefaultImport.ts", + "refactors/extractSymbol.ts", + "refactors/generateGetAccessorAndSetAccessor.ts", + "sourcemaps.ts", + "services.ts", + "breakpoints.ts", + "transform.ts", + "shims.ts" ] } diff --git a/src/services/types.ts b/src/services/types.ts index 096ef2de190..01b8b5ad4d4 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -52,6 +52,16 @@ namespace ts { getNonNullableType(): Type; getConstraint(): Type | undefined; getDefault(): Type | undefined; + + isUnion(): this is UnionType; + isIntersection(): this is IntersectionType; + isUnionOrIntersection(): this is UnionOrIntersectionType; + isLiteral(): this is LiteralType; + isStringLiteral(): this is StringLiteralType; + isNumberLiteral(): this is NumberLiteralType; + isTypeParameter(): this is TypeParameter; + isClassOrInterface(): this is InterfaceType; + isClass(): this is InterfaceType; } export interface Signature { @@ -218,6 +228,7 @@ namespace ts { } export interface UserPreferences { + readonly disableSuggestions?: boolean; readonly quotePreference?: "double" | "single"; readonly includeCompletionsForModuleExports?: boolean; readonly includeCompletionsWithInsertText?: boolean; @@ -435,6 +446,8 @@ namespace ts { } export interface CodeFixAction extends CodeAction { + /** Short name to identify the fix, for use by telemetry. */ + fixName: string; /** * If present, one may call 'getCombinedCodeFix' with this fixId. * This may be omitted to indicate that the code fix can't be applied in a group. diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 18b0db15981..63170678202 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -627,18 +627,12 @@ namespace ts { return syntaxList; } - /* Gets the token whose text has range [start, end) and - * position >= start and (position < end or (position === end && token is keyword or identifier)) - */ - export function getTouchingWord(sourceFile: SourceFile, position: number, includeJsDocComment: boolean): Node { - return getTouchingToken(sourceFile, position, includeJsDocComment, n => isWord(n.kind)); - } - - /* Gets the token whose text has range [start, end) and position >= start - * and (position < end or (position === end && token is keyword or identifier or numeric/string literal)) + /** + * Gets the token whose text has range [start, end) and + * position >= start and (position < end or (position === end && token is literal or keyword or identifier)) */ export function getTouchingPropertyName(sourceFile: SourceFile, position: number, includeJsDocComment: boolean): Node { - return getTouchingToken(sourceFile, position, includeJsDocComment, n => isPropertyName(n.kind)); + return getTouchingToken(sourceFile, position, includeJsDocComment, n => isPropertyNameLiteral(n) || isKeyword(n.kind)); } /** @@ -1059,14 +1053,6 @@ namespace ts { return undefined; } - export function isWord(kind: SyntaxKind): boolean { - return kind === SyntaxKind.Identifier || isKeyword(kind); - } - - function isPropertyName(kind: SyntaxKind): boolean { - return kind === SyntaxKind.StringLiteral || kind === SyntaxKind.NumericLiteral || isWord(kind); - } - export function isComment(kind: SyntaxKind): boolean { return kind === SyntaxKind.SingleLineCommentTrivia || kind === SyntaxKind.MultiLineCommentTrivia; } @@ -1218,7 +1204,7 @@ namespace ts { } export function skipConstraint(type: Type): Type { - return type.flags & TypeFlags.TypeParameter ? type.getConstraint() : type; + return type.isTypeParameter() ? type.getConstraint() : type; } export function getNameFromPropertyName(name: PropertyName): string | undefined { @@ -1459,11 +1445,13 @@ namespace ts { * WARNING: This is an expensive operation and is only intended to be used in refactorings * and code fixes (because those are triggered by explicit user actions). */ - export function getSynthesizedDeepClone(node: T | undefined): T | undefined { - if (node === undefined) { - return undefined; - } + export function getSynthesizedDeepClone(node: T | undefined, includeTrivia = true): T | undefined { + const clone = node && getSynthesizedDeepCloneWorker(node); + if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone); + return clone; + } + function getSynthesizedDeepCloneWorker(node: T): T | undefined { const visited = visitEachChild(node, getSynthesizedDeepClone, nullTransformationContext); if (visited === node) { // This only happens for leaf nodes - internal nodes always see their children change. @@ -1474,22 +1462,18 @@ namespace ts { else if (isNumericLiteral(clone)) { clone.numericLiteralFlags = (node as any).numericLiteralFlags; } - clone.pos = node.pos; - clone.end = node.end; - return clone; + return setTextRange(clone, node); } // PERF: As an optimization, rather than calling getSynthesizedClone, we'll update // the new node created by visitEachChild with the extra changes getSynthesizedClone // would have made. - visited.parent = undefined; - return visited; } - export function getSynthesizedDeepClones(nodes: NodeArray | undefined): NodeArray | undefined { - return nodes && createNodeArray(nodes.map(getSynthesizedDeepClone), nodes.hasTrailingComma); + export function getSynthesizedDeepClones(nodes: NodeArray | undefined, includeTrivia = true): NodeArray | undefined { + return nodes && createNodeArray(nodes.map(n => getSynthesizedDeepClone(n, includeTrivia)), nodes.hasTrailingComma); } /** @@ -1526,4 +1510,45 @@ namespace ts { function getFirstChild(node: Node): Node | undefined { return node.forEachChild(child => child); } + + /* @internal */ + export function getUniqueName(baseName: string, fileText: string): string { + let nameText = baseName; + for (let i = 1; stringContains(fileText, nameText); i++) { + nameText = `${baseName}_${i}`; + } + return nameText; + } + + /** + * @return The index of the (only) reference to the extracted symbol. We want the cursor + * to be on the reference, rather than the declaration, because it's closer to where the + * user was before extracting it. + */ + /* @internal */ + export function getRenameLocation(edits: ReadonlyArray, renameFilename: string, name: string, isDeclaredBeforeUse: boolean): number { + let delta = 0; + let lastPos = -1; + for (const { fileName, textChanges } of edits) { + Debug.assert(fileName === renameFilename); + for (const change of textChanges) { + const { span, newText } = change; + const index = newText.indexOf(name); + if (index !== -1) { + lastPos = span.start + delta + index; + + // If the reference comes first, return immediately. + if (!isDeclaredBeforeUse) { + return lastPos; + } + } + delta += newText.length - span.length; + } + } + + // If the declaration comes first, return the position of the last occurrence. + Debug.assert(isDeclaredBeforeUse); + Debug.assert(lastPos >= 0); + return lastPos; + } } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json new file mode 100644 index 00000000000..03cffdc49ff --- /dev/null +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json @@ -0,0 +1,93 @@ +{ + "kind": "JSDocComment", + "pos": 0, + "end": 66, + "tags": { + "0": { + "kind": "JSDocParameterTag", + "pos": 6, + "end": 63, + "atToken": { + "kind": "AtToken", + "pos": 6, + "end": 7 + }, + "tagName": { + "kind": "Identifier", + "pos": 7, + "end": 12, + "escapedText": "param" + }, + "typeExpression": { + "kind": "JSDocTypeExpression", + "pos": 34, + "end": 63, + "type": { + "kind": "JSDocTypeLiteral", + "pos": 34, + "end": 63, + "jsDocPropertyTags": [ + { + "kind": "JSDocParameterTag", + "pos": 34, + "end": 54, + "atToken": { + "kind": "AtToken", + "pos": 34, + "end": 35 + }, + "tagName": { + "kind": "Identifier", + "pos": 35, + "end": 40, + "escapedText": "param" + }, + "typeExpression": { + "kind": "JSDocTypeExpression", + "pos": 41, + "end": 49, + "type": { + "kind": "StringKeyword", + "pos": 42, + "end": 48 + } + }, + "name": { + "kind": "FirstNode", + "pos": 50, + "end": 53, + "left": { + "kind": "Identifier", + "pos": 50, + "end": 51, + "escapedText": "o" + }, + "right": { + "kind": "Identifier", + "pos": 52, + "end": 53, + "escapedText": "f" + } + }, + "isNameFirst": false, + "isBracketed": false, + "comment": "Doc for f" + } + ] + } + }, + "name": { + "kind": "Identifier", + "pos": 22, + "end": 23, + "escapedText": "o" + }, + "isNameFirst": true, + "isBracketed": false, + "comment": "Doc doc" + }, + "length": 1, + "pos": 6, + "end": 63 + } +} \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json index 1a49c026e4c..00d7f0dcc30 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 28, + "end": 40, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 28 + "end": 40 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json index 4b463061bb5..6953601f112 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 33, + "end": 45, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 33 + "end": 45 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json index 93d7cf14737..472fbbeb6bb 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 7, - "end": 16, + "end": 58, "atToken": { "kind": "AtToken", "pos": 7, @@ -30,6 +30,6 @@ }, "length": 1, "pos": 7, - "end": 16 + "end": 58 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json index 21d94f52e6a..b3e58d84923 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 30, + "end": 55, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 30 + "end": 55 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json index 18649dcb321..6721afb2ea7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 31, + "end": 57, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 31 + "end": 57 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json index 6bddf6235d5..bf53423ad6a 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 36, + "end": 62, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 36 + "end": 62 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json index e6c48a3f759..68edeb90190 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 29, + "end": 42, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 29 + "end": 42 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json index c73009315bc..6f073802fcd 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 32, + "end": 34, "atToken": { "kind": "AtToken", "pos": 8, diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.errors.txt b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.errors.txt new file mode 100644 index 00000000000..5548bc5e3dc --- /dev/null +++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.errors.txt @@ -0,0 +1,23 @@ +tests/cases/compiler/app.js(6,7): error TS2322: Type '1' is not assignable to type 'WatchHandler'. + + +==== tests/cases/compiler/func.ts (0 errors) ==== + interface ComponentOptions { + watch: Record>; + } + type WatchHandler = (val: T) => void; + declare function extend(options: ComponentOptions<{}>): void; + export var vextend = extend; +==== tests/cases/compiler/app.js (1 errors) ==== + import {vextend} from './func'; + // hover on vextend + export var a = vextend({ + watch: { + data1(val) { + this.data2 = 1; + ~~~~~~~~~~ +!!! error TS2322: Type '1' is not assignable to type 'WatchHandler'. + }, + data2(val) { }, + } + }); \ No newline at end of file diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js new file mode 100644 index 00000000000..c2b9ddb5556 --- /dev/null +++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js @@ -0,0 +1,38 @@ +//// [tests/cases/compiler/allowJscheckJsTypeParameterNoCrash.ts] //// + +//// [func.ts] +interface ComponentOptions { + watch: Record>; +} +type WatchHandler = (val: T) => void; +declare function extend(options: ComponentOptions<{}>): void; +export var vextend = extend; +//// [app.js] +import {vextend} from './func'; +// hover on vextend +export var a = vextend({ + watch: { + data1(val) { + this.data2 = 1; + }, + data2(val) { }, + } +}); + +//// [func.js] +"use strict"; +exports.__esModule = true; +exports.vextend = extend; +//// [app.js] +"use strict"; +exports.__esModule = true; +var func_1 = require("./func"); +// hover on vextend +exports.a = func_1.vextend({ + watch: { + data1: function (val) { + this.data2 = 1; + }, + data2: function (val) { } + } +}); diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.symbols b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.symbols new file mode 100644 index 00000000000..2ca59a3dc60 --- /dev/null +++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.symbols @@ -0,0 +1,51 @@ +=== tests/cases/compiler/func.ts === +interface ComponentOptions { +>ComponentOptions : Symbol(ComponentOptions, Decl(func.ts, 0, 0)) +>V : Symbol(V, Decl(func.ts, 0, 27)) + + watch: Record>; +>watch : Symbol(ComponentOptions.watch, Decl(func.ts, 0, 31)) +>Record : Symbol(Record, Decl(lib.d.ts, --, --)) +>WatchHandler : Symbol(WatchHandler, Decl(func.ts, 2, 1)) +} +type WatchHandler = (val: T) => void; +>WatchHandler : Symbol(WatchHandler, Decl(func.ts, 2, 1)) +>T : Symbol(T, Decl(func.ts, 3, 18)) +>val : Symbol(val, Decl(func.ts, 3, 24)) +>T : Symbol(T, Decl(func.ts, 3, 18)) + +declare function extend(options: ComponentOptions<{}>): void; +>extend : Symbol(extend, Decl(func.ts, 3, 40)) +>options : Symbol(options, Decl(func.ts, 4, 24)) +>ComponentOptions : Symbol(ComponentOptions, Decl(func.ts, 0, 0)) + +export var vextend = extend; +>vextend : Symbol(vextend, Decl(func.ts, 5, 10)) +>extend : Symbol(extend, Decl(func.ts, 3, 40)) + +=== tests/cases/compiler/app.js === +import {vextend} from './func'; +>vextend : Symbol(vextend, Decl(app.js, 0, 8)) + +// hover on vextend +export var a = vextend({ +>a : Symbol(a, Decl(app.js, 2, 10)) +>vextend : Symbol(vextend, Decl(app.js, 0, 8)) + + watch: { +>watch : Symbol(watch, Decl(app.js, 2, 24)) + + data1(val) { +>data1 : Symbol(data1, Decl(app.js, 3, 10)) +>val : Symbol(val, Decl(app.js, 4, 10)) + + this.data2 = 1; +>this : Symbol(__type, Decl(lib.d.ts, --, --)) +>data2 : Symbol(data2, Decl(app.js, 4, 16), Decl(app.js, 6, 6)) + + }, + data2(val) { }, +>data2 : Symbol(data2, Decl(app.js, 4, 16), Decl(app.js, 6, 6)) +>val : Symbol(val, Decl(app.js, 7, 10)) + } +}); diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.types b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.types new file mode 100644 index 00000000000..396cdd4445e --- /dev/null +++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.types @@ -0,0 +1,57 @@ +=== tests/cases/compiler/func.ts === +interface ComponentOptions { +>ComponentOptions : ComponentOptions +>V : V + + watch: Record>; +>watch : Record void> +>Record : Record +>WatchHandler : (val: T) => void +} +type WatchHandler = (val: T) => void; +>WatchHandler : (val: T) => void +>T : T +>val : T +>T : T + +declare function extend(options: ComponentOptions<{}>): void; +>extend : (options: ComponentOptions<{}>) => void +>options : ComponentOptions<{}> +>ComponentOptions : ComponentOptions + +export var vextend = extend; +>vextend : (options: ComponentOptions<{}>) => void +>extend : (options: ComponentOptions<{}>) => void + +=== tests/cases/compiler/app.js === +import {vextend} from './func'; +>vextend : (options: ComponentOptions<{}>) => void + +// hover on vextend +export var a = vextend({ +>a : void +>vextend({ watch: { data1(val) { this.data2 = 1; }, data2(val) { }, }}) : void +>vextend : (options: ComponentOptions<{}>) => void +>{ watch: { data1(val) { this.data2 = 1; }, data2(val) { }, }} : { watch: { data1(val: any): void; }; } + + watch: { +>watch : { data1(val: any): void; } +>{ data1(val) { this.data2 = 1; }, data2(val) { }, } : { data1(val: any): void; } + + data1(val) { +>data1 : (val: any) => void +>val : any + + this.data2 = 1; +>this.data2 = 1 : 1 +>this.data2 : (val: any) => void +>this : Record void> +>data2 : (val: any) => void +>1 : 1 + + }, + data2(val) { }, +>data2 : any +>val : any + } +}); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 2be63b973a5..1c16c71cc99 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -240,7 +240,7 @@ declare namespace ts { IndexedAccessType = 175, MappedType = 176, LiteralType = 177, - ImportTypeNode = 178, + ImportType = 178, ObjectBindingPattern = 179, ArrayBindingPattern = 180, BindingElement = 181, @@ -585,6 +585,7 @@ declare namespace ts { } interface PropertyDeclaration extends ClassElement, JSDocContainer { kind: SyntaxKind.PropertyDeclaration; + parent: ClassLikeDeclaration; name: PropertyName; questionToken?: QuestionToken; exclamationToken?: ExclamationToken; @@ -699,7 +700,7 @@ declare namespace ts { kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.VoidKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.NullKeyword | SyntaxKind.NeverKeyword; } interface ImportTypeNode extends NodeWithTypeArguments { - kind: SyntaxKind.ImportTypeNode; + kind: SyntaxKind.ImportType; isTypeOf?: boolean; argument: TypeNode; qualifier?: EntityName; @@ -1783,6 +1784,10 @@ declare namespace ts { getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol | undefined; getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; + /** + * The function returns the value (local variable) symbol of an identifier in the short-hand property assignment. + * This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value. + */ getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined; getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol | undefined; /** @@ -1821,7 +1826,7 @@ declare namespace ts { isArgumentsSymbol(symbol: Symbol): boolean; isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; - isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean; /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; @@ -2250,7 +2255,7 @@ declare namespace ts { interface IndexInfo { type: Type; isReadonly: boolean; - declaration?: SignatureDeclaration; + declaration?: IndexSignatureDeclaration; } enum InferencePriority { NakedTypeVariable = 1, @@ -2272,6 +2277,7 @@ declare namespace ts { category: DiagnosticCategory; code: number; message: string; + reportsUnnecessary?: {}; } /** * A linked list of formatted diagnostic messages to be used as part of a multiline message. @@ -2291,6 +2297,8 @@ declare namespace ts { length: number | undefined; messageText: string | DiagnosticMessageChain; category: DiagnosticCategory; + /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ + reportsUnnecessary?: {}; code: number; source?: string; } @@ -2921,6 +2929,61 @@ declare namespace ts { function getNodeMajorVersion(): number; let sys: System; } +declare namespace ts { + type ErrorCallback = (message: DiagnosticMessage, length: number) => void; + interface Scanner { + getStartPos(): number; + getToken(): SyntaxKind; + getTextPos(): number; + getTokenPos(): number; + getTokenText(): string; + getTokenValue(): string; + hasExtendedUnicodeEscape(): boolean; + hasPrecedingLineBreak(): boolean; + isIdentifier(): boolean; + isReservedWord(): boolean; + isUnterminated(): boolean; + reScanGreaterToken(): SyntaxKind; + reScanSlashToken(): SyntaxKind; + reScanTemplateToken(): SyntaxKind; + scanJsxIdentifier(): SyntaxKind; + scanJsxAttributeValue(): SyntaxKind; + reScanJsxToken(): JsxTokenSyntaxKind; + scanJsxToken(): JsxTokenSyntaxKind; + scanJSDocToken(): JsDocSyntaxKind; + scan(): SyntaxKind; + getText(): string; + setText(text: string, start?: number, length?: number): void; + setOnError(onError: ErrorCallback): void; + setScriptTarget(scriptTarget: ScriptTarget): void; + setLanguageVariant(variant: LanguageVariant): void; + setTextPos(textPos: number): void; + lookAhead(callback: () => T): T; + scanRange(start: number, length: number, callback: () => T): T; + tryScan(callback: () => T): T; + } + function tokenToString(t: SyntaxKind): string | undefined; + function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number; + function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter; + function isWhiteSpaceLike(ch: number): boolean; + /** Does not include line breaks. For that, see isWhiteSpaceLike. */ + function isWhiteSpaceSingleLine(ch: number): boolean; + function isLineBreak(ch: number): boolean; + function couldStartTrivia(text: string, pos: number): boolean; + function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined; + function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined; + function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined; + function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined; + function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + /** Optionally, get the shebang */ + function getShebang(text: string): string | undefined; + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; +} declare namespace ts { function getDefaultLibFileName(options: CompilerOptions): string; function textSpanEnd(span: TextSpan): number; @@ -2950,7 +3013,11 @@ declare namespace ts { */ function collapseTextChangeRangesAcrossMultipleVersions(changes: ReadonlyArray): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; - function isParameterPropertyDeclaration(node: Node): boolean; + type ParameterPropertyDeclaration = ParameterDeclaration & { + parent: ConstructorDeclaration; + name: Identifier; + }; + function isParameterPropertyDeclaration(node: Node): node is ParameterPropertyDeclaration; function isEmptyBindingPattern(node: BindingName): node is BindingPattern; function isEmptyBindingElement(node: BindingElement): boolean; function getCombinedModifierFlags(node: Node): ModifierFlags; @@ -3242,6 +3309,7 @@ declare namespace ts { function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; function isTypeElement(node: Node): node is TypeElement; + function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike; /** * Node test that determines whether a node is a valid type node. @@ -3266,61 +3334,6 @@ declare namespace ts { function isObjectLiteralElement(node: Node): node is ObjectLiteralElement; function isStringLiteralLike(node: Node): node is StringLiteralLike; } -declare namespace ts { - type ErrorCallback = (message: DiagnosticMessage, length: number) => void; - interface Scanner { - getStartPos(): number; - getToken(): SyntaxKind; - getTextPos(): number; - getTokenPos(): number; - getTokenText(): string; - getTokenValue(): string; - hasExtendedUnicodeEscape(): boolean; - hasPrecedingLineBreak(): boolean; - isIdentifier(): boolean; - isReservedWord(): boolean; - isUnterminated(): boolean; - reScanGreaterToken(): SyntaxKind; - reScanSlashToken(): SyntaxKind; - reScanTemplateToken(): SyntaxKind; - scanJsxIdentifier(): SyntaxKind; - scanJsxAttributeValue(): SyntaxKind; - reScanJsxToken(): JsxTokenSyntaxKind; - scanJsxToken(): JsxTokenSyntaxKind; - scanJSDocToken(): JsDocSyntaxKind; - scan(): SyntaxKind; - getText(): string; - setText(text: string, start?: number, length?: number): void; - setOnError(onError: ErrorCallback): void; - setScriptTarget(scriptTarget: ScriptTarget): void; - setLanguageVariant(variant: LanguageVariant): void; - setTextPos(textPos: number): void; - lookAhead(callback: () => T): T; - scanRange(start: number, length: number, callback: () => T): T; - tryScan(callback: () => T): T; - } - function tokenToString(t: SyntaxKind): string | undefined; - function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number; - function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter; - function isWhiteSpaceLike(ch: number): boolean; - /** Does not include line breaks. For that, see isWhiteSpaceLike. */ - function isWhiteSpaceSingleLine(ch: number): boolean; - function isLineBreak(ch: number): boolean; - function couldStartTrivia(text: string, pos: number): boolean; - function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined; - function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined; - function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined; - function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined; - function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; - function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; - /** Optionally, get the shebang */ - function getShebang(text: string): string | undefined; - function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; - function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; - function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; -} declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; /** @@ -3348,59 +3361,6 @@ declare namespace ts { function isExternalModule(file: SourceFile): boolean; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } -declare namespace ts { - function parseCommandLine(commandLine: ReadonlyArray, readFile?: (path: string) => string | undefined): ParsedCommandLine; - /** - * Read tsconfig.json file - * @param fileName The path to the config file - */ - function readConfigFile(fileName: string, readFile: (path: string) => string | undefined): { - config?: any; - error?: Diagnostic; - }; - /** - * Parse the text of the tsconfig.json file - * @param fileName The path to the config file - * @param jsonText The text of the config file - */ - function parseConfigFileTextToJson(fileName: string, jsonText: string): { - config?: any; - error?: Diagnostic; - }; - /** - * Read tsconfig.json file - * @param fileName The path to the config file - */ - function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): JsonSourceFile; - /** - * Convert the json syntax tree into the json value - */ - function convertToObject(sourceFile: JsonSourceFile, errors: Push): any; - /** - * Parse the contents of a config file (tsconfig.json). - * @param json The contents of the config file to parse - * @param host Instance of ParseConfigHost used to enumerate files in folder. - * @param basePath A root directory to resolve relative path entries in the config - * file to. e.g. outDir - */ - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; - /** - * Parse the contents of a config file (tsconfig.json). - * @param jsonNode The contents of the config file to parse - * @param host Instance of ParseConfigHost used to enumerate files in folder. - * @param basePath A root directory to resolve relative path entries in the config - * file to. e.g. outDir - */ - function parseJsonSourceFileConfigFileContent(sourceFile: JsonSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; - function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { - options: CompilerOptions; - errors: Diagnostic[]; - }; - function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { - options: TypeAcquisition; - errors: Diagnostic[]; - }; -} declare namespace ts { interface GetEffectiveTypeRootsHost { directoryExists?(directoryName: string): boolean; @@ -3499,9 +3459,9 @@ declare namespace ts { function updateGetAccessor(node: GetAccessorDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: PropertyName, parameters: ReadonlyArray, type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; function createSetAccessor(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: string | PropertyName, parameters: ReadonlyArray, body: Block | undefined): SetAccessorDeclaration; function updateSetAccessor(node: SetAccessorDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: PropertyName, parameters: ReadonlyArray, body: Block | undefined): SetAccessorDeclaration; - function createCallSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration; + function createCallSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): CallSignatureDeclaration; function updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; - function createConstructSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; + function createConstructSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function createIndexSignature(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; function updateIndexSignature(node: IndexSignatureDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; @@ -3510,9 +3470,9 @@ declare namespace ts { function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; function createTypeReferenceNode(typeName: string | EntityName, typeArguments: ReadonlyArray | undefined): TypeReferenceNode; function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray | undefined): TypeReferenceNode; - function createFunctionTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): FunctionTypeNode; + function createFunctionTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): FunctionTypeNode; function updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): FunctionTypeNode; - function createConstructorTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructorTypeNode; + function createConstructorTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): ConstructorTypeNode; function updateConstructorTypeNode(node: ConstructorTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructorTypeNode; function createTypeQueryNode(exprName: EntityName): TypeQueryNode; function updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName): TypeQueryNode; @@ -3522,9 +3482,9 @@ declare namespace ts { function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; function createTupleTypeNode(elementTypes: ReadonlyArray): TupleTypeNode; function updateTypleTypeNode(node: TupleTypeNode, elementTypes: ReadonlyArray): TupleTypeNode; - function createUnionTypeNode(types: TypeNode[]): UnionTypeNode; + function createUnionTypeNode(types: ReadonlyArray): UnionTypeNode; function updateUnionTypeNode(node: UnionTypeNode, types: NodeArray): UnionTypeNode; - function createIntersectionTypeNode(types: TypeNode[]): IntersectionTypeNode; + function createIntersectionTypeNode(types: ReadonlyArray): IntersectionTypeNode; function updateIntersectionTypeNode(node: IntersectionTypeNode, types: NodeArray): IntersectionTypeNode; function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: ReadonlyArray): UnionOrIntersectionTypeNode; function createConditionalTypeNode(checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; @@ -3757,10 +3717,10 @@ declare namespace ts { function updateCommaList(node: CommaListExpression, elements: ReadonlyArray): CommaListExpression; function createBundle(sourceFiles: ReadonlyArray): Bundle; function updateBundle(node: Bundle, sourceFiles: ReadonlyArray): Bundle; - function createImmediatelyInvokedFunctionExpression(statements: Statement[]): CallExpression; - function createImmediatelyInvokedFunctionExpression(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; - function createImmediatelyInvokedArrowFunction(statements: Statement[]): CallExpression; - function createImmediatelyInvokedArrowFunction(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; + function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray): CallExpression; + function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; + function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray): CallExpression; + function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; function createComma(left: Expression, right: Expression): Expression; function createLessThan(left: Expression, right: Expression): Expression; function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment; @@ -3965,6 +3925,312 @@ declare namespace ts { */ function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray): Program; } +declare namespace ts { + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; + } + interface OutputFile { + name: string; + writeByteOrderMark: boolean; + text: string; + } +} +declare namespace ts { + type AffectedFileResult = { + result: T; + affected: SourceFile | Program; + } | undefined; + interface BuilderProgramHost { + /** + * return true if file names are treated with case sensitivity + */ + useCaseSensitiveFileNames(): boolean; + /** + * If provided this would be used this hash instead of actual file shape text for detecting changes + */ + createHash?: (data: string) => string; + /** + * When emit or emitNextAffectedFile are called without writeFile, + * this callback if present would be used to write files + */ + writeFile?: WriteFileCallback; + } + /** + * Builder to manage the program state changes + */ + interface BuilderProgram { + /** + * Returns current program + */ + getProgram(): Program; + /** + * Get compiler options of the program + */ + getCompilerOptions(): CompilerOptions; + /** + * Get the source file in the program with file name + */ + getSourceFile(fileName: string): SourceFile | undefined; + /** + * Get a list of files in the program + */ + getSourceFiles(): ReadonlyArray; + /** + * Get the diagnostics for compiler options + */ + getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + /** + * Get the diagnostics that dont belong to any file + */ + getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + /** + * Get the diagnostics from config file parsing + */ + getConfigFileParsingDiagnostics(): ReadonlyArray; + /** + * Get the syntax diagnostics, for all source files if source file is not supplied + */ + getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + /** + * Get all the dependencies of the file + */ + getAllDependencies(sourceFile: SourceFile): ReadonlyArray; + /** + * Gets the semantic diagnostics from the program corresponding to this state of file (if provided) or whole program + * The semantic diagnostics are cached and managed here + * Note that it is assumed that when asked about semantic diagnostics through this API, + * the file has been taken out of affected files so it is safe to use cache or get from program and cache the diagnostics + * In case of SemanticDiagnosticsBuilderProgram if the source file is not provided, + * it will iterate through all the affected files, to ensure that cache stays valid and yet provide a way to get all semantic diagnostics + */ + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + /** + * Emits the JavaScript and declaration files. + * When targetSource file is specified, emits the files corresponding to that source file, + * otherwise for the whole program. + * In case of EmitAndSemanticDiagnosticsBuilderProgram, when targetSourceFile is specified, + * it is assumed that that file is handled from affected file list. If targetSourceFile is not specified, + * it will only emit all the affected files instead of whole program + * + * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host + * in that order would be used to write the files + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; + /** + * Get the current directory of the program + */ + getCurrentDirectory(): string; + } + /** + * The builder that caches the semantic diagnostics for the program and handles the changed files and affected files + */ + interface SemanticDiagnosticsBuilderProgram extends BuilderProgram { + /** + * Gets the semantic diagnostics from the program for the next affected file and caches it + * Returns undefined if the iteration is complete + */ + getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult>; + } + /** + * The builder that can handle the changes in program and iterate through changed file to emit the files + * The semantic diagnostics are cached per file and managed by clearing for the changed/affected files + */ + interface EmitAndSemanticDiagnosticsBuilderProgram extends BuilderProgram { + /** + * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete + * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host + * in that order would be used to write the files + */ + emitNextAffectedFile(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): AffectedFileResult; + } + /** + * Create the builder to manage semantic diagnostics and cache them + */ + function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram; + function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram; + /** + * Create the builder that can handle the changes in program and iterate through changed files + * to emit the those files and manage semantic diagnostics cache as well + */ + function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram; + function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram; + /** + * Creates a builder thats just abstraction over program and can be used with watch + */ + function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; + function createAbstractBuilder(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; +} +declare namespace ts { + type DiagnosticReporter = (diagnostic: Diagnostic) => void; + type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void; + /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */ + type CreateProgram = (rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: ReadonlyArray) => T; + interface WatchCompilerHost { + /** + * Used to create the program when need for program creation or recreation detected + */ + createProgram: CreateProgram; + /** If provided, callback to invoke after every new program creation */ + afterProgramCreate?(program: T): void; + /** If provided, called with Diagnostic message that informs about change in watch status */ + onWatchStatusChange?(diagnostic: Diagnostic, newLine: string, options: CompilerOptions): void; + useCaseSensitiveFileNames(): boolean; + getNewLine(): string; + getCurrentDirectory(): string; + getDefaultLibFileName(options: CompilerOptions): string; + getDefaultLibLocation?(): string; + createHash?(data: string): string; + /** + * Use to check file presence for source files and + * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well + */ + fileExists(path: string): boolean; + /** + * Use to read file text for source files and + * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well + */ + readFile(path: string, encoding?: string): string | undefined; + /** If provided, used for module resolution as well as to handle directory structure */ + directoryExists?(path: string): boolean; + /** If provided, used in resolutions as well as handling directory structure */ + getDirectories?(path: string): string[]; + /** If provided, used to cache and handle directory structure modifications */ + readDirectory?(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[]; + /** Symbol links resolution */ + realpath?(path: string): string; + /** If provided would be used to write log about compilation */ + trace?(s: string): void; + /** If provided is used to get the environment variable */ + getEnvironmentVariable?(name: string): string; + /** If provided, used to resolve the module names, otherwise typescript's default module resolution */ + resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[]): ResolvedModule[]; + /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ + resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): (ResolvedTypeReferenceDirective | undefined)[]; + /** Used to watch changes in source files, missing files needed to update the program or config file */ + watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; + /** Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added */ + watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; + /** If provided, will be used to set delayed compilation, so that multiple changes in short span are compiled together */ + setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; + /** If provided, will be used to reset existing delayed compilation */ + clearTimeout?(timeoutId: any): void; + } + /** + * Host to create watch with root files and options + */ + interface WatchCompilerHostOfFilesAndCompilerOptions extends WatchCompilerHost { + /** root files to use to generate program */ + rootFiles: string[]; + /** Compiler options */ + options: CompilerOptions; + } + /** + * Reports config file diagnostics + */ + interface ConfigFileDiagnosticsReporter { + /** + * Reports unrecoverable error when parsing config file + */ + onUnRecoverableConfigFileDiagnostic: DiagnosticReporter; + } + /** + * Host to create watch with config file + */ + interface WatchCompilerHostOfConfigFile extends WatchCompilerHost, ConfigFileDiagnosticsReporter { + /** Name of the config file to compile */ + configFileName: string; + /** Options to extend */ + optionsToExtend?: CompilerOptions; + /** + * Used to generate source file names from the config file and its include, exclude, files rules + * and also to cache the directory stucture + */ + readDirectory(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[]; + } + interface Watch { + /** Synchronize with host and get updated program */ + getProgram(): T; + } + /** + * Creates the watch what generates program using the config file + */ + interface WatchOfConfigFile extends Watch { + } + /** + * Creates the watch that generates program using the root files and compiler options + */ + interface WatchOfFilesAndCompilerOptions extends Watch { + /** Updates the root files in the program, only if this is not config file compilation */ + updateRootFileNames(fileNames: string[]): void; + } + /** + * Create the watch compiler host for either configFile or fileNames and its options + */ + function createWatchCompilerHost(rootFiles: string[], options: CompilerOptions, system: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHostOfFilesAndCompilerOptions; + function createWatchCompilerHost(configFileName: string, optionsToExtend: CompilerOptions | undefined, system: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHostOfConfigFile; + /** + * Creates the watch from the host for root files and compiler options + */ + function createWatchProgram(host: WatchCompilerHostOfFilesAndCompilerOptions): WatchOfFilesAndCompilerOptions; + /** + * Creates the watch from the host for config file + */ + function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile; +} +declare namespace ts { + function parseCommandLine(commandLine: ReadonlyArray, readFile?: (path: string) => string | undefined): ParsedCommandLine; + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string, readFile: (path: string) => string | undefined): { + config?: any; + error?: Diagnostic; + }; + /** + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ + function parseConfigFileTextToJson(fileName: string, jsonText: string): { + config?: any; + error?: Diagnostic; + }; + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): JsonSourceFile; + /** + * Convert the json syntax tree into the json value + */ + function convertToObject(sourceFile: JsonSourceFile, errors: Push): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param host Instance of ParseConfigHost used to enumerate files in folder. + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; + /** + * Parse the contents of a config file (tsconfig.json). + * @param jsonNode The contents of the config file to parse + * @param host Instance of ParseConfigHost used to enumerate files in folder. + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseJsonSourceFileConfigFileContent(sourceFile: JsonSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; + function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: CompilerOptions; + errors: Diagnostic[]; + }; + function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: TypeAcquisition; + errors: Diagnostic[]; + }; +} declare namespace ts { interface Node { getSourceFile(): SourceFile; @@ -4009,6 +4275,15 @@ declare namespace ts { getNonNullableType(): Type; getConstraint(): Type | undefined; getDefault(): Type | undefined; + isUnion(): this is UnionType; + isIntersection(): this is IntersectionType; + isUnionOrIntersection(): this is UnionOrIntersectionType; + isLiteral(): this is LiteralType; + isStringLiteral(): this is StringLiteralType; + isNumberLiteral(): this is NumberLiteralType; + isTypeParameter(): this is TypeParameter; + isClassOrInterface(): this is InterfaceType; + isClass(): this is InterfaceType; } interface Signature { getDeclaration(): SignatureDeclaration; @@ -4101,6 +4376,7 @@ declare namespace ts { installPackage?(options: InstallPackageOptions): Promise; } interface UserPreferences { + readonly disableSuggestions?: boolean; readonly quotePreference?: "double" | "single"; readonly includeCompletionsForModuleExports?: boolean; readonly includeCompletionsWithInsertText?: boolean; @@ -4257,6 +4533,8 @@ declare namespace ts { commands?: CodeActionCommand[]; } interface CodeFixAction extends CodeAction { + /** Short name to identify the fix, for use by telemetry. */ + fixName: string; /** * If present, one may call 'getCombinedCodeFix' with this fixId. * This may be omitted to indicate that the code fix can't be applied in a group. @@ -4860,7 +5138,7 @@ declare namespace ts { function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; - function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnly?: boolean): LanguageService; /** * Get the path of the default library files (lib.d.ts) as distributed with the typescript * node package. @@ -4868,6 +5146,15 @@ declare namespace ts { */ function getDefaultLibFilePath(options: CompilerOptions): string; } +declare namespace ts { + /** + * Transform one or more nodes using the supplied transformers. + * @param source A single `Node` or an array of `Node` objects. + * @param transformers An array of `TransformerFactory` callbacks used to process the transformation. + * @param compilerOptions Optional compiler options. + */ + function transform(source: T | T[], transformers: TransformerFactory[], compilerOptions?: CompilerOptions): TransformationResult; +} declare namespace ts.server { interface CompressedData { length: number; @@ -5026,7 +5313,6 @@ declare namespace ts.server { function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never; } function getDefaultFormatCodeSettings(host: ServerHost): FormatCodeSettings; - function mergeMapLikes(target: T, source: Partial): void; type NormalizedPath = string & { __normalizedPathTag: any; }; @@ -5391,6 +5677,8 @@ declare namespace ts.server.protocol { endLocation: Location; category: string; code: number; + /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ + reportsUnnecessary?: {}; } /** * Response message for "projectInfo" request @@ -6330,6 +6618,8 @@ declare namespace ts.server.protocol { commands?: ReadonlyArray<{}>; } interface CodeFixAction extends CodeAction { + /** Short name to identify the fix, for use by telemetry. */ + fixName: string; /** * If present, one may call 'getCombinedCodeFix' with this fixId. * This may be omitted to indicate that the code fix can't be applied in a group. @@ -6741,6 +7031,7 @@ declare namespace ts.server.protocol { * The category of the diagnostic message, e.g. "error", "warning", or "suggestion". */ category: string; + reportsUnnecessary?: {}; /** * The error code of the diagnostic message. */ @@ -7139,6 +7430,7 @@ declare namespace ts.server.protocol { insertSpaceBeforeTypeAnnotation?: boolean; } interface UserPreferences { + readonly disableSuggestions?: boolean; readonly quotePreference?: "double" | "single"; /** * If enabled, TypeScript will search through all external modules' exports and add them to the completions list. @@ -7255,180 +7547,6 @@ declare namespace ts.server.protocol { ESNext = "ESNext" } } -declare namespace ts.server { - interface ServerCancellationToken extends HostCancellationToken { - setRequest(requestId: number): void; - resetRequest(requestId: number): void; - } - const nullCancellationToken: ServerCancellationToken; - interface PendingErrorCheck { - fileName: NormalizedPath; - project: Project; - } - type CommandNames = protocol.CommandTypes; - const CommandNames: any; - function formatMessage(msg: T, logger: Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string; - type Event = (body: T, eventName: string) => void; - interface EventSender { - event: Event; - } - interface SessionOptions { - host: ServerHost; - cancellationToken: ServerCancellationToken; - useSingleInferredProject: boolean; - useInferredProjectPerProjectRoot: boolean; - typingsInstaller: ITypingsInstaller; - byteLength: (buf: string, encoding?: string) => number; - hrtime: (start?: number[]) => number[]; - logger: Logger; - /** - * If falsy, all events are suppressed. - */ - canUseEvents: boolean; - eventHandler?: ProjectServiceEventHandler; - /** Has no effect if eventHandler is also specified. */ - suppressDiagnosticEvents?: boolean; - throttleWaitMilliseconds?: number; - globalPlugins?: ReadonlyArray; - pluginProbeLocations?: ReadonlyArray; - allowLocalPluginLoads?: boolean; - } - class Session implements EventSender { - private readonly gcTimer; - protected projectService: ProjectService; - private changeSeq; - private currentRequestId; - private errorCheck; - protected host: ServerHost; - private readonly cancellationToken; - protected readonly typingsInstaller: ITypingsInstaller; - protected byteLength: (buf: string, encoding?: string) => number; - private hrtime; - protected logger: Logger; - protected canUseEvents: boolean; - private suppressDiagnosticEvents?; - private eventHandler; - constructor(opts: SessionOptions); - private sendRequestCompletedEvent; - private defaultEventHandler; - private projectsUpdatedInBackgroundEvent; - logError(err: Error, cmd: string): void; - send(msg: protocol.Message): void; - event(body: T, eventName: string): void; - /** @deprecated */ - output(info: any, cmdName: string, reqSeq?: number, errorMsg?: string): void; - private doOutput; - private semanticCheck; - private syntacticCheck; - private infoCheck; - private sendDiagnosticsEvent; - /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ - private updateErrorCheck; - private cleanProjects; - private cleanup; - private getEncodedSemanticClassifications; - private getProject; - private getConfigFileAndProject; - private getConfigFileDiagnostics; - private convertToDiagnosticsWithLinePositionFromDiagnosticFile; - private getCompilerOptionsDiagnostics; - private convertToDiagnosticsWithLinePosition; - private getDiagnosticsWorker; - private getDefinition; - private getDefinitionAndBoundSpan; - private mapDefinitionInfo; - private toFileSpan; - private getTypeDefinition; - private getImplementation; - private getOccurrences; - private getSyntacticDiagnosticsSync; - private getSemanticDiagnosticsSync; - private getSuggestionDiagnosticsSync; - private getDocumentHighlights; - private setCompilerOptionsForInferredProjects; - private getProjectInfo; - private getProjectInfoWorker; - private getRenameInfo; - private getProjects; - private getDefaultProject; - private getRenameLocations; - private getReferences; - /** - * @param fileName is the name of the file to be opened - * @param fileContent is a version of the file content that is known to be more up to date than the one on disk - */ - private openClientFile; - private getPosition; - private getPositionInFile; - private getFileAndProject; - private getFileAndLanguageServiceForSyntacticOperation; - private getFileAndProjectWorker; - private getOutliningSpans; - private getTodoComments; - private getDocCommentTemplate; - private getSpanOfEnclosingComment; - private getIndentation; - private getBreakpointStatement; - private getNameOrDottedNameSpan; - private isValidBraceCompletion; - private getQuickInfoWorker; - private getFormattingEditsForRange; - private getFormattingEditsForRangeFull; - private getFormattingEditsForDocumentFull; - private getFormattingEditsAfterKeystrokeFull; - private getFormattingEditsAfterKeystroke; - private getCompletions; - private getCompletionEntryDetails; - private getCompileOnSaveAffectedFileList; - private emitFile; - private getSignatureHelpItems; - private createCheckList; - private getDiagnostics; - private change; - private reload; - private saveToTmp; - private closeClientFile; - private mapLocationNavigationBarItems; - private getNavigationBarItems; - private toLocationNavigationTree; - private toLocationTextSpan; - private getNavigationTree; - private getNavigateToItems; - private getSupportedCodeFixes; - private isLocation; - private extractPositionAndRange; - private getApplicableRefactors; - private getEditsForRefactor; - private organizeImports; - private getCodeFixes; - private getCombinedCodeFix; - private applyCodeActionCommand; - private getStartAndEndPosition; - private mapCodeAction; - private mapTextChangesToCodeEdits; - private mapTextChangesToCodeEditsUsingScriptinfo; - private convertTextChangeToCodeEdit; - private getBraceMatching; - private getDiagnosticsForProject; - getCanonicalFileName(fileName: string): string; - exit(): void; - private notRequired; - private requiredResponse; - private handlers; - addProtocolHandler(command: string, handler: (request: protocol.Request) => HandlerResponse): void; - private setCurrentRequest; - private resetCurrentRequest; - executeWithRequestId(requestId: number, f: () => T): T; - executeCommand(request: protocol.Request): HandlerResponse; - onMessage(message: string): void; - private getFormatOptions; - private getPreferences; - } - interface HandlerResponse { - response?: {}; - responseRequired?: boolean; - } -} declare namespace ts.server { class ScriptInfo { private readonly host; @@ -7503,17 +7621,6 @@ declare namespace ts.server { onProjectClosed(project: Project): void; } } -declare namespace ts { - interface EmitOutput { - outputFiles: OutputFile[]; - emitSkipped: boolean; - } - interface OutputFile { - name: string; - writeByteOrderMark: boolean; - text: string; - } -} declare namespace ts.server { enum ProjectKind { Inferred = 0, @@ -7857,6 +7964,7 @@ declare namespace ts.server { pluginProbeLocations?: ReadonlyArray; allowLocalPluginLoads?: boolean; typesMapLocation?: string; + syntaxOnly?: boolean; } class ProjectService { readonly typingsCache: TypingsCache; @@ -7916,6 +8024,7 @@ declare namespace ts.server { readonly useSingleInferredProject: boolean; readonly useInferredProjectPerProjectRoot: boolean; readonly typingsInstaller: ITypingsInstaller; + private readonly globalCacheLocationDirectoryPath; readonly throttleWaitMilliseconds?: number; private readonly eventHandler?; private readonly suppressDiagnosticEvents?; @@ -7923,6 +8032,7 @@ declare namespace ts.server { readonly pluginProbeLocations: ReadonlyArray; readonly allowLocalPluginLoads: boolean; readonly typesMapLocation: string | undefined; + readonly syntaxOnly?: boolean; /** Tracks projects that we have already sent telemetry for. */ private readonly seenProjects; constructor(opts: ProjectServiceOptions); @@ -8067,7 +8177,7 @@ declare namespace ts.server { * @param fileContent is a known version of the file content that is more up to date than the one on disk */ openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind, projectRootPath?: string): OpenConfiguredProjectResult; - private findExternalProjetContainingOpenScriptInfo; + private findExternalProjectContainingOpenScriptInfo; openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult; /** * Close file whose contents is managed by the client @@ -8086,6 +8196,182 @@ declare namespace ts.server { openExternalProject(proj: protocol.ExternalProject): void; } } +declare namespace ts.server { + interface ServerCancellationToken extends HostCancellationToken { + setRequest(requestId: number): void; + resetRequest(requestId: number): void; + } + const nullCancellationToken: ServerCancellationToken; + interface PendingErrorCheck { + fileName: NormalizedPath; + project: Project; + } + type CommandNames = protocol.CommandTypes; + const CommandNames: any; + function formatMessage(msg: T, logger: Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string; + type Event = (body: T, eventName: string) => void; + interface EventSender { + event: Event; + } + interface SessionOptions { + host: ServerHost; + cancellationToken: ServerCancellationToken; + useSingleInferredProject: boolean; + useInferredProjectPerProjectRoot: boolean; + typingsInstaller: ITypingsInstaller; + byteLength: (buf: string, encoding?: string) => number; + hrtime: (start?: number[]) => number[]; + logger: Logger; + /** + * If falsy, all events are suppressed. + */ + canUseEvents: boolean; + eventHandler?: ProjectServiceEventHandler; + /** Has no effect if eventHandler is also specified. */ + suppressDiagnosticEvents?: boolean; + syntaxOnly?: boolean; + throttleWaitMilliseconds?: number; + globalPlugins?: ReadonlyArray; + pluginProbeLocations?: ReadonlyArray; + allowLocalPluginLoads?: boolean; + } + class Session implements EventSender { + private readonly gcTimer; + protected projectService: ProjectService; + private changeSeq; + private currentRequestId; + private errorCheck; + protected host: ServerHost; + private readonly cancellationToken; + protected readonly typingsInstaller: ITypingsInstaller; + protected byteLength: (buf: string, encoding?: string) => number; + private hrtime; + protected logger: Logger; + protected canUseEvents: boolean; + private suppressDiagnosticEvents?; + private eventHandler; + constructor(opts: SessionOptions); + private sendRequestCompletedEvent; + private defaultEventHandler; + private projectsUpdatedInBackgroundEvent; + logError(err: Error, cmd: string): void; + send(msg: protocol.Message): void; + event(body: T, eventName: string): void; + /** @deprecated */ + output(info: any, cmdName: string, reqSeq?: number, errorMsg?: string): void; + private doOutput; + private semanticCheck; + private syntacticCheck; + private suggestionCheck; + private sendDiagnosticsEvent; + /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ + private updateErrorCheck; + private cleanProjects; + private cleanup; + private getEncodedSemanticClassifications; + private getProject; + private getConfigFileAndProject; + private getConfigFileDiagnostics; + private convertToDiagnosticsWithLinePositionFromDiagnosticFile; + private getCompilerOptionsDiagnostics; + private convertToDiagnosticsWithLinePosition; + private getDiagnosticsWorker; + private getDefinition; + private getDefinitionAndBoundSpan; + private mapDefinitionInfo; + private toFileSpan; + private getTypeDefinition; + private getImplementation; + private getOccurrences; + private getSyntacticDiagnosticsSync; + private getSemanticDiagnosticsSync; + private getSuggestionDiagnosticsSync; + private getDocumentHighlights; + private setCompilerOptionsForInferredProjects; + private getProjectInfo; + private getProjectInfoWorker; + private getRenameInfo; + private getProjects; + private getDefaultProject; + private getRenameLocations; + private getReferences; + /** + * @param fileName is the name of the file to be opened + * @param fileContent is a version of the file content that is known to be more up to date than the one on disk + */ + private openClientFile; + private getPosition; + private getPositionInFile; + private getFileAndProject; + private getFileAndLanguageServiceForSyntacticOperation; + private getFileAndProjectWorker; + private getOutliningSpans; + private getTodoComments; + private getDocCommentTemplate; + private getSpanOfEnclosingComment; + private getIndentation; + private getBreakpointStatement; + private getNameOrDottedNameSpan; + private isValidBraceCompletion; + private getQuickInfoWorker; + private getFormattingEditsForRange; + private getFormattingEditsForRangeFull; + private getFormattingEditsForDocumentFull; + private getFormattingEditsAfterKeystrokeFull; + private getFormattingEditsAfterKeystroke; + private getCompletions; + private getCompletionEntryDetails; + private getCompileOnSaveAffectedFileList; + private emitFile; + private getSignatureHelpItems; + private createCheckList; + private getDiagnostics; + private change; + private reload; + private saveToTmp; + private closeClientFile; + private mapLocationNavigationBarItems; + private getNavigationBarItems; + private toLocationNavigationTree; + private toLocationTextSpan; + private getNavigationTree; + private getNavigateToItems; + private getSupportedCodeFixes; + private isLocation; + private extractPositionAndRange; + private getApplicableRefactors; + private getEditsForRefactor; + private organizeImports; + private getCodeFixes; + private getCombinedCodeFix; + private applyCodeActionCommand; + private getStartAndEndPosition; + private mapCodeAction; + private mapCodeFixAction; + private mapTextChangesToCodeEdits; + private mapTextChangesToCodeEditsUsingScriptinfo; + private convertTextChangeToCodeEdit; + private getBraceMatching; + private getDiagnosticsForProject; + getCanonicalFileName(fileName: string): string; + exit(): void; + private notRequired; + private requiredResponse; + private handlers; + addProtocolHandler(command: string, handler: (request: protocol.Request) => HandlerResponse): void; + private setCurrentRequest; + private resetCurrentRequest; + executeWithRequestId(requestId: number, f: () => T): T; + executeCommand(request: protocol.Request): HandlerResponse; + onMessage(message: string): void; + private getFormatOptions; + private getPreferences; + } + interface HandlerResponse { + response?: {}; + responseRequired?: boolean; + } +} export = ts; export as namespace ts; \ No newline at end of file diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 0b1b4f43511..7c23f93e038 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -240,7 +240,7 @@ declare namespace ts { IndexedAccessType = 175, MappedType = 176, LiteralType = 177, - ImportTypeNode = 178, + ImportType = 178, ObjectBindingPattern = 179, ArrayBindingPattern = 180, BindingElement = 181, @@ -585,6 +585,7 @@ declare namespace ts { } interface PropertyDeclaration extends ClassElement, JSDocContainer { kind: SyntaxKind.PropertyDeclaration; + parent: ClassLikeDeclaration; name: PropertyName; questionToken?: QuestionToken; exclamationToken?: ExclamationToken; @@ -699,7 +700,7 @@ declare namespace ts { kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.VoidKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.NullKeyword | SyntaxKind.NeverKeyword; } interface ImportTypeNode extends NodeWithTypeArguments { - kind: SyntaxKind.ImportTypeNode; + kind: SyntaxKind.ImportType; isTypeOf?: boolean; argument: TypeNode; qualifier?: EntityName; @@ -1783,6 +1784,10 @@ declare namespace ts { getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol | undefined; getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; + /** + * The function returns the value (local variable) symbol of an identifier in the short-hand property assignment. + * This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value. + */ getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined; getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol | undefined; /** @@ -1821,7 +1826,7 @@ declare namespace ts { isArgumentsSymbol(symbol: Symbol): boolean; isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; - isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean; /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; @@ -2250,7 +2255,7 @@ declare namespace ts { interface IndexInfo { type: Type; isReadonly: boolean; - declaration?: SignatureDeclaration; + declaration?: IndexSignatureDeclaration; } enum InferencePriority { NakedTypeVariable = 1, @@ -2272,6 +2277,7 @@ declare namespace ts { category: DiagnosticCategory; code: number; message: string; + reportsUnnecessary?: {}; } /** * A linked list of formatted diagnostic messages to be used as part of a multiline message. @@ -2291,6 +2297,8 @@ declare namespace ts { length: number | undefined; messageText: string | DiagnosticMessageChain; category: DiagnosticCategory; + /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ + reportsUnnecessary?: {}; code: number; source?: string; } @@ -3005,7 +3013,11 @@ declare namespace ts { */ function collapseTextChangeRangesAcrossMultipleVersions(changes: ReadonlyArray): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; - function isParameterPropertyDeclaration(node: Node): boolean; + type ParameterPropertyDeclaration = ParameterDeclaration & { + parent: ConstructorDeclaration; + name: Identifier; + }; + function isParameterPropertyDeclaration(node: Node): node is ParameterPropertyDeclaration; function isEmptyBindingPattern(node: BindingName): node is BindingPattern; function isEmptyBindingElement(node: BindingElement): boolean; function getCombinedModifierFlags(node: Node): ModifierFlags; @@ -3297,6 +3309,7 @@ declare namespace ts { function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; function isTypeElement(node: Node): node is TypeElement; + function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike; /** * Node test that determines whether a node is a valid type node. @@ -3446,9 +3459,9 @@ declare namespace ts { function updateGetAccessor(node: GetAccessorDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: PropertyName, parameters: ReadonlyArray, type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; function createSetAccessor(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: string | PropertyName, parameters: ReadonlyArray, body: Block | undefined): SetAccessorDeclaration; function updateSetAccessor(node: SetAccessorDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, name: PropertyName, parameters: ReadonlyArray, body: Block | undefined): SetAccessorDeclaration; - function createCallSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration; + function createCallSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): CallSignatureDeclaration; function updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; - function createConstructSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; + function createConstructSignature(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function createIndexSignature(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; function updateIndexSignature(node: IndexSignatureDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; @@ -3457,9 +3470,9 @@ declare namespace ts { function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; function createTypeReferenceNode(typeName: string | EntityName, typeArguments: ReadonlyArray | undefined): TypeReferenceNode; function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray | undefined): TypeReferenceNode; - function createFunctionTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): FunctionTypeNode; + function createFunctionTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): FunctionTypeNode; function updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): FunctionTypeNode; - function createConstructorTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructorTypeNode; + function createConstructorTypeNode(typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined): ConstructorTypeNode; function updateConstructorTypeNode(node: ConstructorTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructorTypeNode; function createTypeQueryNode(exprName: EntityName): TypeQueryNode; function updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName): TypeQueryNode; @@ -3469,9 +3482,9 @@ declare namespace ts { function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; function createTupleTypeNode(elementTypes: ReadonlyArray): TupleTypeNode; function updateTypleTypeNode(node: TupleTypeNode, elementTypes: ReadonlyArray): TupleTypeNode; - function createUnionTypeNode(types: TypeNode[]): UnionTypeNode; + function createUnionTypeNode(types: ReadonlyArray): UnionTypeNode; function updateUnionTypeNode(node: UnionTypeNode, types: NodeArray): UnionTypeNode; - function createIntersectionTypeNode(types: TypeNode[]): IntersectionTypeNode; + function createIntersectionTypeNode(types: ReadonlyArray): IntersectionTypeNode; function updateIntersectionTypeNode(node: IntersectionTypeNode, types: NodeArray): IntersectionTypeNode; function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: ReadonlyArray): UnionOrIntersectionTypeNode; function createConditionalTypeNode(checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; @@ -3704,10 +3717,10 @@ declare namespace ts { function updateCommaList(node: CommaListExpression, elements: ReadonlyArray): CommaListExpression; function createBundle(sourceFiles: ReadonlyArray): Bundle; function updateBundle(node: Bundle, sourceFiles: ReadonlyArray): Bundle; - function createImmediatelyInvokedFunctionExpression(statements: Statement[]): CallExpression; - function createImmediatelyInvokedFunctionExpression(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; - function createImmediatelyInvokedArrowFunction(statements: Statement[]): CallExpression; - function createImmediatelyInvokedArrowFunction(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; + function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray): CallExpression; + function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; + function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray): CallExpression; + function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; function createComma(left: Expression, right: Expression): Expression; function createLessThan(left: Expression, right: Expression): Expression; function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment; @@ -4262,6 +4275,15 @@ declare namespace ts { getNonNullableType(): Type; getConstraint(): Type | undefined; getDefault(): Type | undefined; + isUnion(): this is UnionType; + isIntersection(): this is IntersectionType; + isUnionOrIntersection(): this is UnionOrIntersectionType; + isLiteral(): this is LiteralType; + isStringLiteral(): this is StringLiteralType; + isNumberLiteral(): this is NumberLiteralType; + isTypeParameter(): this is TypeParameter; + isClassOrInterface(): this is InterfaceType; + isClass(): this is InterfaceType; } interface Signature { getDeclaration(): SignatureDeclaration; @@ -4354,6 +4376,7 @@ declare namespace ts { installPackage?(options: InstallPackageOptions): Promise; } interface UserPreferences { + readonly disableSuggestions?: boolean; readonly quotePreference?: "double" | "single"; readonly includeCompletionsForModuleExports?: boolean; readonly includeCompletionsWithInsertText?: boolean; @@ -4510,6 +4533,8 @@ declare namespace ts { commands?: CodeActionCommand[]; } interface CodeFixAction extends CodeAction { + /** Short name to identify the fix, for use by telemetry. */ + fixName: string; /** * If present, one may call 'getCombinedCodeFix' with this fixId. * This may be omitted to indicate that the code fix can't be applied in a group. @@ -5113,7 +5138,7 @@ declare namespace ts { function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; - function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnly?: boolean): LanguageService; /** * Get the path of the default library files (lib.d.ts) as distributed with the typescript * node package. diff --git a/tests/baselines/reference/chainedPrototypeAssignment.types b/tests/baselines/reference/chainedPrototypeAssignment.types index d9b02c1f54f..e49e1a89980 100644 --- a/tests/baselines/reference/chainedPrototypeAssignment.types +++ b/tests/baselines/reference/chainedPrototypeAssignment.types @@ -7,30 +7,30 @@ var mod = require('./mod'); >'./mod' : "./mod" var a = new mod.A() ->a : { a: number; } & { [x: string]: any; m(n: number): number; } ->new mod.A() : { a: number; } & { [x: string]: any; m(n: number): number; } ->mod.A : () => void +>a : A & { [x: string]: any; m(n: number): number; } +>new mod.A() : A & { [x: string]: any; m(n: number): number; } +>mod.A : typeof A >mod : typeof import("tests/cases/conformance/salsa/mod") ->A : () => void +>A : typeof A var b = new mod.B() ->b : { b: number; } & { [x: string]: any; m(n: number): number; } ->new mod.B() : { b: number; } & { [x: string]: any; m(n: number): number; } ->mod.B : () => void +>b : B & { [x: string]: any; m(n: number): number; } +>new mod.B() : B & { [x: string]: any; m(n: number): number; } +>mod.B : typeof B >mod : typeof import("tests/cases/conformance/salsa/mod") ->B : () => void +>B : typeof B a.m('nope') >a.m('nope') : number >a.m : (n: number) => number ->a : { a: number; } & { [x: string]: any; m(n: number): number; } +>a : A & { [x: string]: any; m(n: number): number; } >m : (n: number) => number >'nope' : "nope" b.m('not really') >b.m('not really') : number >b.m : (n: number) => number ->b : { b: number; } & { [x: string]: any; m(n: number): number; } +>b : B & { [x: string]: any; m(n: number): number; } >m : (n: number) => number >'not really' : "not really" @@ -45,8 +45,8 @@ declare var exports: any; === tests/cases/conformance/salsa/mod.js === /// var A = function() { ->A : () => void ->function() { this.a = 1} : () => void +>A : typeof A +>function() { this.a = 1} : typeof A this.a = 1 >this.a = 1 : 1 @@ -56,8 +56,8 @@ var A = function() { >1 : 1 } var B = function() { ->B : () => void ->function() { this.b = 2} : () => void +>B : typeof B +>function() { this.b = 2} : typeof B this.b = 2 >this.b = 2 : 2 @@ -67,27 +67,27 @@ var B = function() { >2 : 2 } exports.A = A ->exports.A = A : () => void ->exports.A : () => void +>exports.A = A : typeof A +>exports.A : typeof A >exports : typeof import("tests/cases/conformance/salsa/mod") ->A : () => void ->A : () => void +>A : typeof A +>A : typeof A exports.B = B ->exports.B = B : () => void ->exports.B : () => void +>exports.B = B : typeof B +>exports.B : typeof B >exports : typeof import("tests/cases/conformance/salsa/mod") ->B : () => void ->B : () => void +>B : typeof B +>B : typeof B A.prototype = B.prototype = { >A.prototype = B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { [x: string]: any; m(n: number): number; } >A.prototype : any ->A : () => void +>A : typeof A >prototype : any >B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { [x: string]: any; m(n: number): number; } >B.prototype : any ->B : () => void +>B : typeof B >prototype : any >{ /** @param {number} n */ m(n) { return n + 1 }} : { [x: string]: any; m(n: number): number; } diff --git a/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt b/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt index b409185a114..0b65f4fd3be 100644 --- a/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt +++ b/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt @@ -1,10 +1,9 @@ tests/cases/compiler/weird.js(1,1): error TS2304: Cannot find name 'someFunction'. tests/cases/compiler/weird.js(1,23): error TS7006: Parameter 'BaseClass' implicitly has an 'any' type. -tests/cases/compiler/weird.js(6,13): error TS2346: Call target does not contain any signatures. tests/cases/compiler/weird.js(9,17): error TS7006: Parameter 'error' implicitly has an 'any' type. -==== tests/cases/compiler/weird.js (4 errors) ==== +==== tests/cases/compiler/weird.js (3 errors) ==== someFunction(function(BaseClass) { ~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'someFunction'. @@ -15,8 +14,6 @@ tests/cases/compiler/weird.js(9,17): error TS7006: Parameter 'error' implicitly class Hello extends BaseClass { constructor() { super(); - ~~~~~~~ -!!! error TS2346: Call target does not contain any signatures. this.foo = "bar"; } _render(error) { diff --git a/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt index e01fce65781..6878372be8b 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(42,27): error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & SingleChildProp'. +tests/cases/conformance/jsx/file.tsx(42,11): error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & SingleChildProp'. Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'SingleChildProp'. Types of property 'children' are incompatible. Type 'Element[]' is not assignable to type 'Element'. @@ -48,7 +48,7 @@ tests/cases/conformance/jsx/file.tsx(42,27): error TS2322: Type '{ children: Ele // Error let k5 = <>