typescript 5.5.0-dev.20240419 → 5.5.0-dev.20240421

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/typescript.js CHANGED
@@ -146,6 +146,7 @@ __export(typescript_exports, {
146
146
  ProcessLevel: () => ProcessLevel,
147
147
  ProgramUpdateLevel: () => ProgramUpdateLevel,
148
148
  QuotePreference: () => QuotePreference,
149
+ RegularExpressionFlags: () => RegularExpressionFlags,
149
150
  RelationComparisonResult: () => RelationComparisonResult,
150
151
  Rename: () => ts_Rename_exports,
151
152
  ScriptElementKind: () => ScriptElementKind,
@@ -274,6 +275,7 @@ __export(typescript_exports, {
274
275
  changeFullExtension: () => changeFullExtension,
275
276
  changesAffectModuleResolution: () => changesAffectModuleResolution,
276
277
  changesAffectingProgramStructure: () => changesAffectingProgramStructure,
278
+ characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
277
279
  childIsDecorated: () => childIsDecorated,
278
280
  classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
279
281
  classHasClassThisAssignment: () => classHasClassThisAssignment,
@@ -419,6 +421,7 @@ __export(typescript_exports, {
419
421
  createForOfBindingStatement: () => createForOfBindingStatement,
420
422
  createFutureSourceFile: () => createFutureSourceFile,
421
423
  createGetCanonicalFileName: () => createGetCanonicalFileName,
424
+ createGetIsolatedDeclarationErrors: () => createGetIsolatedDeclarationErrors,
422
425
  createGetSourceFile: () => createGetSourceFile,
423
426
  createGetSymbolAccessibilityDiagnosticForNode: () => createGetSymbolAccessibilityDiagnosticForNode,
424
427
  createGetSymbolAccessibilityDiagnosticForNodeName: () => createGetSymbolAccessibilityDiagnosticForNodeName,
@@ -473,6 +476,7 @@ __export(typescript_exports, {
473
476
  createSuperAccessVariableStatement: () => createSuperAccessVariableStatement,
474
477
  createSymbolTable: () => createSymbolTable,
475
478
  createSymlinkCache: () => createSymlinkCache,
479
+ createSyntacticTypeNodeBuilder: () => createSyntacticTypeNodeBuilder,
476
480
  createSystemWatchFunctions: () => createSystemWatchFunctions,
477
481
  createTextChange: () => createTextChange,
478
482
  createTextChangeFromStartLength: () => createTextChangeFromStartLength,
@@ -912,6 +916,7 @@ __export(typescript_exports, {
912
916
  getNameOfDeclaration: () => getNameOfDeclaration,
913
917
  getNameOfExpando: () => getNameOfExpando,
914
918
  getNameOfJSDocTypedef: () => getNameOfJSDocTypedef,
919
+ getNameOfScriptTarget: () => getNameOfScriptTarget,
915
920
  getNameOrArgument: () => getNameOrArgument,
916
921
  getNameTable: () => getNameTable,
917
922
  getNamesForExportedSymbol: () => getNamesForExportedSymbol,
@@ -1126,6 +1131,7 @@ __export(typescript_exports, {
1126
1131
  hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
1127
1132
  hasExtension: () => hasExtension,
1128
1133
  hasIndexSignature: () => hasIndexSignature,
1134
+ hasInferredType: () => hasInferredType,
1129
1135
  hasInitializer: () => hasInitializer,
1130
1136
  hasInvalidEscape: () => hasInvalidEscape,
1131
1137
  hasJSDocNodes: () => hasJSDocNodes,
@@ -1670,12 +1676,12 @@ __export(typescript_exports, {
1670
1676
  isPackageJsonInfo: () => isPackageJsonInfo,
1671
1677
  isPackedArrayLiteral: () => isPackedArrayLiteral,
1672
1678
  isParameter: () => isParameter,
1673
- isParameterDeclaration: () => isParameterDeclaration,
1674
1679
  isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
1675
1680
  isParameterPropertyModifier: () => isParameterPropertyModifier,
1676
1681
  isParenthesizedExpression: () => isParenthesizedExpression,
1677
1682
  isParenthesizedTypeNode: () => isParenthesizedTypeNode,
1678
1683
  isParseTreeNode: () => isParseTreeNode,
1684
+ isPartOfParameterDeclaration: () => isPartOfParameterDeclaration,
1679
1685
  isPartOfTypeNode: () => isPartOfTypeNode,
1680
1686
  isPartOfTypeQuery: () => isPartOfTypeQuery,
1681
1687
  isPartiallyEmittedExpression: () => isPartiallyEmittedExpression,
@@ -1686,6 +1692,7 @@ __export(typescript_exports, {
1686
1692
  isPossiblyTypeArgumentPosition: () => isPossiblyTypeArgumentPosition,
1687
1693
  isPostfixUnaryExpression: () => isPostfixUnaryExpression,
1688
1694
  isPrefixUnaryExpression: () => isPrefixUnaryExpression,
1695
+ isPrimitiveLiteralValue: () => isPrimitiveLiteralValue,
1689
1696
  isPrivateIdentifier: () => isPrivateIdentifier,
1690
1697
  isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
1691
1698
  isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
@@ -1852,6 +1859,7 @@ __export(typescript_exports, {
1852
1859
  isValueSignatureDeclaration: () => isValueSignatureDeclaration,
1853
1860
  isVarAwaitUsing: () => isVarAwaitUsing,
1854
1861
  isVarConst: () => isVarConst,
1862
+ isVarConstLike: () => isVarConstLike,
1855
1863
  isVarUsing: () => isVarUsing,
1856
1864
  isVariableDeclaration: () => isVariableDeclaration,
1857
1865
  isVariableDeclarationInVariableStatement: () => isVariableDeclarationInVariableStatement,
@@ -2056,6 +2064,7 @@ __export(typescript_exports, {
2056
2064
  reducePathComponents: () => reducePathComponents,
2057
2065
  refactor: () => ts_refactor_exports,
2058
2066
  regExpEscape: () => regExpEscape,
2067
+ regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
2059
2068
  relativeComplement: () => relativeComplement,
2060
2069
  removeAllComments: () => removeAllComments,
2061
2070
  removeEmitHelper: () => removeEmitHelper,
@@ -2311,6 +2320,7 @@ __export(typescript_exports, {
2311
2320
  unsetNodeChildren: () => unsetNodeChildren,
2312
2321
  unusedLabelIsError: () => unusedLabelIsError,
2313
2322
  unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
2323
+ unwrapParenthesizedExpression: () => unwrapParenthesizedExpression,
2314
2324
  updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
2315
2325
  updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
2316
2326
  updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
@@ -2350,7 +2360,7 @@ module.exports = __toCommonJS(typescript_exports);
2350
2360
 
2351
2361
  // src/compiler/corePublic.ts
2352
2362
  var versionMajorMinor = "5.5";
2353
- var version = `${versionMajorMinor}.0-dev.20240419`;
2363
+ var version = `${versionMajorMinor}.0-dev.20240421`;
2354
2364
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2355
2365
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2356
2366
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6254,6 +6264,20 @@ var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
6254
6264
  GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["AllowNameSubstitution"] = 64] = "AllowNameSubstitution";
6255
6265
  return GeneratedIdentifierFlags2;
6256
6266
  })(GeneratedIdentifierFlags || {});
6267
+ var RegularExpressionFlags = /* @__PURE__ */ ((RegularExpressionFlags2) => {
6268
+ RegularExpressionFlags2[RegularExpressionFlags2["None"] = 0] = "None";
6269
+ RegularExpressionFlags2[RegularExpressionFlags2["HasIndices"] = 1] = "HasIndices";
6270
+ RegularExpressionFlags2[RegularExpressionFlags2["Global"] = 2] = "Global";
6271
+ RegularExpressionFlags2[RegularExpressionFlags2["IgnoreCase"] = 4] = "IgnoreCase";
6272
+ RegularExpressionFlags2[RegularExpressionFlags2["Multiline"] = 8] = "Multiline";
6273
+ RegularExpressionFlags2[RegularExpressionFlags2["DotAll"] = 16] = "DotAll";
6274
+ RegularExpressionFlags2[RegularExpressionFlags2["Unicode"] = 32] = "Unicode";
6275
+ RegularExpressionFlags2[RegularExpressionFlags2["UnicodeSets"] = 64] = "UnicodeSets";
6276
+ RegularExpressionFlags2[RegularExpressionFlags2["Sticky"] = 128] = "Sticky";
6277
+ RegularExpressionFlags2[RegularExpressionFlags2["UnicodeMode"] = 96] = "UnicodeMode";
6278
+ RegularExpressionFlags2[RegularExpressionFlags2["Modifiers"] = 28] = "Modifiers";
6279
+ return RegularExpressionFlags2;
6280
+ })(RegularExpressionFlags || {});
6257
6281
  var TokenFlags = /* @__PURE__ */ ((TokenFlags2) => {
6258
6282
  TokenFlags2[TokenFlags2["None"] = 0] = "None";
6259
6283
  TokenFlags2[TokenFlags2["PrecedingLineBreak"] = 1] = "PrecedingLineBreak";
@@ -6389,6 +6413,7 @@ var NodeBuilderFlags = /* @__PURE__ */ ((NodeBuilderFlags2) => {
6389
6413
  NodeBuilderFlags2[NodeBuilderFlags2["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
6390
6414
  NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType";
6391
6415
  NodeBuilderFlags2[NodeBuilderFlags2["WriteComputedProps"] = 1073741824] = "WriteComputedProps";
6416
+ NodeBuilderFlags2[NodeBuilderFlags2["NoSyntacticPrinter"] = -2147483648] = "NoSyntacticPrinter";
6392
6417
  NodeBuilderFlags2[NodeBuilderFlags2["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths";
6393
6418
  NodeBuilderFlags2[NodeBuilderFlags2["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain";
6394
6419
  NodeBuilderFlags2[NodeBuilderFlags2["IgnoreErrors"] = 70221824] = "IgnoreErrors";
@@ -9753,6 +9778,43 @@ var Diagnostics = {
9753
9778
  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."),
9754
9779
  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."),
9755
9780
  Invalid_syntax_in_decorator: diag(1498, 1 /* Error */, "Invalid_syntax_in_decorator_1498", "Invalid syntax in decorator."),
9781
+ Unknown_regular_expression_flag: diag(1499, 1 /* Error */, "Unknown_regular_expression_flag_1499", "Unknown regular expression flag."),
9782
+ Duplicate_regular_expression_flag: diag(1500, 1 /* Error */, "Duplicate_regular_expression_flag_1500", "Duplicate regular expression flag."),
9783
+ 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."),
9784
+ 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."),
9785
+ 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."),
9786
+ 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."),
9787
+ Incomplete_quantifier_Digit_expected: diag(1505, 1 /* Error */, "Incomplete_quantifier_Digit_expected_1505", "Incomplete quantifier. Digit expected."),
9788
+ Numbers_out_of_order_in_quantifier: diag(1506, 1 /* Error */, "Numbers_out_of_order_in_quantifier_1506", "Numbers out of order in quantifier."),
9789
+ There_is_nothing_available_for_repetition: diag(1507, 1 /* Error */, "There_is_nothing_available_for_repetition_1507", "There is nothing available for repetition."),
9790
+ 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?"),
9791
+ 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."),
9792
+ 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."),
9793
+ 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."),
9794
+ 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."),
9795
+ Undetermined_character_escape: diag(1513, 1 /* Error */, "Undetermined_character_escape_1513", "Undetermined character escape."),
9796
+ Expected_a_capturing_group_name: diag(1514, 1 /* Error */, "Expected_a_capturing_group_name_1514", "Expected a capturing group name."),
9797
+ 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."),
9798
+ 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."),
9799
+ 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."),
9800
+ 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."),
9801
+ 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."),
9802
+ Expected_a_class_set_oprand: diag(1520, 1 /* Error */, "Expected_a_class_set_oprand_1520", "Expected a class set oprand."),
9803
+ 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."),
9804
+ 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?"),
9805
+ Expected_a_Unicode_property_name: diag(1523, 1 /* Error */, "Expected_a_Unicode_property_name_1523", "Expected a Unicode property name."),
9806
+ Unknown_Unicode_property_name: diag(1524, 1 /* Error */, "Unknown_Unicode_property_name_1524", "Unknown Unicode property name."),
9807
+ Expected_a_Unicode_property_value: diag(1525, 1 /* Error */, "Expected_a_Unicode_property_value_1525", "Expected a Unicode property value."),
9808
+ Unknown_Unicode_property_value: diag(1526, 1 /* Error */, "Unknown_Unicode_property_value_1526", "Unknown Unicode property value."),
9809
+ 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."),
9810
+ 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."),
9811
+ Unknown_Unicode_property_name_or_value: diag(1529, 1 /* Error */, "Unknown_Unicode_property_name_or_value_1529", "Unknown Unicode property name or value."),
9812
+ 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."),
9813
+ _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."),
9814
+ 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."),
9815
+ 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."),
9816
+ 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."),
9817
+ 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."),
9756
9818
  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."),
9757
9819
  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."),
9758
9820
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -10998,6 +11060,7 @@ var Diagnostics = {
10998
11060
  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."),
10999
11061
  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."),
11000
11062
  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."),
11063
+ 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."),
11001
11064
  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'."),
11002
11065
  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."),
11003
11066
  one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
@@ -11139,6 +11202,36 @@ var Diagnostics = {
11139
11202
  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"),
11140
11203
  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."),
11141
11204
  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."),
11205
+ 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."),
11206
+ 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."),
11207
+ 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."),
11208
+ 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."),
11209
+ 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."),
11210
+ 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."),
11211
+ 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."),
11212
+ 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."),
11213
+ 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."),
11214
+ 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."),
11215
+ 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."),
11216
+ 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."),
11217
+ 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."),
11218
+ 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."),
11219
+ 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."),
11220
+ 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."),
11221
+ 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."),
11222
+ 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."),
11223
+ 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."),
11224
+ 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}."),
11225
+ 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}."),
11226
+ 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}."),
11227
+ 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."),
11228
+ 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."),
11229
+ 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."),
11230
+ 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."),
11231
+ 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"),
11232
+ 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."),
11233
+ 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."),
11234
+ 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."),
11142
11235
  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'."),
11143
11236
  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."),
11144
11237
  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}'."),
@@ -11611,6 +11704,26 @@ var textToToken = new Map(Object.entries({
11611
11704
  "#": 63 /* HashToken */,
11612
11705
  "`": 62 /* BacktickToken */
11613
11706
  }));
11707
+ var charToRegExpFlag = new Map(Object.entries({
11708
+ d: 1 /* HasIndices */,
11709
+ g: 2 /* Global */,
11710
+ i: 4 /* IgnoreCase */,
11711
+ m: 8 /* Multiline */,
11712
+ s: 16 /* DotAll */,
11713
+ u: 32 /* Unicode */,
11714
+ v: 64 /* UnicodeSets */,
11715
+ y: 128 /* Sticky */
11716
+ }));
11717
+ var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
11718
+ [1 /* HasIndices */, 9 /* ES2022 */],
11719
+ [2 /* Global */, 0 /* ES3 */],
11720
+ [4 /* IgnoreCase */, 0 /* ES3 */],
11721
+ [8 /* Multiline */, 0 /* ES3 */],
11722
+ [16 /* DotAll */, 5 /* ES2018 */],
11723
+ [32 /* Unicode */, 2 /* ES2015 */],
11724
+ [64 /* UnicodeSets */, 99 /* ESNext */],
11725
+ [128 /* Sticky */, 2 /* ES2015 */]
11726
+ ]);
11614
11727
  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];
11615
11728
  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];
11616
11729
  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];
@@ -11659,6 +11772,13 @@ function tokenToString(t) {
11659
11772
  function stringToToken(s) {
11660
11773
  return textToToken.get(s);
11661
11774
  }
11775
+ var regExpFlagChars = makeReverseMap(charToRegExpFlag);
11776
+ function regularExpressionFlagToCharacter(f) {
11777
+ return regExpFlagChars[f];
11778
+ }
11779
+ function characterToRegularExpressionFlag(c) {
11780
+ return charToRegExpFlag.get(c);
11781
+ }
11662
11782
  function computeLineStarts(text) {
11663
11783
  const result = [];
11664
11784
  let pos = 0;
@@ -11755,8 +11875,11 @@ function isDigit(ch) {
11755
11875
  function isHexDigit(ch) {
11756
11876
  return isDigit(ch) || ch >= 65 /* A */ && ch <= 70 /* F */ || ch >= 97 /* a */ && ch <= 102 /* f */;
11757
11877
  }
11758
- function isCodePoint(code) {
11759
- return code <= 1114111;
11878
+ function isASCIILetter(ch) {
11879
+ return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */;
11880
+ }
11881
+ function isWordCharacter(ch) {
11882
+ return isASCIILetter(ch) || isDigit(ch) || ch === 95 /* _ */;
11760
11883
  }
11761
11884
  function isOctalDigit(ch) {
11762
11885
  return ch >= 48 /* _0 */ && ch <= 55 /* _7 */;
@@ -12095,10 +12218,10 @@ function getShebang(text) {
12095
12218
  }
12096
12219
  }
12097
12220
  function isIdentifierStart(ch, languageVersion) {
12098
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
12221
+ return isASCIILetter(ch) || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
12099
12222
  }
12100
12223
  function isIdentifierPart(ch, languageVersion, identifierVariant) {
12101
- 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
12224
+ return isWordCharacter(ch) || ch === 36 /* $ */ || // "-" and ":" are valid in JSX Identifiers
12102
12225
  (identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
12103
12226
  }
12104
12227
  function isIdentifierText(name, languageVersion, identifierVariant) {
@@ -12419,7 +12542,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12419
12542
  result += text.substring(start2, pos);
12420
12543
  result += scanEscapeSequence(
12421
12544
  /*shouldEmitInvalidEscapeError*/
12422
- true
12545
+ true,
12546
+ /*isRegularExpression*/
12547
+ false
12423
12548
  );
12424
12549
  start2 = pos;
12425
12550
  continue;
@@ -12463,7 +12588,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12463
12588
  }
12464
12589
  if (currChar === 92 /* backslash */) {
12465
12590
  contents += text.substring(start2, pos);
12466
- contents += scanEscapeSequence(shouldEmitInvalidEscapeError);
12591
+ contents += scanEscapeSequence(
12592
+ shouldEmitInvalidEscapeError,
12593
+ /*isRegularExpression*/
12594
+ false
12595
+ );
12467
12596
  start2 = pos;
12468
12597
  continue;
12469
12598
  }
@@ -12483,7 +12612,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12483
12612
  tokenValue = contents;
12484
12613
  return resultingToken;
12485
12614
  }
12486
- function scanEscapeSequence(shouldEmitInvalidEscapeError) {
12615
+ function scanEscapeSequence(shouldEmitInvalidEscapeError, isRegularExpression) {
12487
12616
  const start2 = pos;
12488
12617
  pos++;
12489
12618
  if (pos >= end) {
@@ -12511,7 +12640,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12511
12640
  pos++;
12512
12641
  }
12513
12642
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12514
- if (shouldEmitInvalidEscapeError) {
12643
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
12515
12644
  const code = parseInt(text.substring(start2 + 1, pos), 8);
12516
12645
  error2(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
12517
12646
  return String.fromCharCode(code);
@@ -12520,7 +12649,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12520
12649
  case 56 /* _8 */:
12521
12650
  case 57 /* _9 */:
12522
12651
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12523
- if (shouldEmitInvalidEscapeError) {
12652
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
12524
12653
  error2(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
12525
12654
  return String.fromCharCode(ch);
12526
12655
  }
@@ -12542,62 +12671,42 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12542
12671
  case 34 /* doubleQuote */:
12543
12672
  return '"';
12544
12673
  case 117 /* u */:
12545
- if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
12546
- pos++;
12547
- const escapedValueString = scanMinimumNumberOfHexDigits(
12548
- 1,
12549
- /*canHaveSeparators*/
12550
- false
12551
- );
12552
- const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
12553
- if (escapedValue < 0) {
12554
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
12555
- if (shouldEmitInvalidEscapeError) {
12556
- error2(Diagnostics.Hexadecimal_digit_expected);
12557
- }
12558
- return text.substring(start2, pos);
12559
- }
12560
- if (!isCodePoint(escapedValue)) {
12561
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
12562
- if (shouldEmitInvalidEscapeError) {
12563
- error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
12564
- }
12565
- return text.substring(start2, pos);
12566
- }
12567
- if (pos >= end) {
12568
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
12569
- if (shouldEmitInvalidEscapeError) {
12570
- error2(Diagnostics.Unexpected_end_of_text);
12571
- }
12572
- return text.substring(start2, pos);
12573
- }
12574
- if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
12575
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
12576
- if (shouldEmitInvalidEscapeError) {
12577
- error2(Diagnostics.Unterminated_Unicode_escape_sequence);
12578
- }
12579
- return text.substring(start2, pos);
12580
- }
12581
- pos++;
12582
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
12583
- return utf16EncodeAsString(escapedValue);
12674
+ if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
12675
+ pos -= 2;
12676
+ return scanExtendedUnicodeEscape(isRegularExpression || shouldEmitInvalidEscapeError);
12584
12677
  }
12585
12678
  for (; pos < start2 + 6; pos++) {
12586
12679
  if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
12587
12680
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12588
- if (shouldEmitInvalidEscapeError) {
12681
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
12589
12682
  error2(Diagnostics.Hexadecimal_digit_expected);
12590
12683
  }
12591
12684
  return text.substring(start2, pos);
12592
12685
  }
12593
12686
  }
12594
12687
  tokenFlags |= 1024 /* UnicodeEscape */;
12595
- return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
12688
+ const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
12689
+ const escapedValueString = String.fromCharCode(escapedValue);
12690
+ if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && text.charCodeAt(pos + 2) !== 123 /* openBrace */) {
12691
+ const nextStart = pos;
12692
+ let nextPos = pos + 2;
12693
+ for (; nextPos < nextStart + 6; nextPos++) {
12694
+ if (!isHexDigit(text.charCodeAt(pos))) {
12695
+ return escapedValueString;
12696
+ }
12697
+ }
12698
+ const nextEscapedValue = parseInt(text.substring(nextStart + 2, nextPos), 16);
12699
+ if (nextEscapedValue >= 56320 && nextEscapedValue <= 57343) {
12700
+ pos = nextPos;
12701
+ return escapedValueString + String.fromCharCode(nextEscapedValue);
12702
+ }
12703
+ }
12704
+ return escapedValueString;
12596
12705
  case 120 /* x */:
12597
12706
  for (; pos < start2 + 4; pos++) {
12598
12707
  if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
12599
12708
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12600
- if (shouldEmitInvalidEscapeError) {
12709
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
12601
12710
  error2(Diagnostics.Hexadecimal_digit_expected);
12602
12711
  }
12603
12712
  return text.substring(start2, pos);
@@ -12614,10 +12723,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12614
12723
  case 8233 /* paragraphSeparator */:
12615
12724
  return "";
12616
12725
  default:
12726
+ if (isRegularExpression && (shouldEmitInvalidEscapeError || isIdentifierPart(ch, languageVersion))) {
12727
+ error2(Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, pos - 2, 2);
12728
+ }
12617
12729
  return String.fromCharCode(ch);
12618
12730
  }
12619
12731
  }
12620
- function scanExtendedUnicodeEscape() {
12732
+ function scanExtendedUnicodeEscape(shouldEmitInvalidEscapeError) {
12733
+ const start2 = pos;
12734
+ pos += 3;
12735
+ const escapedStart = pos;
12621
12736
  const escapedValueString = scanMinimumNumberOfHexDigits(
12622
12737
  1,
12623
12738
  /*canHaveSeparators*/
@@ -12626,24 +12741,34 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12626
12741
  const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
12627
12742
  let isInvalidExtendedEscape = false;
12628
12743
  if (escapedValue < 0) {
12629
- error2(Diagnostics.Hexadecimal_digit_expected);
12744
+ if (shouldEmitInvalidEscapeError) {
12745
+ error2(Diagnostics.Hexadecimal_digit_expected);
12746
+ }
12630
12747
  isInvalidExtendedEscape = true;
12631
12748
  } else if (escapedValue > 1114111) {
12632
- error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
12749
+ if (shouldEmitInvalidEscapeError) {
12750
+ error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive, escapedStart, pos - escapedStart);
12751
+ }
12633
12752
  isInvalidExtendedEscape = true;
12634
12753
  }
12635
12754
  if (pos >= end) {
12636
- error2(Diagnostics.Unexpected_end_of_text);
12755
+ if (shouldEmitInvalidEscapeError) {
12756
+ error2(Diagnostics.Unexpected_end_of_text);
12757
+ }
12637
12758
  isInvalidExtendedEscape = true;
12638
12759
  } else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
12639
12760
  pos++;
12640
12761
  } else {
12641
- error2(Diagnostics.Unterminated_Unicode_escape_sequence);
12762
+ if (shouldEmitInvalidEscapeError) {
12763
+ error2(Diagnostics.Unterminated_Unicode_escape_sequence);
12764
+ }
12642
12765
  isInvalidExtendedEscape = true;
12643
12766
  }
12644
12767
  if (isInvalidExtendedEscape) {
12645
- return "";
12768
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
12769
+ return text.substring(start2, pos);
12646
12770
  }
12771
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
12647
12772
  return utf16EncodeAsString(escapedValue);
12648
12773
  }
12649
12774
  function peekUnicodeEscape() {
@@ -12685,9 +12810,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12685
12810
  } else if (ch === 92 /* backslash */) {
12686
12811
  ch = peekExtendedUnicodeEscape();
12687
12812
  if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
12688
- pos += 3;
12689
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
12690
- result += scanExtendedUnicodeEscape();
12813
+ result += scanExtendedUnicodeEscape(
12814
+ /*shouldEmitInvalidEscapeError*/
12815
+ true
12816
+ );
12691
12817
  start2 = pos;
12692
12818
  continue;
12693
12819
  }
@@ -13152,9 +13278,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13152
13278
  case 92 /* backslash */:
13153
13279
  const extendedCookedChar = peekExtendedUnicodeEscape();
13154
13280
  if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
13155
- pos += 3;
13156
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
13157
- tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
13281
+ tokenValue = scanExtendedUnicodeEscape(
13282
+ /*shouldEmitInvalidEscapeError*/
13283
+ true
13284
+ ) + scanIdentifierParts();
13158
13285
  return token = getIdentifierToken();
13159
13286
  }
13160
13287
  const cookedChar = peekUnicodeEscape();
@@ -13169,7 +13296,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13169
13296
  return token = 0 /* Unknown */;
13170
13297
  case 35 /* hash */:
13171
13298
  if (pos !== 0 && text[pos + 1] === "!") {
13172
- error2(Diagnostics.can_only_be_used_at_the_start_of_a_file);
13299
+ error2(Diagnostics.can_only_be_used_at_the_start_of_a_file, pos, 2);
13173
13300
  pos++;
13174
13301
  return token = 0 /* Unknown */;
13175
13302
  }
@@ -13178,9 +13305,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13178
13305
  pos++;
13179
13306
  const extendedCookedChar2 = peekExtendedUnicodeEscape();
13180
13307
  if (extendedCookedChar2 >= 0 && isIdentifierStart(extendedCookedChar2, languageVersion)) {
13181
- pos += 3;
13182
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
13183
- tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
13308
+ tokenValue = "#" + scanExtendedUnicodeEscape(
13309
+ /*shouldEmitInvalidEscapeError*/
13310
+ true
13311
+ ) + scanIdentifierParts();
13184
13312
  return token = 81 /* PrivateIdentifier */;
13185
13313
  }
13186
13314
  const cookedChar2 = peekUnicodeEscape();
@@ -13321,14 +13449,841 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13321
13449
  }
13322
13450
  p++;
13323
13451
  }
13324
- while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {
13452
+ const isUnterminated = !!(tokenFlags & 4 /* Unterminated */);
13453
+ const endOfBody = p - (isUnterminated ? 0 : 1);
13454
+ let regExpFlags = 0 /* None */;
13455
+ while (p < end) {
13456
+ const ch = text.charCodeAt(p);
13457
+ if (!isIdentifierPart(ch, languageVersion)) {
13458
+ break;
13459
+ }
13460
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13461
+ if (flag === void 0) {
13462
+ error2(Diagnostics.Unknown_regular_expression_flag, p, 1);
13463
+ } else if (regExpFlags & flag) {
13464
+ error2(Diagnostics.Duplicate_regular_expression_flag, p, 1);
13465
+ } else if (((regExpFlags | flag) & 96 /* UnicodeMode */) === 96 /* UnicodeMode */) {
13466
+ error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, p, 1);
13467
+ } else {
13468
+ regExpFlags |= flag;
13469
+ const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
13470
+ if (languageVersion < availableFrom) {
13471
+ error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, p, 1, getNameOfScriptTarget(availableFrom));
13472
+ }
13473
+ }
13325
13474
  p++;
13326
13475
  }
13327
- pos = p;
13476
+ pos = tokenStart + 1;
13477
+ const saveTokenPos = tokenStart;
13478
+ const saveTokenFlags = tokenFlags;
13479
+ scanRegularExpressionWorker(text, endOfBody, regExpFlags, isUnterminated);
13480
+ if (!isUnterminated) {
13481
+ pos = p;
13482
+ }
13483
+ tokenStart = saveTokenPos;
13484
+ tokenFlags = saveTokenFlags;
13328
13485
  tokenValue = text.substring(tokenStart, pos);
13329
13486
  token = 14 /* RegularExpressionLiteral */;
13330
13487
  }
13331
13488
  return token;
13489
+ function scanRegularExpressionWorker(text2, end2, regExpFlags, isUnterminated) {
13490
+ const unicodeMode = !!(regExpFlags & 96 /* UnicodeMode */);
13491
+ const unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
13492
+ let mayContainStrings = false;
13493
+ let numberOfCapturingGroups = 0;
13494
+ const groupSpecifiers = /* @__PURE__ */ new Set();
13495
+ const groupNameReferences = [];
13496
+ const decimalEscapes = [];
13497
+ const namedCapturingGroups = [];
13498
+ function scanDisjunction(isInGroup) {
13499
+ while (true) {
13500
+ namedCapturingGroups.push(/* @__PURE__ */ new Set());
13501
+ scanAlternative(isInGroup);
13502
+ namedCapturingGroups.pop();
13503
+ if (text2.charCodeAt(pos) !== 124 /* bar */) {
13504
+ return;
13505
+ }
13506
+ pos++;
13507
+ }
13508
+ }
13509
+ function scanAlternative(isInGroup) {
13510
+ let isPreviousTermQuantifiable = false;
13511
+ while (pos < end2) {
13512
+ const start2 = pos;
13513
+ const ch = text2.charCodeAt(pos);
13514
+ switch (ch) {
13515
+ case 94 /* caret */:
13516
+ case 36 /* $ */:
13517
+ pos++;
13518
+ isPreviousTermQuantifiable = false;
13519
+ break;
13520
+ case 92 /* backslash */:
13521
+ pos++;
13522
+ switch (text2.charCodeAt(pos)) {
13523
+ case 98 /* b */:
13524
+ case 66 /* B */:
13525
+ pos++;
13526
+ isPreviousTermQuantifiable = false;
13527
+ break;
13528
+ default:
13529
+ scanAtomEscape();
13530
+ isPreviousTermQuantifiable = true;
13531
+ break;
13532
+ }
13533
+ break;
13534
+ case 40 /* openParen */:
13535
+ pos++;
13536
+ if (text2.charCodeAt(pos) === 63 /* question */) {
13537
+ pos++;
13538
+ switch (text2.charCodeAt(pos)) {
13539
+ case 61 /* equals */:
13540
+ case 33 /* exclamation */:
13541
+ pos++;
13542
+ isPreviousTermQuantifiable = false;
13543
+ break;
13544
+ case 60 /* lessThan */:
13545
+ const groupNameStart = pos;
13546
+ pos++;
13547
+ switch (text2.charCodeAt(pos)) {
13548
+ case 61 /* equals */:
13549
+ case 33 /* exclamation */:
13550
+ pos++;
13551
+ isPreviousTermQuantifiable = false;
13552
+ break;
13553
+ default:
13554
+ scanGroupName(
13555
+ /*isReference*/
13556
+ false
13557
+ );
13558
+ scanExpectedChar(62 /* greaterThan */);
13559
+ if (languageVersion < 5 /* ES2018 */) {
13560
+ error2(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
13561
+ }
13562
+ numberOfCapturingGroups++;
13563
+ isPreviousTermQuantifiable = true;
13564
+ break;
13565
+ }
13566
+ break;
13567
+ default:
13568
+ const start3 = pos;
13569
+ const setFlags = scanPatternModifiers(0 /* None */);
13570
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
13571
+ pos++;
13572
+ scanPatternModifiers(setFlags);
13573
+ if (pos === start3 + 1) {
13574
+ error2(Diagnostics.Subpattern_flags_must_be_present_when_there_is_a_minus_sign, start3, pos - start3);
13575
+ }
13576
+ }
13577
+ scanExpectedChar(58 /* colon */);
13578
+ isPreviousTermQuantifiable = true;
13579
+ break;
13580
+ }
13581
+ } else {
13582
+ numberOfCapturingGroups++;
13583
+ isPreviousTermQuantifiable = true;
13584
+ }
13585
+ scanDisjunction(
13586
+ /*isInGroup*/
13587
+ true
13588
+ );
13589
+ scanExpectedChar(41 /* closeParen */);
13590
+ break;
13591
+ case 123 /* openBrace */:
13592
+ pos++;
13593
+ const digitsStart = pos;
13594
+ scanDigits();
13595
+ const min2 = tokenValue;
13596
+ if (text2.charCodeAt(pos) === 44 /* comma */) {
13597
+ pos++;
13598
+ scanDigits();
13599
+ const max = tokenValue;
13600
+ if (!min2) {
13601
+ if (max || text2.charCodeAt(pos) === 125 /* closeBrace */) {
13602
+ error2(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
13603
+ } else {
13604
+ if (unicodeMode) {
13605
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13606
+ }
13607
+ isPreviousTermQuantifiable = true;
13608
+ break;
13609
+ }
13610
+ }
13611
+ if (max && Number.parseInt(min2) > Number.parseInt(max)) {
13612
+ error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
13613
+ }
13614
+ } else if (!min2) {
13615
+ if (unicodeMode) {
13616
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13617
+ }
13618
+ isPreviousTermQuantifiable = true;
13619
+ break;
13620
+ }
13621
+ scanExpectedChar(125 /* closeBrace */);
13622
+ pos--;
13623
+ case 42 /* asterisk */:
13624
+ case 43 /* plus */:
13625
+ case 63 /* question */:
13626
+ pos++;
13627
+ if (text2.charCodeAt(pos) === 63 /* question */) {
13628
+ pos++;
13629
+ }
13630
+ if (!isPreviousTermQuantifiable) {
13631
+ error2(Diagnostics.There_is_nothing_available_for_repetition, start2, pos - start2);
13632
+ }
13633
+ isPreviousTermQuantifiable = false;
13634
+ break;
13635
+ case 46 /* dot */:
13636
+ pos++;
13637
+ isPreviousTermQuantifiable = true;
13638
+ break;
13639
+ case 91 /* openBracket */:
13640
+ pos++;
13641
+ if (unicodeSetsMode) {
13642
+ scanClassSetExpression();
13643
+ } else {
13644
+ scanClassRanges();
13645
+ }
13646
+ scanExpectedChar(93 /* closeBracket */);
13647
+ isPreviousTermQuantifiable = true;
13648
+ break;
13649
+ case 41 /* closeParen */:
13650
+ if (isInGroup) {
13651
+ return;
13652
+ }
13653
+ case 93 /* closeBracket */:
13654
+ case 125 /* closeBrace */:
13655
+ if (isUnterminated && !isInGroup) {
13656
+ return;
13657
+ }
13658
+ if (unicodeMode || ch === 41 /* closeParen */) {
13659
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13660
+ }
13661
+ pos++;
13662
+ isPreviousTermQuantifiable = true;
13663
+ break;
13664
+ case 47 /* slash */:
13665
+ case 124 /* bar */:
13666
+ return;
13667
+ default:
13668
+ scanSourceCharacter();
13669
+ isPreviousTermQuantifiable = true;
13670
+ break;
13671
+ }
13672
+ }
13673
+ }
13674
+ function scanPatternModifiers(currFlags) {
13675
+ while (pos < end2) {
13676
+ const ch = text2.charCodeAt(pos);
13677
+ if (!isIdentifierPart(ch, languageVersion)) {
13678
+ break;
13679
+ }
13680
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13681
+ if (flag === void 0) {
13682
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13683
+ } else if (currFlags & flag) {
13684
+ error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
13685
+ } else if (!(flag & 28 /* Modifiers */)) {
13686
+ error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
13687
+ } else {
13688
+ currFlags |= flag;
13689
+ const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
13690
+ if (languageVersion < availableFrom) {
13691
+ error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, 1, getNameOfScriptTarget(availableFrom));
13692
+ }
13693
+ }
13694
+ pos++;
13695
+ }
13696
+ return currFlags;
13697
+ }
13698
+ function scanAtomEscape() {
13699
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
13700
+ switch (text2.charCodeAt(pos)) {
13701
+ case 107 /* k */:
13702
+ pos++;
13703
+ if (text2.charCodeAt(pos) === 60 /* lessThan */) {
13704
+ pos++;
13705
+ scanGroupName(
13706
+ /*isReference*/
13707
+ true
13708
+ );
13709
+ scanExpectedChar(62 /* greaterThan */);
13710
+ } else if (unicodeMode) {
13711
+ error2(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
13712
+ }
13713
+ break;
13714
+ case 113 /* q */:
13715
+ if (unicodeSetsMode) {
13716
+ pos++;
13717
+ error2(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
13718
+ break;
13719
+ }
13720
+ default:
13721
+ Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape());
13722
+ break;
13723
+ }
13724
+ }
13725
+ function scanDecimalEscape() {
13726
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
13727
+ const ch = text2.charCodeAt(pos);
13728
+ if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
13729
+ const start2 = pos;
13730
+ scanDigits();
13731
+ decimalEscapes.push({ pos: start2, end: pos, value: +tokenValue });
13732
+ return true;
13733
+ }
13734
+ return false;
13735
+ }
13736
+ function scanCharacterEscape() {
13737
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
13738
+ let ch = text2.charCodeAt(pos);
13739
+ switch (ch) {
13740
+ case 99 /* c */:
13741
+ pos++;
13742
+ ch = text2.charCodeAt(pos);
13743
+ if (isASCIILetter(ch)) {
13744
+ pos++;
13745
+ return String.fromCharCode(ch & 31);
13746
+ }
13747
+ if (unicodeMode) {
13748
+ error2(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
13749
+ }
13750
+ return String.fromCharCode(ch);
13751
+ case 94 /* caret */:
13752
+ case 36 /* $ */:
13753
+ case 47 /* slash */:
13754
+ case 92 /* backslash */:
13755
+ case 46 /* dot */:
13756
+ case 42 /* asterisk */:
13757
+ case 43 /* plus */:
13758
+ case 63 /* question */:
13759
+ case 40 /* openParen */:
13760
+ case 41 /* closeParen */:
13761
+ case 91 /* openBracket */:
13762
+ case 93 /* closeBracket */:
13763
+ case 123 /* openBrace */:
13764
+ case 125 /* closeBrace */:
13765
+ case 124 /* bar */:
13766
+ pos++;
13767
+ return String.fromCharCode(ch);
13768
+ default:
13769
+ if (pos >= end2) {
13770
+ error2(Diagnostics.Undetermined_character_escape, pos - 1, 1, ch);
13771
+ return "\\";
13772
+ }
13773
+ pos--;
13774
+ return scanEscapeSequence(
13775
+ /*shouldEmitInvalidEscapeError*/
13776
+ unicodeMode,
13777
+ /*isRegularExpression*/
13778
+ true
13779
+ );
13780
+ }
13781
+ }
13782
+ function scanGroupName(isReference) {
13783
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 60 /* lessThan */);
13784
+ tokenStart = pos;
13785
+ scanIdentifier(codePointAt(text2, pos), languageVersion);
13786
+ if (pos === tokenStart) {
13787
+ error2(Diagnostics.Expected_a_capturing_group_name);
13788
+ } else if (isReference) {
13789
+ groupNameReferences.push({ pos: tokenStart, end: pos, name: tokenValue });
13790
+ } else if (namedCapturingGroups.some((group2) => group2.has(tokenValue))) {
13791
+ error2(Diagnostics.Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other, tokenStart, pos - tokenStart);
13792
+ } else {
13793
+ last(namedCapturingGroups).add(tokenValue);
13794
+ groupSpecifiers.add(tokenValue);
13795
+ }
13796
+ }
13797
+ function isClassContentExit(ch) {
13798
+ return ch === 93 /* closeBracket */ || pos >= end2;
13799
+ }
13800
+ function scanClassRanges() {
13801
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
13802
+ if (text2.charCodeAt(pos) === 94 /* caret */) {
13803
+ pos++;
13804
+ }
13805
+ while (pos < end2) {
13806
+ const ch = text2.charCodeAt(pos);
13807
+ if (isClassContentExit(ch)) {
13808
+ return;
13809
+ }
13810
+ const minStart = pos;
13811
+ const minCharacter = scanClassAtom();
13812
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
13813
+ pos++;
13814
+ const ch2 = text2.charCodeAt(pos);
13815
+ if (isClassContentExit(ch2)) {
13816
+ return;
13817
+ }
13818
+ if (!minCharacter) {
13819
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
13820
+ }
13821
+ const maxStart = pos;
13822
+ const maxCharacter = scanClassAtom();
13823
+ if (!maxCharacter) {
13824
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
13825
+ continue;
13826
+ }
13827
+ if (!minCharacter) {
13828
+ continue;
13829
+ }
13830
+ const minCharacterValue = codePointAt(minCharacter, 0);
13831
+ const maxCharacterValue = codePointAt(maxCharacter, 0);
13832
+ if (minCharacter.length === charSize(minCharacterValue) && maxCharacter.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
13833
+ error2(Diagnostics.Range_out_of_order_in_character_class, minStart, pos - minStart);
13834
+ }
13835
+ }
13836
+ }
13837
+ }
13838
+ function scanClassSetExpression() {
13839
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
13840
+ let isCharacterComplement = false;
13841
+ if (text2.charCodeAt(pos) === 94 /* caret */) {
13842
+ pos++;
13843
+ isCharacterComplement = true;
13844
+ }
13845
+ let expressionMayContainStrings = false;
13846
+ let ch = text2.charCodeAt(pos);
13847
+ if (isClassContentExit(ch)) {
13848
+ return;
13849
+ }
13850
+ let start2 = pos;
13851
+ let oprand;
13852
+ switch (text2.slice(pos, pos + 2)) {
13853
+ case "--":
13854
+ case "&&":
13855
+ error2(Diagnostics.Expected_a_class_set_oprand);
13856
+ mayContainStrings = false;
13857
+ break;
13858
+ default:
13859
+ oprand = scanClassSetOprand();
13860
+ break;
13861
+ }
13862
+ switch (text2.charCodeAt(pos)) {
13863
+ case 45 /* minus */:
13864
+ if (text2.charCodeAt(pos + 1) === 45 /* minus */) {
13865
+ if (isCharacterComplement && mayContainStrings) {
13866
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
13867
+ }
13868
+ expressionMayContainStrings = mayContainStrings;
13869
+ scanClassSetSubExpression(3 /* ClassSubtraction */);
13870
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13871
+ return;
13872
+ }
13873
+ break;
13874
+ case 38 /* ampersand */:
13875
+ if (text2.charCodeAt(pos + 1) === 38 /* ampersand */) {
13876
+ scanClassSetSubExpression(2 /* ClassIntersection */);
13877
+ if (isCharacterComplement && mayContainStrings) {
13878
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
13879
+ }
13880
+ expressionMayContainStrings = mayContainStrings;
13881
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13882
+ return;
13883
+ } else {
13884
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13885
+ }
13886
+ break;
13887
+ default:
13888
+ if (isCharacterComplement && mayContainStrings) {
13889
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
13890
+ }
13891
+ expressionMayContainStrings = mayContainStrings;
13892
+ break;
13893
+ }
13894
+ while (pos < end2) {
13895
+ ch = text2.charCodeAt(pos);
13896
+ switch (ch) {
13897
+ case 45 /* minus */:
13898
+ pos++;
13899
+ ch = text2.charCodeAt(pos);
13900
+ if (isClassContentExit(ch)) {
13901
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13902
+ return;
13903
+ }
13904
+ if (ch === 45 /* minus */) {
13905
+ pos++;
13906
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13907
+ start2 = pos - 2;
13908
+ oprand = text2.slice(start2, pos);
13909
+ continue;
13910
+ } else {
13911
+ if (!oprand) {
13912
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start2, pos - 1 - start2);
13913
+ }
13914
+ const secondStart = pos;
13915
+ const secondOprand = scanClassSetOprand();
13916
+ if (isCharacterComplement && mayContainStrings) {
13917
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
13918
+ }
13919
+ expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
13920
+ if (!secondOprand) {
13921
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
13922
+ break;
13923
+ }
13924
+ if (!oprand) {
13925
+ break;
13926
+ }
13927
+ const minCharacterValue = codePointAt(oprand, 0);
13928
+ const maxCharacterValue = codePointAt(secondOprand, 0);
13929
+ if (oprand.length === charSize(minCharacterValue) && secondOprand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
13930
+ error2(Diagnostics.Range_out_of_order_in_character_class, start2, pos - start2);
13931
+ }
13932
+ }
13933
+ break;
13934
+ case 38 /* ampersand */:
13935
+ start2 = pos;
13936
+ pos++;
13937
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
13938
+ pos++;
13939
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13940
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
13941
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13942
+ pos++;
13943
+ }
13944
+ } else {
13945
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
13946
+ }
13947
+ oprand = text2.slice(start2, pos);
13948
+ continue;
13949
+ }
13950
+ if (isClassContentExit(text2.charCodeAt(pos))) {
13951
+ break;
13952
+ }
13953
+ start2 = pos;
13954
+ switch (text2.slice(pos, pos + 2)) {
13955
+ case "--":
13956
+ case "&&":
13957
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
13958
+ pos += 2;
13959
+ oprand = text2.slice(start2, pos);
13960
+ break;
13961
+ default:
13962
+ oprand = scanClassSetOprand();
13963
+ break;
13964
+ }
13965
+ }
13966
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13967
+ }
13968
+ function scanClassSetSubExpression(expressionType) {
13969
+ let expressionMayContainStrings = mayContainStrings;
13970
+ while (pos < end2) {
13971
+ let ch = text2.charCodeAt(pos);
13972
+ if (isClassContentExit(ch)) {
13973
+ break;
13974
+ }
13975
+ switch (ch) {
13976
+ case 45 /* minus */:
13977
+ pos++;
13978
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
13979
+ pos++;
13980
+ if (expressionType !== 3 /* ClassSubtraction */) {
13981
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13982
+ }
13983
+ } else {
13984
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 1, 1);
13985
+ }
13986
+ break;
13987
+ case 38 /* ampersand */:
13988
+ pos++;
13989
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
13990
+ pos++;
13991
+ if (expressionType !== 2 /* ClassIntersection */) {
13992
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13993
+ }
13994
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
13995
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13996
+ pos++;
13997
+ }
13998
+ } else {
13999
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
14000
+ }
14001
+ break;
14002
+ default:
14003
+ switch (expressionType) {
14004
+ case 3 /* ClassSubtraction */:
14005
+ error2(Diagnostics._0_expected, pos, 0, "--");
14006
+ break;
14007
+ case 2 /* ClassIntersection */:
14008
+ error2(Diagnostics._0_expected, pos, 0, "&&");
14009
+ break;
14010
+ default:
14011
+ break;
14012
+ }
14013
+ break;
14014
+ }
14015
+ ch = text2.charCodeAt(pos);
14016
+ if (isClassContentExit(ch)) {
14017
+ error2(Diagnostics.Expected_a_class_set_oprand);
14018
+ break;
14019
+ }
14020
+ scanClassSetOprand();
14021
+ expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
14022
+ }
14023
+ mayContainStrings = expressionMayContainStrings;
14024
+ }
14025
+ function scanClassSetOprand() {
14026
+ mayContainStrings = false;
14027
+ switch (text2.charCodeAt(pos)) {
14028
+ case 91 /* openBracket */:
14029
+ pos++;
14030
+ scanClassSetExpression();
14031
+ scanExpectedChar(93 /* closeBracket */);
14032
+ return "";
14033
+ case 92 /* backslash */:
14034
+ pos++;
14035
+ if (scanCharacterClassEscape()) {
14036
+ return "";
14037
+ } else if (text2.charCodeAt(pos) === 113 /* q */) {
14038
+ pos++;
14039
+ if (text2.charCodeAt(pos) === 123 /* openBrace */) {
14040
+ pos++;
14041
+ scanClassStringDisjunctionContents();
14042
+ scanExpectedChar(125 /* closeBrace */);
14043
+ return "";
14044
+ } else {
14045
+ error2(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
14046
+ return "q";
14047
+ }
14048
+ }
14049
+ pos--;
14050
+ default:
14051
+ return scanClassSetCharacter();
14052
+ }
14053
+ }
14054
+ function scanClassStringDisjunctionContents() {
14055
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 123 /* openBrace */);
14056
+ let characterCount = 0;
14057
+ while (pos < end2) {
14058
+ const ch = text2.charCodeAt(pos);
14059
+ switch (ch) {
14060
+ case 125 /* closeBrace */:
14061
+ if (characterCount !== 1) {
14062
+ mayContainStrings = true;
14063
+ }
14064
+ return;
14065
+ case 124 /* bar */:
14066
+ if (characterCount !== 1) {
14067
+ mayContainStrings = true;
14068
+ }
14069
+ pos++;
14070
+ start = pos;
14071
+ characterCount = 0;
14072
+ break;
14073
+ default:
14074
+ scanClassSetCharacter();
14075
+ characterCount++;
14076
+ break;
14077
+ }
14078
+ }
14079
+ }
14080
+ function scanClassSetCharacter() {
14081
+ const ch = text2.charCodeAt(pos);
14082
+ if (ch === 92 /* backslash */) {
14083
+ pos++;
14084
+ const ch2 = text2.charCodeAt(pos);
14085
+ switch (ch2) {
14086
+ case 98 /* b */:
14087
+ pos++;
14088
+ return "\b";
14089
+ case 38 /* ampersand */:
14090
+ case 45 /* minus */:
14091
+ case 33 /* exclamation */:
14092
+ case 35 /* hash */:
14093
+ case 37 /* percent */:
14094
+ case 44 /* comma */:
14095
+ case 58 /* colon */:
14096
+ case 59 /* semicolon */:
14097
+ case 60 /* lessThan */:
14098
+ case 61 /* equals */:
14099
+ case 62 /* greaterThan */:
14100
+ case 64 /* at */:
14101
+ case 96 /* backtick */:
14102
+ case 126 /* tilde */:
14103
+ pos++;
14104
+ return String.fromCharCode(ch2);
14105
+ default:
14106
+ return scanCharacterEscape();
14107
+ }
14108
+ } else if (ch === text2.charCodeAt(pos + 1)) {
14109
+ switch (ch) {
14110
+ case 38 /* ampersand */:
14111
+ case 33 /* exclamation */:
14112
+ case 35 /* hash */:
14113
+ case 37 /* percent */:
14114
+ case 42 /* asterisk */:
14115
+ case 43 /* plus */:
14116
+ case 44 /* comma */:
14117
+ case 46 /* dot */:
14118
+ case 58 /* colon */:
14119
+ case 59 /* semicolon */:
14120
+ case 60 /* lessThan */:
14121
+ case 61 /* equals */:
14122
+ case 62 /* greaterThan */:
14123
+ case 63 /* question */:
14124
+ case 64 /* at */:
14125
+ case 96 /* backtick */:
14126
+ case 126 /* tilde */:
14127
+ error2(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
14128
+ pos += 2;
14129
+ return text2.substring(pos - 2, pos);
14130
+ }
14131
+ }
14132
+ switch (ch) {
14133
+ case 47 /* slash */:
14134
+ case 40 /* openParen */:
14135
+ case 41 /* closeParen */:
14136
+ case 91 /* openBracket */:
14137
+ case 93 /* closeBracket */:
14138
+ case 123 /* openBrace */:
14139
+ case 125 /* closeBrace */:
14140
+ case 45 /* minus */:
14141
+ case 124 /* bar */:
14142
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
14143
+ pos++;
14144
+ return String.fromCharCode(ch);
14145
+ }
14146
+ return scanSourceCharacter();
14147
+ }
14148
+ function scanClassAtom() {
14149
+ if (text2.charCodeAt(pos) === 92 /* backslash */) {
14150
+ pos++;
14151
+ const ch = text2.charCodeAt(pos);
14152
+ switch (ch) {
14153
+ case 98 /* b */:
14154
+ pos++;
14155
+ return "\b";
14156
+ case 45 /* minus */:
14157
+ pos++;
14158
+ return String.fromCharCode(ch);
14159
+ default:
14160
+ if (scanCharacterClassEscape()) {
14161
+ return "";
14162
+ }
14163
+ return scanCharacterEscape();
14164
+ }
14165
+ } else {
14166
+ return scanSourceCharacter();
14167
+ }
14168
+ }
14169
+ function scanCharacterClassEscape() {
14170
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
14171
+ let isCharacterComplement = false;
14172
+ const start2 = pos - 1;
14173
+ const ch = text2.charCodeAt(pos);
14174
+ switch (ch) {
14175
+ case 100 /* d */:
14176
+ case 68 /* D */:
14177
+ case 115 /* s */:
14178
+ case 83 /* S */:
14179
+ case 119 /* w */:
14180
+ case 87 /* W */:
14181
+ pos++;
14182
+ return true;
14183
+ case 80 /* P */:
14184
+ isCharacterComplement = true;
14185
+ case 112 /* p */:
14186
+ pos++;
14187
+ if (text2.charCodeAt(pos) === 123 /* openBrace */) {
14188
+ pos++;
14189
+ const propertyNameOrValueStart = pos;
14190
+ const propertyNameOrValue = scanWordCharacters();
14191
+ if (text2.charCodeAt(pos) === 61 /* equals */) {
14192
+ const propertyName = nonBinaryUnicodeProperties.get(propertyNameOrValue);
14193
+ if (pos === propertyNameOrValueStart) {
14194
+ error2(Diagnostics.Expected_a_Unicode_property_name);
14195
+ } else if (propertyName === void 0) {
14196
+ error2(Diagnostics.Unknown_Unicode_property_name, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14197
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, nonBinaryUnicodeProperties.keys(), identity);
14198
+ if (suggestion) {
14199
+ error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
14200
+ }
14201
+ }
14202
+ pos++;
14203
+ const propertyValueStart = pos;
14204
+ const propertyValue = scanWordCharacters();
14205
+ if (pos === propertyValueStart) {
14206
+ error2(Diagnostics.Expected_a_Unicode_property_value);
14207
+ } else if (propertyName !== void 0 && !valuesOfNonBinaryUnicodeProperties[propertyName].has(propertyValue)) {
14208
+ error2(Diagnostics.Unknown_Unicode_property_value, propertyValueStart, pos - propertyValueStart);
14209
+ const suggestion = getSpellingSuggestion(propertyValue, valuesOfNonBinaryUnicodeProperties[propertyName], identity);
14210
+ if (suggestion) {
14211
+ error2(Diagnostics.Did_you_mean_0, propertyValueStart, pos - propertyValueStart, suggestion);
14212
+ }
14213
+ }
14214
+ } else {
14215
+ if (pos === propertyNameOrValueStart) {
14216
+ error2(Diagnostics.Expected_a_Unicode_property_name_or_value);
14217
+ } else if (binaryUnicodePropertiesOfStrings.has(propertyNameOrValue)) {
14218
+ if (!unicodeSetsMode) {
14219
+ error2(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);
14220
+ } else if (isCharacterComplement) {
14221
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14222
+ } else {
14223
+ mayContainStrings = true;
14224
+ }
14225
+ } else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
14226
+ error2(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14227
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
14228
+ if (suggestion) {
14229
+ error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
14230
+ }
14231
+ }
14232
+ }
14233
+ scanExpectedChar(125 /* closeBrace */);
14234
+ if (!unicodeMode) {
14235
+ error2(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
14236
+ }
14237
+ } else if (unicodeMode) {
14238
+ error2(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
14239
+ }
14240
+ return true;
14241
+ }
14242
+ return false;
14243
+ }
14244
+ function scanWordCharacters() {
14245
+ let value = "";
14246
+ while (pos < end2) {
14247
+ const ch = text2.charCodeAt(pos);
14248
+ if (!isWordCharacter(ch)) {
14249
+ break;
14250
+ }
14251
+ value += String.fromCharCode(ch);
14252
+ pos++;
14253
+ }
14254
+ return value;
14255
+ }
14256
+ function scanSourceCharacter() {
14257
+ const size = unicodeMode ? charSize(codePointAt(text2, pos)) : 1;
14258
+ pos += size;
14259
+ return text2.substring(pos - size, pos);
14260
+ }
14261
+ function scanExpectedChar(ch) {
14262
+ if (text2.charCodeAt(pos) === ch) {
14263
+ pos++;
14264
+ } else {
14265
+ error2(Diagnostics._0_expected, pos, 0, String.fromCharCode(ch));
14266
+ }
14267
+ }
14268
+ scanDisjunction(
14269
+ /*isInGroup*/
14270
+ false
14271
+ );
14272
+ forEach(groupNameReferences, (reference) => {
14273
+ if (!groupSpecifiers.has(reference.name)) {
14274
+ error2(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
14275
+ }
14276
+ });
14277
+ forEach(decimalEscapes, (escape) => {
14278
+ if (escape.value > numberOfCapturingGroups) {
14279
+ if (numberOfCapturingGroups) {
14280
+ error2(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);
14281
+ } else {
14282
+ error2(Diagnostics.Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression, escape.pos, escape.end - escape.pos);
14283
+ }
14284
+ }
14285
+ });
14286
+ }
13332
14287
  }
13333
14288
  function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
13334
14289
  const type = getDirectiveFromComment(text2.trimStart(), commentDirectiveRegEx);
@@ -13555,9 +14510,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13555
14510
  pos--;
13556
14511
  const extendedCookedChar = peekExtendedUnicodeEscape();
13557
14512
  if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
13558
- pos += 3;
13559
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
13560
- tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
14513
+ tokenValue = scanExtendedUnicodeEscape(
14514
+ /*shouldEmitInvalidEscapeError*/
14515
+ true
14516
+ ) + scanIdentifierParts();
13561
14517
  return token = getIdentifierToken();
13562
14518
  }
13563
14519
  const cookedChar = peekUnicodeEscape();
@@ -13697,6 +14653,22 @@ var utf16EncodeAsStringWorker = String.fromCodePoint ? (codePoint) => String.fro
13697
14653
  function utf16EncodeAsString(codePoint) {
13698
14654
  return utf16EncodeAsStringWorker(codePoint);
13699
14655
  }
14656
+ var nonBinaryUnicodeProperties = new Map(Object.entries({
14657
+ General_Category: "General_Category",
14658
+ gc: "General_Category",
14659
+ Script: "Script",
14660
+ sc: "Script",
14661
+ Script_Extensions: "Script_Extensions",
14662
+ scx: "Script_Extensions"
14663
+ }));
14664
+ 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"]);
14665
+ 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"]);
14666
+ var valuesOfNonBinaryUnicodeProperties = {
14667
+ 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"]),
14668
+ 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"]),
14669
+ Script_Extensions: /* @__PURE__ */ new Set()
14670
+ // Currently empty
14671
+ };
13700
14672
 
13701
14673
  // src/compiler/utilitiesPublic.ts
13702
14674
  function isExternalModuleNameRelative(moduleName) {
@@ -15916,6 +16888,10 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
15916
16888
  ],
15917
16889
  es2022: [
15918
16890
  "at"
16891
+ ],
16892
+ esnext: [
16893
+ "isWellFormed",
16894
+ "toWellFormed"
15919
16895
  ]
15920
16896
  })),
15921
16897
  StringConstructor: new Map(Object.entries({
@@ -16607,6 +17583,10 @@ function isVarUsing(node) {
16607
17583
  function isVarConst(node) {
16608
17584
  return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 2 /* Const */;
16609
17585
  }
17586
+ function isVarConstLike(node) {
17587
+ const blockScopeKind = getCombinedNodeFlags(node) & 7 /* BlockScoped */;
17588
+ return blockScopeKind === 2 /* Const */ || blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */;
17589
+ }
16610
17590
  function isLet(node) {
16611
17591
  return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 1 /* Let */;
16612
17592
  }
@@ -18546,7 +19526,7 @@ function isNamedEvaluation(node, cb) {
18546
19526
  function isPushOrUnshiftIdentifier(node) {
18547
19527
  return node.escapedText === "push" || node.escapedText === "unshift";
18548
19528
  }
18549
- function isParameterDeclaration(node) {
19529
+ function isPartOfParameterDeclaration(node) {
18550
19530
  const root = getRootDeclaration(node);
18551
19531
  return root.kind === 169 /* Parameter */;
18552
19532
  }
@@ -20937,6 +21917,9 @@ function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)
20937
21917
  function getStrictOptionValue(compilerOptions, flag) {
20938
21918
  return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
20939
21919
  }
21920
+ function getNameOfScriptTarget(scriptTarget) {
21921
+ return forEachEntry(targetOptionDeclaration.type, (value, key) => value === scriptTarget ? key : void 0);
21922
+ }
20940
21923
  function getEmitStandardClassFields(compilerOptions) {
20941
21924
  return compilerOptions.useDefineForClassFields !== false && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */;
20942
21925
  }
@@ -22045,26 +23028,28 @@ function replaceFirstStar(s, replacement) {
22045
23028
  function getNameFromImportAttribute(node) {
22046
23029
  return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
22047
23030
  }
22048
- function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false) {
22049
- return { value, isSyntacticallyString, resolvedOtherFiles };
23031
+ function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false, hasExternalReferences = false) {
23032
+ return { value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences };
22050
23033
  }
22051
23034
  function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameExpression }) {
22052
23035
  function evaluate(expr, location) {
22053
23036
  let isSyntacticallyString = false;
22054
23037
  let resolvedOtherFiles = false;
23038
+ let hasExternalReferences = false;
22055
23039
  expr = skipParentheses(expr);
22056
23040
  switch (expr.kind) {
22057
23041
  case 224 /* PrefixUnaryExpression */:
22058
23042
  const result = evaluate(expr.operand, location);
22059
23043
  resolvedOtherFiles = result.resolvedOtherFiles;
23044
+ hasExternalReferences = result.hasExternalReferences;
22060
23045
  if (typeof result.value === "number") {
22061
23046
  switch (expr.operator) {
22062
23047
  case 40 /* PlusToken */:
22063
- return evaluatorResult(result.value, isSyntacticallyString, resolvedOtherFiles);
23048
+ return evaluatorResult(result.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22064
23049
  case 41 /* MinusToken */:
22065
- return evaluatorResult(-result.value, isSyntacticallyString, resolvedOtherFiles);
23050
+ return evaluatorResult(-result.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22066
23051
  case 55 /* TildeToken */:
22067
- return evaluatorResult(~result.value, isSyntacticallyString, resolvedOtherFiles);
23052
+ return evaluatorResult(~result.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22068
23053
  }
22069
23054
  }
22070
23055
  break;
@@ -22073,38 +23058,40 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
22073
23058
  const right = evaluate(expr.right, location);
22074
23059
  isSyntacticallyString = (left.isSyntacticallyString || right.isSyntacticallyString) && expr.operatorToken.kind === 40 /* PlusToken */;
22075
23060
  resolvedOtherFiles = left.resolvedOtherFiles || right.resolvedOtherFiles;
23061
+ hasExternalReferences = left.hasExternalReferences || right.hasExternalReferences;
22076
23062
  if (typeof left.value === "number" && typeof right.value === "number") {
22077
23063
  switch (expr.operatorToken.kind) {
22078
23064
  case 52 /* BarToken */:
22079
- return evaluatorResult(left.value | right.value, isSyntacticallyString, resolvedOtherFiles);
23065
+ return evaluatorResult(left.value | right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22080
23066
  case 51 /* AmpersandToken */:
22081
- return evaluatorResult(left.value & right.value, isSyntacticallyString, resolvedOtherFiles);
23067
+ return evaluatorResult(left.value & right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22082
23068
  case 49 /* GreaterThanGreaterThanToken */:
22083
- return evaluatorResult(left.value >> right.value, isSyntacticallyString, resolvedOtherFiles);
23069
+ return evaluatorResult(left.value >> right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22084
23070
  case 50 /* GreaterThanGreaterThanGreaterThanToken */:
22085
- return evaluatorResult(left.value >>> right.value, isSyntacticallyString, resolvedOtherFiles);
23071
+ return evaluatorResult(left.value >>> right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22086
23072
  case 48 /* LessThanLessThanToken */:
22087
- return evaluatorResult(left.value << right.value, isSyntacticallyString, resolvedOtherFiles);
23073
+ return evaluatorResult(left.value << right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22088
23074
  case 53 /* CaretToken */:
22089
- return evaluatorResult(left.value ^ right.value, isSyntacticallyString, resolvedOtherFiles);
23075
+ return evaluatorResult(left.value ^ right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22090
23076
  case 42 /* AsteriskToken */:
22091
- return evaluatorResult(left.value * right.value, isSyntacticallyString, resolvedOtherFiles);
23077
+ return evaluatorResult(left.value * right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22092
23078
  case 44 /* SlashToken */:
22093
- return evaluatorResult(left.value / right.value, isSyntacticallyString, resolvedOtherFiles);
23079
+ return evaluatorResult(left.value / right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22094
23080
  case 40 /* PlusToken */:
22095
- return evaluatorResult(left.value + right.value, isSyntacticallyString, resolvedOtherFiles);
23081
+ return evaluatorResult(left.value + right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22096
23082
  case 41 /* MinusToken */:
22097
- return evaluatorResult(left.value - right.value, isSyntacticallyString, resolvedOtherFiles);
23083
+ return evaluatorResult(left.value - right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22098
23084
  case 45 /* PercentToken */:
22099
- return evaluatorResult(left.value % right.value, isSyntacticallyString, resolvedOtherFiles);
23085
+ return evaluatorResult(left.value % right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22100
23086
  case 43 /* AsteriskAsteriskToken */:
22101
- return evaluatorResult(left.value ** right.value, isSyntacticallyString, resolvedOtherFiles);
23087
+ return evaluatorResult(left.value ** right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
22102
23088
  }
22103
23089
  } else if ((typeof left.value === "string" || typeof left.value === "number") && (typeof right.value === "string" || typeof right.value === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
22104
23090
  return evaluatorResult(
22105
23091
  "" + left.value + right.value,
22106
23092
  isSyntacticallyString,
22107
- resolvedOtherFiles
23093
+ resolvedOtherFiles,
23094
+ hasExternalReferences
22108
23095
  );
22109
23096
  }
22110
23097
  break;
@@ -22134,12 +23121,14 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
22134
23121
  /*value*/
22135
23122
  void 0,
22136
23123
  isSyntacticallyString,
22137
- resolvedOtherFiles
23124
+ resolvedOtherFiles,
23125
+ hasExternalReferences
22138
23126
  );
22139
23127
  }
22140
23128
  function evaluateTemplateExpression(expr, location) {
22141
23129
  let result = expr.head.text;
22142
23130
  let resolvedOtherFiles = false;
23131
+ let hasExternalReferences = false;
22143
23132
  for (const span of expr.templateSpans) {
22144
23133
  const spanResult = evaluate(span.expression, location);
22145
23134
  if (spanResult.value === void 0) {
@@ -22153,12 +23142,14 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
22153
23142
  result += spanResult.value;
22154
23143
  result += span.literal.text;
22155
23144
  resolvedOtherFiles || (resolvedOtherFiles = spanResult.resolvedOtherFiles);
23145
+ hasExternalReferences || (hasExternalReferences = spanResult.hasExternalReferences);
22156
23146
  }
22157
23147
  return evaluatorResult(
22158
23148
  result,
22159
23149
  /*isSyntacticallyString*/
22160
23150
  true,
22161
- resolvedOtherFiles
23151
+ resolvedOtherFiles,
23152
+ hasExternalReferences
22162
23153
  );
22163
23154
  }
22164
23155
  return evaluate;
@@ -22388,7 +23379,7 @@ function createNameResolver({
22388
23379
  break;
22389
23380
  case 208 /* BindingElement */:
22390
23381
  if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
22391
- if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
23382
+ if (isPartOfParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
22392
23383
  associatedDeclarationForContainingInitializerOrBindingName = location;
22393
23384
  }
22394
23385
  }
@@ -22537,6 +23528,55 @@ function createNameResolver({
22537
23528
  return false;
22538
23529
  }
22539
23530
  }
23531
+ function isPrimitiveLiteralValue(node, includeBigInt = true) {
23532
+ Debug.type(node);
23533
+ switch (node.kind) {
23534
+ case 112 /* TrueKeyword */:
23535
+ case 97 /* FalseKeyword */:
23536
+ case 9 /* NumericLiteral */:
23537
+ case 11 /* StringLiteral */:
23538
+ case 15 /* NoSubstitutionTemplateLiteral */:
23539
+ return true;
23540
+ case 10 /* BigIntLiteral */:
23541
+ return includeBigInt;
23542
+ case 224 /* PrefixUnaryExpression */:
23543
+ if (node.operator === 41 /* MinusToken */) {
23544
+ return isNumericLiteral(node.operand) || includeBigInt && isBigIntLiteral(node.operand);
23545
+ }
23546
+ if (node.operator === 40 /* PlusToken */) {
23547
+ return isNumericLiteral(node.operand);
23548
+ }
23549
+ return false;
23550
+ default:
23551
+ assertType(node);
23552
+ return false;
23553
+ }
23554
+ }
23555
+ function unwrapParenthesizedExpression(o) {
23556
+ while (o.kind === 217 /* ParenthesizedExpression */) {
23557
+ o = o.expression;
23558
+ }
23559
+ return o;
23560
+ }
23561
+ function hasInferredType(node) {
23562
+ Debug.type(node);
23563
+ switch (node.kind) {
23564
+ case 169 /* Parameter */:
23565
+ case 171 /* PropertySignature */:
23566
+ case 172 /* PropertyDeclaration */:
23567
+ case 208 /* BindingElement */:
23568
+ case 211 /* PropertyAccessExpression */:
23569
+ case 212 /* ElementAccessExpression */:
23570
+ case 226 /* BinaryExpression */:
23571
+ case 260 /* VariableDeclaration */:
23572
+ case 277 /* ExportAssignment */:
23573
+ case 303 /* PropertyAssignment */:
23574
+ return true;
23575
+ default:
23576
+ assertType(node);
23577
+ return false;
23578
+ }
23579
+ }
22540
23580
 
22541
23581
  // src/compiler/factory/baseNodeFactory.ts
22542
23582
  function createBaseNodeFactory() {
@@ -29599,6 +30639,8 @@ function isSyntaxList(n) {
29599
30639
  // src/compiler/factory/nodeChildren.ts
29600
30640
  var nodeChildren = /* @__PURE__ */ new WeakMap();
29601
30641
  function getNodeChildren(node) {
30642
+ if (!isNodeKind(node.kind))
30643
+ return emptyArray;
29602
30644
  return nodeChildren.get(node);
29603
30645
  }
29604
30646
  function setNodeChildren(node, children) {
@@ -31935,7 +32977,10 @@ var Parser;
31935
32977
  function parseErrorAtPosition(start, length2, message, ...args) {
31936
32978
  const lastError = lastOrUndefined(parseDiagnostics);
31937
32979
  let result;
31938
- if (!lastError || start !== lastError.start) {
32980
+ if (message.category === 3 /* Message */ && lastError && start === lastError.start && length2 === lastError.length) {
32981
+ result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
32982
+ addRelatedInfo(lastError, result);
32983
+ } else if (!lastError || start !== lastError.start) {
31939
32984
  result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
31940
32985
  parseDiagnostics.push(result);
31941
32986
  }
@@ -32091,7 +33136,7 @@ var Parser;
32091
33136
  parseErrorForInvalidName(Diagnostics.Type_alias_name_cannot_be_0, Diagnostics.Type_alias_must_be_given_a_name, 64 /* EqualsToken */);
32092
33137
  return;
32093
33138
  }
32094
- const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, (n) => n) ?? getSpaceSuggestion(expressionText);
33139
+ const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, identity) ?? getSpaceSuggestion(expressionText);
32095
33140
  if (suggestion) {
32096
33141
  parseErrorAt(pos, node.end, Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion);
32097
33142
  return;
@@ -38888,6 +39933,7 @@ var libEntries = [
38888
39933
  ["esnext.object", "lib.esnext.object.d.ts"],
38889
39934
  ["esnext.array", "lib.esnext.array.d.ts"],
38890
39935
  ["esnext.regexp", "lib.esnext.regexp.d.ts"],
39936
+ ["esnext.string", "lib.esnext.string.d.ts"],
38891
39937
  ["decorators", "lib.decorators.d.ts"],
38892
39938
  ["decorators.legacy", "lib.decorators.legacy.d.ts"]
38893
39939
  ];
@@ -39456,6 +40502,15 @@ var commandOptionsWithoutBuild = [
39456
40502
  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,
39457
40503
  defaultValueDescription: false
39458
40504
  },
40505
+ {
40506
+ name: "isolatedDeclarations",
40507
+ type: "boolean",
40508
+ category: Diagnostics.Interop_Constraints,
40509
+ description: Diagnostics.Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files,
40510
+ defaultValueDescription: false,
40511
+ affectsBuildInfo: true,
40512
+ affectsSemanticDiagnostics: true
40513
+ },
39459
40514
  // Strict Type Checks
39460
40515
  {
39461
40516
  name: "strict",
@@ -47512,7 +48567,7 @@ function createBinder() {
47512
48567
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
47513
48568
  } else if (isBlockOrCatchScoped(node)) {
47514
48569
  bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
47515
- } else if (isParameterDeclaration(node)) {
48570
+ } else if (isPartOfParameterDeclaration(node)) {
47516
48571
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
47517
48572
  } else {
47518
48573
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
@@ -49053,6 +50108,17 @@ function createTypeChecker(host) {
49053
50108
  var checkBinaryExpression = createCheckBinaryExpression();
49054
50109
  var emitResolver = createResolver();
49055
50110
  var nodeBuilder = createNodeBuilder();
50111
+ var syntacticNodeBuilder = createSyntacticTypeNodeBuilder(compilerOptions, {
50112
+ isEntityNameVisible,
50113
+ isExpandoFunctionDeclaration,
50114
+ isNonNarrowedBindableName,
50115
+ getAllAccessorDeclarations: getAllAccessorDeclarationsForDeclaration,
50116
+ requiresAddingImplicitUndefined,
50117
+ isUndefinedIdentifierExpression(node) {
50118
+ Debug.assert(isExpressionNode(node));
50119
+ return getSymbolAtLocation(node) === undefinedSymbol;
50120
+ }
50121
+ });
49056
50122
  var evaluate = createEvaluator({
49057
50123
  evaluateElementAccessExpression,
49058
50124
  evaluateEntityNameExpression
@@ -53079,7 +54145,7 @@ function createTypeChecker(host) {
53079
54145
  }
53080
54146
  return meaning;
53081
54147
  }
53082
- function isEntityNameVisible(entityName, enclosingDeclaration) {
54148
+ function isEntityNameVisible(entityName, enclosingDeclaration, shouldComputeAliasToMakeVisible = true) {
53083
54149
  const meaning = getMeaningOfEntityNameReference(entityName);
53084
54150
  const firstIdentifier = getFirstIdentifier(entityName);
53085
54151
  const symbol = resolveName(
@@ -53109,11 +54175,7 @@ function createTypeChecker(host) {
53109
54175
  ).accessibility === 0 /* Accessible */) {
53110
54176
  return { accessibility: 0 /* Accessible */ };
53111
54177
  }
53112
- return symbol && hasVisibleDeclarations(
53113
- symbol,
53114
- /*shouldComputeAliasToMakeVisible*/
53115
- true
53116
- ) || {
54178
+ return symbol && hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) || {
53117
54179
  accessibility: 1 /* NotAccessible */,
53118
54180
  errorSymbolName: getTextOfNode(firstIdentifier),
53119
54181
  errorNode: firstIdentifier
@@ -53262,6 +54324,16 @@ function createTypeChecker(host) {
53262
54324
  return setTextRange(setOriginalNode(range, location), location);
53263
54325
  }
53264
54326
  function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
54327
+ const oldFlags = context.flags;
54328
+ if (expr && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
54329
+ syntacticNodeBuilder.serializeTypeOfExpression(expr, context, addUndefined);
54330
+ }
54331
+ context.flags |= -2147483648 /* NoSyntacticPrinter */;
54332
+ const result = expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined);
54333
+ context.flags = oldFlags;
54334
+ return result;
54335
+ }
54336
+ function expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined) {
53265
54337
  if (expr) {
53266
54338
  const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
53267
54339
  if (typeNode && !isConstTypeReference(typeNode)) {
@@ -55206,6 +56278,10 @@ function createTypeChecker(host) {
55206
56278
  }
55207
56279
  const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
55208
56280
  const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
56281
+ if (decl && hasInferredType(decl) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
56282
+ syntacticNodeBuilder.serializeTypeOfDeclaration(decl, context);
56283
+ }
56284
+ context.flags |= -2147483648 /* NoSyntacticPrinter */;
55209
56285
  const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
55210
56286
  context.flags = oldFlags;
55211
56287
  return result;
@@ -55227,6 +56303,10 @@ function createTypeChecker(host) {
55227
56303
  let returnTypeNode;
55228
56304
  const returnType = getReturnTypeOfSignature(signature);
55229
56305
  if (returnType && !(suppressAny && isTypeAny(returnType))) {
56306
+ if (signature.declaration && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
56307
+ syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, context);
56308
+ }
56309
+ context.flags |= -2147483648 /* NoSyntacticPrinter */;
55230
56310
  returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
55231
56311
  } else if (!suppressAny) {
55232
56312
  returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
@@ -55294,7 +56374,7 @@ function createTypeChecker(host) {
55294
56374
  );
55295
56375
  if (sym) {
55296
56376
  if (sym.flags & 1 /* FunctionScopedVariable */ && sym.valueDeclaration) {
55297
- if (isParameterDeclaration(sym.valueDeclaration)) {
56377
+ if (isPartOfParameterDeclaration(sym.valueDeclaration)) {
55298
56378
  return { introducesError, node: attachSymbolToLeftmostIdentifier(node) };
55299
56379
  }
55300
56380
  }
@@ -56000,7 +57080,7 @@ function createTypeChecker(host) {
56000
57080
  }
56001
57081
  }
56002
57082
  function includePrivateSymbol(symbol) {
56003
- if (some(symbol.declarations, isParameterDeclaration))
57083
+ if (some(symbol.declarations, isPartOfParameterDeclaration))
56004
57084
  return;
56005
57085
  Debug.assertIsDefined(deferredPrivatesStack[deferredPrivatesStack.length - 1]);
56006
57086
  getUnusedName(unescapeLeadingUnderscores(symbol.escapedName), symbol);
@@ -57587,7 +58667,7 @@ function createTypeChecker(host) {
57587
58667
  return parentType;
57588
58668
  }
57589
58669
  const pattern = declaration.parent;
57590
- if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
58670
+ if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isPartOfParameterDeclaration(declaration)) {
57591
58671
  parentType = getNonNullableType(parentType);
57592
58672
  } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
57593
58673
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
@@ -64982,13 +66062,18 @@ function createTypeChecker(host) {
64982
66062
  const typeArguments = map(typeParameters, (t) => getMappedType(t, combinedMapper));
64983
66063
  const newAliasSymbol = aliasSymbol || type.aliasSymbol;
64984
66064
  const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
64985
- const id = getTypeListId(typeArguments) + getAliasId(newAliasSymbol, newAliasTypeArguments);
66065
+ const id = (type.objectFlags & 134217728 /* SingleSignatureType */ ? "S" : "") + getTypeListId(typeArguments) + getAliasId(newAliasSymbol, newAliasTypeArguments);
64986
66066
  if (!target.instantiations) {
64987
66067
  target.instantiations = /* @__PURE__ */ new Map();
64988
66068
  target.instantiations.set(getTypeListId(typeParameters) + getAliasId(target.aliasSymbol, target.aliasTypeArguments), target);
64989
66069
  }
64990
66070
  let result = target.instantiations.get(id);
64991
66071
  if (!result) {
66072
+ if (type.objectFlags & 134217728 /* SingleSignatureType */) {
66073
+ result = instantiateAnonymousType(type, mapper);
66074
+ target.instantiations.set(id, result);
66075
+ return result;
66076
+ }
64992
66077
  const newMapper = createTypeMapper(typeParameters, typeArguments);
64993
66078
  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);
64994
66079
  target.instantiations.set(id, result);
@@ -71825,7 +72910,7 @@ function createTypeChecker(host) {
71825
72910
  case 206 /* ObjectBindingPattern */:
71826
72911
  case 207 /* ArrayBindingPattern */:
71827
72912
  const rootDeclaration = getRootDeclaration(node.parent);
71828
- return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
72913
+ return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration(rootDeclaration) && isVarConstLike2(rootDeclaration);
71829
72914
  }
71830
72915
  return false;
71831
72916
  }
@@ -71964,7 +73049,7 @@ function createTypeChecker(host) {
71964
73049
  if (!isReachableFlowNode(flow)) {
71965
73050
  return unreachableNeverType;
71966
73051
  }
71967
- if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConstLike(node))) {
73052
+ if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConstLike2(node))) {
71968
73053
  const init = getDeclaredExpandoInitializer(node);
71969
73054
  if (init && (init.kind === 218 /* FunctionExpression */ || init.kind === 219 /* ArrowFunction */)) {
71970
73055
  return getTypeAtFlowNode(flow.antecedent);
@@ -76204,7 +77289,10 @@ function createTypeChecker(host) {
76204
77289
  if (indexInfo.isReadonly && (isAssignmentTarget(node) || isDeleteTarget(node))) {
76205
77290
  error2(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
76206
77291
  }
76207
- propType = compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node) ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
77292
+ propType = indexInfo.type;
77293
+ if (compilerOptions.noUncheckedIndexedAccess && getAssignmentTargetKind(node) !== 1 /* Definite */) {
77294
+ propType = getUnionType([propType, missingType]);
77295
+ }
76208
77296
  if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
76209
77297
  error2(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText));
76210
77298
  }
@@ -76654,7 +77742,16 @@ function createTypeChecker(host) {
76654
77742
  return errorType;
76655
77743
  }
76656
77744
  const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
76657
- const accessFlags = isAssignmentTarget(node) ? 4 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 /* NoIndexSignatures */ : 0) : 32 /* ExpressionPosition */;
77745
+ const assignmentTargetKind = getAssignmentTargetKind(node);
77746
+ let accessFlags;
77747
+ if (assignmentTargetKind === 0 /* None */) {
77748
+ accessFlags = 32 /* ExpressionPosition */;
77749
+ } else {
77750
+ accessFlags = 4 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 /* NoIndexSignatures */ : 0);
77751
+ if (assignmentTargetKind === 2 /* Compound */) {
77752
+ accessFlags |= 32 /* ExpressionPosition */;
77753
+ }
77754
+ }
76658
77755
  const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
76659
77756
  return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
76660
77757
  }
@@ -78439,7 +79536,7 @@ function createTypeChecker(host) {
78439
79536
  let name;
78440
79537
  let decl;
78441
79538
  if (isVariableDeclaration(node.parent) && node.parent.initializer === node) {
78442
- if (!isInJSFile(node) && !(isVarConstLike(node.parent) && isFunctionLikeDeclaration(node))) {
79539
+ if (!isInJSFile(node) && !(isVarConstLike2(node.parent) && isFunctionLikeDeclaration(node))) {
78443
79540
  return void 0;
78444
79541
  }
78445
79542
  name = node.parent.name;
@@ -83882,7 +84979,7 @@ function createTypeChecker(host) {
83882
84979
  for (const node of potentialUnusedRenamedBindingElementsInTypes) {
83883
84980
  if (!((_a = getSymbolOfDeclaration(node)) == null ? void 0 : _a.isReferenced)) {
83884
84981
  const wrappingDeclaration = walkUpBindingElementsAndPatterns(node);
83885
- Debug.assert(isParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
84982
+ Debug.assert(isPartOfParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
83886
84983
  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));
83887
84984
  if (!wrappingDeclaration.type) {
83888
84985
  addRelatedInfo(
@@ -84070,7 +85167,7 @@ function createTypeChecker(host) {
84070
85167
  }
84071
85168
  }
84072
85169
  function checkVarDeclaredNamesNotShadowed(node) {
84073
- if ((getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) {
85170
+ if ((getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */) !== 0 || isPartOfParameterDeclaration(node)) {
84074
85171
  return;
84075
85172
  }
84076
85173
  const symbol = getSymbolOfDeclaration(node);
@@ -84118,7 +85215,7 @@ function createTypeChecker(host) {
84118
85215
  }
84119
85216
  }
84120
85217
  if (isBindingElement(node)) {
84121
- if (node.propertyName && isIdentifier(node.name) && isParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
85218
+ if (node.propertyName && isIdentifier(node.name) && isPartOfParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
84122
85219
  potentialUnusedRenamedBindingElementsInTypes.push(node);
84123
85220
  return;
84124
85221
  }
@@ -84163,7 +85260,7 @@ function createTypeChecker(host) {
84163
85260
  }
84164
85261
  forEach(node.name.elements, checkSourceElement);
84165
85262
  }
84166
- if (node.initializer && isParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
85263
+ if (node.initializer && isPartOfParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
84167
85264
  error2(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
84168
85265
  return;
84169
85266
  }
@@ -86315,10 +87412,18 @@ function createTypeChecker(host) {
86315
87412
  /*isSyntacticallyString*/
86316
87413
  false,
86317
87414
  /*resolvedOtherFiles*/
87415
+ true,
87416
+ /*hasExternalReferences*/
86318
87417
  true
86319
87418
  );
86320
87419
  }
86321
- return result;
87420
+ return evaluatorResult(
87421
+ result.value,
87422
+ result.isSyntacticallyString,
87423
+ result.resolvedOtherFiles,
87424
+ /*hasExternalReferences*/
87425
+ true
87426
+ );
86322
87427
  }
86323
87428
  }
86324
87429
  return evaluatorResult(
@@ -86365,7 +87470,17 @@ function createTypeChecker(host) {
86365
87470
  0
86366
87471
  );
86367
87472
  }
86368
- return getEnumMemberValue(declaration);
87473
+ const value = getEnumMemberValue(declaration);
87474
+ if (location.parent !== declaration.parent) {
87475
+ return evaluatorResult(
87476
+ value.value,
87477
+ value.isSyntacticallyString,
87478
+ value.resolvedOtherFiles,
87479
+ /*hasExternalReferences*/
87480
+ true
87481
+ );
87482
+ }
87483
+ return value;
86369
87484
  }
86370
87485
  function checkEnumDeclaration(node) {
86371
87486
  addLazyDiagnostic(() => checkEnumDeclarationWorker(node));
@@ -88476,12 +89591,24 @@ function createTypeChecker(host) {
88476
89591
  return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
88477
89592
  }
88478
89593
  function isExpandoFunctionDeclaration(node) {
88479
- const declaration = getParseTreeNode(node, isFunctionDeclaration);
89594
+ const declaration = getParseTreeNode(node, (n) => isFunctionDeclaration(n) || isVariableDeclaration(n));
88480
89595
  if (!declaration) {
88481
89596
  return false;
88482
89597
  }
88483
- const symbol = getSymbolOfDeclaration(declaration);
88484
- if (!symbol || !(symbol.flags & 16 /* Function */)) {
89598
+ let symbol;
89599
+ if (isVariableDeclaration(declaration)) {
89600
+ if (declaration.type || !isInJSFile(declaration) && !isVarConstLike2(declaration)) {
89601
+ return false;
89602
+ }
89603
+ const initializer = getDeclaredExpandoInitializer(declaration);
89604
+ if (!initializer || !canHaveSymbol(initializer)) {
89605
+ return false;
89606
+ }
89607
+ symbol = getSymbolOfDeclaration(initializer);
89608
+ } else {
89609
+ symbol = getSymbolOfDeclaration(declaration);
89610
+ }
89611
+ if (!symbol || !(symbol.flags & 16 /* Function */ | 3 /* Variable */)) {
88485
89612
  return false;
88486
89613
  }
88487
89614
  return !!forEachEntry(getExportsOfSymbol(symbol), (p) => p.flags & 111551 /* Value */ && isExpandoPropertyDeclaration(p.valueDeclaration));
@@ -88785,11 +89912,27 @@ function createTypeChecker(host) {
88785
89912
  return void 0;
88786
89913
  }
88787
89914
  function isLiteralConstDeclaration(node) {
88788
- if (isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike(node)) {
89915
+ if (isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike2(node)) {
88789
89916
  return isFreshLiteralType(getTypeOfSymbol(getSymbolOfDeclaration(node)));
88790
89917
  }
88791
89918
  return false;
88792
89919
  }
89920
+ function isNonNarrowedBindableName(node) {
89921
+ if (!hasBindableName(node.parent)) {
89922
+ return false;
89923
+ }
89924
+ const expression = node.expression;
89925
+ if (!isEntityNameExpression(expression)) {
89926
+ return true;
89927
+ }
89928
+ const type = getTypeOfExpression(expression);
89929
+ const symbol = getSymbolAtLocation(expression);
89930
+ if (!symbol) {
89931
+ return false;
89932
+ }
89933
+ const declaredType = getTypeOfSymbol(symbol);
89934
+ return declaredType === type;
89935
+ }
88793
89936
  function literalTypeToNode(type, enclosing, tracker) {
88794
89937
  const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
88795
89938
  type.symbol,
@@ -88909,6 +90052,7 @@ function createTypeChecker(host) {
88909
90052
  return node && getExternalModuleFileFromDeclaration(node);
88910
90053
  },
88911
90054
  isLiteralConstDeclaration,
90055
+ isNonNarrowedBindableName,
88912
90056
  isLateBound: (nodeIn) => {
88913
90057
  const node = getParseTreeNode(nodeIn, isDeclaration);
88914
90058
  const symbol = node && getSymbolOfDeclaration(node);
@@ -90280,7 +91424,7 @@ function createTypeChecker(host) {
90280
91424
  const initializer = node.initializer;
90281
91425
  if (initializer) {
90282
91426
  const isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) || isSimpleLiteralEnumReference(initializer) || initializer.kind === 112 /* TrueKeyword */ || initializer.kind === 97 /* FalseKeyword */ || isBigIntLiteralExpression(initializer));
90283
- const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike(node);
91427
+ const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike2(node);
90284
91428
  if (isConstOrReadonly && !node.type) {
90285
91429
  if (isInvalidInitializer) {
90286
91430
  return grammarErrorOnNode(initializer, Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference);
@@ -90745,7 +91889,7 @@ function createTypeChecker(host) {
90745
91889
  lastGetCombinedNodeFlagsResult = getCombinedNodeFlags(node);
90746
91890
  return lastGetCombinedNodeFlagsResult;
90747
91891
  }
90748
- function isVarConstLike(node) {
91892
+ function isVarConstLike2(node) {
90749
91893
  const blockScopeKind = getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */;
90750
91894
  return blockScopeKind === 2 /* Const */ || blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */;
90751
91895
  }
@@ -90899,6 +92043,12 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
90899
92043
  onDiagnosticReported() {
90900
92044
  this.context.reportedDiagnostic = true;
90901
92045
  }
92046
+ reportInferenceFallback(node) {
92047
+ var _a;
92048
+ if ((_a = this.inner) == null ? void 0 : _a.reportInferenceFallback) {
92049
+ this.inner.reportInferenceFallback(node);
92050
+ }
92051
+ }
90902
92052
  };
90903
92053
 
90904
92054
  // src/compiler/visitorPublic.ts
@@ -95128,7 +96278,7 @@ function transformTypeScript(context) {
95128
96278
  }
95129
96279
  function visitParenthesizedExpression(node) {
95130
96280
  const innerExpression = skipOuterExpressions(node.expression, ~6 /* Assertions */);
95131
- if (isAssertionExpression(innerExpression)) {
96281
+ if (isAssertionExpression(innerExpression) || isSatisfiesExpression(innerExpression)) {
95132
96282
  const expression = visitNode(node.expression, visitor, isExpression);
95133
96283
  Debug.assert(expression);
95134
96284
  return factory2.createPartiallyEmittedExpression(expression, node);
@@ -114051,6 +115201,194 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
114051
115201
  };
114052
115202
  }
114053
115203
  }
115204
+ function createGetIsolatedDeclarationErrors(resolver) {
115205
+ const relatedSuggestionByDeclarationKind = {
115206
+ [219 /* ArrowFunction */]: Diagnostics.Add_a_return_type_to_the_function_expression,
115207
+ [218 /* FunctionExpression */]: Diagnostics.Add_a_return_type_to_the_function_expression,
115208
+ [174 /* MethodDeclaration */]: Diagnostics.Add_a_return_type_to_the_method,
115209
+ [177 /* GetAccessor */]: Diagnostics.Add_a_return_type_to_the_get_accessor_declaration,
115210
+ [178 /* SetAccessor */]: Diagnostics.Add_a_type_to_parameter_of_the_set_accessor_declaration,
115211
+ [262 /* FunctionDeclaration */]: Diagnostics.Add_a_return_type_to_the_function_declaration,
115212
+ [180 /* ConstructSignature */]: Diagnostics.Add_a_return_type_to_the_function_declaration,
115213
+ [169 /* Parameter */]: Diagnostics.Add_a_type_annotation_to_the_parameter_0,
115214
+ [260 /* VariableDeclaration */]: Diagnostics.Add_a_type_annotation_to_the_variable_0,
115215
+ [172 /* PropertyDeclaration */]: Diagnostics.Add_a_type_annotation_to_the_property_0,
115216
+ [171 /* PropertySignature */]: Diagnostics.Add_a_type_annotation_to_the_property_0,
115217
+ [277 /* ExportAssignment */]: Diagnostics.Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it
115218
+ };
115219
+ const errorByDeclarationKind = {
115220
+ [218 /* FunctionExpression */]: Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
115221
+ [262 /* FunctionDeclaration */]: Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
115222
+ [219 /* ArrowFunction */]: Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
115223
+ [174 /* MethodDeclaration */]: Diagnostics.Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
115224
+ [180 /* ConstructSignature */]: Diagnostics.Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
115225
+ [177 /* GetAccessor */]: Diagnostics.At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
115226
+ [178 /* SetAccessor */]: Diagnostics.At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
115227
+ [169 /* Parameter */]: Diagnostics.Parameter_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
115228
+ [260 /* VariableDeclaration */]: Diagnostics.Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
115229
+ [172 /* PropertyDeclaration */]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
115230
+ [171 /* PropertySignature */]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
115231
+ [167 /* ComputedPropertyName */]: Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations,
115232
+ [305 /* SpreadAssignment */]: Diagnostics.Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations,
115233
+ [304 /* ShorthandPropertyAssignment */]: Diagnostics.Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations,
115234
+ [209 /* ArrayLiteralExpression */]: Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations,
115235
+ [277 /* ExportAssignment */]: Diagnostics.Default_exports_can_t_be_inferred_with_isolatedDeclarations,
115236
+ [230 /* SpreadElement */]: Diagnostics.Arrays_with_spread_elements_can_t_inferred_with_isolatedDeclarations
115237
+ };
115238
+ return getDiagnostic2;
115239
+ function getDiagnostic2(node) {
115240
+ const heritageClause = findAncestor(node, isHeritageClause);
115241
+ if (heritageClause) {
115242
+ return createDiagnosticForNode(node, Diagnostics.Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations);
115243
+ }
115244
+ Debug.type(node);
115245
+ switch (node.kind) {
115246
+ case 177 /* GetAccessor */:
115247
+ case 178 /* SetAccessor */:
115248
+ return createAccessorTypeError(node);
115249
+ case 167 /* ComputedPropertyName */:
115250
+ case 304 /* ShorthandPropertyAssignment */:
115251
+ case 305 /* SpreadAssignment */:
115252
+ return createObjectLiteralError(node);
115253
+ case 209 /* ArrayLiteralExpression */:
115254
+ case 230 /* SpreadElement */:
115255
+ return createArrayLiteralError(node);
115256
+ case 174 /* MethodDeclaration */:
115257
+ case 180 /* ConstructSignature */:
115258
+ case 218 /* FunctionExpression */:
115259
+ case 219 /* ArrowFunction */:
115260
+ case 262 /* FunctionDeclaration */:
115261
+ return createReturnTypeError(node);
115262
+ case 208 /* BindingElement */:
115263
+ return createBindingElementError(node);
115264
+ case 172 /* PropertyDeclaration */:
115265
+ case 260 /* VariableDeclaration */:
115266
+ return createVariableOrPropertyError(node);
115267
+ case 169 /* Parameter */:
115268
+ return createParameterError(node);
115269
+ case 303 /* PropertyAssignment */:
115270
+ return createExpressionError(node.initializer);
115271
+ case 231 /* ClassExpression */:
115272
+ return createClassExpressionError(node);
115273
+ default:
115274
+ assertType(node);
115275
+ return createExpressionError(node);
115276
+ }
115277
+ }
115278
+ function findNearestDeclaration(node) {
115279
+ const result = findAncestor(node, (n) => isExportAssignment(n) || (isStatement(n) ? "quit" : isVariableDeclaration(n) || isPropertyDeclaration(n) || isParameter(n)));
115280
+ return result;
115281
+ }
115282
+ function createAccessorTypeError(node) {
115283
+ const { getAccessor, setAccessor } = getAllAccessorDeclarations(node.symbol.declarations, node);
115284
+ const targetNode = (isSetAccessor(node) ? node.parameters[0] : node) ?? node;
115285
+ const diag2 = createDiagnosticForNode(targetNode, errorByDeclarationKind[node.kind]);
115286
+ if (setAccessor) {
115287
+ addRelatedInfo(diag2, createDiagnosticForNode(setAccessor, relatedSuggestionByDeclarationKind[setAccessor.kind]));
115288
+ }
115289
+ if (getAccessor) {
115290
+ addRelatedInfo(diag2, createDiagnosticForNode(getAccessor, relatedSuggestionByDeclarationKind[getAccessor.kind]));
115291
+ }
115292
+ return diag2;
115293
+ }
115294
+ function createObjectLiteralError(node) {
115295
+ const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
115296
+ const parentDeclaration = findNearestDeclaration(node);
115297
+ if (parentDeclaration) {
115298
+ const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
115299
+ parentDeclaration.name,
115300
+ /*includeTrivia*/
115301
+ false
115302
+ );
115303
+ addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
115304
+ }
115305
+ return diag2;
115306
+ }
115307
+ function createArrayLiteralError(node) {
115308
+ const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
115309
+ const parentDeclaration = findNearestDeclaration(node);
115310
+ if (parentDeclaration) {
115311
+ const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
115312
+ parentDeclaration.name,
115313
+ /*includeTrivia*/
115314
+ false
115315
+ );
115316
+ addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
115317
+ }
115318
+ return diag2;
115319
+ }
115320
+ function createReturnTypeError(node) {
115321
+ const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
115322
+ const parentDeclaration = findNearestDeclaration(node);
115323
+ if (parentDeclaration) {
115324
+ const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
115325
+ parentDeclaration.name,
115326
+ /*includeTrivia*/
115327
+ false
115328
+ );
115329
+ addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
115330
+ }
115331
+ addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind]));
115332
+ return diag2;
115333
+ }
115334
+ function createBindingElementError(node) {
115335
+ return createDiagnosticForNode(node, Diagnostics.Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations);
115336
+ }
115337
+ function createVariableOrPropertyError(node) {
115338
+ const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
115339
+ const targetStr = getTextOfNode(
115340
+ node.name,
115341
+ /*includeTrivia*/
115342
+ false
115343
+ );
115344
+ addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind], targetStr));
115345
+ return diag2;
115346
+ }
115347
+ function createParameterError(node) {
115348
+ if (isSetAccessor(node.parent)) {
115349
+ return createAccessorTypeError(node.parent);
115350
+ }
115351
+ const addUndefined = resolver.requiresAddingImplicitUndefined(node);
115352
+ if (!addUndefined && node.initializer) {
115353
+ return createExpressionError(node.initializer);
115354
+ }
115355
+ 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];
115356
+ const diag2 = createDiagnosticForNode(node, message);
115357
+ const targetStr = getTextOfNode(
115358
+ node.name,
115359
+ /*includeTrivia*/
115360
+ false
115361
+ );
115362
+ addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind], targetStr));
115363
+ return diag2;
115364
+ }
115365
+ function createClassExpressionError(node) {
115366
+ return createExpressionError(node, Diagnostics.Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations);
115367
+ }
115368
+ function createExpressionError(node, diagnosticMessage) {
115369
+ const parentDeclaration = findNearestDeclaration(node);
115370
+ let diag2;
115371
+ if (parentDeclaration) {
115372
+ const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
115373
+ parentDeclaration.name,
115374
+ /*includeTrivia*/
115375
+ false
115376
+ );
115377
+ const parent2 = findAncestor(node.parent, (n) => isExportAssignment(n) || (isStatement(n) ? "quit" : !isParenthesizedExpression(n) && !isTypeAssertionExpression(n) && !isAsExpression(n)));
115378
+ if (parentDeclaration === parent2) {
115379
+ diag2 = createDiagnosticForNode(node, diagnosticMessage ?? errorByDeclarationKind[parentDeclaration.kind]);
115380
+ addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
115381
+ } else {
115382
+ diag2 = createDiagnosticForNode(node, diagnosticMessage ?? Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations);
115383
+ addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
115384
+ addRelatedInfo(diag2, createDiagnosticForNode(node, Diagnostics.Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit));
115385
+ }
115386
+ } else {
115387
+ diag2 = createDiagnosticForNode(node, diagnosticMessage ?? Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations);
115388
+ }
115389
+ return diag2;
115390
+ }
115391
+ }
114054
115392
 
114055
115393
  // src/compiler/transformers/declarations.ts
114056
115394
  function getDeclarationDiagnostics(host, resolver, file) {
@@ -114092,7 +115430,8 @@ function transformDeclarations(context) {
114092
115430
  reportTruncationError,
114093
115431
  moduleResolverHost: host,
114094
115432
  reportNonlocalAugmentation,
114095
- reportNonSerializableProperty
115433
+ reportNonSerializableProperty,
115434
+ reportInferenceFallback
114096
115435
  };
114097
115436
  let errorNameNode;
114098
115437
  let errorFallbackNode;
@@ -114102,8 +115441,29 @@ function transformDeclarations(context) {
114102
115441
  let rawLibReferenceDirectives;
114103
115442
  const resolver = context.getEmitResolver();
114104
115443
  const options = context.getCompilerOptions();
114105
- const { stripInternal } = options;
115444
+ const getIsolatedDeclarationError = createGetIsolatedDeclarationErrors(resolver);
115445
+ const { stripInternal, isolatedDeclarations } = options;
114106
115446
  return transformRoot;
115447
+ function reportExpandoFunctionErrors(node) {
115448
+ resolver.getPropertiesOfContainerFunction(node).forEach((p) => {
115449
+ if (isExpandoPropertyDeclaration(p.valueDeclaration)) {
115450
+ const errorTarget = isBinaryExpression(p.valueDeclaration) ? p.valueDeclaration.left : p.valueDeclaration;
115451
+ context.addDiagnostic(createDiagnosticForNode(
115452
+ errorTarget,
115453
+ Diagnostics.Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function
115454
+ ));
115455
+ }
115456
+ });
115457
+ }
115458
+ function reportInferenceFallback(node) {
115459
+ if (!isolatedDeclarations || isSourceFileJS(currentSourceFile))
115460
+ return;
115461
+ if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
115462
+ reportExpandoFunctionErrors(node);
115463
+ } else {
115464
+ context.addDiagnostic(getIsolatedDeclarationError(node));
115465
+ }
115466
+ }
114107
115467
  function handleSymbolAccessibilityError(symbolAccessibilityResult) {
114108
115468
  if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
114109
115469
  if (symbolAccessibilityResult.aliasesToMakeVisible) {
@@ -114407,7 +115767,8 @@ function transformDeclarations(context) {
114407
115767
  elem.dotDotDotToken,
114408
115768
  elem.propertyName,
114409
115769
  filterBindingPatternInitializers(elem.name),
114410
- shouldPrintWithInitializer(elem) ? elem.initializer : void 0
115770
+ /*initializer*/
115771
+ void 0
114411
115772
  );
114412
115773
  }
114413
115774
  }
@@ -114438,11 +115799,15 @@ function transformDeclarations(context) {
114438
115799
  return newParam;
114439
115800
  }
114440
115801
  function shouldPrintWithInitializer(node) {
114441
- return canHaveLiteralInitializer(node) && resolver.isLiteralConstDeclaration(getParseTreeNode(node));
115802
+ return canHaveLiteralInitializer(node) && !!node.initializer && resolver.isLiteralConstDeclaration(getParseTreeNode(node));
114442
115803
  }
114443
115804
  function ensureNoInitializer(node) {
114444
115805
  if (shouldPrintWithInitializer(node)) {
114445
- return resolver.createLiteralConstValue(getParseTreeNode(node), symbolTracker);
115806
+ const unwrappedInitializer = unwrapParenthesizedExpression(node.initializer);
115807
+ if (!isPrimitiveLiteralValue(unwrappedInitializer)) {
115808
+ reportInferenceFallback(node);
115809
+ }
115810
+ return resolver.createLiteralConstValue(getParseTreeNode(node, canHaveLiteralInitializer), symbolTracker);
114446
115811
  }
114447
115812
  return void 0;
114448
115813
  }
@@ -114684,6 +116049,9 @@ function transformDeclarations(context) {
114684
116049
  );
114685
116050
  }
114686
116051
  if (resolver.isImportRequiredByAugmentation(decl)) {
116052
+ if (isolatedDeclarations) {
116053
+ context.addDiagnostic(createDiagnosticForNode(decl, Diagnostics.Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_supported_with_isolatedDeclarations));
116054
+ }
114687
116055
  return factory2.updateImportDeclaration(
114688
116056
  decl,
114689
116057
  decl.modifiers,
@@ -114738,6 +116106,9 @@ function transformDeclarations(context) {
114738
116106
  if (isDeclarationAndNotVisible(input))
114739
116107
  return;
114740
116108
  if (hasDynamicName(input) && !resolver.isLateBound(getParseTreeNode(input))) {
116109
+ if (isolatedDeclarations && isClassDeclaration(input.parent) && isEntityNameExpression(input.name.expression) && resolver.isEntityNameVisible(input.name.expression, input.parent).accessibility === 0 /* Accessible */ && !resolver.isNonNarrowedBindableName(input.name)) {
116110
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
116111
+ }
114741
116112
  return;
114742
116113
  }
114743
116114
  }
@@ -115178,6 +116549,9 @@ function transformDeclarations(context) {
115178
116549
  ));
115179
116550
  if (clean2 && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) {
115180
116551
  const props = resolver.getPropertiesOfContainerFunction(input);
116552
+ if (isolatedDeclarations) {
116553
+ reportExpandoFunctionErrors(input);
116554
+ }
115181
116555
  const fakespace = parseNodeFactory.createModuleDeclaration(
115182
116556
  /*modifiers*/
115183
116557
  void 0,
@@ -115198,7 +116572,7 @@ function transformDeclarations(context) {
115198
116572
  return void 0;
115199
116573
  }
115200
116574
  getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
115201
- const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker);
116575
+ const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags | -2147483648 /* NoSyntacticPrinter */, symbolTracker);
115202
116576
  getSymbolAccessibilityDiagnostic = oldDiag;
115203
116577
  const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
115204
116578
  const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
@@ -115452,7 +116826,12 @@ function transformDeclarations(context) {
115452
116826
  factory2.createNodeArray(mapDefined(input.members, (m) => {
115453
116827
  if (shouldStripInternal(m))
115454
116828
  return;
115455
- const constValue = resolver.getConstantValue(m);
116829
+ const enumValue = resolver.getEnumMemberValue(m);
116830
+ const constValue = enumValue == null ? void 0 : enumValue.value;
116831
+ if (isolatedDeclarations && m.initializer && (enumValue == null ? void 0 : enumValue.hasExternalReferences) && // This will be its own compiler error instead, so don't report.
116832
+ !isComputedPropertyName(m.name)) {
116833
+ context.addDiagnostic(createDiagnosticForNode(m, Diagnostics.Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDeclarations));
116834
+ }
115456
116835
  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);
115457
116836
  return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
115458
116837
  }))
@@ -116699,6 +118078,7 @@ var notImplementedResolver = {
116699
118078
  isArgumentsLocalBinding: notImplemented,
116700
118079
  getExternalModuleFileFromDeclaration: notImplemented,
116701
118080
  isLiteralConstDeclaration: notImplemented,
118081
+ isNonNarrowedBindableName: notImplemented,
116702
118082
  getJsxFactoryEntity: notImplemented,
116703
118083
  getJsxFragmentFactoryEntity: notImplemented,
116704
118084
  isBindingCapturedByNode: notImplemented,
@@ -122508,6 +123888,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122508
123888
  const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
122509
123889
  const hasEmitBlockingDiagnostics = /* @__PURE__ */ new Map();
122510
123890
  let _compilerOptionsObjectLiteralSyntax;
123891
+ let _compilerOptionsPropertySyntax;
122511
123892
  let moduleResolutionCache;
122512
123893
  let actualResolveModuleNamesWorker;
122513
123894
  const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse;
@@ -124721,6 +126102,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124721
126102
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
124722
126103
  }
124723
126104
  }
126105
+ if (options.isolatedDeclarations) {
126106
+ if (getAllowJSCompilerOption(options)) {
126107
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "isolatedDeclarations");
126108
+ }
126109
+ if (!getEmitDeclarations(options)) {
126110
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "isolatedDeclarations", "declaration", "composite");
126111
+ }
126112
+ }
124724
126113
  if (options.inlineSourceMap) {
124725
126114
  if (options.sourceMap) {
124726
126115
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap");
@@ -124872,7 +126261,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124872
126261
  }
124873
126262
  }
124874
126263
  if (options.checkJs && !getAllowJSCompilerOption(options)) {
124875
- programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs"));
126264
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs");
124876
126265
  }
124877
126266
  if (options.emitDeclarationOnly) {
124878
126267
  if (!getEmitDeclarations(options)) {
@@ -125224,7 +126613,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125224
126613
  message = Diagnostics.File_is_library_specified_here;
125225
126614
  break;
125226
126615
  }
125227
- const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0);
126616
+ const target = getNameOfScriptTarget(getEmitScriptTarget(options));
125228
126617
  configFileNode = target ? getOptionsSyntaxByValue("target", target) : void 0;
125229
126618
  message = Diagnostics.File_is_default_library_for_target_specified_here;
125230
126619
  break;
@@ -125277,7 +126666,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125277
126666
  }
125278
126667
  });
125279
126668
  if (needCompilerDiagnostic) {
125280
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
126669
+ createCompilerOptionsDiagnostic(message, ...args);
125281
126670
  }
125282
126671
  }
125283
126672
  function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
@@ -125296,7 +126685,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125296
126685
  }
125297
126686
  });
125298
126687
  if (needCompilerDiagnostic) {
125299
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
126688
+ createCompilerOptionsDiagnostic(message, ...args);
125300
126689
  }
125301
126690
  }
125302
126691
  function forEachOptionsSyntaxByName(name, callback) {
@@ -125347,22 +126736,39 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125347
126736
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
125348
126737
  const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
125349
126738
  if (needCompilerDiagnostic) {
126739
+ createCompilerOptionsDiagnostic(message, ...args);
126740
+ }
126741
+ }
126742
+ function createCompilerOptionsDiagnostic(message, ...args) {
126743
+ const compilerOptionsProperty = getCompilerOptionsPropertySyntax();
126744
+ if (compilerOptionsProperty) {
125350
126745
  if ("messageText" in message) {
125351
- programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
126746
+ programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, compilerOptionsProperty.name, message));
125352
126747
  } else {
125353
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
126748
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, compilerOptionsProperty.name, message, ...args));
125354
126749
  }
126750
+ } else if ("messageText" in message) {
126751
+ programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
126752
+ } else {
126753
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
125355
126754
  }
125356
126755
  }
125357
126756
  function getCompilerOptionsObjectLiteralSyntax() {
125358
126757
  if (_compilerOptionsObjectLiteralSyntax === void 0) {
125359
- _compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment(
126758
+ const compilerOptionsProperty = getCompilerOptionsPropertySyntax();
126759
+ _compilerOptionsObjectLiteralSyntax = compilerOptionsProperty ? tryCast(compilerOptionsProperty.initializer, isObjectLiteralExpression) || false : false;
126760
+ }
126761
+ return _compilerOptionsObjectLiteralSyntax || void 0;
126762
+ }
126763
+ function getCompilerOptionsPropertySyntax() {
126764
+ if (_compilerOptionsPropertySyntax === void 0) {
126765
+ _compilerOptionsPropertySyntax = forEachPropertyAssignment(
125360
126766
  getTsConfigObjectLiteralExpression(options.configFile),
125361
126767
  "compilerOptions",
125362
- (prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0
126768
+ identity
125363
126769
  ) || false;
125364
126770
  }
125365
- return _compilerOptionsObjectLiteralSyntax || void 0;
126771
+ return _compilerOptionsPropertySyntax || void 0;
125366
126772
  }
125367
126773
  function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
125368
126774
  let needsCompilerDiagnostic = false;
@@ -128929,7 +130335,7 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
128929
130335
  Diagnostics.Library_0_specified_in_compilerOptions,
128930
130336
  options.lib[reason.index]
128931
130337
  );
128932
- const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0);
130338
+ const target = getNameOfScriptTarget(getEmitScriptTarget(options));
128933
130339
  const messageAndArgs = target ? [Diagnostics.Default_library_for_target_0, target] : [Diagnostics.Default_library];
128934
130340
  return chainDiagnosticMessages(
128935
130341
  /*details*/
@@ -133010,6 +134416,443 @@ function writeConfigFile(sys2, reportDiagnostic, options, fileNames) {
133010
134416
  return;
133011
134417
  }
133012
134418
 
134419
+ // src/compiler/expressionToTypeNode.ts
134420
+ function createSyntacticTypeNodeBuilder(options, resolver) {
134421
+ const strictNullChecks = getStrictOptionValue(options, "strictNullChecks");
134422
+ return {
134423
+ typeFromExpression,
134424
+ serializeTypeOfDeclaration,
134425
+ serializeReturnTypeForSignature,
134426
+ serializeTypeOfExpression
134427
+ };
134428
+ function serializeExistingTypeAnnotation(type) {
134429
+ return type === void 0 ? void 0 : !type.parent || !isParameter(type.parent) || !resolver.requiresAddingImplicitUndefined(type.parent) || canAddUndefined(type);
134430
+ }
134431
+ function serializeTypeOfExpression(expr, context, addUndefined, preserveLiterals) {
134432
+ return typeFromExpression(
134433
+ expr,
134434
+ context,
134435
+ /*isConstContext*/
134436
+ false,
134437
+ addUndefined,
134438
+ preserveLiterals
134439
+ ) ?? inferExpressionType(expr, context);
134440
+ }
134441
+ function serializeTypeOfDeclaration(node, context) {
134442
+ switch (node.kind) {
134443
+ case 171 /* PropertySignature */:
134444
+ return serializeExistingTypeAnnotation(getEffectiveTypeAnnotationNode(node));
134445
+ case 169 /* Parameter */:
134446
+ return typeFromParameter(node, context);
134447
+ case 260 /* VariableDeclaration */:
134448
+ return typeFromVariable(node, context);
134449
+ case 172 /* PropertyDeclaration */:
134450
+ return typeFromProperty(node, context);
134451
+ case 208 /* BindingElement */:
134452
+ return inferTypeOfDeclaration(node, context);
134453
+ case 277 /* ExportAssignment */:
134454
+ return serializeTypeOfExpression(
134455
+ node.expression,
134456
+ context,
134457
+ /*addUndefined*/
134458
+ void 0,
134459
+ /*preserveLiterals*/
134460
+ true
134461
+ );
134462
+ case 211 /* PropertyAccessExpression */:
134463
+ case 212 /* ElementAccessExpression */:
134464
+ case 226 /* BinaryExpression */:
134465
+ return serializeExistingTypeAnnotation(getEffectiveTypeAnnotationNode(node)) || inferTypeOfDeclaration(node, context);
134466
+ case 303 /* PropertyAssignment */:
134467
+ return typeFromExpression(node.initializer, context) || inferTypeOfDeclaration(node, context);
134468
+ default:
134469
+ Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`);
134470
+ }
134471
+ }
134472
+ function serializeReturnTypeForSignature(node, context) {
134473
+ switch (node.kind) {
134474
+ case 177 /* GetAccessor */:
134475
+ return typeFromAccessor(node, context);
134476
+ case 174 /* MethodDeclaration */:
134477
+ case 262 /* FunctionDeclaration */:
134478
+ case 180 /* ConstructSignature */:
134479
+ case 173 /* MethodSignature */:
134480
+ case 179 /* CallSignature */:
134481
+ case 176 /* Constructor */:
134482
+ case 178 /* SetAccessor */:
134483
+ case 181 /* IndexSignature */:
134484
+ case 184 /* FunctionType */:
134485
+ case 185 /* ConstructorType */:
134486
+ case 218 /* FunctionExpression */:
134487
+ case 219 /* ArrowFunction */:
134488
+ case 317 /* JSDocFunctionType */:
134489
+ case 323 /* JSDocSignature */:
134490
+ return createReturnFromSignature(node, context);
134491
+ default:
134492
+ Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`);
134493
+ }
134494
+ }
134495
+ function getTypeAnnotationFromAccessor2(accessor) {
134496
+ if (accessor) {
134497
+ return accessor.kind === 177 /* GetAccessor */ ? getEffectiveReturnTypeNode(accessor) : accessor.parameters.length > 0 ? getEffectiveTypeAnnotationNode(accessor.parameters[0]) : void 0;
134498
+ }
134499
+ }
134500
+ function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) {
134501
+ let accessorType = getTypeAnnotationFromAccessor2(node);
134502
+ if (!accessorType && node !== accessors.firstAccessor) {
134503
+ accessorType = getTypeAnnotationFromAccessor2(accessors.firstAccessor);
134504
+ }
134505
+ if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) {
134506
+ accessorType = getTypeAnnotationFromAccessor2(accessors.secondAccessor);
134507
+ }
134508
+ return accessorType;
134509
+ }
134510
+ function typeFromAccessor(node, context) {
134511
+ const accessorDeclarations = resolver.getAllAccessorDeclarations(node);
134512
+ const accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessorDeclarations);
134513
+ if (accessorType) {
134514
+ return serializeExistingTypeAnnotation(accessorType);
134515
+ }
134516
+ if (accessorDeclarations.getAccessor) {
134517
+ return createReturnFromSignature(accessorDeclarations.getAccessor, context);
134518
+ }
134519
+ return false;
134520
+ }
134521
+ function typeFromVariable(node, context) {
134522
+ const declaredType = getEffectiveTypeAnnotationNode(node);
134523
+ if (declaredType) {
134524
+ return serializeExistingTypeAnnotation(declaredType);
134525
+ }
134526
+ let resultType;
134527
+ if (node.initializer) {
134528
+ if (!resolver.isExpandoFunctionDeclaration(node)) {
134529
+ resultType = typeFromExpression(
134530
+ node.initializer,
134531
+ context,
134532
+ /*isConstContext*/
134533
+ void 0,
134534
+ /*requiresAddingUndefined*/
134535
+ void 0,
134536
+ isVarConstLike(node)
134537
+ );
134538
+ }
134539
+ }
134540
+ return resultType ?? inferTypeOfDeclaration(node, context);
134541
+ }
134542
+ function typeFromParameter(node, context) {
134543
+ const parent2 = node.parent;
134544
+ if (parent2.kind === 178 /* SetAccessor */) {
134545
+ return typeFromAccessor(parent2, context);
134546
+ }
134547
+ const declaredType = getEffectiveTypeAnnotationNode(node);
134548
+ const addUndefined = resolver.requiresAddingImplicitUndefined(node);
134549
+ let resultType;
134550
+ if (!addUndefined) {
134551
+ if (declaredType) {
134552
+ return serializeExistingTypeAnnotation(declaredType);
134553
+ }
134554
+ if (node.initializer && isIdentifier(node.name)) {
134555
+ resultType = typeFromExpression(node.initializer, context);
134556
+ }
134557
+ }
134558
+ return resultType ?? inferTypeOfDeclaration(node, context);
134559
+ }
134560
+ function typeFromProperty(node, context) {
134561
+ const declaredType = getEffectiveTypeAnnotationNode(node);
134562
+ if (declaredType) {
134563
+ return serializeExistingTypeAnnotation(declaredType);
134564
+ }
134565
+ let resultType;
134566
+ if (node.initializer) {
134567
+ const isReadonly = isDeclarationReadonly(node);
134568
+ resultType = typeFromExpression(
134569
+ node.initializer,
134570
+ context,
134571
+ /*isConstContext*/
134572
+ void 0,
134573
+ /*requiresAddingUndefined*/
134574
+ void 0,
134575
+ isReadonly
134576
+ );
134577
+ }
134578
+ return resultType ?? inferTypeOfDeclaration(node, context);
134579
+ }
134580
+ function inferTypeOfDeclaration(node, context) {
134581
+ context.tracker.reportInferenceFallback(node);
134582
+ return false;
134583
+ }
134584
+ function inferExpressionType(node, context) {
134585
+ context.tracker.reportInferenceFallback(node);
134586
+ return false;
134587
+ }
134588
+ function inferReturnTypeOfSignatureSignature(node, context) {
134589
+ context.tracker.reportInferenceFallback(node);
134590
+ return false;
134591
+ }
134592
+ function inferAccessorType(node, allAccessors, context) {
134593
+ if (node.kind === 177 /* GetAccessor */) {
134594
+ return createReturnFromSignature(node, context);
134595
+ } else {
134596
+ context.tracker.reportInferenceFallback(node);
134597
+ return false;
134598
+ }
134599
+ }
134600
+ function typeFromTypeAssertion(expression, type, context, requiresAddingUndefined) {
134601
+ if (isConstTypeReference(type)) {
134602
+ return typeFromExpression(
134603
+ expression,
134604
+ context,
134605
+ /*isConstContext*/
134606
+ true,
134607
+ requiresAddingUndefined
134608
+ );
134609
+ }
134610
+ if (requiresAddingUndefined && !canAddUndefined(type)) {
134611
+ context.tracker.reportInferenceFallback(type);
134612
+ }
134613
+ return serializeExistingTypeAnnotation(type);
134614
+ }
134615
+ function typeFromExpression(node, context, isConstContext = false, requiresAddingUndefined = false, preserveLiterals = false) {
134616
+ switch (node.kind) {
134617
+ case 217 /* ParenthesizedExpression */:
134618
+ if (isJSDocTypeAssertion(node)) {
134619
+ return typeFromTypeAssertion(node.expression, getJSDocTypeAssertionType(node), context, requiresAddingUndefined);
134620
+ }
134621
+ return typeFromExpression(node.expression, context, isConstContext, requiresAddingUndefined);
134622
+ case 80 /* Identifier */:
134623
+ if (resolver.isUndefinedIdentifierExpression(node)) {
134624
+ return true;
134625
+ }
134626
+ break;
134627
+ case 106 /* NullKeyword */:
134628
+ return true;
134629
+ case 219 /* ArrowFunction */:
134630
+ case 218 /* FunctionExpression */:
134631
+ return typeFromFunctionLikeExpression(node, context);
134632
+ case 216 /* TypeAssertionExpression */:
134633
+ case 234 /* AsExpression */:
134634
+ const asExpression = node;
134635
+ return typeFromTypeAssertion(asExpression.expression, asExpression.type, context, requiresAddingUndefined);
134636
+ case 224 /* PrefixUnaryExpression */:
134637
+ const unaryExpression = node;
134638
+ if (isPrimitiveLiteralValue(unaryExpression)) {
134639
+ if (unaryExpression.operand.kind === 10 /* BigIntLiteral */) {
134640
+ return typeFromPrimitiveLiteral();
134641
+ }
134642
+ if (unaryExpression.operand.kind === 9 /* NumericLiteral */) {
134643
+ return typeFromPrimitiveLiteral();
134644
+ }
134645
+ }
134646
+ break;
134647
+ case 9 /* NumericLiteral */:
134648
+ return typeFromPrimitiveLiteral();
134649
+ case 228 /* TemplateExpression */:
134650
+ if (!isConstContext && !preserveLiterals) {
134651
+ return true;
134652
+ }
134653
+ break;
134654
+ case 15 /* NoSubstitutionTemplateLiteral */:
134655
+ case 11 /* StringLiteral */:
134656
+ return typeFromPrimitiveLiteral();
134657
+ case 10 /* BigIntLiteral */:
134658
+ return typeFromPrimitiveLiteral();
134659
+ case 112 /* TrueKeyword */:
134660
+ case 97 /* FalseKeyword */:
134661
+ return typeFromPrimitiveLiteral();
134662
+ case 209 /* ArrayLiteralExpression */:
134663
+ return typeFromArrayLiteral(node, context, isConstContext);
134664
+ case 210 /* ObjectLiteralExpression */:
134665
+ return typeFromObjectLiteral(node, context, isConstContext);
134666
+ case 231 /* ClassExpression */:
134667
+ return inferExpressionType(node, context);
134668
+ }
134669
+ return void 0;
134670
+ }
134671
+ function typeFromFunctionLikeExpression(fnNode, context) {
134672
+ const returnType = serializeExistingTypeAnnotation(fnNode.type) ?? createReturnFromSignature(fnNode, context);
134673
+ const typeParameters = reuseTypeParameters(fnNode.typeParameters);
134674
+ const parameters = fnNode.parameters.every((p) => ensureParameter(p, context));
134675
+ return returnType && typeParameters && parameters;
134676
+ }
134677
+ function canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext) {
134678
+ if (!isConstContext) {
134679
+ context.tracker.reportInferenceFallback(arrayLiteral);
134680
+ return false;
134681
+ }
134682
+ for (const element of arrayLiteral.elements) {
134683
+ if (element.kind === 230 /* SpreadElement */) {
134684
+ context.tracker.reportInferenceFallback(element);
134685
+ return false;
134686
+ }
134687
+ }
134688
+ return true;
134689
+ }
134690
+ function typeFromArrayLiteral(arrayLiteral, context, isConstContext) {
134691
+ if (!canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext)) {
134692
+ return false;
134693
+ }
134694
+ let canInferArray = true;
134695
+ for (const element of arrayLiteral.elements) {
134696
+ Debug.assert(element.kind !== 230 /* SpreadElement */);
134697
+ if (element.kind !== 232 /* OmittedExpression */) {
134698
+ canInferArray = (typeFromExpression(element, context, isConstContext) ?? inferExpressionType(element, context)) && canInferArray;
134699
+ }
134700
+ }
134701
+ return true;
134702
+ }
134703
+ function canGetTypeFromObjectLiteral(objectLiteral, context) {
134704
+ let result = true;
134705
+ for (const prop of objectLiteral.properties) {
134706
+ if (prop.flags & 262144 /* ThisNodeHasError */) {
134707
+ result = false;
134708
+ break;
134709
+ }
134710
+ if (prop.kind === 304 /* ShorthandPropertyAssignment */ || prop.kind === 305 /* SpreadAssignment */) {
134711
+ context.tracker.reportInferenceFallback(prop);
134712
+ result = false;
134713
+ } else if (prop.name.flags & 262144 /* ThisNodeHasError */) {
134714
+ result = false;
134715
+ break;
134716
+ } else if (prop.name.kind === 81 /* PrivateIdentifier */) {
134717
+ result = false;
134718
+ } else if (prop.name.kind === 167 /* ComputedPropertyName */) {
134719
+ const expression = prop.name.expression;
134720
+ if (!isPrimitiveLiteralValue(
134721
+ expression,
134722
+ /*includeBigInt*/
134723
+ false
134724
+ ) && !isEntityNameExpression(expression)) {
134725
+ context.tracker.reportInferenceFallback(prop.name);
134726
+ result = false;
134727
+ }
134728
+ }
134729
+ }
134730
+ return result;
134731
+ }
134732
+ function typeFromObjectLiteral(objectLiteral, context, isConstContext) {
134733
+ if (!canGetTypeFromObjectLiteral(objectLiteral, context))
134734
+ return false;
134735
+ let canInferObjectLiteral = true;
134736
+ for (const prop of objectLiteral.properties) {
134737
+ Debug.assert(!isShorthandPropertyAssignment(prop) && !isSpreadAssignment(prop));
134738
+ const name = prop.name;
134739
+ if (prop.name.kind === 167 /* ComputedPropertyName */) {
134740
+ if (!resolver.isNonNarrowedBindableName(prop.name)) {
134741
+ context.tracker.reportInferenceFallback(prop.name);
134742
+ } else if (isEntityNameExpression(prop.name.expression)) {
134743
+ const visibilityResult = resolver.isEntityNameVisible(
134744
+ prop.name.expression,
134745
+ context.enclosingDeclaration,
134746
+ /*shouldComputeAliasToMakeVisible*/
134747
+ false
134748
+ );
134749
+ if (visibilityResult.accessibility !== 0 /* Accessible */) {
134750
+ context.tracker.reportInferenceFallback(prop.name);
134751
+ }
134752
+ }
134753
+ }
134754
+ switch (prop.kind) {
134755
+ case 174 /* MethodDeclaration */:
134756
+ canInferObjectLiteral = !!typeFromObjectLiteralMethod(prop, name, context) && canInferObjectLiteral;
134757
+ break;
134758
+ case 303 /* PropertyAssignment */:
134759
+ canInferObjectLiteral = !!typeFromObjectLiteralPropertyAssignment(prop, name, context, isConstContext) && canInferObjectLiteral;
134760
+ break;
134761
+ case 178 /* SetAccessor */:
134762
+ case 177 /* GetAccessor */:
134763
+ canInferObjectLiteral = !!typeFromObjectLiteralAccessor(prop, name, context) && canInferObjectLiteral;
134764
+ break;
134765
+ }
134766
+ }
134767
+ return canInferObjectLiteral;
134768
+ }
134769
+ function typeFromObjectLiteralPropertyAssignment(prop, name, context, isConstContext) {
134770
+ return typeFromExpression(prop.initializer, context, isConstContext) ?? inferTypeOfDeclaration(prop, context);
134771
+ }
134772
+ function ensureParameter(p, context) {
134773
+ return typeFromParameter(p, context);
134774
+ }
134775
+ function reuseTypeParameters(typeParameters) {
134776
+ return (typeParameters == null ? void 0 : typeParameters.every(
134777
+ (tp) => serializeExistingTypeAnnotation(tp.constraint) && serializeExistingTypeAnnotation(tp.default)
134778
+ )) ?? true;
134779
+ }
134780
+ function typeFromObjectLiteralMethod(method, name, context) {
134781
+ const returnType = createReturnFromSignature(method, context);
134782
+ const typeParameters = reuseTypeParameters(method.typeParameters);
134783
+ const parameters = method.parameters.every((p) => ensureParameter(p, context));
134784
+ return returnType && typeParameters && parameters;
134785
+ }
134786
+ function typeFromObjectLiteralAccessor(accessor, name, context) {
134787
+ const allAccessors = resolver.getAllAccessorDeclarations(accessor);
134788
+ const getAccessorType = allAccessors.getAccessor && getTypeAnnotationFromAccessor2(allAccessors.getAccessor);
134789
+ const setAccessorType = allAccessors.setAccessor && getTypeAnnotationFromAccessor2(allAccessors.setAccessor);
134790
+ if (getAccessorType !== void 0 && setAccessorType !== void 0) {
134791
+ const parameters = accessor.parameters.every((p) => ensureParameter(p, context));
134792
+ if (isGetAccessor(accessor)) {
134793
+ return parameters && serializeExistingTypeAnnotation(getAccessorType);
134794
+ } else {
134795
+ return parameters;
134796
+ }
134797
+ } else if (allAccessors.firstAccessor === accessor) {
134798
+ const foundType = getAccessorType ?? setAccessorType;
134799
+ const propertyType = foundType ? serializeExistingTypeAnnotation(foundType) : inferAccessorType(accessor, allAccessors, context);
134800
+ return propertyType;
134801
+ }
134802
+ return false;
134803
+ }
134804
+ function typeFromPrimitiveLiteral() {
134805
+ return true;
134806
+ }
134807
+ function canAddUndefined(node) {
134808
+ if (!strictNullChecks)
134809
+ return true;
134810
+ 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 */) {
134811
+ return true;
134812
+ }
134813
+ if (node.kind === 196 /* ParenthesizedType */) {
134814
+ return canAddUndefined(node.type);
134815
+ }
134816
+ if (node.kind === 192 /* UnionType */ || node.kind === 193 /* IntersectionType */) {
134817
+ return node.types.every(canAddUndefined);
134818
+ }
134819
+ return false;
134820
+ }
134821
+ function createReturnFromSignature(fn, context) {
134822
+ let returnType;
134823
+ const returnTypeNode = getEffectiveReturnTypeNode(fn);
134824
+ if (returnTypeNode) {
134825
+ returnType = serializeExistingTypeAnnotation(returnTypeNode);
134826
+ }
134827
+ if (!returnType && isValueSignatureDeclaration(fn)) {
134828
+ returnType = typeFromSingleReturnExpression(fn, context);
134829
+ }
134830
+ return returnType ?? inferReturnTypeOfSignatureSignature(fn, context);
134831
+ }
134832
+ function typeFromSingleReturnExpression(declaration, context) {
134833
+ let candidateExpr;
134834
+ if (declaration && !nodeIsMissing(declaration.body)) {
134835
+ const body = declaration.body;
134836
+ if (body && isBlock(body)) {
134837
+ forEachReturnStatement(body, (s) => {
134838
+ if (!candidateExpr) {
134839
+ candidateExpr = s.expression;
134840
+ } else {
134841
+ candidateExpr = void 0;
134842
+ return true;
134843
+ }
134844
+ });
134845
+ } else {
134846
+ candidateExpr = body;
134847
+ }
134848
+ }
134849
+ if (candidateExpr) {
134850
+ return typeFromExpression(candidateExpr, context);
134851
+ }
134852
+ return void 0;
134853
+ }
134854
+ }
134855
+
133013
134856
  // src/jsTyping/_namespaces/ts.JsTyping.ts
133014
134857
  var ts_JsTyping_exports = {};
133015
134858
  __export(ts_JsTyping_exports, {
@@ -146483,9 +148326,6 @@ var NodeObject = class {
146483
148326
  }
146484
148327
  };
146485
148328
  function createChildren(node, sourceFile) {
146486
- if (!isNodeKind(node.kind)) {
146487
- return emptyArray;
146488
- }
146489
148329
  const children = [];
146490
148330
  if (isJSDocCommentContainingNode(node)) {
146491
148331
  node.forEachChild((child) => {
@@ -156711,6 +158551,9 @@ registerCodeFix({
156711
158551
  createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteEntireVariableStatement(t, sourceFile, token.parent)), Diagnostics.Remove_variable_statement)
156712
158552
  ];
156713
158553
  }
158554
+ if (isIdentifier(token) && isFunctionDeclaration(token.parent)) {
158555
+ return [createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteFunctionLikeDeclaration(t, sourceFile, token.parent)), [Diagnostics.Remove_unused_declaration_for_Colon_0, token.getText(sourceFile)])];
158556
+ }
156714
158557
  const result = [];
156715
158558
  if (token.kind === 140 /* InferKeyword */) {
156716
158559
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => changeInferToUnknown(t, sourceFile, token));
@@ -156977,6 +158820,14 @@ function isLastParameter(func, parameter, isFixAll) {
156977
158820
  function mayDeleteExpression(node) {
156978
158821
  return (isBinaryExpression(node.parent) && node.parent.left === node || (isPostfixUnaryExpression(node.parent) || isPrefixUnaryExpression(node.parent)) && node.parent.operand === node) && isExpressionStatement(node.parent.parent);
156979
158822
  }
158823
+ function deleteFunctionLikeDeclaration(changes, sourceFile, node) {
158824
+ const declarations = node.symbol.declarations;
158825
+ if (declarations) {
158826
+ for (const declaration of declarations) {
158827
+ changes.delete(sourceFile, declaration);
158828
+ }
158829
+ }
158830
+ }
156980
158831
 
156981
158832
  // src/services/codefixes/fixUnreachableCode.ts
156982
158833
  var fixId33 = "fixUnreachableCode";
@@ -164999,7 +166850,7 @@ function isPathRelativeToScript(path) {
164999
166850
  }
165000
166851
  return false;
165001
166852
  }
165002
- var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*<reference\s+(path|types)\s*=\s*(?:'|"))([^\3"]*)$/;
166853
+ var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*<reference\s+(path|types)\s*=\s*(?:'|"))([^\x03"]*)$/;
165003
166854
  var nodeModulesDependencyKeys = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
165004
166855
  function containsSlash(fragment) {
165005
166856
  return fragment.includes(directorySeparator);
@@ -167897,9 +169748,13 @@ function isExpandoDeclaration(node) {
167897
169748
  }
167898
169749
  function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) {
167899
169750
  const filteredDeclarations = filter(symbol.declarations, (d) => d !== excludeDeclaration);
169751
+ const signatureDefinition = getConstructSignatureDefinition() || getCallSignatureDefinition();
169752
+ if (signatureDefinition) {
169753
+ return signatureDefinition;
169754
+ }
167900
169755
  const withoutExpandos = filter(filteredDeclarations, (d) => !isExpandoDeclaration(d));
167901
169756
  const results = some(withoutExpandos) ? withoutExpandos : filteredDeclarations;
167902
- return getConstructSignatureDefinition() || getCallSignatureDefinition() || map(results, (declaration) => createDefinitionInfo(
169757
+ return map(results, (declaration) => createDefinitionInfo(
167903
169758
  declaration,
167904
169759
  typeChecker,
167905
169760
  symbol,
@@ -167910,8 +169765,8 @@ function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolutio
167910
169765
  ));
167911
169766
  function getConstructSignatureDefinition() {
167912
169767
  if (symbol.flags & 32 /* Class */ && !(symbol.flags & (16 /* Function */ | 3 /* Variable */)) && (isNewExpressionTarget(node) || node.kind === 137 /* ConstructorKeyword */)) {
167913
- const cls = find(filteredDeclarations, isClassLike) || Debug.fail("Expected declaration to have at least one class-like declaration");
167914
- return getSignatureDefinition(
169768
+ const cls = find(filteredDeclarations, isClassLike);
169769
+ return cls && getSignatureDefinition(
167915
169770
  cls.members,
167916
169771
  /*selectConstructors*/
167917
169772
  true
@@ -168781,7 +170636,7 @@ function provideInlayHints(context) {
168781
170636
  return name === "undefined";
168782
170637
  }
168783
170638
  function isHintableDeclaration(node) {
168784
- if ((isParameterDeclaration(node) || isVariableDeclaration(node) && isVarConst(node)) && node.initializer) {
170639
+ if ((isPartOfParameterDeclaration(node) || isVariableDeclaration(node) && isVarConst(node)) && node.initializer) {
168785
170640
  const initializer = skipParentheses(node.initializer);
168786
170641
  return !(isHintableLiteral(initializer) || isNewExpression(initializer) || isObjectLiteralExpression(initializer) || isAssertionExpression(initializer));
168787
170642
  }
@@ -176039,6 +177894,7 @@ __export(ts_exports2, {
176039
177894
  ProcessLevel: () => ProcessLevel,
176040
177895
  ProgramUpdateLevel: () => ProgramUpdateLevel,
176041
177896
  QuotePreference: () => QuotePreference,
177897
+ RegularExpressionFlags: () => RegularExpressionFlags,
176042
177898
  RelationComparisonResult: () => RelationComparisonResult,
176043
177899
  Rename: () => ts_Rename_exports,
176044
177900
  ScriptElementKind: () => ScriptElementKind,
@@ -176167,6 +178023,7 @@ __export(ts_exports2, {
176167
178023
  changeFullExtension: () => changeFullExtension,
176168
178024
  changesAffectModuleResolution: () => changesAffectModuleResolution,
176169
178025
  changesAffectingProgramStructure: () => changesAffectingProgramStructure,
178026
+ characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
176170
178027
  childIsDecorated: () => childIsDecorated,
176171
178028
  classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
176172
178029
  classHasClassThisAssignment: () => classHasClassThisAssignment,
@@ -176312,6 +178169,7 @@ __export(ts_exports2, {
176312
178169
  createForOfBindingStatement: () => createForOfBindingStatement,
176313
178170
  createFutureSourceFile: () => createFutureSourceFile,
176314
178171
  createGetCanonicalFileName: () => createGetCanonicalFileName,
178172
+ createGetIsolatedDeclarationErrors: () => createGetIsolatedDeclarationErrors,
176315
178173
  createGetSourceFile: () => createGetSourceFile,
176316
178174
  createGetSymbolAccessibilityDiagnosticForNode: () => createGetSymbolAccessibilityDiagnosticForNode,
176317
178175
  createGetSymbolAccessibilityDiagnosticForNodeName: () => createGetSymbolAccessibilityDiagnosticForNodeName,
@@ -176366,6 +178224,7 @@ __export(ts_exports2, {
176366
178224
  createSuperAccessVariableStatement: () => createSuperAccessVariableStatement,
176367
178225
  createSymbolTable: () => createSymbolTable,
176368
178226
  createSymlinkCache: () => createSymlinkCache,
178227
+ createSyntacticTypeNodeBuilder: () => createSyntacticTypeNodeBuilder,
176369
178228
  createSystemWatchFunctions: () => createSystemWatchFunctions,
176370
178229
  createTextChange: () => createTextChange,
176371
178230
  createTextChangeFromStartLength: () => createTextChangeFromStartLength,
@@ -176805,6 +178664,7 @@ __export(ts_exports2, {
176805
178664
  getNameOfDeclaration: () => getNameOfDeclaration,
176806
178665
  getNameOfExpando: () => getNameOfExpando,
176807
178666
  getNameOfJSDocTypedef: () => getNameOfJSDocTypedef,
178667
+ getNameOfScriptTarget: () => getNameOfScriptTarget,
176808
178668
  getNameOrArgument: () => getNameOrArgument,
176809
178669
  getNameTable: () => getNameTable,
176810
178670
  getNamesForExportedSymbol: () => getNamesForExportedSymbol,
@@ -177019,6 +178879,7 @@ __export(ts_exports2, {
177019
178879
  hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
177020
178880
  hasExtension: () => hasExtension,
177021
178881
  hasIndexSignature: () => hasIndexSignature,
178882
+ hasInferredType: () => hasInferredType,
177022
178883
  hasInitializer: () => hasInitializer,
177023
178884
  hasInvalidEscape: () => hasInvalidEscape,
177024
178885
  hasJSDocNodes: () => hasJSDocNodes,
@@ -177563,12 +179424,12 @@ __export(ts_exports2, {
177563
179424
  isPackageJsonInfo: () => isPackageJsonInfo,
177564
179425
  isPackedArrayLiteral: () => isPackedArrayLiteral,
177565
179426
  isParameter: () => isParameter,
177566
- isParameterDeclaration: () => isParameterDeclaration,
177567
179427
  isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
177568
179428
  isParameterPropertyModifier: () => isParameterPropertyModifier,
177569
179429
  isParenthesizedExpression: () => isParenthesizedExpression,
177570
179430
  isParenthesizedTypeNode: () => isParenthesizedTypeNode,
177571
179431
  isParseTreeNode: () => isParseTreeNode,
179432
+ isPartOfParameterDeclaration: () => isPartOfParameterDeclaration,
177572
179433
  isPartOfTypeNode: () => isPartOfTypeNode,
177573
179434
  isPartOfTypeQuery: () => isPartOfTypeQuery,
177574
179435
  isPartiallyEmittedExpression: () => isPartiallyEmittedExpression,
@@ -177579,6 +179440,7 @@ __export(ts_exports2, {
177579
179440
  isPossiblyTypeArgumentPosition: () => isPossiblyTypeArgumentPosition,
177580
179441
  isPostfixUnaryExpression: () => isPostfixUnaryExpression,
177581
179442
  isPrefixUnaryExpression: () => isPrefixUnaryExpression,
179443
+ isPrimitiveLiteralValue: () => isPrimitiveLiteralValue,
177582
179444
  isPrivateIdentifier: () => isPrivateIdentifier,
177583
179445
  isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
177584
179446
  isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
@@ -177745,6 +179607,7 @@ __export(ts_exports2, {
177745
179607
  isValueSignatureDeclaration: () => isValueSignatureDeclaration,
177746
179608
  isVarAwaitUsing: () => isVarAwaitUsing,
177747
179609
  isVarConst: () => isVarConst,
179610
+ isVarConstLike: () => isVarConstLike,
177748
179611
  isVarUsing: () => isVarUsing,
177749
179612
  isVariableDeclaration: () => isVariableDeclaration,
177750
179613
  isVariableDeclarationInVariableStatement: () => isVariableDeclarationInVariableStatement,
@@ -177949,6 +179812,7 @@ __export(ts_exports2, {
177949
179812
  reducePathComponents: () => reducePathComponents,
177950
179813
  refactor: () => ts_refactor_exports,
177951
179814
  regExpEscape: () => regExpEscape,
179815
+ regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
177952
179816
  relativeComplement: () => relativeComplement,
177953
179817
  removeAllComments: () => removeAllComments,
177954
179818
  removeEmitHelper: () => removeEmitHelper,
@@ -178204,6 +180068,7 @@ __export(ts_exports2, {
178204
180068
  unsetNodeChildren: () => unsetNodeChildren,
178205
180069
  unusedLabelIsError: () => unusedLabelIsError,
178206
180070
  unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
180071
+ unwrapParenthesizedExpression: () => unwrapParenthesizedExpression,
178207
180072
  updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
178208
180073
  updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
178209
180074
  updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
@@ -183721,13 +185586,8 @@ var _ProjectService = class _ProjectService {
183721
185586
  if (result !== void 0)
183722
185587
  return result || void 0;
183723
185588
  }
183724
- this.logger.info(`Search path: ${getDirectoryPath(info.fileName)}`);
183725
185589
  const configFileName = this.forEachConfigFileLocation(info, (canonicalConfigFilePath, configFileName2) => this.configFileExists(configFileName2, canonicalConfigFilePath, info));
183726
- if (configFileName) {
183727
- this.logger.info(`For info: ${info.fileName} :: Config file name: ${configFileName}`);
183728
- } else {
183729
- this.logger.info(`For info: ${info.fileName} :: No config files found.`);
183730
- }
185590
+ this.logger.info(`getConfigFileNameForFile:: File: ${info.fileName} ProjectRootPath: ${this.openFiles.get(info.path)}:: Result: ${configFileName}`);
183731
185591
  if (isOpenScriptInfo(info)) {
183732
185592
  this.configFileForOpenFiles.set(info.path, configFileName || false);
183733
185593
  }
@@ -190460,6 +192320,7 @@ if (typeof console !== "undefined") {
190460
192320
  ProcessLevel,
190461
192321
  ProgramUpdateLevel,
190462
192322
  QuotePreference,
192323
+ RegularExpressionFlags,
190463
192324
  RelationComparisonResult,
190464
192325
  Rename,
190465
192326
  ScriptElementKind,
@@ -190588,6 +192449,7 @@ if (typeof console !== "undefined") {
190588
192449
  changeFullExtension,
190589
192450
  changesAffectModuleResolution,
190590
192451
  changesAffectingProgramStructure,
192452
+ characterToRegularExpressionFlag,
190591
192453
  childIsDecorated,
190592
192454
  classElementOrClassElementParameterIsDecorated,
190593
192455
  classHasClassThisAssignment,
@@ -190733,6 +192595,7 @@ if (typeof console !== "undefined") {
190733
192595
  createForOfBindingStatement,
190734
192596
  createFutureSourceFile,
190735
192597
  createGetCanonicalFileName,
192598
+ createGetIsolatedDeclarationErrors,
190736
192599
  createGetSourceFile,
190737
192600
  createGetSymbolAccessibilityDiagnosticForNode,
190738
192601
  createGetSymbolAccessibilityDiagnosticForNodeName,
@@ -190787,6 +192650,7 @@ if (typeof console !== "undefined") {
190787
192650
  createSuperAccessVariableStatement,
190788
192651
  createSymbolTable,
190789
192652
  createSymlinkCache,
192653
+ createSyntacticTypeNodeBuilder,
190790
192654
  createSystemWatchFunctions,
190791
192655
  createTextChange,
190792
192656
  createTextChangeFromStartLength,
@@ -191226,6 +193090,7 @@ if (typeof console !== "undefined") {
191226
193090
  getNameOfDeclaration,
191227
193091
  getNameOfExpando,
191228
193092
  getNameOfJSDocTypedef,
193093
+ getNameOfScriptTarget,
191229
193094
  getNameOrArgument,
191230
193095
  getNameTable,
191231
193096
  getNamesForExportedSymbol,
@@ -191440,6 +193305,7 @@ if (typeof console !== "undefined") {
191440
193305
  hasEffectiveReadonlyModifier,
191441
193306
  hasExtension,
191442
193307
  hasIndexSignature,
193308
+ hasInferredType,
191443
193309
  hasInitializer,
191444
193310
  hasInvalidEscape,
191445
193311
  hasJSDocNodes,
@@ -191984,12 +193850,12 @@ if (typeof console !== "undefined") {
191984
193850
  isPackageJsonInfo,
191985
193851
  isPackedArrayLiteral,
191986
193852
  isParameter,
191987
- isParameterDeclaration,
191988
193853
  isParameterPropertyDeclaration,
191989
193854
  isParameterPropertyModifier,
191990
193855
  isParenthesizedExpression,
191991
193856
  isParenthesizedTypeNode,
191992
193857
  isParseTreeNode,
193858
+ isPartOfParameterDeclaration,
191993
193859
  isPartOfTypeNode,
191994
193860
  isPartOfTypeQuery,
191995
193861
  isPartiallyEmittedExpression,
@@ -192000,6 +193866,7 @@ if (typeof console !== "undefined") {
192000
193866
  isPossiblyTypeArgumentPosition,
192001
193867
  isPostfixUnaryExpression,
192002
193868
  isPrefixUnaryExpression,
193869
+ isPrimitiveLiteralValue,
192003
193870
  isPrivateIdentifier,
192004
193871
  isPrivateIdentifierClassElementDeclaration,
192005
193872
  isPrivateIdentifierPropertyAccessExpression,
@@ -192166,6 +194033,7 @@ if (typeof console !== "undefined") {
192166
194033
  isValueSignatureDeclaration,
192167
194034
  isVarAwaitUsing,
192168
194035
  isVarConst,
194036
+ isVarConstLike,
192169
194037
  isVarUsing,
192170
194038
  isVariableDeclaration,
192171
194039
  isVariableDeclarationInVariableStatement,
@@ -192370,6 +194238,7 @@ if (typeof console !== "undefined") {
192370
194238
  reducePathComponents,
192371
194239
  refactor,
192372
194240
  regExpEscape,
194241
+ regularExpressionFlagToCharacter,
192373
194242
  relativeComplement,
192374
194243
  removeAllComments,
192375
194244
  removeEmitHelper,
@@ -192625,6 +194494,7 @@ if (typeof console !== "undefined") {
192625
194494
  unsetNodeChildren,
192626
194495
  unusedLabelIsError,
192627
194496
  unwrapInnermostStatementOfLabel,
194497
+ unwrapParenthesizedExpression,
192628
194498
  updateErrorForNoInputFiles,
192629
194499
  updateLanguageServiceSourceFile,
192630
194500
  updateMissingFilePathsWatch,