typescript 5.5.0-dev.20240419 → 5.5.0-dev.20240420

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240419`;
21
+ var version = `${versionMajorMinor}.0-dev.20240420`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6172,6 +6172,43 @@ var Diagnostics = {
6172
6172
  Identifier_string_literal_or_number_literal_expected: diag(1496, 1 /* Error */, "Identifier_string_literal_or_number_literal_expected_1496", "Identifier, string literal, or number literal expected."),
6173
6173
  Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator: diag(1497, 1 /* Error */, "Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator_1497", "Expression must be enclosed in parentheses to be used as a decorator."),
6174
6174
  Invalid_syntax_in_decorator: diag(1498, 1 /* Error */, "Invalid_syntax_in_decorator_1498", "Invalid syntax in decorator."),
6175
+ Unknown_regular_expression_flag: diag(1499, 1 /* Error */, "Unknown_regular_expression_flag_1499", "Unknown regular expression flag."),
6176
+ Duplicate_regular_expression_flag: diag(1500, 1 /* Error */, "Duplicate_regular_expression_flag_1500", "Duplicate regular expression flag."),
6177
+ This_regular_expression_flag_is_only_available_when_targeting_0_or_later: diag(1501, 1 /* Error */, "This_regular_expression_flag_is_only_available_when_targeting_0_or_later_1501", "This regular expression flag is only available when targeting '{0}' or later."),
6178
+ The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously: diag(1502, 1 /* Error */, "The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously_1502", "The Unicode (u) flag and the Unicode Sets (v) flag cannot be set simultaneously."),
6179
+ Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later: diag(1503, 1 /* Error */, "Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later_1503", "Named capturing groups are only available when targeting 'ES2018' or later."),
6180
+ Subpattern_flags_must_be_present_when_there_is_a_minus_sign: diag(1504, 1 /* Error */, "Subpattern_flags_must_be_present_when_there_is_a_minus_sign_1504", "Subpattern flags must be present when there is a minus sign."),
6181
+ Incomplete_quantifier_Digit_expected: diag(1505, 1 /* Error */, "Incomplete_quantifier_Digit_expected_1505", "Incomplete quantifier. Digit expected."),
6182
+ Numbers_out_of_order_in_quantifier: diag(1506, 1 /* Error */, "Numbers_out_of_order_in_quantifier_1506", "Numbers out of order in quantifier."),
6183
+ There_is_nothing_available_for_repetition: diag(1507, 1 /* Error */, "There_is_nothing_available_for_repetition_1507", "There is nothing available for repetition."),
6184
+ Unexpected_0_Did_you_mean_to_escape_it_with_backslash: diag(1508, 1 /* Error */, "Unexpected_0_Did_you_mean_to_escape_it_with_backslash_1508", "Unexpected '{0}'. Did you mean to escape it with backslash?"),
6185
+ This_regular_expression_flag_cannot_be_toggled_within_a_subpattern: diag(1509, 1 /* Error */, "This_regular_expression_flag_cannot_be_toggled_within_a_subpattern_1509", "This regular expression flag cannot be toggled within a subpattern."),
6186
+ k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets: diag(1510, 1 /* Error */, "k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets_1510", "'\\k' must be followed by a capturing group name enclosed in angle brackets."),
6187
+ q_is_only_available_inside_character_class: diag(1511, 1 /* Error */, "q_is_only_available_inside_character_class_1511", "'\\q' is only available inside character class."),
6188
+ c_must_be_followed_by_an_ASCII_letter: diag(1512, 1 /* Error */, "c_must_be_followed_by_an_ASCII_letter_1512", "'\\c' must be followed by an ASCII letter."),
6189
+ Undetermined_character_escape: diag(1513, 1 /* Error */, "Undetermined_character_escape_1513", "Undetermined character escape."),
6190
+ Expected_a_capturing_group_name: diag(1514, 1 /* Error */, "Expected_a_capturing_group_name_1514", "Expected a capturing group name."),
6191
+ Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other: diag(1515, 1 /* Error */, "Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other_1515", "Named capturing groups with the same name must be mutually exclusive to each other."),
6192
+ A_character_class_range_must_not_be_bounded_by_another_character_class: diag(1516, 1 /* Error */, "A_character_class_range_must_not_be_bounded_by_another_character_class_1516", "A character class range must not be bounded by another character class."),
6193
+ Range_out_of_order_in_character_class: diag(1517, 1 /* Error */, "Range_out_of_order_in_character_class_1517", "Range out of order in character class."),
6194
+ Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class: diag(1518, 1 /* Error */, "Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_characte_1518", "Anything that would possibly match more than a single character is invalid inside a negated character class."),
6195
+ Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead: diag(1519, 1 /* Error */, "Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead_1519", "Operators must not be mixed within a character class. Wrap it in a nested class instead."),
6196
+ Expected_a_class_set_oprand: diag(1520, 1 /* Error */, "Expected_a_class_set_oprand_1520", "Expected a class set oprand."),
6197
+ q_must_be_followed_by_string_alternatives_enclosed_in_braces: diag(1521, 1 /* Error */, "q_must_be_followed_by_string_alternatives_enclosed_in_braces_1521", "'\\q' must be followed by string alternatives enclosed in braces."),
6198
+ A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash: diag(1522, 1 /* Error */, "A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backs_1522", "A character class must not contain a reserved double punctuator. Did you mean to escape it with backslash?"),
6199
+ Expected_a_Unicode_property_name: diag(1523, 1 /* Error */, "Expected_a_Unicode_property_name_1523", "Expected a Unicode property name."),
6200
+ Unknown_Unicode_property_name: diag(1524, 1 /* Error */, "Unknown_Unicode_property_name_1524", "Unknown Unicode property name."),
6201
+ Expected_a_Unicode_property_value: diag(1525, 1 /* Error */, "Expected_a_Unicode_property_value_1525", "Expected a Unicode property value."),
6202
+ Unknown_Unicode_property_value: diag(1526, 1 /* Error */, "Unknown_Unicode_property_value_1526", "Unknown Unicode property value."),
6203
+ Expected_a_Unicode_property_name_or_value: diag(1527, 1 /* Error */, "Expected_a_Unicode_property_name_or_value_1527", "Expected a Unicode property name or value."),
6204
+ Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_the_Unicode_Sets_v_flag_is_set: diag(1528, 1 /* Error */, "Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_t_1528", "Any Unicode property that would possibly match more than a single character is only available when the Unicode Sets (v) flag is set."),
6205
+ Unknown_Unicode_property_name_or_value: diag(1529, 1 /* Error */, "Unknown_Unicode_property_name_or_value_1529", "Unknown Unicode property name or value."),
6206
+ Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set: diag(1530, 1 /* Error */, "Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v__1530", "Unicode property value expressions are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set."),
6207
+ _0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces: diag(1531, 1 /* Error */, "_0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces_1531", "'\\{0}' must be followed by a Unicode property value expression enclosed in braces."),
6208
+ There_is_no_capturing_group_named_0_in_this_regular_expression: diag(1532, 1 /* Error */, "There_is_no_capturing_group_named_0_in_this_regular_expression_1532", "There is no capturing group named '{0}' in this regular expression."),
6209
+ A_decimal_escape_must_refer_to_an_existent_capturing_group_There_are_only_0_capturing_groups_in_this_regular_expression: diag(1533, 1 /* Error */, "A_decimal_escape_must_refer_to_an_existent_capturing_group_There_are_only_0_capturing_groups_in_this_1533", "A decimal escape must refer to an existent capturing group. There are only {0} capturing groups in this regular expression."),
6210
+ Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression: diag(1534, 1 /* Error */, "Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression_1534", "Decimal escapes are invalid when there are no capturing groups in a regular expression."),
6211
+ This_character_cannot_be_escaped_in_a_regular_expression: diag(1535, 1 /* Error */, "This_character_cannot_be_escaped_in_a_regular_expression_1535", "This character cannot be escaped in a regular expression."),
6175
6212
  The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
6176
6213
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
6177
6214
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -7417,6 +7454,7 @@ var Diagnostics = {
7417
7454
  Specify_how_the_TypeScript_watch_mode_works: diag(6715, 3 /* Message */, "Specify_how_the_TypeScript_watch_mode_works_6715", "Specify how the TypeScript watch mode works."),
7418
7455
  Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, 3 /* Message */, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
7419
7456
  Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
7457
+ Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
7420
7458
  Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
7421
7459
  Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
7422
7460
  one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
@@ -7558,6 +7596,36 @@ var Diagnostics = {
7558
7596
  A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag: diag(8039, 1 /* Error */, "A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag_8039", "A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag"),
7559
7597
  Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
7560
7598
  Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
7599
+ Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations: diag(9007, 1 /* Error */, "Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9007", "Function must have an explicit return type annotation with --isolatedDeclarations."),
7600
+ Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations: diag(9008, 1 /* Error */, "Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9008", "Method must have an explicit return type annotation with --isolatedDeclarations."),
7601
+ At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations: diag(9009, 1 /* Error */, "At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9009", "At least one accessor must have an explicit return type annotation with --isolatedDeclarations."),
7602
+ Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations: diag(9010, 1 /* Error */, "Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9010", "Variable must have an explicit type annotation with --isolatedDeclarations."),
7603
+ Parameter_must_have_an_explicit_type_annotation_with_isolatedDeclarations: diag(9011, 1 /* Error */, "Parameter_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9011", "Parameter must have an explicit type annotation with --isolatedDeclarations."),
7604
+ Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations: diag(9012, 1 /* Error */, "Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9012", "Property must have an explicit type annotation with --isolatedDeclarations."),
7605
+ Expression_type_can_t_be_inferred_with_isolatedDeclarations: diag(9013, 1 /* Error */, "Expression_type_can_t_be_inferred_with_isolatedDeclarations_9013", "Expression type can't be inferred with --isolatedDeclarations."),
7606
+ Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations: diag(9014, 1 /* Error */, "Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedD_9014", "Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations."),
7607
+ Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations: diag(9015, 1 /* Error */, "Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations_9015", "Objects that contain spread assignments can't be inferred with --isolatedDeclarations."),
7608
+ Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations: diag(9016, 1 /* Error */, "Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations_9016", "Objects that contain shorthand properties can't be inferred with --isolatedDeclarations."),
7609
+ Only_const_arrays_can_be_inferred_with_isolatedDeclarations: diag(9017, 1 /* Error */, "Only_const_arrays_can_be_inferred_with_isolatedDeclarations_9017", "Only const arrays can be inferred with --isolatedDeclarations."),
7610
+ Arrays_with_spread_elements_can_t_inferred_with_isolatedDeclarations: diag(9018, 1 /* Error */, "Arrays_with_spread_elements_can_t_inferred_with_isolatedDeclarations_9018", "Arrays with spread elements can't inferred with --isolatedDeclarations."),
7611
+ Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations: diag(9019, 1 /* Error */, "Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations_9019", "Binding elements can't be exported directly with --isolatedDeclarations."),
7612
+ Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDeclarations: diag(9020, 1 /* Error */, "Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDecl_9020", "Enum member initializers must be computable without references to external symbols with --isolatedDeclarations."),
7613
+ Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations: diag(9021, 1 /* Error */, "Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations_9021", "Extends clause can't contain an expression with --isolatedDeclarations."),
7614
+ Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations: diag(9022, 1 /* Error */, "Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations_9022", "Inference from class expressions is not supported with --isolatedDeclarations."),
7615
+ Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function: diag(9023, 1 /* Error */, "Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations__9023", "Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function."),
7616
+ Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations: diag(9025, 1 /* Error */, "Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025", "Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations."),
7617
+ Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_supported_with_isolatedDeclarations: diag(9026, 1 /* Error */, "Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_support_9026", "Declaration emit for this file requires preserving this import for augmentations. This is not supported with --isolatedDeclarations."),
7618
+ Add_a_type_annotation_to_the_variable_0: diag(9027, 1 /* Error */, "Add_a_type_annotation_to_the_variable_0_9027", "Add a type annotation to the variable {0}."),
7619
+ Add_a_type_annotation_to_the_parameter_0: diag(9028, 1 /* Error */, "Add_a_type_annotation_to_the_parameter_0_9028", "Add a type annotation to the parameter {0}."),
7620
+ Add_a_type_annotation_to_the_property_0: diag(9029, 1 /* Error */, "Add_a_type_annotation_to_the_property_0_9029", "Add a type annotation to the property {0}."),
7621
+ Add_a_return_type_to_the_function_expression: diag(9030, 1 /* Error */, "Add_a_return_type_to_the_function_expression_9030", "Add a return type to the function expression."),
7622
+ Add_a_return_type_to_the_function_declaration: diag(9031, 1 /* Error */, "Add_a_return_type_to_the_function_declaration_9031", "Add a return type to the function declaration."),
7623
+ Add_a_return_type_to_the_get_accessor_declaration: diag(9032, 1 /* Error */, "Add_a_return_type_to_the_get_accessor_declaration_9032", "Add a return type to the get accessor declaration."),
7624
+ Add_a_type_to_parameter_of_the_set_accessor_declaration: diag(9033, 1 /* Error */, "Add_a_type_to_parameter_of_the_set_accessor_declaration_9033", "Add a type to parameter of the set accessor declaration."),
7625
+ Add_a_return_type_to_the_method: diag(9034, 1 /* Error */, "Add_a_return_type_to_the_method_9034", "Add a return type to the method"),
7626
+ Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit: diag(9035, 1 /* Error */, "Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit_9035", "Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit."),
7627
+ Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it: diag(9036, 1 /* Error */, "Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it_9036", "Move the expression in default export to a variable and add a type annotation to it."),
7628
+ Default_exports_can_t_be_inferred_with_isolatedDeclarations: diag(9037, 1 /* Error */, "Default_exports_can_t_be_inferred_with_isolatedDeclarations_9037", "Default exports can't be inferred with --isolatedDeclarations."),
7561
7629
  JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
7562
7630
  JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, 1 /* Error */, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."),
7563
7631
  Expected_corresponding_JSX_closing_tag_for_0: diag(17002, 1 /* Error */, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."),
@@ -8030,6 +8098,26 @@ var textToToken = new Map(Object.entries({
8030
8098
  "#": 63 /* HashToken */,
8031
8099
  "`": 62 /* BacktickToken */
8032
8100
  }));
8101
+ var charToRegExpFlag = new Map(Object.entries({
8102
+ d: 1 /* HasIndices */,
8103
+ g: 2 /* Global */,
8104
+ i: 4 /* IgnoreCase */,
8105
+ m: 8 /* Multiline */,
8106
+ s: 16 /* DotAll */,
8107
+ u: 32 /* Unicode */,
8108
+ v: 64 /* UnicodeSets */,
8109
+ y: 128 /* Sticky */
8110
+ }));
8111
+ var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
8112
+ [1 /* HasIndices */, 9 /* ES2022 */],
8113
+ [2 /* Global */, 0 /* ES3 */],
8114
+ [4 /* IgnoreCase */, 0 /* ES3 */],
8115
+ [8 /* Multiline */, 0 /* ES3 */],
8116
+ [16 /* DotAll */, 5 /* ES2018 */],
8117
+ [32 /* Unicode */, 2 /* ES2015 */],
8118
+ [64 /* UnicodeSets */, 99 /* ESNext */],
8119
+ [128 /* Sticky */, 2 /* ES2015 */]
8120
+ ]);
8033
8121
  var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6e3, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
8034
8122
  var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6e3, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
8035
8123
  var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3133, 3160, 3162, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6e3, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101];
@@ -8078,6 +8166,10 @@ function tokenToString(t) {
8078
8166
  function stringToToken(s) {
8079
8167
  return textToToken.get(s);
8080
8168
  }
8169
+ var regExpFlagChars = makeReverseMap(charToRegExpFlag);
8170
+ function characterToRegularExpressionFlag(c) {
8171
+ return charToRegExpFlag.get(c);
8172
+ }
8081
8173
  function computeLineStarts(text) {
8082
8174
  const result = [];
8083
8175
  let pos = 0;
@@ -8174,8 +8266,11 @@ function isDigit(ch) {
8174
8266
  function isHexDigit(ch) {
8175
8267
  return isDigit(ch) || ch >= 65 /* A */ && ch <= 70 /* F */ || ch >= 97 /* a */ && ch <= 102 /* f */;
8176
8268
  }
8177
- function isCodePoint(code) {
8178
- return code <= 1114111;
8269
+ function isASCIILetter(ch) {
8270
+ return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */;
8271
+ }
8272
+ function isWordCharacter(ch) {
8273
+ return isASCIILetter(ch) || isDigit(ch) || ch === 95 /* _ */;
8179
8274
  }
8180
8275
  function isOctalDigit(ch) {
8181
8276
  return ch >= 48 /* _0 */ && ch <= 55 /* _7 */;
@@ -8493,10 +8588,10 @@ function getShebang(text) {
8493
8588
  }
8494
8589
  }
8495
8590
  function isIdentifierStart(ch, languageVersion) {
8496
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
8591
+ return isASCIILetter(ch) || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
8497
8592
  }
8498
8593
  function isIdentifierPart(ch, languageVersion, identifierVariant) {
8499
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || // "-" and ":" are valid in JSX Identifiers
8594
+ return isWordCharacter(ch) || ch === 36 /* $ */ || // "-" and ":" are valid in JSX Identifiers
8500
8595
  (identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
8501
8596
  }
8502
8597
  function isIdentifierText(name, languageVersion, identifierVariant) {
@@ -8817,7 +8912,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8817
8912
  result += text.substring(start2, pos);
8818
8913
  result += scanEscapeSequence(
8819
8914
  /*shouldEmitInvalidEscapeError*/
8820
- true
8915
+ true,
8916
+ /*isRegularExpression*/
8917
+ false
8821
8918
  );
8822
8919
  start2 = pos;
8823
8920
  continue;
@@ -8861,7 +8958,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8861
8958
  }
8862
8959
  if (currChar === 92 /* backslash */) {
8863
8960
  contents += text.substring(start2, pos);
8864
- contents += scanEscapeSequence(shouldEmitInvalidEscapeError);
8961
+ contents += scanEscapeSequence(
8962
+ shouldEmitInvalidEscapeError,
8963
+ /*isRegularExpression*/
8964
+ false
8965
+ );
8865
8966
  start2 = pos;
8866
8967
  continue;
8867
8968
  }
@@ -8881,7 +8982,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8881
8982
  tokenValue = contents;
8882
8983
  return resultingToken;
8883
8984
  }
8884
- function scanEscapeSequence(shouldEmitInvalidEscapeError) {
8985
+ function scanEscapeSequence(shouldEmitInvalidEscapeError, isRegularExpression) {
8885
8986
  const start2 = pos;
8886
8987
  pos++;
8887
8988
  if (pos >= end) {
@@ -8909,7 +9010,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8909
9010
  pos++;
8910
9011
  }
8911
9012
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8912
- if (shouldEmitInvalidEscapeError) {
9013
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8913
9014
  const code = parseInt(text.substring(start2 + 1, pos), 8);
8914
9015
  error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
8915
9016
  return String.fromCharCode(code);
@@ -8918,7 +9019,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8918
9019
  case 56 /* _8 */:
8919
9020
  case 57 /* _9 */:
8920
9021
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8921
- if (shouldEmitInvalidEscapeError) {
9022
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8922
9023
  error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8923
9024
  return String.fromCharCode(ch);
8924
9025
  }
@@ -8940,62 +9041,42 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8940
9041
  case 34 /* doubleQuote */:
8941
9042
  return '"';
8942
9043
  case 117 /* u */:
8943
- if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
8944
- pos++;
8945
- const escapedValueString = scanMinimumNumberOfHexDigits(
8946
- 1,
8947
- /*canHaveSeparators*/
8948
- false
8949
- );
8950
- const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8951
- if (escapedValue < 0) {
8952
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8953
- if (shouldEmitInvalidEscapeError) {
8954
- error(Diagnostics.Hexadecimal_digit_expected);
8955
- }
8956
- return text.substring(start2, pos);
8957
- }
8958
- if (!isCodePoint(escapedValue)) {
8959
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8960
- if (shouldEmitInvalidEscapeError) {
8961
- error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
8962
- }
8963
- return text.substring(start2, pos);
8964
- }
8965
- if (pos >= end) {
8966
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8967
- if (shouldEmitInvalidEscapeError) {
8968
- error(Diagnostics.Unexpected_end_of_text);
8969
- }
8970
- return text.substring(start2, pos);
8971
- }
8972
- if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
8973
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8974
- if (shouldEmitInvalidEscapeError) {
8975
- error(Diagnostics.Unterminated_Unicode_escape_sequence);
8976
- }
8977
- return text.substring(start2, pos);
8978
- }
8979
- pos++;
8980
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
8981
- return utf16EncodeAsString(escapedValue);
9044
+ if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
9045
+ pos -= 2;
9046
+ return scanExtendedUnicodeEscape(isRegularExpression || shouldEmitInvalidEscapeError);
8982
9047
  }
8983
9048
  for (; pos < start2 + 6; pos++) {
8984
9049
  if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8985
9050
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8986
- if (shouldEmitInvalidEscapeError) {
9051
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8987
9052
  error(Diagnostics.Hexadecimal_digit_expected);
8988
9053
  }
8989
9054
  return text.substring(start2, pos);
8990
9055
  }
8991
9056
  }
8992
9057
  tokenFlags |= 1024 /* UnicodeEscape */;
8993
- return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
9058
+ const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
9059
+ const escapedValueString = String.fromCharCode(escapedValue);
9060
+ if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && text.charCodeAt(pos + 2) !== 123 /* openBrace */) {
9061
+ const nextStart = pos;
9062
+ let nextPos = pos + 2;
9063
+ for (; nextPos < nextStart + 6; nextPos++) {
9064
+ if (!isHexDigit(text.charCodeAt(pos))) {
9065
+ return escapedValueString;
9066
+ }
9067
+ }
9068
+ const nextEscapedValue = parseInt(text.substring(nextStart + 2, nextPos), 16);
9069
+ if (nextEscapedValue >= 56320 && nextEscapedValue <= 57343) {
9070
+ pos = nextPos;
9071
+ return escapedValueString + String.fromCharCode(nextEscapedValue);
9072
+ }
9073
+ }
9074
+ return escapedValueString;
8994
9075
  case 120 /* x */:
8995
9076
  for (; pos < start2 + 4; pos++) {
8996
9077
  if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8997
9078
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8998
- if (shouldEmitInvalidEscapeError) {
9079
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8999
9080
  error(Diagnostics.Hexadecimal_digit_expected);
9000
9081
  }
9001
9082
  return text.substring(start2, pos);
@@ -9012,10 +9093,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9012
9093
  case 8233 /* paragraphSeparator */:
9013
9094
  return "";
9014
9095
  default:
9096
+ if (isRegularExpression && (shouldEmitInvalidEscapeError || isIdentifierPart(ch, languageVersion))) {
9097
+ error(Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, pos - 2, 2);
9098
+ }
9015
9099
  return String.fromCharCode(ch);
9016
9100
  }
9017
9101
  }
9018
- function scanExtendedUnicodeEscape() {
9102
+ function scanExtendedUnicodeEscape(shouldEmitInvalidEscapeError) {
9103
+ const start2 = pos;
9104
+ pos += 3;
9105
+ const escapedStart = pos;
9019
9106
  const escapedValueString = scanMinimumNumberOfHexDigits(
9020
9107
  1,
9021
9108
  /*canHaveSeparators*/
@@ -9024,24 +9111,34 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9024
9111
  const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
9025
9112
  let isInvalidExtendedEscape = false;
9026
9113
  if (escapedValue < 0) {
9027
- error(Diagnostics.Hexadecimal_digit_expected);
9114
+ if (shouldEmitInvalidEscapeError) {
9115
+ error(Diagnostics.Hexadecimal_digit_expected);
9116
+ }
9028
9117
  isInvalidExtendedEscape = true;
9029
9118
  } else if (escapedValue > 1114111) {
9030
- error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
9119
+ if (shouldEmitInvalidEscapeError) {
9120
+ error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive, escapedStart, pos - escapedStart);
9121
+ }
9031
9122
  isInvalidExtendedEscape = true;
9032
9123
  }
9033
9124
  if (pos >= end) {
9034
- error(Diagnostics.Unexpected_end_of_text);
9125
+ if (shouldEmitInvalidEscapeError) {
9126
+ error(Diagnostics.Unexpected_end_of_text);
9127
+ }
9035
9128
  isInvalidExtendedEscape = true;
9036
9129
  } else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
9037
9130
  pos++;
9038
9131
  } else {
9039
- error(Diagnostics.Unterminated_Unicode_escape_sequence);
9132
+ if (shouldEmitInvalidEscapeError) {
9133
+ error(Diagnostics.Unterminated_Unicode_escape_sequence);
9134
+ }
9040
9135
  isInvalidExtendedEscape = true;
9041
9136
  }
9042
9137
  if (isInvalidExtendedEscape) {
9043
- return "";
9138
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
9139
+ return text.substring(start2, pos);
9044
9140
  }
9141
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9045
9142
  return utf16EncodeAsString(escapedValue);
9046
9143
  }
9047
9144
  function peekUnicodeEscape() {
@@ -9083,9 +9180,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9083
9180
  } else if (ch === 92 /* backslash */) {
9084
9181
  ch = peekExtendedUnicodeEscape();
9085
9182
  if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
9086
- pos += 3;
9087
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9088
- result += scanExtendedUnicodeEscape();
9183
+ result += scanExtendedUnicodeEscape(
9184
+ /*shouldEmitInvalidEscapeError*/
9185
+ true
9186
+ );
9089
9187
  start2 = pos;
9090
9188
  continue;
9091
9189
  }
@@ -9550,9 +9648,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9550
9648
  case 92 /* backslash */:
9551
9649
  const extendedCookedChar = peekExtendedUnicodeEscape();
9552
9650
  if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
9553
- pos += 3;
9554
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9555
- tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
9651
+ tokenValue = scanExtendedUnicodeEscape(
9652
+ /*shouldEmitInvalidEscapeError*/
9653
+ true
9654
+ ) + scanIdentifierParts();
9556
9655
  return token = getIdentifierToken();
9557
9656
  }
9558
9657
  const cookedChar = peekUnicodeEscape();
@@ -9567,7 +9666,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9567
9666
  return token = 0 /* Unknown */;
9568
9667
  case 35 /* hash */:
9569
9668
  if (pos !== 0 && text[pos + 1] === "!") {
9570
- error(Diagnostics.can_only_be_used_at_the_start_of_a_file);
9669
+ error(Diagnostics.can_only_be_used_at_the_start_of_a_file, pos, 2);
9571
9670
  pos++;
9572
9671
  return token = 0 /* Unknown */;
9573
9672
  }
@@ -9576,9 +9675,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9576
9675
  pos++;
9577
9676
  const extendedCookedChar2 = peekExtendedUnicodeEscape();
9578
9677
  if (extendedCookedChar2 >= 0 && isIdentifierStart(extendedCookedChar2, languageVersion)) {
9579
- pos += 3;
9580
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9581
- tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
9678
+ tokenValue = "#" + scanExtendedUnicodeEscape(
9679
+ /*shouldEmitInvalidEscapeError*/
9680
+ true
9681
+ ) + scanIdentifierParts();
9582
9682
  return token = 81 /* PrivateIdentifier */;
9583
9683
  }
9584
9684
  const cookedChar2 = peekUnicodeEscape();
@@ -9719,14 +9819,841 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9719
9819
  }
9720
9820
  p++;
9721
9821
  }
9722
- while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {
9822
+ const isUnterminated = !!(tokenFlags & 4 /* Unterminated */);
9823
+ const endOfBody = p - (isUnterminated ? 0 : 1);
9824
+ let regExpFlags = 0 /* None */;
9825
+ while (p < end) {
9826
+ const ch = text.charCodeAt(p);
9827
+ if (!isIdentifierPart(ch, languageVersion)) {
9828
+ break;
9829
+ }
9830
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
9831
+ if (flag === void 0) {
9832
+ error(Diagnostics.Unknown_regular_expression_flag, p, 1);
9833
+ } else if (regExpFlags & flag) {
9834
+ error(Diagnostics.Duplicate_regular_expression_flag, p, 1);
9835
+ } else if (((regExpFlags | flag) & 96 /* UnicodeMode */) === 96 /* UnicodeMode */) {
9836
+ error(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, p, 1);
9837
+ } else {
9838
+ regExpFlags |= flag;
9839
+ const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
9840
+ if (languageVersion < availableFrom) {
9841
+ error(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, p, 1, getNameOfScriptTarget(availableFrom));
9842
+ }
9843
+ }
9723
9844
  p++;
9724
9845
  }
9725
- pos = p;
9846
+ pos = tokenStart + 1;
9847
+ const saveTokenPos = tokenStart;
9848
+ const saveTokenFlags = tokenFlags;
9849
+ scanRegularExpressionWorker(text, endOfBody, regExpFlags, isUnterminated);
9850
+ if (!isUnterminated) {
9851
+ pos = p;
9852
+ }
9853
+ tokenStart = saveTokenPos;
9854
+ tokenFlags = saveTokenFlags;
9726
9855
  tokenValue = text.substring(tokenStart, pos);
9727
9856
  token = 14 /* RegularExpressionLiteral */;
9728
9857
  }
9729
9858
  return token;
9859
+ function scanRegularExpressionWorker(text2, end2, regExpFlags, isUnterminated) {
9860
+ const unicodeMode = !!(regExpFlags & 96 /* UnicodeMode */);
9861
+ const unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
9862
+ let mayContainStrings = false;
9863
+ let numberOfCapturingGroups = 0;
9864
+ const groupSpecifiers = /* @__PURE__ */ new Set();
9865
+ const groupNameReferences = [];
9866
+ const decimalEscapes = [];
9867
+ const namedCapturingGroups = [];
9868
+ function scanDisjunction(isInGroup) {
9869
+ while (true) {
9870
+ namedCapturingGroups.push(/* @__PURE__ */ new Set());
9871
+ scanAlternative(isInGroup);
9872
+ namedCapturingGroups.pop();
9873
+ if (text2.charCodeAt(pos) !== 124 /* bar */) {
9874
+ return;
9875
+ }
9876
+ pos++;
9877
+ }
9878
+ }
9879
+ function scanAlternative(isInGroup) {
9880
+ let isPreviousTermQuantifiable = false;
9881
+ while (pos < end2) {
9882
+ const start2 = pos;
9883
+ const ch = text2.charCodeAt(pos);
9884
+ switch (ch) {
9885
+ case 94 /* caret */:
9886
+ case 36 /* $ */:
9887
+ pos++;
9888
+ isPreviousTermQuantifiable = false;
9889
+ break;
9890
+ case 92 /* backslash */:
9891
+ pos++;
9892
+ switch (text2.charCodeAt(pos)) {
9893
+ case 98 /* b */:
9894
+ case 66 /* B */:
9895
+ pos++;
9896
+ isPreviousTermQuantifiable = false;
9897
+ break;
9898
+ default:
9899
+ scanAtomEscape();
9900
+ isPreviousTermQuantifiable = true;
9901
+ break;
9902
+ }
9903
+ break;
9904
+ case 40 /* openParen */:
9905
+ pos++;
9906
+ if (text2.charCodeAt(pos) === 63 /* question */) {
9907
+ pos++;
9908
+ switch (text2.charCodeAt(pos)) {
9909
+ case 61 /* equals */:
9910
+ case 33 /* exclamation */:
9911
+ pos++;
9912
+ isPreviousTermQuantifiable = false;
9913
+ break;
9914
+ case 60 /* lessThan */:
9915
+ const groupNameStart = pos;
9916
+ pos++;
9917
+ switch (text2.charCodeAt(pos)) {
9918
+ case 61 /* equals */:
9919
+ case 33 /* exclamation */:
9920
+ pos++;
9921
+ isPreviousTermQuantifiable = false;
9922
+ break;
9923
+ default:
9924
+ scanGroupName(
9925
+ /*isReference*/
9926
+ false
9927
+ );
9928
+ scanExpectedChar(62 /* greaterThan */);
9929
+ if (languageVersion < 5 /* ES2018 */) {
9930
+ error(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
9931
+ }
9932
+ numberOfCapturingGroups++;
9933
+ isPreviousTermQuantifiable = true;
9934
+ break;
9935
+ }
9936
+ break;
9937
+ default:
9938
+ const start3 = pos;
9939
+ const setFlags = scanPatternModifiers(0 /* None */);
9940
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
9941
+ pos++;
9942
+ scanPatternModifiers(setFlags);
9943
+ if (pos === start3 + 1) {
9944
+ error(Diagnostics.Subpattern_flags_must_be_present_when_there_is_a_minus_sign, start3, pos - start3);
9945
+ }
9946
+ }
9947
+ scanExpectedChar(58 /* colon */);
9948
+ isPreviousTermQuantifiable = true;
9949
+ break;
9950
+ }
9951
+ } else {
9952
+ numberOfCapturingGroups++;
9953
+ isPreviousTermQuantifiable = true;
9954
+ }
9955
+ scanDisjunction(
9956
+ /*isInGroup*/
9957
+ true
9958
+ );
9959
+ scanExpectedChar(41 /* closeParen */);
9960
+ break;
9961
+ case 123 /* openBrace */:
9962
+ pos++;
9963
+ const digitsStart = pos;
9964
+ scanDigits();
9965
+ const min2 = tokenValue;
9966
+ if (text2.charCodeAt(pos) === 44 /* comma */) {
9967
+ pos++;
9968
+ scanDigits();
9969
+ const max = tokenValue;
9970
+ if (!min2) {
9971
+ if (max || text2.charCodeAt(pos) === 125 /* closeBrace */) {
9972
+ error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
9973
+ } else {
9974
+ if (unicodeMode) {
9975
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9976
+ }
9977
+ isPreviousTermQuantifiable = true;
9978
+ break;
9979
+ }
9980
+ }
9981
+ if (max && Number.parseInt(min2) > Number.parseInt(max)) {
9982
+ error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
9983
+ }
9984
+ } else if (!min2) {
9985
+ if (unicodeMode) {
9986
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9987
+ }
9988
+ isPreviousTermQuantifiable = true;
9989
+ break;
9990
+ }
9991
+ scanExpectedChar(125 /* closeBrace */);
9992
+ pos--;
9993
+ case 42 /* asterisk */:
9994
+ case 43 /* plus */:
9995
+ case 63 /* question */:
9996
+ pos++;
9997
+ if (text2.charCodeAt(pos) === 63 /* question */) {
9998
+ pos++;
9999
+ }
10000
+ if (!isPreviousTermQuantifiable) {
10001
+ error(Diagnostics.There_is_nothing_available_for_repetition, start2, pos - start2);
10002
+ }
10003
+ isPreviousTermQuantifiable = false;
10004
+ break;
10005
+ case 46 /* dot */:
10006
+ pos++;
10007
+ isPreviousTermQuantifiable = true;
10008
+ break;
10009
+ case 91 /* openBracket */:
10010
+ pos++;
10011
+ if (unicodeSetsMode) {
10012
+ scanClassSetExpression();
10013
+ } else {
10014
+ scanClassRanges();
10015
+ }
10016
+ scanExpectedChar(93 /* closeBracket */);
10017
+ isPreviousTermQuantifiable = true;
10018
+ break;
10019
+ case 41 /* closeParen */:
10020
+ if (isInGroup) {
10021
+ return;
10022
+ }
10023
+ case 93 /* closeBracket */:
10024
+ case 125 /* closeBrace */:
10025
+ if (isUnterminated && !isInGroup) {
10026
+ return;
10027
+ }
10028
+ if (unicodeMode || ch === 41 /* closeParen */) {
10029
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10030
+ }
10031
+ pos++;
10032
+ isPreviousTermQuantifiable = true;
10033
+ break;
10034
+ case 47 /* slash */:
10035
+ case 124 /* bar */:
10036
+ return;
10037
+ default:
10038
+ scanSourceCharacter();
10039
+ isPreviousTermQuantifiable = true;
10040
+ break;
10041
+ }
10042
+ }
10043
+ }
10044
+ function scanPatternModifiers(currFlags) {
10045
+ while (pos < end2) {
10046
+ const ch = text2.charCodeAt(pos);
10047
+ if (!isIdentifierPart(ch, languageVersion)) {
10048
+ break;
10049
+ }
10050
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
10051
+ if (flag === void 0) {
10052
+ error(Diagnostics.Unknown_regular_expression_flag, pos, 1);
10053
+ } else if (currFlags & flag) {
10054
+ error(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
10055
+ } else if (!(flag & 28 /* Modifiers */)) {
10056
+ error(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
10057
+ } else {
10058
+ currFlags |= flag;
10059
+ const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
10060
+ if (languageVersion < availableFrom) {
10061
+ error(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, 1, getNameOfScriptTarget(availableFrom));
10062
+ }
10063
+ }
10064
+ pos++;
10065
+ }
10066
+ return currFlags;
10067
+ }
10068
+ function scanAtomEscape() {
10069
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
10070
+ switch (text2.charCodeAt(pos)) {
10071
+ case 107 /* k */:
10072
+ pos++;
10073
+ if (text2.charCodeAt(pos) === 60 /* lessThan */) {
10074
+ pos++;
10075
+ scanGroupName(
10076
+ /*isReference*/
10077
+ true
10078
+ );
10079
+ scanExpectedChar(62 /* greaterThan */);
10080
+ } else if (unicodeMode) {
10081
+ error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
10082
+ }
10083
+ break;
10084
+ case 113 /* q */:
10085
+ if (unicodeSetsMode) {
10086
+ pos++;
10087
+ error(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
10088
+ break;
10089
+ }
10090
+ default:
10091
+ Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape());
10092
+ break;
10093
+ }
10094
+ }
10095
+ function scanDecimalEscape() {
10096
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
10097
+ const ch = text2.charCodeAt(pos);
10098
+ if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
10099
+ const start2 = pos;
10100
+ scanDigits();
10101
+ decimalEscapes.push({ pos: start2, end: pos, value: +tokenValue });
10102
+ return true;
10103
+ }
10104
+ return false;
10105
+ }
10106
+ function scanCharacterEscape() {
10107
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
10108
+ let ch = text2.charCodeAt(pos);
10109
+ switch (ch) {
10110
+ case 99 /* c */:
10111
+ pos++;
10112
+ ch = text2.charCodeAt(pos);
10113
+ if (isASCIILetter(ch)) {
10114
+ pos++;
10115
+ return String.fromCharCode(ch & 31);
10116
+ }
10117
+ if (unicodeMode) {
10118
+ error(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
10119
+ }
10120
+ return String.fromCharCode(ch);
10121
+ case 94 /* caret */:
10122
+ case 36 /* $ */:
10123
+ case 47 /* slash */:
10124
+ case 92 /* backslash */:
10125
+ case 46 /* dot */:
10126
+ case 42 /* asterisk */:
10127
+ case 43 /* plus */:
10128
+ case 63 /* question */:
10129
+ case 40 /* openParen */:
10130
+ case 41 /* closeParen */:
10131
+ case 91 /* openBracket */:
10132
+ case 93 /* closeBracket */:
10133
+ case 123 /* openBrace */:
10134
+ case 125 /* closeBrace */:
10135
+ case 124 /* bar */:
10136
+ pos++;
10137
+ return String.fromCharCode(ch);
10138
+ default:
10139
+ if (pos >= end2) {
10140
+ error(Diagnostics.Undetermined_character_escape, pos - 1, 1, ch);
10141
+ return "\\";
10142
+ }
10143
+ pos--;
10144
+ return scanEscapeSequence(
10145
+ /*shouldEmitInvalidEscapeError*/
10146
+ unicodeMode,
10147
+ /*isRegularExpression*/
10148
+ true
10149
+ );
10150
+ }
10151
+ }
10152
+ function scanGroupName(isReference) {
10153
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 60 /* lessThan */);
10154
+ tokenStart = pos;
10155
+ scanIdentifier(codePointAt(text2, pos), languageVersion);
10156
+ if (pos === tokenStart) {
10157
+ error(Diagnostics.Expected_a_capturing_group_name);
10158
+ } else if (isReference) {
10159
+ groupNameReferences.push({ pos: tokenStart, end: pos, name: tokenValue });
10160
+ } else if (namedCapturingGroups.some((group2) => group2.has(tokenValue))) {
10161
+ error(Diagnostics.Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other, tokenStart, pos - tokenStart);
10162
+ } else {
10163
+ last(namedCapturingGroups).add(tokenValue);
10164
+ groupSpecifiers.add(tokenValue);
10165
+ }
10166
+ }
10167
+ function isClassContentExit(ch) {
10168
+ return ch === 93 /* closeBracket */ || pos >= end2;
10169
+ }
10170
+ function scanClassRanges() {
10171
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
10172
+ if (text2.charCodeAt(pos) === 94 /* caret */) {
10173
+ pos++;
10174
+ }
10175
+ while (pos < end2) {
10176
+ const ch = text2.charCodeAt(pos);
10177
+ if (isClassContentExit(ch)) {
10178
+ return;
10179
+ }
10180
+ const minStart = pos;
10181
+ const minCharacter = scanClassAtom();
10182
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
10183
+ pos++;
10184
+ const ch2 = text2.charCodeAt(pos);
10185
+ if (isClassContentExit(ch2)) {
10186
+ return;
10187
+ }
10188
+ if (!minCharacter) {
10189
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
10190
+ }
10191
+ const maxStart = pos;
10192
+ const maxCharacter = scanClassAtom();
10193
+ if (!maxCharacter) {
10194
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
10195
+ continue;
10196
+ }
10197
+ if (!minCharacter) {
10198
+ continue;
10199
+ }
10200
+ const minCharacterValue = codePointAt(minCharacter, 0);
10201
+ const maxCharacterValue = codePointAt(maxCharacter, 0);
10202
+ if (minCharacter.length === charSize(minCharacterValue) && maxCharacter.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
10203
+ error(Diagnostics.Range_out_of_order_in_character_class, minStart, pos - minStart);
10204
+ }
10205
+ }
10206
+ }
10207
+ }
10208
+ function scanClassSetExpression() {
10209
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
10210
+ let isCharacterComplement = false;
10211
+ if (text2.charCodeAt(pos) === 94 /* caret */) {
10212
+ pos++;
10213
+ isCharacterComplement = true;
10214
+ }
10215
+ let expressionMayContainStrings = false;
10216
+ let ch = text2.charCodeAt(pos);
10217
+ if (isClassContentExit(ch)) {
10218
+ return;
10219
+ }
10220
+ let start2 = pos;
10221
+ let oprand;
10222
+ switch (text2.slice(pos, pos + 2)) {
10223
+ case "--":
10224
+ case "&&":
10225
+ error(Diagnostics.Expected_a_class_set_oprand);
10226
+ mayContainStrings = false;
10227
+ break;
10228
+ default:
10229
+ oprand = scanClassSetOprand();
10230
+ break;
10231
+ }
10232
+ switch (text2.charCodeAt(pos)) {
10233
+ case 45 /* minus */:
10234
+ if (text2.charCodeAt(pos + 1) === 45 /* minus */) {
10235
+ if (isCharacterComplement && mayContainStrings) {
10236
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
10237
+ }
10238
+ expressionMayContainStrings = mayContainStrings;
10239
+ scanClassSetSubExpression(3 /* ClassSubtraction */);
10240
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10241
+ return;
10242
+ }
10243
+ break;
10244
+ case 38 /* ampersand */:
10245
+ if (text2.charCodeAt(pos + 1) === 38 /* ampersand */) {
10246
+ scanClassSetSubExpression(2 /* ClassIntersection */);
10247
+ if (isCharacterComplement && mayContainStrings) {
10248
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
10249
+ }
10250
+ expressionMayContainStrings = mayContainStrings;
10251
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10252
+ return;
10253
+ } else {
10254
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10255
+ }
10256
+ break;
10257
+ default:
10258
+ if (isCharacterComplement && mayContainStrings) {
10259
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
10260
+ }
10261
+ expressionMayContainStrings = mayContainStrings;
10262
+ break;
10263
+ }
10264
+ while (pos < end2) {
10265
+ ch = text2.charCodeAt(pos);
10266
+ switch (ch) {
10267
+ case 45 /* minus */:
10268
+ pos++;
10269
+ ch = text2.charCodeAt(pos);
10270
+ if (isClassContentExit(ch)) {
10271
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10272
+ return;
10273
+ }
10274
+ if (ch === 45 /* minus */) {
10275
+ pos++;
10276
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10277
+ start2 = pos - 2;
10278
+ oprand = text2.slice(start2, pos);
10279
+ continue;
10280
+ } else {
10281
+ if (!oprand) {
10282
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start2, pos - 1 - start2);
10283
+ }
10284
+ const secondStart = pos;
10285
+ const secondOprand = scanClassSetOprand();
10286
+ if (isCharacterComplement && mayContainStrings) {
10287
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
10288
+ }
10289
+ expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
10290
+ if (!secondOprand) {
10291
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
10292
+ break;
10293
+ }
10294
+ if (!oprand) {
10295
+ break;
10296
+ }
10297
+ const minCharacterValue = codePointAt(oprand, 0);
10298
+ const maxCharacterValue = codePointAt(secondOprand, 0);
10299
+ if (oprand.length === charSize(minCharacterValue) && secondOprand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
10300
+ error(Diagnostics.Range_out_of_order_in_character_class, start2, pos - start2);
10301
+ }
10302
+ }
10303
+ break;
10304
+ case 38 /* ampersand */:
10305
+ start2 = pos;
10306
+ pos++;
10307
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10308
+ pos++;
10309
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10310
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10311
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10312
+ pos++;
10313
+ }
10314
+ } else {
10315
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
10316
+ }
10317
+ oprand = text2.slice(start2, pos);
10318
+ continue;
10319
+ }
10320
+ if (isClassContentExit(text2.charCodeAt(pos))) {
10321
+ break;
10322
+ }
10323
+ start2 = pos;
10324
+ switch (text2.slice(pos, pos + 2)) {
10325
+ case "--":
10326
+ case "&&":
10327
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
10328
+ pos += 2;
10329
+ oprand = text2.slice(start2, pos);
10330
+ break;
10331
+ default:
10332
+ oprand = scanClassSetOprand();
10333
+ break;
10334
+ }
10335
+ }
10336
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10337
+ }
10338
+ function scanClassSetSubExpression(expressionType) {
10339
+ let expressionMayContainStrings = mayContainStrings;
10340
+ while (pos < end2) {
10341
+ let ch = text2.charCodeAt(pos);
10342
+ if (isClassContentExit(ch)) {
10343
+ break;
10344
+ }
10345
+ switch (ch) {
10346
+ case 45 /* minus */:
10347
+ pos++;
10348
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
10349
+ pos++;
10350
+ if (expressionType !== 3 /* ClassSubtraction */) {
10351
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10352
+ }
10353
+ } else {
10354
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 1, 1);
10355
+ }
10356
+ break;
10357
+ case 38 /* ampersand */:
10358
+ pos++;
10359
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10360
+ pos++;
10361
+ if (expressionType !== 2 /* ClassIntersection */) {
10362
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10363
+ }
10364
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10365
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10366
+ pos++;
10367
+ }
10368
+ } else {
10369
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
10370
+ }
10371
+ break;
10372
+ default:
10373
+ switch (expressionType) {
10374
+ case 3 /* ClassSubtraction */:
10375
+ error(Diagnostics._0_expected, pos, 0, "--");
10376
+ break;
10377
+ case 2 /* ClassIntersection */:
10378
+ error(Diagnostics._0_expected, pos, 0, "&&");
10379
+ break;
10380
+ default:
10381
+ break;
10382
+ }
10383
+ break;
10384
+ }
10385
+ ch = text2.charCodeAt(pos);
10386
+ if (isClassContentExit(ch)) {
10387
+ error(Diagnostics.Expected_a_class_set_oprand);
10388
+ break;
10389
+ }
10390
+ scanClassSetOprand();
10391
+ expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
10392
+ }
10393
+ mayContainStrings = expressionMayContainStrings;
10394
+ }
10395
+ function scanClassSetOprand() {
10396
+ mayContainStrings = false;
10397
+ switch (text2.charCodeAt(pos)) {
10398
+ case 91 /* openBracket */:
10399
+ pos++;
10400
+ scanClassSetExpression();
10401
+ scanExpectedChar(93 /* closeBracket */);
10402
+ return "";
10403
+ case 92 /* backslash */:
10404
+ pos++;
10405
+ if (scanCharacterClassEscape()) {
10406
+ return "";
10407
+ } else if (text2.charCodeAt(pos) === 113 /* q */) {
10408
+ pos++;
10409
+ if (text2.charCodeAt(pos) === 123 /* openBrace */) {
10410
+ pos++;
10411
+ scanClassStringDisjunctionContents();
10412
+ scanExpectedChar(125 /* closeBrace */);
10413
+ return "";
10414
+ } else {
10415
+ error(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
10416
+ return "q";
10417
+ }
10418
+ }
10419
+ pos--;
10420
+ default:
10421
+ return scanClassSetCharacter();
10422
+ }
10423
+ }
10424
+ function scanClassStringDisjunctionContents() {
10425
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 123 /* openBrace */);
10426
+ let characterCount = 0;
10427
+ while (pos < end2) {
10428
+ const ch = text2.charCodeAt(pos);
10429
+ switch (ch) {
10430
+ case 125 /* closeBrace */:
10431
+ if (characterCount !== 1) {
10432
+ mayContainStrings = true;
10433
+ }
10434
+ return;
10435
+ case 124 /* bar */:
10436
+ if (characterCount !== 1) {
10437
+ mayContainStrings = true;
10438
+ }
10439
+ pos++;
10440
+ start = pos;
10441
+ characterCount = 0;
10442
+ break;
10443
+ default:
10444
+ scanClassSetCharacter();
10445
+ characterCount++;
10446
+ break;
10447
+ }
10448
+ }
10449
+ }
10450
+ function scanClassSetCharacter() {
10451
+ const ch = text2.charCodeAt(pos);
10452
+ if (ch === 92 /* backslash */) {
10453
+ pos++;
10454
+ const ch2 = text2.charCodeAt(pos);
10455
+ switch (ch2) {
10456
+ case 98 /* b */:
10457
+ pos++;
10458
+ return "\b";
10459
+ case 38 /* ampersand */:
10460
+ case 45 /* minus */:
10461
+ case 33 /* exclamation */:
10462
+ case 35 /* hash */:
10463
+ case 37 /* percent */:
10464
+ case 44 /* comma */:
10465
+ case 58 /* colon */:
10466
+ case 59 /* semicolon */:
10467
+ case 60 /* lessThan */:
10468
+ case 61 /* equals */:
10469
+ case 62 /* greaterThan */:
10470
+ case 64 /* at */:
10471
+ case 96 /* backtick */:
10472
+ case 126 /* tilde */:
10473
+ pos++;
10474
+ return String.fromCharCode(ch2);
10475
+ default:
10476
+ return scanCharacterEscape();
10477
+ }
10478
+ } else if (ch === text2.charCodeAt(pos + 1)) {
10479
+ switch (ch) {
10480
+ case 38 /* ampersand */:
10481
+ case 33 /* exclamation */:
10482
+ case 35 /* hash */:
10483
+ case 37 /* percent */:
10484
+ case 42 /* asterisk */:
10485
+ case 43 /* plus */:
10486
+ case 44 /* comma */:
10487
+ case 46 /* dot */:
10488
+ case 58 /* colon */:
10489
+ case 59 /* semicolon */:
10490
+ case 60 /* lessThan */:
10491
+ case 61 /* equals */:
10492
+ case 62 /* greaterThan */:
10493
+ case 63 /* question */:
10494
+ case 64 /* at */:
10495
+ case 96 /* backtick */:
10496
+ case 126 /* tilde */:
10497
+ error(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
10498
+ pos += 2;
10499
+ return text2.substring(pos - 2, pos);
10500
+ }
10501
+ }
10502
+ switch (ch) {
10503
+ case 47 /* slash */:
10504
+ case 40 /* openParen */:
10505
+ case 41 /* closeParen */:
10506
+ case 91 /* openBracket */:
10507
+ case 93 /* closeBracket */:
10508
+ case 123 /* openBrace */:
10509
+ case 125 /* closeBrace */:
10510
+ case 45 /* minus */:
10511
+ case 124 /* bar */:
10512
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10513
+ pos++;
10514
+ return String.fromCharCode(ch);
10515
+ }
10516
+ return scanSourceCharacter();
10517
+ }
10518
+ function scanClassAtom() {
10519
+ if (text2.charCodeAt(pos) === 92 /* backslash */) {
10520
+ pos++;
10521
+ const ch = text2.charCodeAt(pos);
10522
+ switch (ch) {
10523
+ case 98 /* b */:
10524
+ pos++;
10525
+ return "\b";
10526
+ case 45 /* minus */:
10527
+ pos++;
10528
+ return String.fromCharCode(ch);
10529
+ default:
10530
+ if (scanCharacterClassEscape()) {
10531
+ return "";
10532
+ }
10533
+ return scanCharacterEscape();
10534
+ }
10535
+ } else {
10536
+ return scanSourceCharacter();
10537
+ }
10538
+ }
10539
+ function scanCharacterClassEscape() {
10540
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
10541
+ let isCharacterComplement = false;
10542
+ const start2 = pos - 1;
10543
+ const ch = text2.charCodeAt(pos);
10544
+ switch (ch) {
10545
+ case 100 /* d */:
10546
+ case 68 /* D */:
10547
+ case 115 /* s */:
10548
+ case 83 /* S */:
10549
+ case 119 /* w */:
10550
+ case 87 /* W */:
10551
+ pos++;
10552
+ return true;
10553
+ case 80 /* P */:
10554
+ isCharacterComplement = true;
10555
+ case 112 /* p */:
10556
+ pos++;
10557
+ if (text2.charCodeAt(pos) === 123 /* openBrace */) {
10558
+ pos++;
10559
+ const propertyNameOrValueStart = pos;
10560
+ const propertyNameOrValue = scanWordCharacters();
10561
+ if (text2.charCodeAt(pos) === 61 /* equals */) {
10562
+ const propertyName = nonBinaryUnicodeProperties.get(propertyNameOrValue);
10563
+ if (pos === propertyNameOrValueStart) {
10564
+ error(Diagnostics.Expected_a_Unicode_property_name);
10565
+ } else if (propertyName === void 0) {
10566
+ error(Diagnostics.Unknown_Unicode_property_name, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10567
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, nonBinaryUnicodeProperties.keys(), identity);
10568
+ if (suggestion) {
10569
+ error(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
10570
+ }
10571
+ }
10572
+ pos++;
10573
+ const propertyValueStart = pos;
10574
+ const propertyValue = scanWordCharacters();
10575
+ if (pos === propertyValueStart) {
10576
+ error(Diagnostics.Expected_a_Unicode_property_value);
10577
+ } else if (propertyName !== void 0 && !valuesOfNonBinaryUnicodeProperties[propertyName].has(propertyValue)) {
10578
+ error(Diagnostics.Unknown_Unicode_property_value, propertyValueStart, pos - propertyValueStart);
10579
+ const suggestion = getSpellingSuggestion(propertyValue, valuesOfNonBinaryUnicodeProperties[propertyName], identity);
10580
+ if (suggestion) {
10581
+ error(Diagnostics.Did_you_mean_0, propertyValueStart, pos - propertyValueStart, suggestion);
10582
+ }
10583
+ }
10584
+ } else {
10585
+ if (pos === propertyNameOrValueStart) {
10586
+ error(Diagnostics.Expected_a_Unicode_property_name_or_value);
10587
+ } else if (binaryUnicodePropertiesOfStrings.has(propertyNameOrValue)) {
10588
+ if (!unicodeSetsMode) {
10589
+ error(Diagnostics.Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_the_Unicode_Sets_v_flag_is_set, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10590
+ } else if (isCharacterComplement) {
10591
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10592
+ } else {
10593
+ mayContainStrings = true;
10594
+ }
10595
+ } else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
10596
+ error(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10597
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
10598
+ if (suggestion) {
10599
+ error(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
10600
+ }
10601
+ }
10602
+ }
10603
+ scanExpectedChar(125 /* closeBrace */);
10604
+ if (!unicodeMode) {
10605
+ error(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
10606
+ }
10607
+ } else if (unicodeMode) {
10608
+ error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
10609
+ }
10610
+ return true;
10611
+ }
10612
+ return false;
10613
+ }
10614
+ function scanWordCharacters() {
10615
+ let value = "";
10616
+ while (pos < end2) {
10617
+ const ch = text2.charCodeAt(pos);
10618
+ if (!isWordCharacter(ch)) {
10619
+ break;
10620
+ }
10621
+ value += String.fromCharCode(ch);
10622
+ pos++;
10623
+ }
10624
+ return value;
10625
+ }
10626
+ function scanSourceCharacter() {
10627
+ const size = unicodeMode ? charSize(codePointAt(text2, pos)) : 1;
10628
+ pos += size;
10629
+ return text2.substring(pos - size, pos);
10630
+ }
10631
+ function scanExpectedChar(ch) {
10632
+ if (text2.charCodeAt(pos) === ch) {
10633
+ pos++;
10634
+ } else {
10635
+ error(Diagnostics._0_expected, pos, 0, String.fromCharCode(ch));
10636
+ }
10637
+ }
10638
+ scanDisjunction(
10639
+ /*isInGroup*/
10640
+ false
10641
+ );
10642
+ forEach(groupNameReferences, (reference) => {
10643
+ if (!groupSpecifiers.has(reference.name)) {
10644
+ error(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
10645
+ }
10646
+ });
10647
+ forEach(decimalEscapes, (escape) => {
10648
+ if (escape.value > numberOfCapturingGroups) {
10649
+ if (numberOfCapturingGroups) {
10650
+ error(Diagnostics.A_decimal_escape_must_refer_to_an_existent_capturing_group_There_are_only_0_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos, numberOfCapturingGroups);
10651
+ } else {
10652
+ error(Diagnostics.Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression, escape.pos, escape.end - escape.pos);
10653
+ }
10654
+ }
10655
+ });
10656
+ }
9730
10657
  }
9731
10658
  function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
9732
10659
  const type = getDirectiveFromComment(text2.trimStart(), commentDirectiveRegEx);
@@ -9953,9 +10880,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9953
10880
  pos--;
9954
10881
  const extendedCookedChar = peekExtendedUnicodeEscape();
9955
10882
  if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
9956
- pos += 3;
9957
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9958
- tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
10883
+ tokenValue = scanExtendedUnicodeEscape(
10884
+ /*shouldEmitInvalidEscapeError*/
10885
+ true
10886
+ ) + scanIdentifierParts();
9959
10887
  return token = getIdentifierToken();
9960
10888
  }
9961
10889
  const cookedChar = peekUnicodeEscape();
@@ -10095,6 +11023,22 @@ var utf16EncodeAsStringWorker = String.fromCodePoint ? (codePoint) => String.fro
10095
11023
  function utf16EncodeAsString(codePoint) {
10096
11024
  return utf16EncodeAsStringWorker(codePoint);
10097
11025
  }
11026
+ var nonBinaryUnicodeProperties = new Map(Object.entries({
11027
+ General_Category: "General_Category",
11028
+ gc: "General_Category",
11029
+ Script: "Script",
11030
+ sc: "Script",
11031
+ Script_Extensions: "Script_Extensions",
11032
+ scx: "Script_Extensions"
11033
+ }));
11034
+ var binaryUnicodeProperties = /* @__PURE__ */ new Set(["ASCII", "ASCII_Hex_Digit", "AHex", "Alphabetic", "Alpha", "Any", "Assigned", "Bidi_Control", "Bidi_C", "Bidi_Mirrored", "Bidi_M", "Case_Ignorable", "CI", "Cased", "Changes_When_Casefolded", "CWCF", "Changes_When_Casemapped", "CWCM", "Changes_When_Lowercased", "CWL", "Changes_When_NFKC_Casefolded", "CWKCF", "Changes_When_Titlecased", "CWT", "Changes_When_Uppercased", "CWU", "Dash", "Default_Ignorable_Code_Point", "DI", "Deprecated", "Dep", "Diacritic", "Dia", "Emoji", "Emoji_Component", "EComp", "Emoji_Modifier", "EMod", "Emoji_Modifier_Base", "EBase", "Emoji_Presentation", "EPres", "Extended_Pictographic", "ExtPict", "Extender", "Ext", "Grapheme_Base", "Gr_Base", "Grapheme_Extend", "Gr_Ext", "Hex_Digit", "Hex", "IDS_Binary_Operator", "IDSB", "IDS_Trinary_Operator", "IDST", "ID_Continue", "IDC", "ID_Start", "IDS", "Ideographic", "Ideo", "Join_Control", "Join_C", "Logical_Order_Exception", "LOE", "Lowercase", "Lower", "Math", "Noncharacter_Code_Point", "NChar", "Pattern_Syntax", "Pat_Syn", "Pattern_White_Space", "Pat_WS", "Quotation_Mark", "QMark", "Radical", "Regional_Indicator", "RI", "Sentence_Terminal", "STerm", "Soft_Dotted", "SD", "Terminal_Punctuation", "Term", "Unified_Ideograph", "UIdeo", "Uppercase", "Upper", "Variation_Selector", "VS", "White_Space", "space", "XID_Continue", "XIDC", "XID_Start", "XIDS"]);
11035
+ var binaryUnicodePropertiesOfStrings = /* @__PURE__ */ new Set(["Basic_Emoji", "Emoji_Keycap_Sequence", "RGI_Emoji_Modifier_Sequence", "RGI_Emoji_Flag_Sequence", "RGI_Emoji_Tag_Sequence", "RGI_Emoji_ZWJ_Sequence", "RGI_Emoji"]);
11036
+ var valuesOfNonBinaryUnicodeProperties = {
11037
+ General_Category: /* @__PURE__ */ new Set(["C", "Other", "Cc", "Control", "cntrl", "Cf", "Format", "Cn", "Unassigned", "Co", "Private_Use", "Cs", "Surrogate", "L", "Letter", "LC", "Cased_Letter", "Ll", "Lowercase_Letter", "Lm", "Modifier_Letter", "Lo", "Other_Letter", "Lt", "Titlecase_Letter", "Lu", "Uppercase_Letter", "M", "Mark", "Combining_Mark", "Mc", "Spacing_Mark", "Me", "Enclosing_Mark", "Mn", "Nonspacing_Mark", "N", "Number", "Nd", "Decimal_Number", "digit", "Nl", "Letter_Number", "No", "Other_Number", "P", "Punctuation", "punct", "Pc", "Connector_Punctuation", "Pd", "Dash_Punctuation", "Pe", "Close_Punctuation", "Pf", "Final_Punctuation", "Pi", "Initial_Punctuation", "Po", "Other_Punctuation", "Ps", "Open_Punctuation", "S", "Symbol", "Sc", "Currency_Symbol", "Sk", "Modifier_Symbol", "Sm", "Math_Symbol", "So", "Other_Symbol", "Z", "Separator", "Zl", "Line_Separator", "Zp", "Paragraph_Separator", "Zs", "Space_Separator"]),
11038
+ Script: /* @__PURE__ */ new Set(["Adlm", "Adlam", "Aghb", "Caucasian_Albanian", "Ahom", "Ahom", "Arab", "Arabic", "Armi", "Imperial_Aramaic", "Armn", "Armenian", "Avst", "Avestan", "Bali", "Balinese", "Bamu", "Bamum", "Bass", "Bassa_Vah", "Batk", "Batak", "Beng", "Bengali", "Bhks", "Bhaiksuki", "Bopo", "Bopomofo", "Brah", "Brahmi", "Brai", "Braille", "Bugi", "Buginese", "Buhd", "Buhid", "Cakm", "Chakma", "Cans", "Canadian_Aboriginal", "Cari", "Carian", "Cham", "Cham", "Cher", "Cherokee", "Chrs", "Chorasmian", "Copt", "Coptic", "Qaac", "Cpmn", "Cypro_Minoan", "Cprt", "Cypriot", "Cyrl", "Cyrillic", "Deva", "Devanagari", "Diak", "Dives_Akuru", "Dogr", "Dogra", "Dsrt", "Deseret", "Dupl", "Duployan", "Egyp", "Egyptian_Hieroglyphs", "Elba", "Elbasan", "Elym", "Elymaic", "Ethi", "Ethiopic", "Geor", "Georgian", "Glag", "Glagolitic", "Gong", "Gunjala_Gondi", "Gonm", "Masaram_Gondi", "Goth", "Gothic", "Gran", "Grantha", "Grek", "Greek", "Gujr", "Gujarati", "Guru", "Gurmukhi", "Hang", "Hangul", "Hani", "Han", "Hano", "Hanunoo", "Hatr", "Hatran", "Hebr", "Hebrew", "Hira", "Hiragana", "Hluw", "Anatolian_Hieroglyphs", "Hmng", "Pahawh_Hmong", "Hmnp", "Nyiakeng_Puachue_Hmong", "Hrkt", "Katakana_Or_Hiragana", "Hung", "Old_Hungarian", "Ital", "Old_Italic", "Java", "Javanese", "Kali", "Kayah_Li", "Kana", "Katakana", "Kawi", "Kawi", "Khar", "Kharoshthi", "Khmr", "Khmer", "Khoj", "Khojki", "Kits", "Khitan_Small_Script", "Knda", "Kannada", "Kthi", "Kaithi", "Lana", "Tai_Tham", "Laoo", "Lao", "Latn", "Latin", "Lepc", "Lepcha", "Limb", "Limbu", "Lina", "Linear_A", "Linb", "Linear_B", "Lisu", "Lisu", "Lyci", "Lycian", "Lydi", "Lydian", "Mahj", "Mahajani", "Maka", "Makasar", "Mand", "Mandaic", "Mani", "Manichaean", "Marc", "Marchen", "Medf", "Medefaidrin", "Mend", "Mende_Kikakui", "Merc", "Meroitic_Cursive", "Mero", "Meroitic_Hieroglyphs", "Mlym", "Malayalam", "Modi", "Modi", "Mong", "Mongolian", "Mroo", "Mro", "Mtei", "Meetei_Mayek", "Mult", "Multani", "Mymr", "Myanmar", "Nagm", "Nag_Mundari", "Nand", "Nandinagari", "Narb", "Old_North_Arabian", "Nbat", "Nabataean", "Newa", "Newa", "Nkoo", "Nko", "Nshu", "Nushu", "Ogam", "Ogham", "Olck", "Ol_Chiki", "Orkh", "Old_Turkic", "Orya", "Oriya", "Osge", "Osage", "Osma", "Osmanya", "Ougr", "Old_Uyghur", "Palm", "Palmyrene", "Pauc", "Pau_Cin_Hau", "Perm", "Old_Permic", "Phag", "Phags_Pa", "Phli", "Inscriptional_Pahlavi", "Phlp", "Psalter_Pahlavi", "Phnx", "Phoenician", "Plrd", "Miao", "Prti", "Inscriptional_Parthian", "Rjng", "Rejang", "Rohg", "Hanifi_Rohingya", "Runr", "Runic", "Samr", "Samaritan", "Sarb", "Old_South_Arabian", "Saur", "Saurashtra", "Sgnw", "SignWriting", "Shaw", "Shavian", "Shrd", "Sharada", "Sidd", "Siddham", "Sind", "Khudawadi", "Sinh", "Sinhala", "Sogd", "Sogdian", "Sogo", "Old_Sogdian", "Sora", "Sora_Sompeng", "Soyo", "Soyombo", "Sund", "Sundanese", "Sylo", "Syloti_Nagri", "Syrc", "Syriac", "Tagb", "Tagbanwa", "Takr", "Takri", "Tale", "Tai_Le", "Talu", "New_Tai_Lue", "Taml", "Tamil", "Tang", "Tangut", "Tavt", "Tai_Viet", "Telu", "Telugu", "Tfng", "Tifinagh", "Tglg", "Tagalog", "Thaa", "Thaana", "Thai", "Thai", "Tibt", "Tibetan", "Tirh", "Tirhuta", "Tnsa", "Tangsa", "Toto", "Toto", "Ugar", "Ugaritic", "Vaii", "Vai", "Vith", "Vithkuqi", "Wara", "Warang_Citi", "Wcho", "Wancho", "Xpeo", "Old_Persian", "Xsux", "Cuneiform", "Yezi", "Yezidi", "Yiii", "Yi", "Zanb", "Zanabazar_Square", "Zinh", "Inherited", "Qaai", "Zyyy", "Common", "Zzzz", "Unknown"]),
11039
+ Script_Extensions: /* @__PURE__ */ new Set()
11040
+ // Currently empty
11041
+ };
10098
11042
 
10099
11043
  // src/compiler/utilitiesPublic.ts
10100
11044
  function isExternalModuleNameRelative(moduleName) {
@@ -12083,6 +13027,10 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
12083
13027
  ],
12084
13028
  es2022: [
12085
13029
  "at"
13030
+ ],
13031
+ esnext: [
13032
+ "isWellFormed",
13033
+ "toWellFormed"
12086
13034
  ]
12087
13035
  })),
12088
13036
  StringConstructor: new Map(Object.entries({
@@ -12717,6 +13665,10 @@ function isVarUsing(node) {
12717
13665
  function isVarConst(node) {
12718
13666
  return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 2 /* Const */;
12719
13667
  }
13668
+ function isVarConstLike(node) {
13669
+ const blockScopeKind = getCombinedNodeFlags(node) & 7 /* BlockScoped */;
13670
+ return blockScopeKind === 2 /* Const */ || blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */;
13671
+ }
12720
13672
  function isLet(node) {
12721
13673
  return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 1 /* Let */;
12722
13674
  }
@@ -14533,7 +15485,7 @@ function isNamedEvaluation(node, cb) {
14533
15485
  function isPushOrUnshiftIdentifier(node) {
14534
15486
  return node.escapedText === "push" || node.escapedText === "unshift";
14535
15487
  }
14536
- function isParameterDeclaration(node) {
15488
+ function isPartOfParameterDeclaration(node) {
14537
15489
  const root = getRootDeclaration(node);
14538
15490
  return root.kind === 169 /* Parameter */;
14539
15491
  }
@@ -16726,6 +17678,9 @@ function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)
16726
17678
  function getStrictOptionValue(compilerOptions, flag) {
16727
17679
  return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
16728
17680
  }
17681
+ function getNameOfScriptTarget(scriptTarget) {
17682
+ return forEachEntry(targetOptionDeclaration.type, (value, key) => value === scriptTarget ? key : void 0);
17683
+ }
16729
17684
  function getEmitStandardClassFields(compilerOptions) {
16730
17685
  return compilerOptions.useDefineForClassFields !== false && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */;
16731
17686
  }
@@ -17782,26 +18737,28 @@ function replaceFirstStar(s, replacement) {
17782
18737
  function getNameFromImportAttribute(node) {
17783
18738
  return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
17784
18739
  }
17785
- function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false) {
17786
- return { value, isSyntacticallyString, resolvedOtherFiles };
18740
+ function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false, hasExternalReferences = false) {
18741
+ return { value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences };
17787
18742
  }
17788
18743
  function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameExpression }) {
17789
18744
  function evaluate(expr, location) {
17790
18745
  let isSyntacticallyString = false;
17791
18746
  let resolvedOtherFiles = false;
18747
+ let hasExternalReferences = false;
17792
18748
  expr = skipParentheses(expr);
17793
18749
  switch (expr.kind) {
17794
18750
  case 224 /* PrefixUnaryExpression */:
17795
18751
  const result = evaluate(expr.operand, location);
17796
18752
  resolvedOtherFiles = result.resolvedOtherFiles;
18753
+ hasExternalReferences = result.hasExternalReferences;
17797
18754
  if (typeof result.value === "number") {
17798
18755
  switch (expr.operator) {
17799
18756
  case 40 /* PlusToken */:
17800
- return evaluatorResult(result.value, isSyntacticallyString, resolvedOtherFiles);
18757
+ return evaluatorResult(result.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17801
18758
  case 41 /* MinusToken */:
17802
- return evaluatorResult(-result.value, isSyntacticallyString, resolvedOtherFiles);
18759
+ return evaluatorResult(-result.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17803
18760
  case 55 /* TildeToken */:
17804
- return evaluatorResult(~result.value, isSyntacticallyString, resolvedOtherFiles);
18761
+ return evaluatorResult(~result.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17805
18762
  }
17806
18763
  }
17807
18764
  break;
@@ -17810,38 +18767,40 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
17810
18767
  const right = evaluate(expr.right, location);
17811
18768
  isSyntacticallyString = (left.isSyntacticallyString || right.isSyntacticallyString) && expr.operatorToken.kind === 40 /* PlusToken */;
17812
18769
  resolvedOtherFiles = left.resolvedOtherFiles || right.resolvedOtherFiles;
18770
+ hasExternalReferences = left.hasExternalReferences || right.hasExternalReferences;
17813
18771
  if (typeof left.value === "number" && typeof right.value === "number") {
17814
18772
  switch (expr.operatorToken.kind) {
17815
18773
  case 52 /* BarToken */:
17816
- return evaluatorResult(left.value | right.value, isSyntacticallyString, resolvedOtherFiles);
18774
+ return evaluatorResult(left.value | right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17817
18775
  case 51 /* AmpersandToken */:
17818
- return evaluatorResult(left.value & right.value, isSyntacticallyString, resolvedOtherFiles);
18776
+ return evaluatorResult(left.value & right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17819
18777
  case 49 /* GreaterThanGreaterThanToken */:
17820
- return evaluatorResult(left.value >> right.value, isSyntacticallyString, resolvedOtherFiles);
18778
+ return evaluatorResult(left.value >> right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17821
18779
  case 50 /* GreaterThanGreaterThanGreaterThanToken */:
17822
- return evaluatorResult(left.value >>> right.value, isSyntacticallyString, resolvedOtherFiles);
18780
+ return evaluatorResult(left.value >>> right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17823
18781
  case 48 /* LessThanLessThanToken */:
17824
- return evaluatorResult(left.value << right.value, isSyntacticallyString, resolvedOtherFiles);
18782
+ return evaluatorResult(left.value << right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17825
18783
  case 53 /* CaretToken */:
17826
- return evaluatorResult(left.value ^ right.value, isSyntacticallyString, resolvedOtherFiles);
18784
+ return evaluatorResult(left.value ^ right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17827
18785
  case 42 /* AsteriskToken */:
17828
- return evaluatorResult(left.value * right.value, isSyntacticallyString, resolvedOtherFiles);
18786
+ return evaluatorResult(left.value * right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17829
18787
  case 44 /* SlashToken */:
17830
- return evaluatorResult(left.value / right.value, isSyntacticallyString, resolvedOtherFiles);
18788
+ return evaluatorResult(left.value / right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17831
18789
  case 40 /* PlusToken */:
17832
- return evaluatorResult(left.value + right.value, isSyntacticallyString, resolvedOtherFiles);
18790
+ return evaluatorResult(left.value + right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17833
18791
  case 41 /* MinusToken */:
17834
- return evaluatorResult(left.value - right.value, isSyntacticallyString, resolvedOtherFiles);
18792
+ return evaluatorResult(left.value - right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17835
18793
  case 45 /* PercentToken */:
17836
- return evaluatorResult(left.value % right.value, isSyntacticallyString, resolvedOtherFiles);
18794
+ return evaluatorResult(left.value % right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17837
18795
  case 43 /* AsteriskAsteriskToken */:
17838
- return evaluatorResult(left.value ** right.value, isSyntacticallyString, resolvedOtherFiles);
18796
+ return evaluatorResult(left.value ** right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
17839
18797
  }
17840
18798
  } else if ((typeof left.value === "string" || typeof left.value === "number") && (typeof right.value === "string" || typeof right.value === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
17841
18799
  return evaluatorResult(
17842
18800
  "" + left.value + right.value,
17843
18801
  isSyntacticallyString,
17844
- resolvedOtherFiles
18802
+ resolvedOtherFiles,
18803
+ hasExternalReferences
17845
18804
  );
17846
18805
  }
17847
18806
  break;
@@ -17871,12 +18830,14 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
17871
18830
  /*value*/
17872
18831
  void 0,
17873
18832
  isSyntacticallyString,
17874
- resolvedOtherFiles
18833
+ resolvedOtherFiles,
18834
+ hasExternalReferences
17875
18835
  );
17876
18836
  }
17877
18837
  function evaluateTemplateExpression(expr, location) {
17878
18838
  let result = expr.head.text;
17879
18839
  let resolvedOtherFiles = false;
18840
+ let hasExternalReferences = false;
17880
18841
  for (const span of expr.templateSpans) {
17881
18842
  const spanResult = evaluate(span.expression, location);
17882
18843
  if (spanResult.value === void 0) {
@@ -17890,12 +18851,14 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
17890
18851
  result += spanResult.value;
17891
18852
  result += span.literal.text;
17892
18853
  resolvedOtherFiles || (resolvedOtherFiles = spanResult.resolvedOtherFiles);
18854
+ hasExternalReferences || (hasExternalReferences = spanResult.hasExternalReferences);
17893
18855
  }
17894
18856
  return evaluatorResult(
17895
18857
  result,
17896
18858
  /*isSyntacticallyString*/
17897
18859
  true,
17898
- resolvedOtherFiles
18860
+ resolvedOtherFiles,
18861
+ hasExternalReferences
17899
18862
  );
17900
18863
  }
17901
18864
  return evaluate;
@@ -18125,7 +19088,7 @@ function createNameResolver({
18125
19088
  break;
18126
19089
  case 208 /* BindingElement */:
18127
19090
  if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
18128
- if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
19091
+ if (isPartOfParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
18129
19092
  associatedDeclarationForContainingInitializerOrBindingName = location;
18130
19093
  }
18131
19094
  }
@@ -18274,6 +19237,55 @@ function createNameResolver({
18274
19237
  return false;
18275
19238
  }
18276
19239
  }
19240
+ function isPrimitiveLiteralValue(node, includeBigInt = true) {
19241
+ Debug.type(node);
19242
+ switch (node.kind) {
19243
+ case 112 /* TrueKeyword */:
19244
+ case 97 /* FalseKeyword */:
19245
+ case 9 /* NumericLiteral */:
19246
+ case 11 /* StringLiteral */:
19247
+ case 15 /* NoSubstitutionTemplateLiteral */:
19248
+ return true;
19249
+ case 10 /* BigIntLiteral */:
19250
+ return includeBigInt;
19251
+ case 224 /* PrefixUnaryExpression */:
19252
+ if (node.operator === 41 /* MinusToken */) {
19253
+ return isNumericLiteral(node.operand) || includeBigInt && isBigIntLiteral(node.operand);
19254
+ }
19255
+ if (node.operator === 40 /* PlusToken */) {
19256
+ return isNumericLiteral(node.operand);
19257
+ }
19258
+ return false;
19259
+ default:
19260
+ assertType(node);
19261
+ return false;
19262
+ }
19263
+ }
19264
+ function unwrapParenthesizedExpression(o) {
19265
+ while (o.kind === 217 /* ParenthesizedExpression */) {
19266
+ o = o.expression;
19267
+ }
19268
+ return o;
19269
+ }
19270
+ function hasInferredType(node) {
19271
+ Debug.type(node);
19272
+ switch (node.kind) {
19273
+ case 169 /* Parameter */:
19274
+ case 171 /* PropertySignature */:
19275
+ case 172 /* PropertyDeclaration */:
19276
+ case 208 /* BindingElement */:
19277
+ case 211 /* PropertyAccessExpression */:
19278
+ case 212 /* ElementAccessExpression */:
19279
+ case 226 /* BinaryExpression */:
19280
+ case 260 /* VariableDeclaration */:
19281
+ case 277 /* ExportAssignment */:
19282
+ case 303 /* PropertyAssignment */:
19283
+ return true;
19284
+ default:
19285
+ assertType(node);
19286
+ return false;
19287
+ }
19288
+ }
18277
19289
 
18278
19290
  // src/compiler/factory/baseNodeFactory.ts
18279
19291
  function createBaseNodeFactory() {
@@ -24839,6 +25851,9 @@ function isNewExpression(node) {
24839
25851
  function isTaggedTemplateExpression(node) {
24840
25852
  return node.kind === 215 /* TaggedTemplateExpression */;
24841
25853
  }
25854
+ function isTypeAssertionExpression(node) {
25855
+ return node.kind === 216 /* TypeAssertionExpression */;
25856
+ }
24842
25857
  function isParenthesizedExpression(node) {
24843
25858
  return node.kind === 217 /* ParenthesizedExpression */;
24844
25859
  }
@@ -24881,6 +25896,9 @@ function isOmittedExpression(node) {
24881
25896
  function isExpressionWithTypeArguments(node) {
24882
25897
  return node.kind === 233 /* ExpressionWithTypeArguments */;
24883
25898
  }
25899
+ function isAsExpression(node) {
25900
+ return node.kind === 234 /* AsExpression */;
25901
+ }
24884
25902
  function isSatisfiesExpression(node) {
24885
25903
  return node.kind === 238 /* SatisfiesExpression */;
24886
25904
  }
@@ -25194,6 +26212,8 @@ function isJSDocImportTag(node) {
25194
26212
  // src/compiler/factory/nodeChildren.ts
25195
26213
  var nodeChildren = /* @__PURE__ */ new WeakMap();
25196
26214
  function getNodeChildren(node) {
26215
+ if (!isNodeKind(node.kind))
26216
+ return emptyArray;
25197
26217
  return nodeChildren.get(node);
25198
26218
  }
25199
26219
  function setNodeChildren(node, children) {
@@ -27489,7 +28509,10 @@ var Parser;
27489
28509
  function parseErrorAtPosition(start, length2, message, ...args) {
27490
28510
  const lastError = lastOrUndefined(parseDiagnostics);
27491
28511
  let result;
27492
- if (!lastError || start !== lastError.start) {
28512
+ if (message.category === 3 /* Message */ && lastError && start === lastError.start && length2 === lastError.length) {
28513
+ result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
28514
+ addRelatedInfo(lastError, result);
28515
+ } else if (!lastError || start !== lastError.start) {
27493
28516
  result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
27494
28517
  parseDiagnostics.push(result);
27495
28518
  }
@@ -27645,7 +28668,7 @@ var Parser;
27645
28668
  parseErrorForInvalidName(Diagnostics.Type_alias_name_cannot_be_0, Diagnostics.Type_alias_must_be_given_a_name, 64 /* EqualsToken */);
27646
28669
  return;
27647
28670
  }
27648
- const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, (n) => n) ?? getSpaceSuggestion(expressionText);
28671
+ const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, identity) ?? getSpaceSuggestion(expressionText);
27649
28672
  if (suggestion) {
27650
28673
  parseErrorAt(pos, node.end, Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion);
27651
28674
  return;
@@ -34442,6 +35465,7 @@ var libEntries = [
34442
35465
  ["esnext.object", "lib.esnext.object.d.ts"],
34443
35466
  ["esnext.array", "lib.esnext.array.d.ts"],
34444
35467
  ["esnext.regexp", "lib.esnext.regexp.d.ts"],
35468
+ ["esnext.string", "lib.esnext.string.d.ts"],
34445
35469
  ["decorators", "lib.decorators.d.ts"],
34446
35470
  ["decorators.legacy", "lib.decorators.legacy.d.ts"]
34447
35471
  ];
@@ -35010,6 +36034,15 @@ var commandOptionsWithoutBuild = [
35010
36034
  description: Diagnostics.Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting,
35011
36035
  defaultValueDescription: false
35012
36036
  },
36037
+ {
36038
+ name: "isolatedDeclarations",
36039
+ type: "boolean",
36040
+ category: Diagnostics.Interop_Constraints,
36041
+ description: Diagnostics.Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files,
36042
+ defaultValueDescription: false,
36043
+ affectsBuildInfo: true,
36044
+ affectsSemanticDiagnostics: true
36045
+ },
35013
36046
  // Strict Type Checks
35014
36047
  {
35015
36048
  name: "strict",
@@ -42811,7 +43844,7 @@ function createBinder() {
42811
43844
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
42812
43845
  } else if (isBlockOrCatchScoped(node)) {
42813
43846
  bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
42814
- } else if (isParameterDeclaration(node)) {
43847
+ } else if (isPartOfParameterDeclaration(node)) {
42815
43848
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
42816
43849
  } else {
42817
43850
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
@@ -44251,6 +45284,17 @@ function createTypeChecker(host) {
44251
45284
  var checkBinaryExpression = createCheckBinaryExpression();
44252
45285
  var emitResolver = createResolver();
44253
45286
  var nodeBuilder = createNodeBuilder();
45287
+ var syntacticNodeBuilder = createSyntacticTypeNodeBuilder(compilerOptions, {
45288
+ isEntityNameVisible,
45289
+ isExpandoFunctionDeclaration,
45290
+ isNonNarrowedBindableName,
45291
+ getAllAccessorDeclarations: getAllAccessorDeclarationsForDeclaration,
45292
+ requiresAddingImplicitUndefined,
45293
+ isUndefinedIdentifierExpression(node) {
45294
+ Debug.assert(isExpressionNode(node));
45295
+ return getSymbolAtLocation(node) === undefinedSymbol;
45296
+ }
45297
+ });
44254
45298
  var evaluate = createEvaluator({
44255
45299
  evaluateElementAccessExpression,
44256
45300
  evaluateEntityNameExpression
@@ -48277,7 +49321,7 @@ function createTypeChecker(host) {
48277
49321
  }
48278
49322
  return meaning;
48279
49323
  }
48280
- function isEntityNameVisible(entityName, enclosingDeclaration) {
49324
+ function isEntityNameVisible(entityName, enclosingDeclaration, shouldComputeAliasToMakeVisible = true) {
48281
49325
  const meaning = getMeaningOfEntityNameReference(entityName);
48282
49326
  const firstIdentifier = getFirstIdentifier(entityName);
48283
49327
  const symbol = resolveName(
@@ -48307,11 +49351,7 @@ function createTypeChecker(host) {
48307
49351
  ).accessibility === 0 /* Accessible */) {
48308
49352
  return { accessibility: 0 /* Accessible */ };
48309
49353
  }
48310
- return symbol && hasVisibleDeclarations(
48311
- symbol,
48312
- /*shouldComputeAliasToMakeVisible*/
48313
- true
48314
- ) || {
49354
+ return symbol && hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) || {
48315
49355
  accessibility: 1 /* NotAccessible */,
48316
49356
  errorSymbolName: getTextOfNode(firstIdentifier),
48317
49357
  errorNode: firstIdentifier
@@ -48460,6 +49500,16 @@ function createTypeChecker(host) {
48460
49500
  return setTextRange(setOriginalNode(range, location), location);
48461
49501
  }
48462
49502
  function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
49503
+ const oldFlags = context.flags;
49504
+ if (expr && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
49505
+ syntacticNodeBuilder.serializeTypeOfExpression(expr, context, addUndefined);
49506
+ }
49507
+ context.flags |= -2147483648 /* NoSyntacticPrinter */;
49508
+ const result = expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined);
49509
+ context.flags = oldFlags;
49510
+ return result;
49511
+ }
49512
+ function expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined) {
48463
49513
  if (expr) {
48464
49514
  const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
48465
49515
  if (typeNode && !isConstTypeReference(typeNode)) {
@@ -50404,6 +51454,10 @@ function createTypeChecker(host) {
50404
51454
  }
50405
51455
  const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
50406
51456
  const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
51457
+ if (decl && hasInferredType(decl) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
51458
+ syntacticNodeBuilder.serializeTypeOfDeclaration(decl, context);
51459
+ }
51460
+ context.flags |= -2147483648 /* NoSyntacticPrinter */;
50407
51461
  const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
50408
51462
  context.flags = oldFlags;
50409
51463
  return result;
@@ -50425,6 +51479,10 @@ function createTypeChecker(host) {
50425
51479
  let returnTypeNode;
50426
51480
  const returnType = getReturnTypeOfSignature(signature);
50427
51481
  if (returnType && !(suppressAny && isTypeAny(returnType))) {
51482
+ if (signature.declaration && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
51483
+ syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, context);
51484
+ }
51485
+ context.flags |= -2147483648 /* NoSyntacticPrinter */;
50428
51486
  returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
50429
51487
  } else if (!suppressAny) {
50430
51488
  returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
@@ -50492,7 +51550,7 @@ function createTypeChecker(host) {
50492
51550
  );
50493
51551
  if (sym) {
50494
51552
  if (sym.flags & 1 /* FunctionScopedVariable */ && sym.valueDeclaration) {
50495
- if (isParameterDeclaration(sym.valueDeclaration)) {
51553
+ if (isPartOfParameterDeclaration(sym.valueDeclaration)) {
50496
51554
  return { introducesError, node: attachSymbolToLeftmostIdentifier(node) };
50497
51555
  }
50498
51556
  }
@@ -51198,7 +52256,7 @@ function createTypeChecker(host) {
51198
52256
  }
51199
52257
  }
51200
52258
  function includePrivateSymbol(symbol) {
51201
- if (some(symbol.declarations, isParameterDeclaration))
52259
+ if (some(symbol.declarations, isPartOfParameterDeclaration))
51202
52260
  return;
51203
52261
  Debug.assertIsDefined(deferredPrivatesStack[deferredPrivatesStack.length - 1]);
51204
52262
  getUnusedName(unescapeLeadingUnderscores(symbol.escapedName), symbol);
@@ -52785,7 +53843,7 @@ function createTypeChecker(host) {
52785
53843
  return parentType;
52786
53844
  }
52787
53845
  const pattern = declaration.parent;
52788
- if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
53846
+ if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isPartOfParameterDeclaration(declaration)) {
52789
53847
  parentType = getNonNullableType(parentType);
52790
53848
  } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
52791
53849
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
@@ -60180,13 +61238,18 @@ function createTypeChecker(host) {
60180
61238
  const typeArguments = map(typeParameters, (t) => getMappedType(t, combinedMapper));
60181
61239
  const newAliasSymbol = aliasSymbol || type.aliasSymbol;
60182
61240
  const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
60183
- const id = getTypeListId(typeArguments) + getAliasId(newAliasSymbol, newAliasTypeArguments);
61241
+ const id = (type.objectFlags & 134217728 /* SingleSignatureType */ ? "S" : "") + getTypeListId(typeArguments) + getAliasId(newAliasSymbol, newAliasTypeArguments);
60184
61242
  if (!target.instantiations) {
60185
61243
  target.instantiations = /* @__PURE__ */ new Map();
60186
61244
  target.instantiations.set(getTypeListId(typeParameters) + getAliasId(target.aliasSymbol, target.aliasTypeArguments), target);
60187
61245
  }
60188
61246
  let result = target.instantiations.get(id);
60189
61247
  if (!result) {
61248
+ if (type.objectFlags & 134217728 /* SingleSignatureType */) {
61249
+ result = instantiateAnonymousType(type, mapper);
61250
+ target.instantiations.set(id, result);
61251
+ return result;
61252
+ }
60190
61253
  const newMapper = createTypeMapper(typeParameters, typeArguments);
60191
61254
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
60192
61255
  target.instantiations.set(id, result);
@@ -67023,7 +68086,7 @@ function createTypeChecker(host) {
67023
68086
  case 206 /* ObjectBindingPattern */:
67024
68087
  case 207 /* ArrayBindingPattern */:
67025
68088
  const rootDeclaration = getRootDeclaration(node.parent);
67026
- return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
68089
+ return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration(rootDeclaration) && isVarConstLike2(rootDeclaration);
67027
68090
  }
67028
68091
  return false;
67029
68092
  }
@@ -67162,7 +68225,7 @@ function createTypeChecker(host) {
67162
68225
  if (!isReachableFlowNode(flow)) {
67163
68226
  return unreachableNeverType;
67164
68227
  }
67165
- if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConstLike(node))) {
68228
+ if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConstLike2(node))) {
67166
68229
  const init = getDeclaredExpandoInitializer(node);
67167
68230
  if (init && (init.kind === 218 /* FunctionExpression */ || init.kind === 219 /* ArrowFunction */)) {
67168
68231
  return getTypeAtFlowNode(flow.antecedent);
@@ -71402,7 +72465,10 @@ function createTypeChecker(host) {
71402
72465
  if (indexInfo.isReadonly && (isAssignmentTarget(node) || isDeleteTarget(node))) {
71403
72466
  error(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
71404
72467
  }
71405
- propType = compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node) ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
72468
+ propType = indexInfo.type;
72469
+ if (compilerOptions.noUncheckedIndexedAccess && getAssignmentTargetKind(node) !== 1 /* Definite */) {
72470
+ propType = getUnionType([propType, missingType]);
72471
+ }
71406
72472
  if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
71407
72473
  error(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText));
71408
72474
  }
@@ -71852,7 +72918,16 @@ function createTypeChecker(host) {
71852
72918
  return errorType;
71853
72919
  }
71854
72920
  const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
71855
- const accessFlags = isAssignmentTarget(node) ? 4 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 /* NoIndexSignatures */ : 0) : 32 /* ExpressionPosition */;
72921
+ const assignmentTargetKind = getAssignmentTargetKind(node);
72922
+ let accessFlags;
72923
+ if (assignmentTargetKind === 0 /* None */) {
72924
+ accessFlags = 32 /* ExpressionPosition */;
72925
+ } else {
72926
+ accessFlags = 4 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 /* NoIndexSignatures */ : 0);
72927
+ if (assignmentTargetKind === 2 /* Compound */) {
72928
+ accessFlags |= 32 /* ExpressionPosition */;
72929
+ }
72930
+ }
71856
72931
  const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
71857
72932
  return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
71858
72933
  }
@@ -73637,7 +74712,7 @@ function createTypeChecker(host) {
73637
74712
  let name;
73638
74713
  let decl;
73639
74714
  if (isVariableDeclaration(node.parent) && node.parent.initializer === node) {
73640
- if (!isInJSFile(node) && !(isVarConstLike(node.parent) && isFunctionLikeDeclaration(node))) {
74715
+ if (!isInJSFile(node) && !(isVarConstLike2(node.parent) && isFunctionLikeDeclaration(node))) {
73641
74716
  return void 0;
73642
74717
  }
73643
74718
  name = node.parent.name;
@@ -79080,7 +80155,7 @@ function createTypeChecker(host) {
79080
80155
  for (const node of potentialUnusedRenamedBindingElementsInTypes) {
79081
80156
  if (!((_a = getSymbolOfDeclaration(node)) == null ? void 0 : _a.isReferenced)) {
79082
80157
  const wrappingDeclaration = walkUpBindingElementsAndPatterns(node);
79083
- Debug.assert(isParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
80158
+ Debug.assert(isPartOfParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
79084
80159
  const diagnostic = createDiagnosticForNode(node.name, Diagnostics._0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation, declarationNameToString(node.name), declarationNameToString(node.propertyName));
79085
80160
  if (!wrappingDeclaration.type) {
79086
80161
  addRelatedInfo(
@@ -79268,7 +80343,7 @@ function createTypeChecker(host) {
79268
80343
  }
79269
80344
  }
79270
80345
  function checkVarDeclaredNamesNotShadowed(node) {
79271
- if ((getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) {
80346
+ if ((getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */) !== 0 || isPartOfParameterDeclaration(node)) {
79272
80347
  return;
79273
80348
  }
79274
80349
  const symbol = getSymbolOfDeclaration(node);
@@ -79316,7 +80391,7 @@ function createTypeChecker(host) {
79316
80391
  }
79317
80392
  }
79318
80393
  if (isBindingElement(node)) {
79319
- if (node.propertyName && isIdentifier(node.name) && isParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
80394
+ if (node.propertyName && isIdentifier(node.name) && isPartOfParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
79320
80395
  potentialUnusedRenamedBindingElementsInTypes.push(node);
79321
80396
  return;
79322
80397
  }
@@ -79361,7 +80436,7 @@ function createTypeChecker(host) {
79361
80436
  }
79362
80437
  forEach(node.name.elements, checkSourceElement);
79363
80438
  }
79364
- if (node.initializer && isParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
80439
+ if (node.initializer && isPartOfParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
79365
80440
  error(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
79366
80441
  return;
79367
80442
  }
@@ -81513,10 +82588,18 @@ function createTypeChecker(host) {
81513
82588
  /*isSyntacticallyString*/
81514
82589
  false,
81515
82590
  /*resolvedOtherFiles*/
82591
+ true,
82592
+ /*hasExternalReferences*/
81516
82593
  true
81517
82594
  );
81518
82595
  }
81519
- return result;
82596
+ return evaluatorResult(
82597
+ result.value,
82598
+ result.isSyntacticallyString,
82599
+ result.resolvedOtherFiles,
82600
+ /*hasExternalReferences*/
82601
+ true
82602
+ );
81520
82603
  }
81521
82604
  }
81522
82605
  return evaluatorResult(
@@ -81563,7 +82646,17 @@ function createTypeChecker(host) {
81563
82646
  0
81564
82647
  );
81565
82648
  }
81566
- return getEnumMemberValue(declaration);
82649
+ const value = getEnumMemberValue(declaration);
82650
+ if (location.parent !== declaration.parent) {
82651
+ return evaluatorResult(
82652
+ value.value,
82653
+ value.isSyntacticallyString,
82654
+ value.resolvedOtherFiles,
82655
+ /*hasExternalReferences*/
82656
+ true
82657
+ );
82658
+ }
82659
+ return value;
81567
82660
  }
81568
82661
  function checkEnumDeclaration(node) {
81569
82662
  addLazyDiagnostic(() => checkEnumDeclarationWorker(node));
@@ -83674,12 +84767,24 @@ function createTypeChecker(host) {
83674
84767
  return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
83675
84768
  }
83676
84769
  function isExpandoFunctionDeclaration(node) {
83677
- const declaration = getParseTreeNode(node, isFunctionDeclaration);
84770
+ const declaration = getParseTreeNode(node, (n) => isFunctionDeclaration(n) || isVariableDeclaration(n));
83678
84771
  if (!declaration) {
83679
84772
  return false;
83680
84773
  }
83681
- const symbol = getSymbolOfDeclaration(declaration);
83682
- if (!symbol || !(symbol.flags & 16 /* Function */)) {
84774
+ let symbol;
84775
+ if (isVariableDeclaration(declaration)) {
84776
+ if (declaration.type || !isInJSFile(declaration) && !isVarConstLike2(declaration)) {
84777
+ return false;
84778
+ }
84779
+ const initializer = getDeclaredExpandoInitializer(declaration);
84780
+ if (!initializer || !canHaveSymbol(initializer)) {
84781
+ return false;
84782
+ }
84783
+ symbol = getSymbolOfDeclaration(initializer);
84784
+ } else {
84785
+ symbol = getSymbolOfDeclaration(declaration);
84786
+ }
84787
+ if (!symbol || !(symbol.flags & 16 /* Function */ | 3 /* Variable */)) {
83683
84788
  return false;
83684
84789
  }
83685
84790
  return !!forEachEntry(getExportsOfSymbol(symbol), (p) => p.flags & 111551 /* Value */ && isExpandoPropertyDeclaration(p.valueDeclaration));
@@ -83983,11 +85088,27 @@ function createTypeChecker(host) {
83983
85088
  return void 0;
83984
85089
  }
83985
85090
  function isLiteralConstDeclaration(node) {
83986
- if (isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike(node)) {
85091
+ if (isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike2(node)) {
83987
85092
  return isFreshLiteralType(getTypeOfSymbol(getSymbolOfDeclaration(node)));
83988
85093
  }
83989
85094
  return false;
83990
85095
  }
85096
+ function isNonNarrowedBindableName(node) {
85097
+ if (!hasBindableName(node.parent)) {
85098
+ return false;
85099
+ }
85100
+ const expression = node.expression;
85101
+ if (!isEntityNameExpression(expression)) {
85102
+ return true;
85103
+ }
85104
+ const type = getTypeOfExpression(expression);
85105
+ const symbol = getSymbolAtLocation(expression);
85106
+ if (!symbol) {
85107
+ return false;
85108
+ }
85109
+ const declaredType = getTypeOfSymbol(symbol);
85110
+ return declaredType === type;
85111
+ }
83991
85112
  function literalTypeToNode(type, enclosing, tracker) {
83992
85113
  const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
83993
85114
  type.symbol,
@@ -84107,6 +85228,7 @@ function createTypeChecker(host) {
84107
85228
  return node && getExternalModuleFileFromDeclaration(node);
84108
85229
  },
84109
85230
  isLiteralConstDeclaration,
85231
+ isNonNarrowedBindableName,
84110
85232
  isLateBound: (nodeIn) => {
84111
85233
  const node = getParseTreeNode(nodeIn, isDeclaration);
84112
85234
  const symbol = node && getSymbolOfDeclaration(node);
@@ -85478,7 +86600,7 @@ function createTypeChecker(host) {
85478
86600
  const initializer = node.initializer;
85479
86601
  if (initializer) {
85480
86602
  const isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) || isSimpleLiteralEnumReference(initializer) || initializer.kind === 112 /* TrueKeyword */ || initializer.kind === 97 /* FalseKeyword */ || isBigIntLiteralExpression(initializer));
85481
- const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike(node);
86603
+ const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike2(node);
85482
86604
  if (isConstOrReadonly && !node.type) {
85483
86605
  if (isInvalidInitializer) {
85484
86606
  return grammarErrorOnNode(initializer, Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference);
@@ -85943,7 +87065,7 @@ function createTypeChecker(host) {
85943
87065
  lastGetCombinedNodeFlagsResult = getCombinedNodeFlags(node);
85944
87066
  return lastGetCombinedNodeFlagsResult;
85945
87067
  }
85946
- function isVarConstLike(node) {
87068
+ function isVarConstLike2(node) {
85947
87069
  const blockScopeKind = getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */;
85948
87070
  return blockScopeKind === 2 /* Const */ || blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */;
85949
87071
  }
@@ -86097,6 +87219,12 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
86097
87219
  onDiagnosticReported() {
86098
87220
  this.context.reportedDiagnostic = true;
86099
87221
  }
87222
+ reportInferenceFallback(node) {
87223
+ var _a;
87224
+ if ((_a = this.inner) == null ? void 0 : _a.reportInferenceFallback) {
87225
+ this.inner.reportInferenceFallback(node);
87226
+ }
87227
+ }
86100
87228
  };
86101
87229
 
86102
87230
  // src/compiler/visitorPublic.ts
@@ -90139,7 +91267,7 @@ function transformTypeScript(context) {
90139
91267
  }
90140
91268
  function visitParenthesizedExpression(node) {
90141
91269
  const innerExpression = skipOuterExpressions(node.expression, ~6 /* Assertions */);
90142
- if (isAssertionExpression(innerExpression)) {
91270
+ if (isAssertionExpression(innerExpression) || isSatisfiesExpression(innerExpression)) {
90143
91271
  const expression = visitNode(node.expression, visitor, isExpression);
90144
91272
  Debug.assert(expression);
90145
91273
  return factory2.createPartiallyEmittedExpression(expression, node);
@@ -109062,6 +110190,194 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
109062
110190
  };
109063
110191
  }
109064
110192
  }
110193
+ function createGetIsolatedDeclarationErrors(resolver) {
110194
+ const relatedSuggestionByDeclarationKind = {
110195
+ [219 /* ArrowFunction */]: Diagnostics.Add_a_return_type_to_the_function_expression,
110196
+ [218 /* FunctionExpression */]: Diagnostics.Add_a_return_type_to_the_function_expression,
110197
+ [174 /* MethodDeclaration */]: Diagnostics.Add_a_return_type_to_the_method,
110198
+ [177 /* GetAccessor */]: Diagnostics.Add_a_return_type_to_the_get_accessor_declaration,
110199
+ [178 /* SetAccessor */]: Diagnostics.Add_a_type_to_parameter_of_the_set_accessor_declaration,
110200
+ [262 /* FunctionDeclaration */]: Diagnostics.Add_a_return_type_to_the_function_declaration,
110201
+ [180 /* ConstructSignature */]: Diagnostics.Add_a_return_type_to_the_function_declaration,
110202
+ [169 /* Parameter */]: Diagnostics.Add_a_type_annotation_to_the_parameter_0,
110203
+ [260 /* VariableDeclaration */]: Diagnostics.Add_a_type_annotation_to_the_variable_0,
110204
+ [172 /* PropertyDeclaration */]: Diagnostics.Add_a_type_annotation_to_the_property_0,
110205
+ [171 /* PropertySignature */]: Diagnostics.Add_a_type_annotation_to_the_property_0,
110206
+ [277 /* ExportAssignment */]: Diagnostics.Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it
110207
+ };
110208
+ const errorByDeclarationKind = {
110209
+ [218 /* FunctionExpression */]: Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
110210
+ [262 /* FunctionDeclaration */]: Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
110211
+ [219 /* ArrowFunction */]: Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
110212
+ [174 /* MethodDeclaration */]: Diagnostics.Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
110213
+ [180 /* ConstructSignature */]: Diagnostics.Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
110214
+ [177 /* GetAccessor */]: Diagnostics.At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
110215
+ [178 /* SetAccessor */]: Diagnostics.At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
110216
+ [169 /* Parameter */]: Diagnostics.Parameter_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
110217
+ [260 /* VariableDeclaration */]: Diagnostics.Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
110218
+ [172 /* PropertyDeclaration */]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
110219
+ [171 /* PropertySignature */]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
110220
+ [167 /* ComputedPropertyName */]: Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations,
110221
+ [305 /* SpreadAssignment */]: Diagnostics.Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations,
110222
+ [304 /* ShorthandPropertyAssignment */]: Diagnostics.Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations,
110223
+ [209 /* ArrayLiteralExpression */]: Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations,
110224
+ [277 /* ExportAssignment */]: Diagnostics.Default_exports_can_t_be_inferred_with_isolatedDeclarations,
110225
+ [230 /* SpreadElement */]: Diagnostics.Arrays_with_spread_elements_can_t_inferred_with_isolatedDeclarations
110226
+ };
110227
+ return getDiagnostic;
110228
+ function getDiagnostic(node) {
110229
+ const heritageClause = findAncestor(node, isHeritageClause);
110230
+ if (heritageClause) {
110231
+ return createDiagnosticForNode(node, Diagnostics.Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations);
110232
+ }
110233
+ Debug.type(node);
110234
+ switch (node.kind) {
110235
+ case 177 /* GetAccessor */:
110236
+ case 178 /* SetAccessor */:
110237
+ return createAccessorTypeError(node);
110238
+ case 167 /* ComputedPropertyName */:
110239
+ case 304 /* ShorthandPropertyAssignment */:
110240
+ case 305 /* SpreadAssignment */:
110241
+ return createObjectLiteralError(node);
110242
+ case 209 /* ArrayLiteralExpression */:
110243
+ case 230 /* SpreadElement */:
110244
+ return createArrayLiteralError(node);
110245
+ case 174 /* MethodDeclaration */:
110246
+ case 180 /* ConstructSignature */:
110247
+ case 218 /* FunctionExpression */:
110248
+ case 219 /* ArrowFunction */:
110249
+ case 262 /* FunctionDeclaration */:
110250
+ return createReturnTypeError(node);
110251
+ case 208 /* BindingElement */:
110252
+ return createBindingElementError(node);
110253
+ case 172 /* PropertyDeclaration */:
110254
+ case 260 /* VariableDeclaration */:
110255
+ return createVariableOrPropertyError(node);
110256
+ case 169 /* Parameter */:
110257
+ return createParameterError(node);
110258
+ case 303 /* PropertyAssignment */:
110259
+ return createExpressionError(node.initializer);
110260
+ case 231 /* ClassExpression */:
110261
+ return createClassExpressionError(node);
110262
+ default:
110263
+ assertType(node);
110264
+ return createExpressionError(node);
110265
+ }
110266
+ }
110267
+ function findNearestDeclaration(node) {
110268
+ const result = findAncestor(node, (n) => isExportAssignment(n) || (isStatement(n) ? "quit" : isVariableDeclaration(n) || isPropertyDeclaration(n) || isParameter(n)));
110269
+ return result;
110270
+ }
110271
+ function createAccessorTypeError(node) {
110272
+ const { getAccessor, setAccessor } = getAllAccessorDeclarations(node.symbol.declarations, node);
110273
+ const targetNode = (isSetAccessor(node) ? node.parameters[0] : node) ?? node;
110274
+ const diag2 = createDiagnosticForNode(targetNode, errorByDeclarationKind[node.kind]);
110275
+ if (setAccessor) {
110276
+ addRelatedInfo(diag2, createDiagnosticForNode(setAccessor, relatedSuggestionByDeclarationKind[setAccessor.kind]));
110277
+ }
110278
+ if (getAccessor) {
110279
+ addRelatedInfo(diag2, createDiagnosticForNode(getAccessor, relatedSuggestionByDeclarationKind[getAccessor.kind]));
110280
+ }
110281
+ return diag2;
110282
+ }
110283
+ function createObjectLiteralError(node) {
110284
+ const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
110285
+ const parentDeclaration = findNearestDeclaration(node);
110286
+ if (parentDeclaration) {
110287
+ const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
110288
+ parentDeclaration.name,
110289
+ /*includeTrivia*/
110290
+ false
110291
+ );
110292
+ addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
110293
+ }
110294
+ return diag2;
110295
+ }
110296
+ function createArrayLiteralError(node) {
110297
+ const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
110298
+ const parentDeclaration = findNearestDeclaration(node);
110299
+ if (parentDeclaration) {
110300
+ const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
110301
+ parentDeclaration.name,
110302
+ /*includeTrivia*/
110303
+ false
110304
+ );
110305
+ addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
110306
+ }
110307
+ return diag2;
110308
+ }
110309
+ function createReturnTypeError(node) {
110310
+ const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
110311
+ const parentDeclaration = findNearestDeclaration(node);
110312
+ if (parentDeclaration) {
110313
+ const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
110314
+ parentDeclaration.name,
110315
+ /*includeTrivia*/
110316
+ false
110317
+ );
110318
+ addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
110319
+ }
110320
+ addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind]));
110321
+ return diag2;
110322
+ }
110323
+ function createBindingElementError(node) {
110324
+ return createDiagnosticForNode(node, Diagnostics.Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations);
110325
+ }
110326
+ function createVariableOrPropertyError(node) {
110327
+ const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
110328
+ const targetStr = getTextOfNode(
110329
+ node.name,
110330
+ /*includeTrivia*/
110331
+ false
110332
+ );
110333
+ addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind], targetStr));
110334
+ return diag2;
110335
+ }
110336
+ function createParameterError(node) {
110337
+ if (isSetAccessor(node.parent)) {
110338
+ return createAccessorTypeError(node.parent);
110339
+ }
110340
+ const addUndefined = resolver.requiresAddingImplicitUndefined(node);
110341
+ if (!addUndefined && node.initializer) {
110342
+ return createExpressionError(node.initializer);
110343
+ }
110344
+ const message = addUndefined ? Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations : errorByDeclarationKind[node.kind];
110345
+ const diag2 = createDiagnosticForNode(node, message);
110346
+ const targetStr = getTextOfNode(
110347
+ node.name,
110348
+ /*includeTrivia*/
110349
+ false
110350
+ );
110351
+ addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind], targetStr));
110352
+ return diag2;
110353
+ }
110354
+ function createClassExpressionError(node) {
110355
+ return createExpressionError(node, Diagnostics.Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations);
110356
+ }
110357
+ function createExpressionError(node, diagnosticMessage) {
110358
+ const parentDeclaration = findNearestDeclaration(node);
110359
+ let diag2;
110360
+ if (parentDeclaration) {
110361
+ const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
110362
+ parentDeclaration.name,
110363
+ /*includeTrivia*/
110364
+ false
110365
+ );
110366
+ const parent = findAncestor(node.parent, (n) => isExportAssignment(n) || (isStatement(n) ? "quit" : !isParenthesizedExpression(n) && !isTypeAssertionExpression(n) && !isAsExpression(n)));
110367
+ if (parentDeclaration === parent) {
110368
+ diag2 = createDiagnosticForNode(node, diagnosticMessage ?? errorByDeclarationKind[parentDeclaration.kind]);
110369
+ addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
110370
+ } else {
110371
+ diag2 = createDiagnosticForNode(node, diagnosticMessage ?? Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations);
110372
+ addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
110373
+ addRelatedInfo(diag2, createDiagnosticForNode(node, Diagnostics.Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit));
110374
+ }
110375
+ } else {
110376
+ diag2 = createDiagnosticForNode(node, diagnosticMessage ?? Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations);
110377
+ }
110378
+ return diag2;
110379
+ }
110380
+ }
109065
110381
 
109066
110382
  // src/compiler/transformers/declarations.ts
109067
110383
  function getDeclarationDiagnostics(host, resolver, file) {
@@ -109103,7 +110419,8 @@ function transformDeclarations(context) {
109103
110419
  reportTruncationError,
109104
110420
  moduleResolverHost: host,
109105
110421
  reportNonlocalAugmentation,
109106
- reportNonSerializableProperty
110422
+ reportNonSerializableProperty,
110423
+ reportInferenceFallback
109107
110424
  };
109108
110425
  let errorNameNode;
109109
110426
  let errorFallbackNode;
@@ -109113,8 +110430,29 @@ function transformDeclarations(context) {
109113
110430
  let rawLibReferenceDirectives;
109114
110431
  const resolver = context.getEmitResolver();
109115
110432
  const options = context.getCompilerOptions();
109116
- const { stripInternal } = options;
110433
+ const getIsolatedDeclarationError = createGetIsolatedDeclarationErrors(resolver);
110434
+ const { stripInternal, isolatedDeclarations } = options;
109117
110435
  return transformRoot;
110436
+ function reportExpandoFunctionErrors(node) {
110437
+ resolver.getPropertiesOfContainerFunction(node).forEach((p) => {
110438
+ if (isExpandoPropertyDeclaration(p.valueDeclaration)) {
110439
+ const errorTarget = isBinaryExpression(p.valueDeclaration) ? p.valueDeclaration.left : p.valueDeclaration;
110440
+ context.addDiagnostic(createDiagnosticForNode(
110441
+ errorTarget,
110442
+ Diagnostics.Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function
110443
+ ));
110444
+ }
110445
+ });
110446
+ }
110447
+ function reportInferenceFallback(node) {
110448
+ if (!isolatedDeclarations || isSourceFileJS(currentSourceFile))
110449
+ return;
110450
+ if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
110451
+ reportExpandoFunctionErrors(node);
110452
+ } else {
110453
+ context.addDiagnostic(getIsolatedDeclarationError(node));
110454
+ }
110455
+ }
109118
110456
  function handleSymbolAccessibilityError(symbolAccessibilityResult) {
109119
110457
  if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
109120
110458
  if (symbolAccessibilityResult.aliasesToMakeVisible) {
@@ -109418,7 +110756,8 @@ function transformDeclarations(context) {
109418
110756
  elem.dotDotDotToken,
109419
110757
  elem.propertyName,
109420
110758
  filterBindingPatternInitializers(elem.name),
109421
- shouldPrintWithInitializer(elem) ? elem.initializer : void 0
110759
+ /*initializer*/
110760
+ void 0
109422
110761
  );
109423
110762
  }
109424
110763
  }
@@ -109449,11 +110788,15 @@ function transformDeclarations(context) {
109449
110788
  return newParam;
109450
110789
  }
109451
110790
  function shouldPrintWithInitializer(node) {
109452
- return canHaveLiteralInitializer(node) && resolver.isLiteralConstDeclaration(getParseTreeNode(node));
110791
+ return canHaveLiteralInitializer(node) && !!node.initializer && resolver.isLiteralConstDeclaration(getParseTreeNode(node));
109453
110792
  }
109454
110793
  function ensureNoInitializer(node) {
109455
110794
  if (shouldPrintWithInitializer(node)) {
109456
- return resolver.createLiteralConstValue(getParseTreeNode(node), symbolTracker);
110795
+ const unwrappedInitializer = unwrapParenthesizedExpression(node.initializer);
110796
+ if (!isPrimitiveLiteralValue(unwrappedInitializer)) {
110797
+ reportInferenceFallback(node);
110798
+ }
110799
+ return resolver.createLiteralConstValue(getParseTreeNode(node, canHaveLiteralInitializer), symbolTracker);
109457
110800
  }
109458
110801
  return void 0;
109459
110802
  }
@@ -109695,6 +111038,9 @@ function transformDeclarations(context) {
109695
111038
  );
109696
111039
  }
109697
111040
  if (resolver.isImportRequiredByAugmentation(decl)) {
111041
+ if (isolatedDeclarations) {
111042
+ context.addDiagnostic(createDiagnosticForNode(decl, Diagnostics.Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_supported_with_isolatedDeclarations));
111043
+ }
109698
111044
  return factory2.updateImportDeclaration(
109699
111045
  decl,
109700
111046
  decl.modifiers,
@@ -109749,6 +111095,9 @@ function transformDeclarations(context) {
109749
111095
  if (isDeclarationAndNotVisible(input))
109750
111096
  return;
109751
111097
  if (hasDynamicName(input) && !resolver.isLateBound(getParseTreeNode(input))) {
111098
+ if (isolatedDeclarations && isClassDeclaration(input.parent) && isEntityNameExpression(input.name.expression) && resolver.isEntityNameVisible(input.name.expression, input.parent).accessibility === 0 /* Accessible */ && !resolver.isNonNarrowedBindableName(input.name)) {
111099
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
111100
+ }
109752
111101
  return;
109753
111102
  }
109754
111103
  }
@@ -110189,6 +111538,9 @@ function transformDeclarations(context) {
110189
111538
  ));
110190
111539
  if (clean2 && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) {
110191
111540
  const props = resolver.getPropertiesOfContainerFunction(input);
111541
+ if (isolatedDeclarations) {
111542
+ reportExpandoFunctionErrors(input);
111543
+ }
110192
111544
  const fakespace = parseNodeFactory.createModuleDeclaration(
110193
111545
  /*modifiers*/
110194
111546
  void 0,
@@ -110209,7 +111561,7 @@ function transformDeclarations(context) {
110209
111561
  return void 0;
110210
111562
  }
110211
111563
  getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
110212
- const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker);
111564
+ const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags | -2147483648 /* NoSyntacticPrinter */, symbolTracker);
110213
111565
  getSymbolAccessibilityDiagnostic = oldDiag;
110214
111566
  const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
110215
111567
  const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
@@ -110463,7 +111815,12 @@ function transformDeclarations(context) {
110463
111815
  factory2.createNodeArray(mapDefined(input.members, (m) => {
110464
111816
  if (shouldStripInternal(m))
110465
111817
  return;
110466
- const constValue = resolver.getConstantValue(m);
111818
+ const enumValue = resolver.getEnumMemberValue(m);
111819
+ const constValue = enumValue == null ? void 0 : enumValue.value;
111820
+ if (isolatedDeclarations && m.initializer && (enumValue == null ? void 0 : enumValue.hasExternalReferences) && // This will be its own compiler error instead, so don't report.
111821
+ !isComputedPropertyName(m.name)) {
111822
+ context.addDiagnostic(createDiagnosticForNode(m, Diagnostics.Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDeclarations));
111823
+ }
110467
111824
  const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(-constValue)) : factory2.createNumericLiteral(constValue);
110468
111825
  return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
110469
111826
  }))
@@ -111699,6 +113056,7 @@ var notImplementedResolver = {
111699
113056
  isArgumentsLocalBinding: notImplemented,
111700
113057
  getExternalModuleFileFromDeclaration: notImplemented,
111701
113058
  isLiteralConstDeclaration: notImplemented,
113059
+ isNonNarrowedBindableName: notImplemented,
111702
113060
  getJsxFactoryEntity: notImplemented,
111703
113061
  getJsxFragmentFactoryEntity: notImplemented,
111704
113062
  isBindingCapturedByNode: notImplemented,
@@ -117462,6 +118820,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117462
118820
  const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
117463
118821
  const hasEmitBlockingDiagnostics = /* @__PURE__ */ new Map();
117464
118822
  let _compilerOptionsObjectLiteralSyntax;
118823
+ let _compilerOptionsPropertySyntax;
117465
118824
  let moduleResolutionCache;
117466
118825
  let actualResolveModuleNamesWorker;
117467
118826
  const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse;
@@ -119675,6 +121034,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119675
121034
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
119676
121035
  }
119677
121036
  }
121037
+ if (options.isolatedDeclarations) {
121038
+ if (getAllowJSCompilerOption(options)) {
121039
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "isolatedDeclarations");
121040
+ }
121041
+ if (!getEmitDeclarations(options)) {
121042
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "isolatedDeclarations", "declaration", "composite");
121043
+ }
121044
+ }
119678
121045
  if (options.inlineSourceMap) {
119679
121046
  if (options.sourceMap) {
119680
121047
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap");
@@ -119826,7 +121193,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119826
121193
  }
119827
121194
  }
119828
121195
  if (options.checkJs && !getAllowJSCompilerOption(options)) {
119829
- programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs"));
121196
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs");
119830
121197
  }
119831
121198
  if (options.emitDeclarationOnly) {
119832
121199
  if (!getEmitDeclarations(options)) {
@@ -120178,7 +121545,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120178
121545
  message = Diagnostics.File_is_library_specified_here;
120179
121546
  break;
120180
121547
  }
120181
- const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0);
121548
+ const target = getNameOfScriptTarget(getEmitScriptTarget(options));
120182
121549
  configFileNode = target ? getOptionsSyntaxByValue("target", target) : void 0;
120183
121550
  message = Diagnostics.File_is_default_library_for_target_specified_here;
120184
121551
  break;
@@ -120231,7 +121598,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120231
121598
  }
120232
121599
  });
120233
121600
  if (needCompilerDiagnostic) {
120234
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
121601
+ createCompilerOptionsDiagnostic(message, ...args);
120235
121602
  }
120236
121603
  }
120237
121604
  function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
@@ -120250,7 +121617,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120250
121617
  }
120251
121618
  });
120252
121619
  if (needCompilerDiagnostic) {
120253
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
121620
+ createCompilerOptionsDiagnostic(message, ...args);
120254
121621
  }
120255
121622
  }
120256
121623
  function forEachOptionsSyntaxByName(name, callback) {
@@ -120301,22 +121668,39 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120301
121668
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
120302
121669
  const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
120303
121670
  if (needCompilerDiagnostic) {
121671
+ createCompilerOptionsDiagnostic(message, ...args);
121672
+ }
121673
+ }
121674
+ function createCompilerOptionsDiagnostic(message, ...args) {
121675
+ const compilerOptionsProperty = getCompilerOptionsPropertySyntax();
121676
+ if (compilerOptionsProperty) {
120304
121677
  if ("messageText" in message) {
120305
- programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
121678
+ programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, compilerOptionsProperty.name, message));
120306
121679
  } else {
120307
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
121680
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, compilerOptionsProperty.name, message, ...args));
120308
121681
  }
121682
+ } else if ("messageText" in message) {
121683
+ programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
121684
+ } else {
121685
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
120309
121686
  }
120310
121687
  }
120311
121688
  function getCompilerOptionsObjectLiteralSyntax() {
120312
121689
  if (_compilerOptionsObjectLiteralSyntax === void 0) {
120313
- _compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment(
121690
+ const compilerOptionsProperty = getCompilerOptionsPropertySyntax();
121691
+ _compilerOptionsObjectLiteralSyntax = compilerOptionsProperty ? tryCast(compilerOptionsProperty.initializer, isObjectLiteralExpression) || false : false;
121692
+ }
121693
+ return _compilerOptionsObjectLiteralSyntax || void 0;
121694
+ }
121695
+ function getCompilerOptionsPropertySyntax() {
121696
+ if (_compilerOptionsPropertySyntax === void 0) {
121697
+ _compilerOptionsPropertySyntax = forEachPropertyAssignment(
120314
121698
  getTsConfigObjectLiteralExpression(options.configFile),
120315
121699
  "compilerOptions",
120316
- (prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0
121700
+ identity
120317
121701
  ) || false;
120318
121702
  }
120319
- return _compilerOptionsObjectLiteralSyntax || void 0;
121703
+ return _compilerOptionsPropertySyntax || void 0;
120320
121704
  }
120321
121705
  function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
120322
121706
  let needsCompilerDiagnostic = false;
@@ -123842,7 +125226,7 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
123842
125226
  Diagnostics.Library_0_specified_in_compilerOptions,
123843
125227
  options.lib[reason.index]
123844
125228
  );
123845
- const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0);
125229
+ const target = getNameOfScriptTarget(getEmitScriptTarget(options));
123846
125230
  const messageAndArgs = target ? [Diagnostics.Default_library_for_target_0, target] : [Diagnostics.Default_library];
123847
125231
  return chainDiagnosticMessages(
123848
125232
  /*details*/
@@ -127867,6 +129251,443 @@ function writeConfigFile(sys2, reportDiagnostic, options, fileNames) {
127867
129251
  return;
127868
129252
  }
127869
129253
 
129254
+ // src/compiler/expressionToTypeNode.ts
129255
+ function createSyntacticTypeNodeBuilder(options, resolver) {
129256
+ const strictNullChecks = getStrictOptionValue(options, "strictNullChecks");
129257
+ return {
129258
+ typeFromExpression,
129259
+ serializeTypeOfDeclaration,
129260
+ serializeReturnTypeForSignature,
129261
+ serializeTypeOfExpression
129262
+ };
129263
+ function serializeExistingTypeAnnotation(type) {
129264
+ return type === void 0 ? void 0 : !type.parent || !isParameter(type.parent) || !resolver.requiresAddingImplicitUndefined(type.parent) || canAddUndefined(type);
129265
+ }
129266
+ function serializeTypeOfExpression(expr, context, addUndefined, preserveLiterals) {
129267
+ return typeFromExpression(
129268
+ expr,
129269
+ context,
129270
+ /*isConstContext*/
129271
+ false,
129272
+ addUndefined,
129273
+ preserveLiterals
129274
+ ) ?? inferExpressionType(expr, context);
129275
+ }
129276
+ function serializeTypeOfDeclaration(node, context) {
129277
+ switch (node.kind) {
129278
+ case 171 /* PropertySignature */:
129279
+ return serializeExistingTypeAnnotation(getEffectiveTypeAnnotationNode(node));
129280
+ case 169 /* Parameter */:
129281
+ return typeFromParameter(node, context);
129282
+ case 260 /* VariableDeclaration */:
129283
+ return typeFromVariable(node, context);
129284
+ case 172 /* PropertyDeclaration */:
129285
+ return typeFromProperty(node, context);
129286
+ case 208 /* BindingElement */:
129287
+ return inferTypeOfDeclaration(node, context);
129288
+ case 277 /* ExportAssignment */:
129289
+ return serializeTypeOfExpression(
129290
+ node.expression,
129291
+ context,
129292
+ /*addUndefined*/
129293
+ void 0,
129294
+ /*preserveLiterals*/
129295
+ true
129296
+ );
129297
+ case 211 /* PropertyAccessExpression */:
129298
+ case 212 /* ElementAccessExpression */:
129299
+ case 226 /* BinaryExpression */:
129300
+ return serializeExistingTypeAnnotation(getEffectiveTypeAnnotationNode(node)) || inferTypeOfDeclaration(node, context);
129301
+ case 303 /* PropertyAssignment */:
129302
+ return typeFromExpression(node.initializer, context) || inferTypeOfDeclaration(node, context);
129303
+ default:
129304
+ Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`);
129305
+ }
129306
+ }
129307
+ function serializeReturnTypeForSignature(node, context) {
129308
+ switch (node.kind) {
129309
+ case 177 /* GetAccessor */:
129310
+ return typeFromAccessor(node, context);
129311
+ case 174 /* MethodDeclaration */:
129312
+ case 262 /* FunctionDeclaration */:
129313
+ case 180 /* ConstructSignature */:
129314
+ case 173 /* MethodSignature */:
129315
+ case 179 /* CallSignature */:
129316
+ case 176 /* Constructor */:
129317
+ case 178 /* SetAccessor */:
129318
+ case 181 /* IndexSignature */:
129319
+ case 184 /* FunctionType */:
129320
+ case 185 /* ConstructorType */:
129321
+ case 218 /* FunctionExpression */:
129322
+ case 219 /* ArrowFunction */:
129323
+ case 317 /* JSDocFunctionType */:
129324
+ case 323 /* JSDocSignature */:
129325
+ return createReturnFromSignature(node, context);
129326
+ default:
129327
+ Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`);
129328
+ }
129329
+ }
129330
+ function getTypeAnnotationFromAccessor2(accessor) {
129331
+ if (accessor) {
129332
+ return accessor.kind === 177 /* GetAccessor */ ? getEffectiveReturnTypeNode(accessor) : accessor.parameters.length > 0 ? getEffectiveTypeAnnotationNode(accessor.parameters[0]) : void 0;
129333
+ }
129334
+ }
129335
+ function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) {
129336
+ let accessorType = getTypeAnnotationFromAccessor2(node);
129337
+ if (!accessorType && node !== accessors.firstAccessor) {
129338
+ accessorType = getTypeAnnotationFromAccessor2(accessors.firstAccessor);
129339
+ }
129340
+ if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) {
129341
+ accessorType = getTypeAnnotationFromAccessor2(accessors.secondAccessor);
129342
+ }
129343
+ return accessorType;
129344
+ }
129345
+ function typeFromAccessor(node, context) {
129346
+ const accessorDeclarations = resolver.getAllAccessorDeclarations(node);
129347
+ const accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessorDeclarations);
129348
+ if (accessorType) {
129349
+ return serializeExistingTypeAnnotation(accessorType);
129350
+ }
129351
+ if (accessorDeclarations.getAccessor) {
129352
+ return createReturnFromSignature(accessorDeclarations.getAccessor, context);
129353
+ }
129354
+ return false;
129355
+ }
129356
+ function typeFromVariable(node, context) {
129357
+ const declaredType = getEffectiveTypeAnnotationNode(node);
129358
+ if (declaredType) {
129359
+ return serializeExistingTypeAnnotation(declaredType);
129360
+ }
129361
+ let resultType;
129362
+ if (node.initializer) {
129363
+ if (!resolver.isExpandoFunctionDeclaration(node)) {
129364
+ resultType = typeFromExpression(
129365
+ node.initializer,
129366
+ context,
129367
+ /*isConstContext*/
129368
+ void 0,
129369
+ /*requiresAddingUndefined*/
129370
+ void 0,
129371
+ isVarConstLike(node)
129372
+ );
129373
+ }
129374
+ }
129375
+ return resultType ?? inferTypeOfDeclaration(node, context);
129376
+ }
129377
+ function typeFromParameter(node, context) {
129378
+ const parent = node.parent;
129379
+ if (parent.kind === 178 /* SetAccessor */) {
129380
+ return typeFromAccessor(parent, context);
129381
+ }
129382
+ const declaredType = getEffectiveTypeAnnotationNode(node);
129383
+ const addUndefined = resolver.requiresAddingImplicitUndefined(node);
129384
+ let resultType;
129385
+ if (!addUndefined) {
129386
+ if (declaredType) {
129387
+ return serializeExistingTypeAnnotation(declaredType);
129388
+ }
129389
+ if (node.initializer && isIdentifier(node.name)) {
129390
+ resultType = typeFromExpression(node.initializer, context);
129391
+ }
129392
+ }
129393
+ return resultType ?? inferTypeOfDeclaration(node, context);
129394
+ }
129395
+ function typeFromProperty(node, context) {
129396
+ const declaredType = getEffectiveTypeAnnotationNode(node);
129397
+ if (declaredType) {
129398
+ return serializeExistingTypeAnnotation(declaredType);
129399
+ }
129400
+ let resultType;
129401
+ if (node.initializer) {
129402
+ const isReadonly = isDeclarationReadonly(node);
129403
+ resultType = typeFromExpression(
129404
+ node.initializer,
129405
+ context,
129406
+ /*isConstContext*/
129407
+ void 0,
129408
+ /*requiresAddingUndefined*/
129409
+ void 0,
129410
+ isReadonly
129411
+ );
129412
+ }
129413
+ return resultType ?? inferTypeOfDeclaration(node, context);
129414
+ }
129415
+ function inferTypeOfDeclaration(node, context) {
129416
+ context.tracker.reportInferenceFallback(node);
129417
+ return false;
129418
+ }
129419
+ function inferExpressionType(node, context) {
129420
+ context.tracker.reportInferenceFallback(node);
129421
+ return false;
129422
+ }
129423
+ function inferReturnTypeOfSignatureSignature(node, context) {
129424
+ context.tracker.reportInferenceFallback(node);
129425
+ return false;
129426
+ }
129427
+ function inferAccessorType(node, allAccessors, context) {
129428
+ if (node.kind === 177 /* GetAccessor */) {
129429
+ return createReturnFromSignature(node, context);
129430
+ } else {
129431
+ context.tracker.reportInferenceFallback(node);
129432
+ return false;
129433
+ }
129434
+ }
129435
+ function typeFromTypeAssertion(expression, type, context, requiresAddingUndefined) {
129436
+ if (isConstTypeReference(type)) {
129437
+ return typeFromExpression(
129438
+ expression,
129439
+ context,
129440
+ /*isConstContext*/
129441
+ true,
129442
+ requiresAddingUndefined
129443
+ );
129444
+ }
129445
+ if (requiresAddingUndefined && !canAddUndefined(type)) {
129446
+ context.tracker.reportInferenceFallback(type);
129447
+ }
129448
+ return serializeExistingTypeAnnotation(type);
129449
+ }
129450
+ function typeFromExpression(node, context, isConstContext = false, requiresAddingUndefined = false, preserveLiterals = false) {
129451
+ switch (node.kind) {
129452
+ case 217 /* ParenthesizedExpression */:
129453
+ if (isJSDocTypeAssertion(node)) {
129454
+ return typeFromTypeAssertion(node.expression, getJSDocTypeAssertionType(node), context, requiresAddingUndefined);
129455
+ }
129456
+ return typeFromExpression(node.expression, context, isConstContext, requiresAddingUndefined);
129457
+ case 80 /* Identifier */:
129458
+ if (resolver.isUndefinedIdentifierExpression(node)) {
129459
+ return true;
129460
+ }
129461
+ break;
129462
+ case 106 /* NullKeyword */:
129463
+ return true;
129464
+ case 219 /* ArrowFunction */:
129465
+ case 218 /* FunctionExpression */:
129466
+ return typeFromFunctionLikeExpression(node, context);
129467
+ case 216 /* TypeAssertionExpression */:
129468
+ case 234 /* AsExpression */:
129469
+ const asExpression = node;
129470
+ return typeFromTypeAssertion(asExpression.expression, asExpression.type, context, requiresAddingUndefined);
129471
+ case 224 /* PrefixUnaryExpression */:
129472
+ const unaryExpression = node;
129473
+ if (isPrimitiveLiteralValue(unaryExpression)) {
129474
+ if (unaryExpression.operand.kind === 10 /* BigIntLiteral */) {
129475
+ return typeFromPrimitiveLiteral();
129476
+ }
129477
+ if (unaryExpression.operand.kind === 9 /* NumericLiteral */) {
129478
+ return typeFromPrimitiveLiteral();
129479
+ }
129480
+ }
129481
+ break;
129482
+ case 9 /* NumericLiteral */:
129483
+ return typeFromPrimitiveLiteral();
129484
+ case 228 /* TemplateExpression */:
129485
+ if (!isConstContext && !preserveLiterals) {
129486
+ return true;
129487
+ }
129488
+ break;
129489
+ case 15 /* NoSubstitutionTemplateLiteral */:
129490
+ case 11 /* StringLiteral */:
129491
+ return typeFromPrimitiveLiteral();
129492
+ case 10 /* BigIntLiteral */:
129493
+ return typeFromPrimitiveLiteral();
129494
+ case 112 /* TrueKeyword */:
129495
+ case 97 /* FalseKeyword */:
129496
+ return typeFromPrimitiveLiteral();
129497
+ case 209 /* ArrayLiteralExpression */:
129498
+ return typeFromArrayLiteral(node, context, isConstContext);
129499
+ case 210 /* ObjectLiteralExpression */:
129500
+ return typeFromObjectLiteral(node, context, isConstContext);
129501
+ case 231 /* ClassExpression */:
129502
+ return inferExpressionType(node, context);
129503
+ }
129504
+ return void 0;
129505
+ }
129506
+ function typeFromFunctionLikeExpression(fnNode, context) {
129507
+ const returnType = serializeExistingTypeAnnotation(fnNode.type) ?? createReturnFromSignature(fnNode, context);
129508
+ const typeParameters = reuseTypeParameters(fnNode.typeParameters);
129509
+ const parameters = fnNode.parameters.every((p) => ensureParameter(p, context));
129510
+ return returnType && typeParameters && parameters;
129511
+ }
129512
+ function canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext) {
129513
+ if (!isConstContext) {
129514
+ context.tracker.reportInferenceFallback(arrayLiteral);
129515
+ return false;
129516
+ }
129517
+ for (const element of arrayLiteral.elements) {
129518
+ if (element.kind === 230 /* SpreadElement */) {
129519
+ context.tracker.reportInferenceFallback(element);
129520
+ return false;
129521
+ }
129522
+ }
129523
+ return true;
129524
+ }
129525
+ function typeFromArrayLiteral(arrayLiteral, context, isConstContext) {
129526
+ if (!canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext)) {
129527
+ return false;
129528
+ }
129529
+ let canInferArray = true;
129530
+ for (const element of arrayLiteral.elements) {
129531
+ Debug.assert(element.kind !== 230 /* SpreadElement */);
129532
+ if (element.kind !== 232 /* OmittedExpression */) {
129533
+ canInferArray = (typeFromExpression(element, context, isConstContext) ?? inferExpressionType(element, context)) && canInferArray;
129534
+ }
129535
+ }
129536
+ return true;
129537
+ }
129538
+ function canGetTypeFromObjectLiteral(objectLiteral, context) {
129539
+ let result = true;
129540
+ for (const prop of objectLiteral.properties) {
129541
+ if (prop.flags & 262144 /* ThisNodeHasError */) {
129542
+ result = false;
129543
+ break;
129544
+ }
129545
+ if (prop.kind === 304 /* ShorthandPropertyAssignment */ || prop.kind === 305 /* SpreadAssignment */) {
129546
+ context.tracker.reportInferenceFallback(prop);
129547
+ result = false;
129548
+ } else if (prop.name.flags & 262144 /* ThisNodeHasError */) {
129549
+ result = false;
129550
+ break;
129551
+ } else if (prop.name.kind === 81 /* PrivateIdentifier */) {
129552
+ result = false;
129553
+ } else if (prop.name.kind === 167 /* ComputedPropertyName */) {
129554
+ const expression = prop.name.expression;
129555
+ if (!isPrimitiveLiteralValue(
129556
+ expression,
129557
+ /*includeBigInt*/
129558
+ false
129559
+ ) && !isEntityNameExpression(expression)) {
129560
+ context.tracker.reportInferenceFallback(prop.name);
129561
+ result = false;
129562
+ }
129563
+ }
129564
+ }
129565
+ return result;
129566
+ }
129567
+ function typeFromObjectLiteral(objectLiteral, context, isConstContext) {
129568
+ if (!canGetTypeFromObjectLiteral(objectLiteral, context))
129569
+ return false;
129570
+ let canInferObjectLiteral = true;
129571
+ for (const prop of objectLiteral.properties) {
129572
+ Debug.assert(!isShorthandPropertyAssignment(prop) && !isSpreadAssignment(prop));
129573
+ const name = prop.name;
129574
+ if (prop.name.kind === 167 /* ComputedPropertyName */) {
129575
+ if (!resolver.isNonNarrowedBindableName(prop.name)) {
129576
+ context.tracker.reportInferenceFallback(prop.name);
129577
+ } else if (isEntityNameExpression(prop.name.expression)) {
129578
+ const visibilityResult = resolver.isEntityNameVisible(
129579
+ prop.name.expression,
129580
+ context.enclosingDeclaration,
129581
+ /*shouldComputeAliasToMakeVisible*/
129582
+ false
129583
+ );
129584
+ if (visibilityResult.accessibility !== 0 /* Accessible */) {
129585
+ context.tracker.reportInferenceFallback(prop.name);
129586
+ }
129587
+ }
129588
+ }
129589
+ switch (prop.kind) {
129590
+ case 174 /* MethodDeclaration */:
129591
+ canInferObjectLiteral = !!typeFromObjectLiteralMethod(prop, name, context) && canInferObjectLiteral;
129592
+ break;
129593
+ case 303 /* PropertyAssignment */:
129594
+ canInferObjectLiteral = !!typeFromObjectLiteralPropertyAssignment(prop, name, context, isConstContext) && canInferObjectLiteral;
129595
+ break;
129596
+ case 178 /* SetAccessor */:
129597
+ case 177 /* GetAccessor */:
129598
+ canInferObjectLiteral = !!typeFromObjectLiteralAccessor(prop, name, context) && canInferObjectLiteral;
129599
+ break;
129600
+ }
129601
+ }
129602
+ return canInferObjectLiteral;
129603
+ }
129604
+ function typeFromObjectLiteralPropertyAssignment(prop, name, context, isConstContext) {
129605
+ return typeFromExpression(prop.initializer, context, isConstContext) ?? inferTypeOfDeclaration(prop, context);
129606
+ }
129607
+ function ensureParameter(p, context) {
129608
+ return typeFromParameter(p, context);
129609
+ }
129610
+ function reuseTypeParameters(typeParameters) {
129611
+ return (typeParameters == null ? void 0 : typeParameters.every(
129612
+ (tp) => serializeExistingTypeAnnotation(tp.constraint) && serializeExistingTypeAnnotation(tp.default)
129613
+ )) ?? true;
129614
+ }
129615
+ function typeFromObjectLiteralMethod(method, name, context) {
129616
+ const returnType = createReturnFromSignature(method, context);
129617
+ const typeParameters = reuseTypeParameters(method.typeParameters);
129618
+ const parameters = method.parameters.every((p) => ensureParameter(p, context));
129619
+ return returnType && typeParameters && parameters;
129620
+ }
129621
+ function typeFromObjectLiteralAccessor(accessor, name, context) {
129622
+ const allAccessors = resolver.getAllAccessorDeclarations(accessor);
129623
+ const getAccessorType = allAccessors.getAccessor && getTypeAnnotationFromAccessor2(allAccessors.getAccessor);
129624
+ const setAccessorType = allAccessors.setAccessor && getTypeAnnotationFromAccessor2(allAccessors.setAccessor);
129625
+ if (getAccessorType !== void 0 && setAccessorType !== void 0) {
129626
+ const parameters = accessor.parameters.every((p) => ensureParameter(p, context));
129627
+ if (isGetAccessor(accessor)) {
129628
+ return parameters && serializeExistingTypeAnnotation(getAccessorType);
129629
+ } else {
129630
+ return parameters;
129631
+ }
129632
+ } else if (allAccessors.firstAccessor === accessor) {
129633
+ const foundType = getAccessorType ?? setAccessorType;
129634
+ const propertyType = foundType ? serializeExistingTypeAnnotation(foundType) : inferAccessorType(accessor, allAccessors, context);
129635
+ return propertyType;
129636
+ }
129637
+ return false;
129638
+ }
129639
+ function typeFromPrimitiveLiteral() {
129640
+ return true;
129641
+ }
129642
+ function canAddUndefined(node) {
129643
+ if (!strictNullChecks)
129644
+ return true;
129645
+ if (isKeyword(node.kind) || node.kind === 201 /* LiteralType */ || node.kind === 184 /* FunctionType */ || node.kind === 185 /* ConstructorType */ || node.kind === 188 /* ArrayType */ || node.kind === 189 /* TupleType */ || node.kind === 187 /* TypeLiteral */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 197 /* ThisType */) {
129646
+ return true;
129647
+ }
129648
+ if (node.kind === 196 /* ParenthesizedType */) {
129649
+ return canAddUndefined(node.type);
129650
+ }
129651
+ if (node.kind === 192 /* UnionType */ || node.kind === 193 /* IntersectionType */) {
129652
+ return node.types.every(canAddUndefined);
129653
+ }
129654
+ return false;
129655
+ }
129656
+ function createReturnFromSignature(fn, context) {
129657
+ let returnType;
129658
+ const returnTypeNode = getEffectiveReturnTypeNode(fn);
129659
+ if (returnTypeNode) {
129660
+ returnType = serializeExistingTypeAnnotation(returnTypeNode);
129661
+ }
129662
+ if (!returnType && isValueSignatureDeclaration(fn)) {
129663
+ returnType = typeFromSingleReturnExpression(fn, context);
129664
+ }
129665
+ return returnType ?? inferReturnTypeOfSignatureSignature(fn, context);
129666
+ }
129667
+ function typeFromSingleReturnExpression(declaration, context) {
129668
+ let candidateExpr;
129669
+ if (declaration && !nodeIsMissing(declaration.body)) {
129670
+ const body = declaration.body;
129671
+ if (body && isBlock(body)) {
129672
+ forEachReturnStatement(body, (s) => {
129673
+ if (!candidateExpr) {
129674
+ candidateExpr = s.expression;
129675
+ } else {
129676
+ candidateExpr = void 0;
129677
+ return true;
129678
+ }
129679
+ });
129680
+ } else {
129681
+ candidateExpr = body;
129682
+ }
129683
+ }
129684
+ if (candidateExpr) {
129685
+ return typeFromExpression(candidateExpr, context);
129686
+ }
129687
+ return void 0;
129688
+ }
129689
+ }
129690
+
127870
129691
  // src/tsc/tsc.ts
127871
129692
  Debug.loggingHost = {
127872
129693
  log(_level, s) {