@typescript-deploys/pr-build 5.5.0-pr-57842-28 → 5.5.0-pr-55267-165

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240530`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240531`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -1518,6 +1518,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1518
1518
  );
1519
1519
  }
1520
1520
  Debug2.formatNodeFlags = formatNodeFlags;
1521
+ function formatNodeCheckFlags(flags) {
1522
+ return formatEnum(
1523
+ flags,
1524
+ NodeCheckFlags,
1525
+ /*isFlags*/
1526
+ true
1527
+ );
1528
+ }
1529
+ Debug2.formatNodeCheckFlags = formatNodeCheckFlags;
1521
1530
  function formatModifierFlags(flags) {
1522
1531
  return formatEnum(
1523
1532
  flags,
@@ -3530,6 +3539,34 @@ var SymbolFlags = /* @__PURE__ */ ((SymbolFlags2) => {
3530
3539
  SymbolFlags2[SymbolFlags2["LateBindingContainer"] = 6256] = "LateBindingContainer";
3531
3540
  return SymbolFlags2;
3532
3541
  })(SymbolFlags || {});
3542
+ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => {
3543
+ NodeCheckFlags3[NodeCheckFlags3["None"] = 0] = "None";
3544
+ NodeCheckFlags3[NodeCheckFlags3["TypeChecked"] = 1] = "TypeChecked";
3545
+ NodeCheckFlags3[NodeCheckFlags3["LexicalThis"] = 2] = "LexicalThis";
3546
+ NodeCheckFlags3[NodeCheckFlags3["CaptureThis"] = 4] = "CaptureThis";
3547
+ NodeCheckFlags3[NodeCheckFlags3["CaptureNewTarget"] = 8] = "CaptureNewTarget";
3548
+ NodeCheckFlags3[NodeCheckFlags3["SuperInstance"] = 16] = "SuperInstance";
3549
+ NodeCheckFlags3[NodeCheckFlags3["SuperStatic"] = 32] = "SuperStatic";
3550
+ NodeCheckFlags3[NodeCheckFlags3["ContextChecked"] = 64] = "ContextChecked";
3551
+ NodeCheckFlags3[NodeCheckFlags3["MethodWithSuperPropertyAccessInAsync"] = 128] = "MethodWithSuperPropertyAccessInAsync";
3552
+ NodeCheckFlags3[NodeCheckFlags3["MethodWithSuperPropertyAssignmentInAsync"] = 256] = "MethodWithSuperPropertyAssignmentInAsync";
3553
+ NodeCheckFlags3[NodeCheckFlags3["CaptureArguments"] = 512] = "CaptureArguments";
3554
+ NodeCheckFlags3[NodeCheckFlags3["EnumValuesComputed"] = 1024] = "EnumValuesComputed";
3555
+ NodeCheckFlags3[NodeCheckFlags3["LexicalModuleMergesWithClass"] = 2048] = "LexicalModuleMergesWithClass";
3556
+ NodeCheckFlags3[NodeCheckFlags3["LoopWithCapturedBlockScopedBinding"] = 4096] = "LoopWithCapturedBlockScopedBinding";
3557
+ NodeCheckFlags3[NodeCheckFlags3["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding";
3558
+ NodeCheckFlags3[NodeCheckFlags3["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding";
3559
+ NodeCheckFlags3[NodeCheckFlags3["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop";
3560
+ NodeCheckFlags3[NodeCheckFlags3["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter";
3561
+ NodeCheckFlags3[NodeCheckFlags3["AssignmentsMarked"] = 131072] = "AssignmentsMarked";
3562
+ NodeCheckFlags3[NodeCheckFlags3["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference";
3563
+ NodeCheckFlags3[NodeCheckFlags3["ConstructorReference"] = 536870912] = "ConstructorReference";
3564
+ NodeCheckFlags3[NodeCheckFlags3["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
3565
+ NodeCheckFlags3[NodeCheckFlags3["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
3566
+ NodeCheckFlags3[NodeCheckFlags3["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
3567
+ NodeCheckFlags3[NodeCheckFlags3["LazyFlags"] = 539358128] = "LazyFlags";
3568
+ return NodeCheckFlags3;
3569
+ })(NodeCheckFlags || {});
3533
3570
  var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3534
3571
  TypeFlags2[TypeFlags2["Any"] = 1] = "Any";
3535
3572
  TypeFlags2[TypeFlags2["Unknown"] = 2] = "Unknown";
@@ -6091,8 +6128,10 @@ var Diagnostics = {
6091
6128
  _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."),
6092
6129
  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."),
6093
6130
  This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_regular_expression: diag(1533, 1 /* Error */, "This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_r_1533", "This backreference refers to a group that does not exist. There are only {0} capturing groups in this regular expression."),
6094
- This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups: diag(1534, 1 /* Error */, "This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups_1534", "This backreference is invalid because the containing regular expression contains no capturing groups."),
6131
+ This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regular_expression: diag(1534, 1 /* Error */, "This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regul_1534", "This backreference refers to a group that does not exist. There are no capturing groups in this regular expression."),
6095
6132
  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."),
6133
+ Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead: diag(1536, 1 /* Error */, "Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended__1536", "Octal escape sequences and backreferences are not allowed in a character class. If this was intended as an escape sequence, use the syntax '{0}' instead."),
6134
+ Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."),
6096
6135
  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."),
6097
6136
  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."),
6098
6137
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -8812,12 +8851,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8812
8851
  }
8813
8852
  if (ch === 92 /* backslash */ && !jsxAttributeString) {
8814
8853
  result += text.substring(start2, pos);
8815
- result += scanEscapeSequence(
8816
- /*shouldEmitInvalidEscapeError*/
8817
- true,
8818
- /*isRegularExpression*/
8819
- false
8820
- );
8854
+ result += scanEscapeSequence(1 /* String */ | 2 /* ReportErrors */);
8821
8855
  start2 = pos;
8822
8856
  continue;
8823
8857
  }
@@ -8860,11 +8894,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8860
8894
  }
8861
8895
  if (currChar === 92 /* backslash */) {
8862
8896
  contents += text.substring(start2, pos);
8863
- contents += scanEscapeSequence(
8864
- shouldEmitInvalidEscapeError,
8865
- /*isRegularExpression*/
8866
- false
8867
- );
8897
+ contents += scanEscapeSequence(1 /* String */ | (shouldEmitInvalidEscapeError ? 2 /* ReportErrors */ : 0));
8868
8898
  start2 = pos;
8869
8899
  continue;
8870
8900
  }
@@ -8884,7 +8914,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8884
8914
  tokenValue = contents;
8885
8915
  return resultingToken;
8886
8916
  }
8887
- function scanEscapeSequence(shouldEmitInvalidEscapeError, isRegularExpression) {
8917
+ function scanEscapeSequence(flags) {
8888
8918
  const start2 = pos;
8889
8919
  pos++;
8890
8920
  if (pos >= end) {
@@ -8912,9 +8942,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8912
8942
  pos++;
8913
8943
  }
8914
8944
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8915
- if (isRegularExpression || shouldEmitInvalidEscapeError) {
8945
+ if (flags & 6 /* ReportInvalidEscapeErrors */) {
8916
8946
  const code = parseInt(text.substring(start2 + 1, pos), 8);
8917
- if (isRegularExpression !== "annex-b") {
8947
+ if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */) && ch !== 48 /* _0 */) {
8948
+ error(Diagnostics.Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
8949
+ } else {
8918
8950
  error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
8919
8951
  }
8920
8952
  return String.fromCharCode(code);
@@ -8923,8 +8955,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8923
8955
  case 56 /* _8 */:
8924
8956
  case 57 /* _9 */:
8925
8957
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8926
- if (isRegularExpression || shouldEmitInvalidEscapeError) {
8927
- error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8958
+ if (flags & 6 /* ReportInvalidEscapeErrors */) {
8959
+ if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */)) {
8960
+ error(Diagnostics.Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class, start2, pos - start2);
8961
+ } else {
8962
+ error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8963
+ }
8928
8964
  return String.fromCharCode(ch);
8929
8965
  }
8930
8966
  return text.substring(start2, pos);
@@ -8945,14 +8981,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8945
8981
  case 34 /* doubleQuote */:
8946
8982
  return '"';
8947
8983
  case 117 /* u */:
8948
- if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
8984
+ if (flags & 17 /* ScanExtendedUnicodeEscape */ && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
8949
8985
  pos -= 2;
8950
- return scanExtendedUnicodeEscape(!!isRegularExpression || shouldEmitInvalidEscapeError);
8986
+ return scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
8951
8987
  }
8952
8988
  for (; pos < start2 + 6; pos++) {
8953
8989
  if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
8954
8990
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8955
- if (isRegularExpression || shouldEmitInvalidEscapeError) {
8991
+ if (flags & 6 /* ReportInvalidEscapeErrors */) {
8956
8992
  error(Diagnostics.Hexadecimal_digit_expected);
8957
8993
  }
8958
8994
  return text.substring(start2, pos);
@@ -8961,7 +8997,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8961
8997
  tokenFlags |= 1024 /* UnicodeEscape */;
8962
8998
  const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
8963
8999
  const escapedValueString = String.fromCharCode(escapedValue);
8964
- if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
9000
+ if (flags & 16 /* AnyUnicodeMode */ && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
8965
9001
  const nextStart = pos;
8966
9002
  let nextPos = pos + 2;
8967
9003
  for (; nextPos < nextStart + 6; nextPos++) {
@@ -8980,7 +9016,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8980
9016
  for (; pos < start2 + 4; pos++) {
8981
9017
  if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
8982
9018
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8983
- if (isRegularExpression || shouldEmitInvalidEscapeError) {
9019
+ if (flags & 6 /* ReportInvalidEscapeErrors */) {
8984
9020
  error(Diagnostics.Hexadecimal_digit_expected);
8985
9021
  }
8986
9022
  return text.substring(start2, pos);
@@ -8997,7 +9033,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8997
9033
  case 8233 /* paragraphSeparator */:
8998
9034
  return "";
8999
9035
  default:
9000
- if (isRegularExpression === true && (shouldEmitInvalidEscapeError || isIdentifierPart(ch, languageVersion))) {
9036
+ if (flags & 16 /* AnyUnicodeMode */ || flags & 4 /* RegularExpression */ && !(flags & 8 /* AnnexB */) && isIdentifierPart(ch, languageVersion)) {
9001
9037
  error(Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, pos - 2, 2);
9002
9038
  }
9003
9039
  return String.fromCharCode(ch);
@@ -9696,6 +9732,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9696
9732
  const startOfRegExpBody = tokenStart + 1;
9697
9733
  pos = startOfRegExpBody;
9698
9734
  let inEscape = false;
9735
+ let namedCaptureGroups = false;
9699
9736
  let inCharacterClass = false;
9700
9737
  while (true) {
9701
9738
  const ch = charCodeChecked(pos);
@@ -9713,6 +9750,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9713
9750
  inEscape = true;
9714
9751
  } else if (ch === 93 /* closeBracket */) {
9715
9752
  inCharacterClass = false;
9753
+ } else if (!inCharacterClass && ch === 40 /* openParen */ && charCodeChecked(pos + 1) === 63 /* question */ && charCodeChecked(pos + 2) === 60 /* lessThan */ && charCodeChecked(pos + 3) !== 61 /* equals */ && charCodeChecked(pos + 3) !== 33 /* exclamation */) {
9754
+ namedCaptureGroups = true;
9716
9755
  }
9717
9756
  pos++;
9718
9757
  }
@@ -9756,7 +9795,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9756
9795
  pos++;
9757
9796
  let regExpFlags = 0 /* None */;
9758
9797
  while (true) {
9759
- const ch = codePointChecked(pos);
9798
+ const ch = charCodeChecked(pos);
9760
9799
  if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
9761
9800
  break;
9762
9801
  }
@@ -9780,7 +9819,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9780
9819
  scanRegularExpressionWorker(
9781
9820
  regExpFlags,
9782
9821
  /*annexB*/
9783
- true
9822
+ true,
9823
+ namedCaptureGroups
9784
9824
  );
9785
9825
  });
9786
9826
  }
@@ -9790,12 +9830,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9790
9830
  }
9791
9831
  return token;
9792
9832
  }
9793
- function scanRegularExpressionWorker(regExpFlags, annexB) {
9833
+ function scanRegularExpressionWorker(regExpFlags, annexB, namedCaptureGroups) {
9794
9834
  var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
9795
9835
  var anyUnicodeMode = !!(regExpFlags & 96 /* AnyUnicodeMode */);
9796
- if (anyUnicodeMode) {
9797
- annexB = false;
9798
- }
9836
+ var anyUnicodeModeOrNonAnnexB = anyUnicodeMode || !annexB;
9799
9837
  var mayContainStrings = false;
9800
9838
  var numberOfCapturingGroups = 0;
9801
9839
  var groupSpecifiers;
@@ -9850,7 +9888,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9850
9888
  case 61 /* equals */:
9851
9889
  case 33 /* exclamation */:
9852
9890
  pos++;
9853
- isPreviousTermQuantifiable = annexB;
9891
+ isPreviousTermQuantifiable = !anyUnicodeModeOrNonAnnexB;
9854
9892
  break;
9855
9893
  case 60 /* lessThan */:
9856
9894
  const groupNameStart = pos;
@@ -9904,6 +9942,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9904
9942
  const digitsStart = pos;
9905
9943
  scanDigits();
9906
9944
  const min2 = tokenValue;
9945
+ if (!anyUnicodeModeOrNonAnnexB && !min2) {
9946
+ isPreviousTermQuantifiable = true;
9947
+ break;
9948
+ }
9907
9949
  if (charCodeChecked(pos) === 44 /* comma */) {
9908
9950
  pos++;
9909
9951
  scanDigits();
@@ -9912,25 +9954,29 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9912
9954
  if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
9913
9955
  error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
9914
9956
  } else {
9915
- if (anyUnicodeMode) {
9916
- error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9917
- }
9957
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9918
9958
  isPreviousTermQuantifiable = true;
9919
9959
  break;
9920
9960
  }
9921
- }
9922
- if (max && Number.parseInt(min2) > Number.parseInt(max)) {
9961
+ } else if (max && Number.parseInt(min2) > Number.parseInt(max) && (anyUnicodeModeOrNonAnnexB || charCodeChecked(pos) === 125 /* closeBrace */)) {
9923
9962
  error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
9924
9963
  }
9925
9964
  } else if (!min2) {
9926
- if (anyUnicodeMode) {
9965
+ if (anyUnicodeModeOrNonAnnexB) {
9927
9966
  error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9928
9967
  }
9929
9968
  isPreviousTermQuantifiable = true;
9930
9969
  break;
9931
9970
  }
9932
- scanExpectedChar(125 /* closeBrace */);
9933
- pos--;
9971
+ if (charCodeChecked(pos) !== 125 /* closeBrace */) {
9972
+ if (anyUnicodeModeOrNonAnnexB) {
9973
+ error(Diagnostics._0_expected, pos, 0, String.fromCharCode(125 /* closeBrace */));
9974
+ pos--;
9975
+ } else {
9976
+ isPreviousTermQuantifiable = true;
9977
+ break;
9978
+ }
9979
+ }
9934
9980
  case 42 /* asterisk */:
9935
9981
  case 43 /* plus */:
9936
9982
  case 63 /* question */:
@@ -9963,7 +10009,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9963
10009
  }
9964
10010
  case 93 /* closeBracket */:
9965
10011
  case 125 /* closeBrace */:
9966
- if (anyUnicodeMode || ch === 41 /* closeParen */) {
10012
+ if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
9967
10013
  error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
9968
10014
  }
9969
10015
  pos++;
@@ -10012,7 +10058,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10012
10058
  true
10013
10059
  );
10014
10060
  scanExpectedChar(62 /* greaterThan */);
10015
- } else if (anyUnicodeMode) {
10061
+ } else if (anyUnicodeModeOrNonAnnexB || namedCaptureGroups) {
10016
10062
  error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
10017
10063
  }
10018
10064
  break;
@@ -10055,9 +10101,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10055
10101
  pos++;
10056
10102
  return String.fromCharCode(ch & 31);
10057
10103
  }
10058
- if (anyUnicodeMode) {
10104
+ if (anyUnicodeModeOrNonAnnexB) {
10059
10105
  error(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
10060
- } else if (atomEscape && annexB) {
10106
+ } else if (atomEscape) {
10061
10107
  pos--;
10062
10108
  return "\\";
10063
10109
  }
@@ -10082,10 +10128,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10082
10128
  default:
10083
10129
  pos--;
10084
10130
  return scanEscapeSequence(
10085
- /*shouldEmitInvalidEscapeError*/
10086
- anyUnicodeMode,
10087
- /*isRegularExpression*/
10088
- annexB ? "annex-b" : true
10131
+ 4 /* RegularExpression */ | (annexB ? 8 /* AnnexB */ : 0) | (anyUnicodeMode ? 16 /* AnyUnicodeMode */ : 0) | (atomEscape ? 32 /* AtomEscape */ : 0)
10089
10132
  );
10090
10133
  }
10091
10134
  }
@@ -10127,12 +10170,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10127
10170
  if (isClassContentExit(ch2)) {
10128
10171
  return;
10129
10172
  }
10130
- if (!minCharacter && !annexB) {
10173
+ if (!minCharacter && anyUnicodeModeOrNonAnnexB) {
10131
10174
  error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
10132
10175
  }
10133
10176
  const maxStart = pos;
10134
10177
  const maxCharacter = scanClassAtom();
10135
- if (!maxCharacter && !annexB) {
10178
+ if (!maxCharacter && anyUnicodeModeOrNonAnnexB) {
10136
10179
  error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
10137
10180
  continue;
10138
10181
  }
@@ -10562,8 +10605,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10562
10605
  if (!anyUnicodeMode) {
10563
10606
  error(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
10564
10607
  }
10565
- } else if (anyUnicodeMode) {
10608
+ } else if (anyUnicodeModeOrNonAnnexB) {
10566
10609
  error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
10610
+ } else {
10611
+ pos--;
10612
+ return false;
10567
10613
  }
10568
10614
  return true;
10569
10615
  }
@@ -10603,11 +10649,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10603
10649
  }
10604
10650
  });
10605
10651
  forEach(decimalEscapes, (escape) => {
10606
- if (!annexB && escape.value > numberOfCapturingGroups) {
10652
+ if (escape.value > numberOfCapturingGroups) {
10607
10653
  if (numberOfCapturingGroups) {
10608
10654
  error(Diagnostics.This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos, numberOfCapturingGroups);
10609
10655
  } else {
10610
- error(Diagnostics.This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups, escape.pos, escape.end - escape.pos);
10656
+ error(Diagnostics.This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos);
10611
10657
  }
10612
10658
  }
10613
10659
  });
@@ -11000,10 +11046,10 @@ var binaryUnicodeProperties = /* @__PURE__ */ new Set(["ASCII", "ASCII_Hex_Digit
11000
11046
  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"]);
11001
11047
  var valuesOfNonBinaryUnicodeProperties = {
11002
11048
  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"]),
11003
- 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"]),
11004
- Script_Extensions: /* @__PURE__ */ new Set()
11005
- // Currently empty
11049
+ Script: /* @__PURE__ */ new Set(["Adlm", "Adlam", "Aghb", "Caucasian_Albanian", "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", "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", "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", "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", "Mong", "Mongolian", "Mroo", "Mro", "Mtei", "Meetei_Mayek", "Mult", "Multani", "Mymr", "Myanmar", "Nagm", "Nag_Mundari", "Nand", "Nandinagari", "Narb", "Old_North_Arabian", "Nbat", "Nabataean", "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", "Tibt", "Tibetan", "Tirh", "Tirhuta", "Tnsa", "Tangsa", "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"]),
11050
+ Script_Extensions: void 0
11006
11051
  };
11052
+ valuesOfNonBinaryUnicodeProperties.Script_Extensions = valuesOfNonBinaryUnicodeProperties.Script;
11007
11053
 
11008
11054
  // src/compiler/utilitiesPublic.ts
11009
11055
  function isExternalModuleNameRelative(moduleName) {
@@ -11047,8 +11093,8 @@ function textSpanIsEmpty(span) {
11047
11093
  function textSpanContainsPosition(span, position) {
11048
11094
  return position >= span.start && position < textSpanEnd(span);
11049
11095
  }
11050
- function textRangeContainsPositionInclusive(range, position) {
11051
- return position >= range.pos && position <= range.end;
11096
+ function textRangeContainsPositionInclusive(span, position) {
11097
+ return position >= span.pos && position <= span.end;
11052
11098
  }
11053
11099
  function createTextSpan(start, length2) {
11054
11100
  if (start < 0) {
@@ -13593,6 +13639,26 @@ function getErrorSpanForNode(sourceFile, node) {
13593
13639
  const pos2 = skipTrivia(sourceFile.text, node.tagName.pos);
13594
13640
  return getSpanOfTokenAtPosition(sourceFile, pos2);
13595
13641
  }
13642
+ case 176 /* Constructor */: {
13643
+ const constructorDeclaration = node;
13644
+ const start = skipTrivia(sourceFile.text, constructorDeclaration.pos);
13645
+ const scanner = createScanner(
13646
+ sourceFile.languageVersion,
13647
+ /*skipTrivia*/
13648
+ true,
13649
+ sourceFile.languageVariant,
13650
+ sourceFile.text,
13651
+ /*onError*/
13652
+ void 0,
13653
+ start
13654
+ );
13655
+ let token = scanner.scan();
13656
+ while (token !== 137 /* ConstructorKeyword */ && token !== 1 /* EndOfFileToken */) {
13657
+ token = scanner.scan();
13658
+ }
13659
+ const end = scanner.getTokenEnd();
13660
+ return createTextSpanFromBounds(start, end);
13661
+ }
13596
13662
  }
13597
13663
  if (errorNode === void 0) {
13598
13664
  return getSpanOfTokenAtPosition(sourceFile, node.pos);
@@ -18252,14 +18318,15 @@ function rangeOfTypeParameters(sourceFile, typeParameters) {
18252
18318
  return { pos, end };
18253
18319
  }
18254
18320
  function skipTypeChecking(sourceFile, options, host) {
18255
- return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName);
18321
+ return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnsotics(sourceFile, options);
18256
18322
  }
18257
- function shouldIncludeBindAndCheckDiagnostics(sourceFile, options) {
18323
+ function canIncludeBindAndCheckDiagnsotics(sourceFile, options) {
18324
+ if (!!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false) return false;
18325
+ if (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */ || sourceFile.scriptKind === 5 /* External */) return true;
18258
18326
  const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
18259
18327
  const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
18260
18328
  const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
18261
- const isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
18262
- return !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */ || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
18329
+ return isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */;
18263
18330
  }
18264
18331
  function isJsonEqual(a, b) {
18265
18332
  return a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && equalOwnProperties(a, b, isJsonEqual);
@@ -25493,7 +25560,7 @@ var addDisposableResourceHelper = {
25493
25560
  var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
25494
25561
  if (value !== null && value !== void 0) {
25495
25562
  if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
25496
- var dispose;
25563
+ var dispose, inner;
25497
25564
  if (async) {
25498
25565
  if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
25499
25566
  dispose = value[Symbol.asyncDispose];
@@ -25501,8 +25568,10 @@ var addDisposableResourceHelper = {
25501
25568
  if (dispose === void 0) {
25502
25569
  if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
25503
25570
  dispose = value[Symbol.dispose];
25571
+ if (async) inner = dispose;
25504
25572
  }
25505
25573
  if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
25574
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
25506
25575
  env.stack.push({ value: value, dispose: dispose, async: async });
25507
25576
  }
25508
25577
  else if (async) {
@@ -35887,7 +35956,7 @@ var commandOptionsWithoutBuild = [
35887
35956
  showInSimplifiedHelpView: false,
35888
35957
  category: Diagnostics.Compiler_Diagnostics,
35889
35958
  description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
35890
- transpileOptionValue: void 0,
35959
+ transpileOptionValue: true,
35891
35960
  defaultValueDescription: false,
35892
35961
  affectsSemanticDiagnostics: true,
35893
35962
  affectsBuildInfo: true,
@@ -45039,9 +45108,6 @@ function createTypeChecker(host) {
45039
45108
  deferredDiagnosticsCallbacks.push(arg);
45040
45109
  };
45041
45110
  var cancellationToken;
45042
- var requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
45043
- var requestedExternalEmitHelpers;
45044
- var externalHelpersModule;
45045
45111
  var scanner;
45046
45112
  var Symbol12 = objectAllocator.getSymbolConstructor();
45047
45113
  var Type7 = objectAllocator.getTypeConstructor();
@@ -45336,6 +45402,7 @@ function createTypeChecker(host) {
45336
45402
  getImmediateAliasedSymbol,
45337
45403
  getAliasedSymbol: resolveAlias,
45338
45404
  getEmitResolver,
45405
+ requiresAddingImplicitUndefined,
45339
45406
  getExportsOfModule: getExportsOfModuleAsArray,
45340
45407
  getExportsAndPropertiesOfModule,
45341
45408
  forEachExportAndPropertyOfModule,
@@ -47684,10 +47751,22 @@ function createTypeChecker(host) {
47684
47751
  return !!aliasDeclarationLinks.typeOnlyDeclaration;
47685
47752
  }
47686
47753
  function getTypeOnlyAliasDeclaration(symbol, include) {
47754
+ var _a;
47687
47755
  if (!(symbol.flags & 2097152 /* Alias */)) {
47688
47756
  return void 0;
47689
47757
  }
47690
47758
  const links = getSymbolLinks(symbol);
47759
+ if (links.typeOnlyDeclaration === void 0) {
47760
+ links.typeOnlyDeclaration = false;
47761
+ const resolved = resolveSymbol(symbol);
47762
+ markSymbolOfAliasDeclarationIfTypeOnly(
47763
+ (_a = symbol.declarations) == null ? void 0 : _a[0],
47764
+ getDeclarationOfAliasSymbol(symbol) && getImmediateAliasedSymbol(symbol),
47765
+ resolved,
47766
+ /*overwriteEmpty*/
47767
+ true
47768
+ );
47769
+ }
47691
47770
  if (include === void 0) {
47692
47771
  return links.typeOnlyDeclaration || void 0;
47693
47772
  }
@@ -51430,21 +51509,136 @@ function createTypeChecker(host) {
51430
51509
  cancellationToken.throwIfCancellationRequested();
51431
51510
  }
51432
51511
  let hadError = false;
51512
+ const { finalizeBoundary, startRecoveryScope } = createRecoveryBoundary();
51433
51513
  const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
51434
- if (hadError) {
51514
+ if (!finalizeBoundary()) {
51435
51515
  return void 0;
51436
51516
  }
51437
51517
  context.approximateLength += existing.end - existing.pos;
51438
51518
  return transformed;
51439
51519
  function visitExistingNodeTreeSymbols(node) {
51520
+ if (hadError) return node;
51521
+ const recover = startRecoveryScope();
51440
51522
  const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
51441
51523
  const result = visitExistingNodeTreeSymbolsWorker(node);
51442
51524
  onExitNewScope == null ? void 0 : onExitNewScope();
51525
+ if (hadError) {
51526
+ if (isTypeNode(node) && !isTypePredicateNode(node)) {
51527
+ recover();
51528
+ return serializeExistingTypeNode(context, node);
51529
+ }
51530
+ return node;
51531
+ }
51443
51532
  return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
51444
51533
  }
51534
+ function createRecoveryBoundary() {
51535
+ let unreportedErrors;
51536
+ const oldTracker = context.tracker;
51537
+ const oldTrackedSymbols = context.trackedSymbols;
51538
+ context.trackedSymbols = [];
51539
+ const oldEncounteredError = context.encounteredError;
51540
+ context.tracker = new SymbolTrackerImpl(context, {
51541
+ ...oldTracker.inner,
51542
+ reportCyclicStructureError() {
51543
+ markError(() => oldTracker.reportCyclicStructureError());
51544
+ },
51545
+ reportInaccessibleThisError() {
51546
+ markError(() => oldTracker.reportInaccessibleThisError());
51547
+ },
51548
+ reportInaccessibleUniqueSymbolError() {
51549
+ markError(() => oldTracker.reportInaccessibleUniqueSymbolError());
51550
+ },
51551
+ reportLikelyUnsafeImportRequiredError(specifier) {
51552
+ markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier));
51553
+ },
51554
+ reportNonSerializableProperty(name) {
51555
+ markError(() => oldTracker.reportNonSerializableProperty(name));
51556
+ },
51557
+ trackSymbol(sym, decl, meaning) {
51558
+ const accessibility = isSymbolAccessible(
51559
+ sym,
51560
+ decl,
51561
+ meaning,
51562
+ /*shouldComputeAliasesToMakeVisible*/
51563
+ false
51564
+ );
51565
+ if (accessibility.accessibility !== 0 /* Accessible */) {
51566
+ (context.trackedSymbols ?? (context.trackedSymbols = [])).push([sym, decl, meaning]);
51567
+ return true;
51568
+ }
51569
+ return false;
51570
+ },
51571
+ moduleResolverHost: context.tracker.moduleResolverHost
51572
+ }, context.tracker.moduleResolverHost);
51573
+ return {
51574
+ startRecoveryScope: startRecoveryScope2,
51575
+ finalizeBoundary: finalizeBoundary2
51576
+ };
51577
+ function markError(unreportedError) {
51578
+ hadError = true;
51579
+ (unreportedErrors ?? (unreportedErrors = [])).push(unreportedError);
51580
+ }
51581
+ function startRecoveryScope2() {
51582
+ var _a;
51583
+ const initialTrackedSymbolsTop = ((_a = context.trackedSymbols) == null ? void 0 : _a.length) ?? 0;
51584
+ const unreportedErrorsTop = (unreportedErrors == null ? void 0 : unreportedErrors.length) ?? 0;
51585
+ return () => {
51586
+ hadError = false;
51587
+ if (context.trackedSymbols) {
51588
+ context.trackedSymbols.length = initialTrackedSymbolsTop;
51589
+ }
51590
+ if (unreportedErrors) {
51591
+ unreportedErrors.length = unreportedErrorsTop;
51592
+ }
51593
+ };
51594
+ }
51595
+ function finalizeBoundary2() {
51596
+ context.tracker = oldTracker;
51597
+ const newTrackedSymbols = context.trackedSymbols;
51598
+ context.trackedSymbols = oldTrackedSymbols;
51599
+ context.encounteredError = oldEncounteredError;
51600
+ unreportedErrors == null ? void 0 : unreportedErrors.forEach((fn) => fn());
51601
+ if (hadError) {
51602
+ return false;
51603
+ }
51604
+ newTrackedSymbols == null ? void 0 : newTrackedSymbols.forEach(
51605
+ ([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
51606
+ symbol,
51607
+ enclosingDeclaration,
51608
+ meaning
51609
+ )
51610
+ );
51611
+ return true;
51612
+ }
51613
+ }
51445
51614
  function onEnterNewScope(node) {
51446
51615
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
51447
51616
  }
51617
+ function tryVisitTypeReference(node) {
51618
+ if (canReuseTypeNode(context, node)) {
51619
+ const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
51620
+ const typeArguments = visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode);
51621
+ if (!introducesError) {
51622
+ const updated = factory.updateTypeReferenceNode(
51623
+ node,
51624
+ newName,
51625
+ typeArguments
51626
+ );
51627
+ return setTextRange2(context, updated, node);
51628
+ } else {
51629
+ const serializedName = serializeTypeName(
51630
+ context,
51631
+ node.typeName,
51632
+ /*isTypeOf*/
51633
+ false,
51634
+ typeArguments
51635
+ );
51636
+ if (serializedName) {
51637
+ return setTextRange2(context, serializedName, node.typeName);
51638
+ }
51639
+ }
51640
+ }
51641
+ }
51448
51642
  function visitExistingNodeTreeSymbolsWorker(node) {
51449
51643
  if (isJSDocTypeExpression(node)) {
51450
51644
  return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
@@ -51541,7 +51735,8 @@ function createTypeChecker(host) {
51541
51735
  if (canReuseTypeNode(context, node)) {
51542
51736
  return node;
51543
51737
  }
51544
- return serializeExistingTypeNode(context, node);
51738
+ hadError = true;
51739
+ return node;
51545
51740
  }
51546
51741
  if (isTypeParameterDeclaration(node)) {
51547
51742
  return factory.updateTypeParameterDeclaration(
@@ -51552,31 +51747,21 @@ function createTypeChecker(host) {
51552
51747
  visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
51553
51748
  );
51554
51749
  }
51750
+ if (isIndexedAccessTypeNode(node) && isTypeReferenceNode(node.objectType)) {
51751
+ const objectType = tryVisitTypeReference(node.objectType);
51752
+ if (!objectType) {
51753
+ hadError = true;
51754
+ return node;
51755
+ }
51756
+ return factory.updateIndexedAccessTypeNode(node, objectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
51757
+ }
51555
51758
  if (isTypeReferenceNode(node)) {
51556
- if (canReuseTypeNode(context, node)) {
51557
- const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
51558
- const typeArguments = visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode);
51559
- if (!introducesError) {
51560
- const updated = factory.updateTypeReferenceNode(
51561
- node,
51562
- newName,
51563
- typeArguments
51564
- );
51565
- return setTextRange2(context, updated, node);
51566
- } else {
51567
- const serializedName = serializeTypeName(
51568
- context,
51569
- node.typeName,
51570
- /*isTypeOf*/
51571
- false,
51572
- typeArguments
51573
- );
51574
- if (serializedName) {
51575
- return setTextRange2(context, serializedName, node.typeName);
51576
- }
51577
- }
51759
+ const result = tryVisitTypeReference(node);
51760
+ if (result) {
51761
+ return result;
51578
51762
  }
51579
- return serializeExistingTypeNode(context, node);
51763
+ hadError = true;
51764
+ return node;
51580
51765
  }
51581
51766
  if (isLiteralImportTypeNode(node)) {
51582
51767
  const nodeSymbol = getNodeLinks(node).resolvedSymbol;
@@ -51627,7 +51812,8 @@ function createTypeChecker(host) {
51627
51812
  if (serializedName) {
51628
51813
  return setTextRange2(context, serializedName, node.exprName);
51629
51814
  }
51630
- return serializeExistingTypeNode(context, node);
51815
+ hadError = true;
51816
+ return node;
51631
51817
  }
51632
51818
  return factory.updateTypeQueryNode(
51633
51819
  node,
@@ -51696,9 +51882,21 @@ function createTypeChecker(host) {
51696
51882
  falseType2
51697
51883
  );
51698
51884
  }
51699
- if (isTypeOperatorNode(node) && node.operator === 158 /* UniqueKeyword */ && node.type.kind === 155 /* SymbolKeyword */) {
51700
- if (!canReuseTypeNode(context, node)) {
51701
- return serializeExistingTypeNode(context, node);
51885
+ if (isTypeOperatorNode(node)) {
51886
+ if (node.operator === 158 /* UniqueKeyword */ && node.type.kind === 155 /* SymbolKeyword */) {
51887
+ if (!canReuseTypeNode(context, node)) {
51888
+ hadError = true;
51889
+ return node;
51890
+ }
51891
+ } else if (node.operator === 143 /* KeyOfKeyword */) {
51892
+ if (isTypeReferenceNode(node.type)) {
51893
+ const type = tryVisitTypeReference(node.type);
51894
+ if (!type) {
51895
+ hadError = true;
51896
+ return node;
51897
+ }
51898
+ return factory.updateTypeOperatorNode(node, type);
51899
+ }
51702
51900
  }
51703
51901
  }
51704
51902
  return visitEachChild(
@@ -51715,13 +51913,39 @@ function createTypeChecker(host) {
51715
51913
  }
51716
51914
  function rewriteModuleSpecifier(parent, lit) {
51717
51915
  if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
51718
- const targetFile = getExternalModuleFileFromDeclaration(parent);
51719
- if (targetFile) {
51720
- const newName = getSpecifierForModuleSymbol(targetFile.symbol, context);
51721
- if (newName !== lit.text) {
51722
- return setOriginalNode(factory.createStringLiteral(newName), lit);
51916
+ let name = lit.text;
51917
+ const nodeSymbol = getNodeLinks(node).resolvedSymbol;
51918
+ const meaning = parent.isTypeOf ? 111551 /* Value */ : 788968 /* Type */;
51919
+ const parentSymbol = nodeSymbol && isSymbolAccessible(
51920
+ nodeSymbol,
51921
+ context.enclosingDeclaration,
51922
+ meaning,
51923
+ /*shouldComputeAliasesToMakeVisible*/
51924
+ false
51925
+ ).accessibility === 0 /* Accessible */ && lookupSymbolChain(
51926
+ nodeSymbol,
51927
+ context,
51928
+ meaning,
51929
+ /*yieldModuleSymbol*/
51930
+ true
51931
+ )[0];
51932
+ if (parentSymbol && parentSymbol.flags & 1536 /* Module */) {
51933
+ name = getSpecifierForModuleSymbol(parentSymbol, context);
51934
+ } else {
51935
+ const targetFile = getExternalModuleFileFromDeclaration(parent);
51936
+ if (targetFile) {
51937
+ name = getSpecifierForModuleSymbol(targetFile.symbol, context);
51723
51938
  }
51724
51939
  }
51940
+ if (name.includes("/node_modules/")) {
51941
+ context.encounteredError = true;
51942
+ if (context.tracker.reportLikelyUnsafeImportRequiredError) {
51943
+ context.tracker.reportLikelyUnsafeImportRequiredError(name);
51944
+ }
51945
+ }
51946
+ if (name !== lit.text) {
51947
+ return setOriginalNode(factory.createStringLiteral(name), lit);
51948
+ }
51725
51949
  }
51726
51950
  return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
51727
51951
  }
@@ -59689,7 +59913,6 @@ function createTypeChecker(host) {
59689
59913
  return links.resolvedType;
59690
59914
  }
59691
59915
  function getTemplateLiteralType(texts, types) {
59692
- var _a, _b;
59693
59916
  const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
59694
59917
  if (unionIndex >= 0) {
59695
59918
  return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
@@ -59697,9 +59920,6 @@ function createTypeChecker(host) {
59697
59920
  if (contains(types, wildcardType)) {
59698
59921
  return wildcardType;
59699
59922
  }
59700
- if (texts.length === 2 && texts[0] === "" && texts[1] === "" && !(types[0].flags & 2944 /* Literal */) && !((_b = (_a = types[0].symbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b.some((d) => d.parent.kind === 195 /* InferType */)) && isTypeAssignableTo(types[0], stringType)) {
59701
- return types[0];
59702
- }
59703
59923
  const newTypes = [];
59704
59924
  const newTexts = [];
59705
59925
  let text = texts[0];
@@ -69124,6 +69344,9 @@ function createTypeChecker(host) {
69124
69344
  return contextualType && !isGenericType(contextualType);
69125
69345
  }
69126
69346
  function getNarrowableTypeForReference(type, reference, checkMode) {
69347
+ if (isNoInferType(type)) {
69348
+ type = type.baseType;
69349
+ }
69127
69350
  const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
69128
69351
  return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
69129
69352
  }
@@ -69189,9 +69412,6 @@ function createTypeChecker(host) {
69189
69412
  if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
69190
69413
  return markJsxAliasReferenced(location);
69191
69414
  }
69192
- if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
69193
- return markAsyncFunctionAliasReferenced(location);
69194
- }
69195
69415
  if (isImportEqualsDeclaration(location)) {
69196
69416
  if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
69197
69417
  return markImportEqualsAliasReferenced(location);
@@ -69201,6 +69421,9 @@ function createTypeChecker(host) {
69201
69421
  if (isExportSpecifier(location)) {
69202
69422
  return markExportSpecifierAliasReferenced(location);
69203
69423
  }
69424
+ if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
69425
+ markAsyncFunctionAliasReferenced(location);
69426
+ }
69204
69427
  if (!compilerOptions.emitDecoratorMetadata) {
69205
69428
  return;
69206
69429
  }
@@ -69538,18 +69761,12 @@ function createTypeChecker(host) {
69538
69761
  }
69539
69762
  return type;
69540
69763
  }
69541
- function checkIdentifier(node, checkMode) {
69542
- if (isThisInTypeQuery(node)) {
69543
- return checkThisExpression(node);
69544
- }
69545
- const symbol = getResolvedSymbol(node);
69546
- if (symbol === unknownSymbol) {
69547
- return errorType;
69548
- }
69764
+ function checkIdentifierCalculateNodeCheckFlags(node, symbol) {
69765
+ if (isThisInTypeQuery(node)) return;
69549
69766
  if (symbol === argumentsSymbol) {
69550
69767
  if (isInPropertyInitializerOrClassStaticBlock(node)) {
69551
69768
  error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
69552
- return errorType;
69769
+ return;
69553
69770
  }
69554
69771
  let container = getContainingFunction(node);
69555
69772
  if (container) {
@@ -69568,17 +69785,14 @@ function createTypeChecker(host) {
69568
69785
  }
69569
69786
  }
69570
69787
  }
69571
- return getTypeOfSymbol(symbol);
69572
- }
69573
- if (shouldMarkIdentifierAliasReferenced(node)) {
69574
- markLinkedReferences(node, 1 /* Identifier */);
69788
+ return;
69575
69789
  }
69576
69790
  const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
69577
69791
  const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
69578
69792
  if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
69579
69793
  addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
69580
69794
  }
69581
- let declaration = localOrExportSymbol.valueDeclaration;
69795
+ const declaration = localOrExportSymbol.valueDeclaration;
69582
69796
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
69583
69797
  if (isClassLike(declaration) && declaration.name !== node) {
69584
69798
  let container = getThisContainer(
@@ -69605,6 +69819,27 @@ function createTypeChecker(host) {
69605
69819
  }
69606
69820
  }
69607
69821
  checkNestedBlockScopedBinding(node, symbol);
69822
+ }
69823
+ function checkIdentifier(node, checkMode) {
69824
+ if (isThisInTypeQuery(node)) {
69825
+ return checkThisExpression(node);
69826
+ }
69827
+ const symbol = getResolvedSymbol(node);
69828
+ if (symbol === unknownSymbol) {
69829
+ return errorType;
69830
+ }
69831
+ checkIdentifierCalculateNodeCheckFlags(node, symbol);
69832
+ if (symbol === argumentsSymbol) {
69833
+ if (isInPropertyInitializerOrClassStaticBlock(node)) {
69834
+ return errorType;
69835
+ }
69836
+ return getTypeOfSymbol(symbol);
69837
+ }
69838
+ if (shouldMarkIdentifierAliasReferenced(node)) {
69839
+ markLinkedReferences(node, 1 /* Identifier */);
69840
+ }
69841
+ const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
69842
+ let declaration = localOrExportSymbol.valueDeclaration;
69608
69843
  let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node, checkMode);
69609
69844
  const assignmentKind = getAssignmentTargetKind(node);
69610
69845
  if (assignmentKind) {
@@ -70270,7 +70505,31 @@ function createTypeChecker(host) {
70270
70505
  if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
70271
70506
  contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator));
70272
70507
  }
70273
- return node.asteriskToken ? contextualReturnType : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator);
70508
+ if (node.asteriskToken) {
70509
+ const iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(contextualReturnType, isAsyncGenerator);
70510
+ const yieldType = (iterationTypes == null ? void 0 : iterationTypes.yieldType) ?? silentNeverType;
70511
+ const returnType = getContextualType(node, contextFlags) ?? silentNeverType;
70512
+ const nextType = (iterationTypes == null ? void 0 : iterationTypes.nextType) ?? unknownType;
70513
+ const generatorType = createGeneratorType(
70514
+ yieldType,
70515
+ returnType,
70516
+ nextType,
70517
+ /*isAsyncGenerator*/
70518
+ false
70519
+ );
70520
+ if (isAsyncGenerator) {
70521
+ const asyncGeneratorType = createGeneratorType(
70522
+ yieldType,
70523
+ returnType,
70524
+ nextType,
70525
+ /*isAsyncGenerator*/
70526
+ true
70527
+ );
70528
+ return getUnionType([generatorType, asyncGeneratorType]);
70529
+ }
70530
+ return generatorType;
70531
+ }
70532
+ return getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator);
70274
70533
  }
70275
70534
  }
70276
70535
  return void 0;
@@ -76040,7 +76299,7 @@ function createTypeChecker(host) {
76040
76299
  if (nextType) nextType = getWidenedType(nextType);
76041
76300
  }
76042
76301
  if (isGenerator) {
76043
- return createGeneratorReturnType(
76302
+ return createGeneratorType(
76044
76303
  yieldType || neverType,
76045
76304
  returnType || fallbackReturnType,
76046
76305
  nextType || getContextualIterationType(2 /* Next */, func) || unknownType,
@@ -76050,7 +76309,7 @@ function createTypeChecker(host) {
76050
76309
  return isAsync ? createPromiseType(returnType || fallbackReturnType) : returnType || fallbackReturnType;
76051
76310
  }
76052
76311
  }
76053
- function createGeneratorReturnType(yieldType, returnType, nextType, isAsyncGenerator) {
76312
+ function createGeneratorType(yieldType, returnType, nextType, isAsyncGenerator) {
76054
76313
  const resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
76055
76314
  const globalGeneratorType = resolver.getGlobalGeneratorType(
76056
76315
  /*reportErrors*/
@@ -78435,7 +78694,7 @@ function createTypeChecker(host) {
78435
78694
  const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
78436
78695
  const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
78437
78696
  const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
78438
- const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
78697
+ const generatorInstantiation = createGeneratorType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
78439
78698
  return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
78440
78699
  }
78441
78700
  function checkClassForDuplicateDeclarations(node) {
@@ -83369,9 +83628,6 @@ function createTypeChecker(host) {
83369
83628
  }
83370
83629
  }
83371
83630
  function checkSourceElementWorker(node) {
83372
- if (getNodeCheckFlags(node) & 8388608 /* PartiallyTypeChecked */) {
83373
- return;
83374
- }
83375
83631
  if (canHaveJSDoc(node)) {
83376
83632
  forEach(node.jsDoc, ({ comment, tags }) => {
83377
83633
  checkJSDocCommentWorker(comment);
@@ -83715,21 +83971,19 @@ function createTypeChecker(host) {
83715
83971
  currentNode = saveCurrentNode;
83716
83972
  (_b = tracing) == null ? void 0 : _b.pop();
83717
83973
  }
83718
- function checkSourceFile(node, nodesToCheck) {
83974
+ function checkSourceFile(node) {
83719
83975
  var _a, _b;
83720
83976
  (_a = tracing) == null ? void 0 : _a.push(
83721
83977
  tracing.Phase.Check,
83722
- nodesToCheck ? "checkSourceFileNodes" : "checkSourceFile",
83978
+ "checkSourceFile",
83723
83979
  { path: node.path },
83724
83980
  /*separateBeginAndEnd*/
83725
83981
  true
83726
83982
  );
83727
- const beforeMark = nodesToCheck ? "beforeCheckNodes" : "beforeCheck";
83728
- const afterMark = nodesToCheck ? "afterCheckNodes" : "afterCheck";
83729
- mark(beforeMark);
83730
- nodesToCheck ? checkSourceFileNodesWorker(node, nodesToCheck) : checkSourceFileWorker(node);
83731
- mark(afterMark);
83732
- measure("Check", beforeMark, afterMark);
83983
+ mark("beforeCheck");
83984
+ checkSourceFileWorker(node);
83985
+ mark("afterCheck");
83986
+ measure("Check", "beforeCheck", "afterCheck");
83733
83987
  (_b = tracing) == null ? void 0 : _b.pop();
83734
83988
  }
83735
83989
  function unusedIsError(kind, isAmbient) {
@@ -83760,13 +84014,6 @@ function createTypeChecker(host) {
83760
84014
  clear(potentialWeakMapSetCollisions);
83761
84015
  clear(potentialReflectCollisions);
83762
84016
  clear(potentialUnusedRenamedBindingElementsInTypes);
83763
- if (links.flags & 8388608 /* PartiallyTypeChecked */) {
83764
- potentialThisCollisions = links.potentialThisCollisions;
83765
- potentialNewTargetCollisions = links.potentialNewTargetCollisions;
83766
- potentialWeakMapSetCollisions = links.potentialWeakMapSetCollisions;
83767
- potentialReflectCollisions = links.potentialReflectCollisions;
83768
- potentialUnusedRenamedBindingElementsInTypes = links.potentialUnusedRenamedBindingElementsInTypes;
83769
- }
83770
84017
  forEach(node.statements, checkSourceElement);
83771
84018
  checkSourceElement(node.endOfFileToken);
83772
84019
  checkDeferredNodes(node);
@@ -83807,38 +84054,10 @@ function createTypeChecker(host) {
83807
84054
  links.flags |= 1 /* TypeChecked */;
83808
84055
  }
83809
84056
  }
83810
- function checkSourceFileNodesWorker(file, nodes) {
83811
- const links = getNodeLinks(file);
83812
- if (!(links.flags & 1 /* TypeChecked */)) {
83813
- if (skipTypeChecking(file, compilerOptions, host)) {
83814
- return;
83815
- }
83816
- checkGrammarSourceFile(file);
83817
- clear(potentialThisCollisions);
83818
- clear(potentialNewTargetCollisions);
83819
- clear(potentialWeakMapSetCollisions);
83820
- clear(potentialReflectCollisions);
83821
- clear(potentialUnusedRenamedBindingElementsInTypes);
83822
- forEach(nodes, checkSourceElement);
83823
- checkDeferredNodes(file);
83824
- (links.potentialThisCollisions || (links.potentialThisCollisions = [])).push(...potentialThisCollisions);
83825
- (links.potentialNewTargetCollisions || (links.potentialNewTargetCollisions = [])).push(...potentialNewTargetCollisions);
83826
- (links.potentialWeakMapSetCollisions || (links.potentialWeakMapSetCollisions = [])).push(...potentialWeakMapSetCollisions);
83827
- (links.potentialReflectCollisions || (links.potentialReflectCollisions = [])).push(...potentialReflectCollisions);
83828
- (links.potentialUnusedRenamedBindingElementsInTypes || (links.potentialUnusedRenamedBindingElementsInTypes = [])).push(
83829
- ...potentialUnusedRenamedBindingElementsInTypes
83830
- );
83831
- links.flags |= 8388608 /* PartiallyTypeChecked */;
83832
- for (const node of nodes) {
83833
- const nodeLinks2 = getNodeLinks(node);
83834
- nodeLinks2.flags |= 8388608 /* PartiallyTypeChecked */;
83835
- }
83836
- }
83837
- }
83838
- function getDiagnostics(sourceFile, ct, nodesToCheck) {
84057
+ function getDiagnostics(sourceFile, ct) {
83839
84058
  try {
83840
84059
  cancellationToken = ct;
83841
- return getDiagnosticsWorker(sourceFile, nodesToCheck);
84060
+ return getDiagnosticsWorker(sourceFile);
83842
84061
  } finally {
83843
84062
  cancellationToken = void 0;
83844
84063
  }
@@ -83849,23 +84068,20 @@ function createTypeChecker(host) {
83849
84068
  }
83850
84069
  deferredDiagnosticsCallbacks = [];
83851
84070
  }
83852
- function checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck) {
84071
+ function checkSourceFileWithEagerDiagnostics(sourceFile) {
83853
84072
  ensurePendingDiagnosticWorkComplete();
83854
84073
  const oldAddLazyDiagnostics = addLazyDiagnostic;
83855
84074
  addLazyDiagnostic = (cb) => cb();
83856
- checkSourceFile(sourceFile, nodesToCheck);
84075
+ checkSourceFile(sourceFile);
83857
84076
  addLazyDiagnostic = oldAddLazyDiagnostics;
83858
84077
  }
83859
- function getDiagnosticsWorker(sourceFile, nodesToCheck) {
84078
+ function getDiagnosticsWorker(sourceFile) {
83860
84079
  if (sourceFile) {
83861
84080
  ensurePendingDiagnosticWorkComplete();
83862
84081
  const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
83863
84082
  const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
83864
- checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck);
84083
+ checkSourceFileWithEagerDiagnostics(sourceFile);
83865
84084
  const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
83866
- if (nodesToCheck) {
83867
- return semanticDiagnostics;
83868
- }
83869
84085
  const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
83870
84086
  if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
83871
84087
  const deferredGlobalDiagnostics = relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, compareDiagnostics);
@@ -83875,7 +84091,7 @@ function createTypeChecker(host) {
83875
84091
  }
83876
84092
  return semanticDiagnostics;
83877
84093
  }
83878
- forEach(host.getSourceFiles(), (file) => checkSourceFileWithEagerDiagnostics(file));
84094
+ forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
83879
84095
  return diagnostics.getDiagnostics();
83880
84096
  }
83881
84097
  function getGlobalDiagnostics() {
@@ -84634,7 +84850,6 @@ function createTypeChecker(host) {
84634
84850
  if (links.isDeclarationWithCollidingName === void 0) {
84635
84851
  const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
84636
84852
  if (isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
84637
- const nodeLinks2 = getNodeLinks(symbol.valueDeclaration);
84638
84853
  if (resolveName(
84639
84854
  container.parent,
84640
84855
  symbol.escapedName,
@@ -84645,8 +84860,8 @@ function createTypeChecker(host) {
84645
84860
  false
84646
84861
  )) {
84647
84862
  links.isDeclarationWithCollidingName = true;
84648
- } else if (nodeLinks2.flags & 16384 /* CapturedBlockScopedBinding */) {
84649
- const isDeclaredInLoop = nodeLinks2.flags & 32768 /* BlockScopedBindingInLoop */;
84863
+ } else if (hasNodeCheckFlag(symbol.valueDeclaration, 16384 /* CapturedBlockScopedBinding */)) {
84864
+ const isDeclaredInLoop = hasNodeCheckFlag(symbol.valueDeclaration, 32768 /* BlockScopedBindingInLoop */);
84650
84865
  const inLoopInitializer = isIterationStatement(
84651
84866
  container,
84652
84867
  /*lookInLabeledStatements*/
@@ -84728,6 +84943,9 @@ function createTypeChecker(host) {
84728
84943
  if (!symbol) {
84729
84944
  return false;
84730
84945
  }
84946
+ const container = getSourceFileOfNode(symbol.valueDeclaration);
84947
+ const fileSymbol = container && getSymbolOfDeclaration(container);
84948
+ void resolveExternalModuleSymbol(fileSymbol);
84731
84949
  const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
84732
84950
  if (target === unknownSymbol) {
84733
84951
  return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
@@ -84826,6 +85044,108 @@ function createTypeChecker(host) {
84826
85044
  if (nodeId < 0 || nodeId >= nodeLinks.length) return 0;
84827
85045
  return ((_a = nodeLinks[nodeId]) == null ? void 0 : _a.flags) || 0;
84828
85046
  }
85047
+ function hasNodeCheckFlag(node, flag) {
85048
+ calculateNodeCheckFlagWorker(node, flag);
85049
+ return !!(getNodeCheckFlags(node) & flag);
85050
+ }
85051
+ function calculateNodeCheckFlagWorker(node, flag) {
85052
+ if (!compilerOptions.noCheck && canIncludeBindAndCheckDiagnsotics(getSourceFileOfNode(node), compilerOptions)) {
85053
+ return;
85054
+ }
85055
+ const links = getNodeLinks(node);
85056
+ if (links.calculatedFlags & flag) {
85057
+ return;
85058
+ }
85059
+ switch (flag) {
85060
+ case 16 /* SuperInstance */:
85061
+ case 32 /* SuperStatic */:
85062
+ return checkSingleSuperExpression(node);
85063
+ case 128 /* MethodWithSuperPropertyAccessInAsync */:
85064
+ case 256 /* MethodWithSuperPropertyAssignmentInAsync */:
85065
+ case 2097152 /* ContainsSuperPropertyInStaticInitializer */:
85066
+ return checkChildSuperExpressions(node);
85067
+ case 512 /* CaptureArguments */:
85068
+ case 8192 /* ContainsCapturedBlockScopeBinding */:
85069
+ case 65536 /* NeedsLoopOutParameter */:
85070
+ case 262144 /* ContainsConstructorReference */:
85071
+ return checkChildIdentifiers(node);
85072
+ case 536870912 /* ConstructorReference */:
85073
+ return checkSingleIdentifier(node);
85074
+ case 4096 /* LoopWithCapturedBlockScopedBinding */:
85075
+ case 32768 /* BlockScopedBindingInLoop */:
85076
+ case 16384 /* CapturedBlockScopedBinding */:
85077
+ return checkContainingBlockScopeBindingUses(node);
85078
+ default:
85079
+ return Debug.assertNever(flag, `Unhandled node check flag calculation: ${Debug.formatNodeCheckFlags(flag)}`);
85080
+ }
85081
+ function forEachNodeRecursively(root, cb) {
85082
+ const rootResult = cb(root, root.parent);
85083
+ if (rootResult === "skip") return void 0;
85084
+ if (rootResult) return rootResult;
85085
+ return forEachChildRecursively(root, cb);
85086
+ }
85087
+ function checkSuperExpressions(node2) {
85088
+ const links2 = getNodeLinks(node2);
85089
+ if (links2.calculatedFlags & flag) return "skip";
85090
+ links2.calculatedFlags |= 128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */ | 2097152 /* ContainsSuperPropertyInStaticInitializer */;
85091
+ checkSingleSuperExpression(node2);
85092
+ return void 0;
85093
+ }
85094
+ function checkChildSuperExpressions(node2) {
85095
+ forEachNodeRecursively(node2, checkSuperExpressions);
85096
+ }
85097
+ function checkSingleSuperExpression(node2) {
85098
+ const nodeLinks2 = getNodeLinks(node2);
85099
+ nodeLinks2.calculatedFlags |= 16 /* SuperInstance */ | 32 /* SuperStatic */;
85100
+ if (node2.kind === 108 /* SuperKeyword */) {
85101
+ checkSuperExpression(node2);
85102
+ }
85103
+ }
85104
+ function checkIdentifiers(node2) {
85105
+ const links2 = getNodeLinks(node2);
85106
+ if (links2.calculatedFlags & flag) return "skip";
85107
+ links2.calculatedFlags |= 512 /* CaptureArguments */ | 8192 /* ContainsCapturedBlockScopeBinding */ | 65536 /* NeedsLoopOutParameter */ | 262144 /* ContainsConstructorReference */;
85108
+ checkSingleIdentifier(node2);
85109
+ return void 0;
85110
+ }
85111
+ function checkChildIdentifiers(node2) {
85112
+ forEachNodeRecursively(node2, checkIdentifiers);
85113
+ }
85114
+ function checkSingleIdentifier(node2) {
85115
+ const nodeLinks2 = getNodeLinks(node2);
85116
+ nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
85117
+ if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
85118
+ const s = getSymbolAtLocation(
85119
+ node2,
85120
+ /*ignoreErrors*/
85121
+ true
85122
+ );
85123
+ if (s && s !== unknownSymbol) {
85124
+ checkIdentifierCalculateNodeCheckFlags(node2, s);
85125
+ }
85126
+ }
85127
+ }
85128
+ function checkBlockScopeBindings(node2) {
85129
+ const links2 = getNodeLinks(node2);
85130
+ if (links2.calculatedFlags & flag) return "skip";
85131
+ links2.calculatedFlags |= 4096 /* LoopWithCapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */ | 16384 /* CapturedBlockScopedBinding */;
85132
+ checkSingleBlockScopeBinding(node2);
85133
+ return void 0;
85134
+ }
85135
+ function checkContainingBlockScopeBindingUses(node2) {
85136
+ const scope = getEnclosingBlockScopeContainer(isDeclarationName(node2) ? node2.parent : node2);
85137
+ forEachNodeRecursively(scope, checkBlockScopeBindings);
85138
+ }
85139
+ function checkSingleBlockScopeBinding(node2) {
85140
+ checkSingleIdentifier(node2);
85141
+ if (isComputedPropertyName(node2)) {
85142
+ checkComputedPropertyName(node2);
85143
+ }
85144
+ if (isPrivateIdentifier(node2) && isClassElement(node2.parent)) {
85145
+ setNodeLinksForPrivateIdentifierScope(node2.parent);
85146
+ }
85147
+ }
85148
+ }
84829
85149
  function getEnumMemberValue(node) {
84830
85150
  computeEnumMemberValues(node.parent);
84831
85151
  return getNodeLinks(node).enumMemberValue ?? evaluatorResult(
@@ -84846,7 +85166,15 @@ function createTypeChecker(host) {
84846
85166
  if (node.kind === 306 /* EnumMember */) {
84847
85167
  return getEnumMemberValue(node).value;
84848
85168
  }
84849
- const symbol = getNodeLinks(node).resolvedSymbol;
85169
+ if (!getNodeLinks(node).resolvedSymbol) {
85170
+ void checkExpressionCached(node);
85171
+ }
85172
+ const symbol = getNodeLinks(node).resolvedSymbol || (isEntityNameExpression(node) ? resolveEntityName(
85173
+ node,
85174
+ 111551 /* Value */,
85175
+ /*ignoreErrors*/
85176
+ true
85177
+ ) : void 0);
84850
85178
  if (symbol && symbol.flags & 8 /* EnumMember */) {
84851
85179
  const member = symbol.valueDeclaration;
84852
85180
  if (isEnumConst(member.parent)) {
@@ -85197,9 +85525,10 @@ function createTypeChecker(host) {
85197
85525
  const node = getParseTreeNode(nodeIn);
85198
85526
  return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
85199
85527
  },
85200
- getNodeCheckFlags: (nodeIn) => {
85528
+ hasNodeCheckFlag: (nodeIn, flag) => {
85201
85529
  const node = getParseTreeNode(nodeIn);
85202
- return node ? getNodeCheckFlags(node) : 0;
85530
+ if (!node) return false;
85531
+ return hasNodeCheckFlag(node, flag);
85203
85532
  },
85204
85533
  isTopLevelValueImportEqualsWithEntityName,
85205
85534
  isDeclarationVisible,
@@ -85222,6 +85551,10 @@ function createTypeChecker(host) {
85222
85551
  return node ? getEnumMemberValue(node) : void 0;
85223
85552
  },
85224
85553
  collectLinkedAliases,
85554
+ markLinkedReferences: (nodeIn) => {
85555
+ const node = getParseTreeNode(nodeIn);
85556
+ return node && markLinkedReferences(node, 0 /* Unspecified */);
85557
+ },
85225
85558
  getReferencedValueDeclaration,
85226
85559
  getReferencedValueDeclarations,
85227
85560
  getTypeReferenceSerializationKind,
@@ -85468,38 +85801,40 @@ function createTypeChecker(host) {
85468
85801
  amalgamatedDuplicates = void 0;
85469
85802
  }
85470
85803
  function checkExternalEmitHelpers(location, helpers) {
85471
- if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
85804
+ if (compilerOptions.importHelpers) {
85472
85805
  const sourceFile = getSourceFileOfNode(location);
85473
85806
  if (isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 33554432 /* Ambient */)) {
85474
85807
  const helpersModule = resolveHelpersModule(sourceFile, location);
85475
85808
  if (helpersModule !== unknownSymbol) {
85476
- const uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
85477
- for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) {
85478
- if (uncheckedHelpers & helper) {
85479
- for (const name of getHelperNames(helper)) {
85480
- if (requestedExternalEmitHelperNames.has(name)) continue;
85481
- requestedExternalEmitHelperNames.add(name);
85482
- const symbol = resolveSymbol(getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
85483
- if (!symbol) {
85484
- error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
85485
- } else if (helper & 524288 /* ClassPrivateFieldGet */) {
85486
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
85487
- error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4);
85488
- }
85489
- } else if (helper & 1048576 /* ClassPrivateFieldSet */) {
85490
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
85491
- error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5);
85492
- }
85493
- } else if (helper & 1024 /* SpreadArray */) {
85494
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
85495
- error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3);
85809
+ const links = getSymbolLinks(helpersModule);
85810
+ links.requestedExternalEmitHelpers ?? (links.requestedExternalEmitHelpers = 0);
85811
+ if ((links.requestedExternalEmitHelpers & helpers) !== helpers) {
85812
+ const uncheckedHelpers = helpers & ~links.requestedExternalEmitHelpers;
85813
+ for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) {
85814
+ if (uncheckedHelpers & helper) {
85815
+ for (const name of getHelperNames(helper)) {
85816
+ const symbol = resolveSymbol(getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
85817
+ if (!symbol) {
85818
+ error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
85819
+ } else if (helper & 524288 /* ClassPrivateFieldGet */) {
85820
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
85821
+ error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4);
85822
+ }
85823
+ } else if (helper & 1048576 /* ClassPrivateFieldSet */) {
85824
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
85825
+ error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5);
85826
+ }
85827
+ } else if (helper & 1024 /* SpreadArray */) {
85828
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
85829
+ error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3);
85830
+ }
85496
85831
  }
85497
85832
  }
85498
85833
  }
85499
85834
  }
85500
85835
  }
85836
+ links.requestedExternalEmitHelpers |= helpers;
85501
85837
  }
85502
- requestedExternalEmitHelpers |= helpers;
85503
85838
  }
85504
85839
  }
85505
85840
  }
@@ -85560,10 +85895,11 @@ function createTypeChecker(host) {
85560
85895
  }
85561
85896
  }
85562
85897
  function resolveHelpersModule(file, errorNode) {
85563
- if (!externalHelpersModule) {
85564
- externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
85898
+ const links = getNodeLinks(file);
85899
+ if (!links.externalHelpersModule) {
85900
+ links.externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
85565
85901
  }
85566
- return externalHelpersModule;
85902
+ return links.externalHelpersModule;
85567
85903
  }
85568
85904
  function checkGrammarModifiers(node) {
85569
85905
  var _a;
@@ -86356,7 +86692,6 @@ function createTypeChecker(host) {
86356
86692
  return true;
86357
86693
  }
86358
86694
  }
86359
- return false;
86360
86695
  }
86361
86696
  }
86362
86697
  if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 65536 /* AwaitContext */) && isIdentifier(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") {
@@ -88953,8 +89288,8 @@ function collectExternalModuleInfo(context, sourceFile) {
88953
89288
  const exportSpecifiers = new IdentifierNameMultiMap();
88954
89289
  const exportedBindings = [];
88955
89290
  const uniqueExports = /* @__PURE__ */ new Map();
89291
+ const exportedFunctions = /* @__PURE__ */ new Set();
88956
89292
  let exportedNames;
88957
- let exportedFunctions;
88958
89293
  let hasExportDefault = false;
88959
89294
  let exportEquals;
88960
89295
  let hasExportStarsToExportValues = false;
@@ -89014,19 +89349,12 @@ function collectExternalModuleInfo(context, sourceFile) {
89014
89349
  break;
89015
89350
  case 262 /* FunctionDeclaration */:
89016
89351
  if (hasSyntacticModifier(node, 32 /* Export */)) {
89017
- exportedFunctions = append(exportedFunctions, node);
89018
- if (hasSyntacticModifier(node, 2048 /* Default */)) {
89019
- if (!hasExportDefault) {
89020
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node));
89021
- hasExportDefault = true;
89022
- }
89023
- } else {
89024
- const name = node.name;
89025
- if (!uniqueExports.get(idText(name))) {
89026
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
89027
- uniqueExports.set(idText(name), true);
89028
- }
89029
- }
89352
+ addExportedFunctionDeclaration(
89353
+ node,
89354
+ /*name*/
89355
+ void 0,
89356
+ hasSyntacticModifier(node, 2048 /* Default */)
89357
+ );
89030
89358
  }
89031
89359
  break;
89032
89360
  case 263 /* ClassDeclaration */:
@@ -89062,6 +89390,10 @@ function collectExternalModuleInfo(context, sourceFile) {
89062
89390
  }
89063
89391
  const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
89064
89392
  if (decl) {
89393
+ if (decl.kind === 262 /* FunctionDeclaration */) {
89394
+ addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
89395
+ continue;
89396
+ }
89065
89397
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
89066
89398
  }
89067
89399
  uniqueExports.set(idText(specifier.name), true);
@@ -89069,6 +89401,21 @@ function collectExternalModuleInfo(context, sourceFile) {
89069
89401
  }
89070
89402
  }
89071
89403
  }
89404
+ function addExportedFunctionDeclaration(node, name, isDefault) {
89405
+ exportedFunctions.add(node);
89406
+ if (isDefault) {
89407
+ if (!hasExportDefault) {
89408
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context.factory.getDeclarationName(node));
89409
+ hasExportDefault = true;
89410
+ }
89411
+ } else {
89412
+ name ?? (name = node.name);
89413
+ if (!uniqueExports.get(idText(name))) {
89414
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
89415
+ uniqueExports.set(idText(name), true);
89416
+ }
89417
+ }
89418
+ }
89072
89419
  }
89073
89420
  function collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings) {
89074
89421
  if (isBindingPattern(decl.name)) {
@@ -93013,7 +93360,7 @@ function transformClassFields(context) {
93013
93360
  containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
93014
93361
  } else if (isPrivateIdentifierClassElementDeclaration(member)) {
93015
93362
  containsInstancePrivateElements = true;
93016
- if (resolver.getNodeCheckFlags(member) & 262144 /* ContainsConstructorReference */) {
93363
+ if (resolver.hasNodeCheckFlag(member, 262144 /* ContainsConstructorReference */)) {
93017
93364
  facts |= 2 /* NeedsClassConstructorReference */;
93018
93365
  }
93019
93366
  } else if (isPropertyDeclaration(member)) {
@@ -93120,7 +93467,7 @@ function transformClassFields(context) {
93120
93467
  if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
93121
93468
  getClassLexicalEnvironment().classThis = node.emitNode.classThis;
93122
93469
  }
93123
- const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */;
93470
+ const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
93124
93471
  const isExport = hasSyntacticModifier(node, 32 /* Export */);
93125
93472
  const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
93126
93473
  let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
@@ -93182,15 +93529,14 @@ function transformClassFields(context) {
93182
93529
  var _a, _b, _c;
93183
93530
  const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
93184
93531
  const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
93185
- const classCheckFlags = resolver.getNodeCheckFlags(node);
93186
- const isClassWithConstructorReference = classCheckFlags & 262144 /* ContainsConstructorReference */;
93532
+ const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
93533
+ const requiresBlockScopedVar = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
93187
93534
  let temp;
93188
93535
  function createClassTempVar() {
93189
93536
  var _a2;
93190
93537
  if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
93191
93538
  return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
93192
93539
  }
93193
- const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
93194
93540
  const temp2 = factory2.createTempVariable(
93195
93541
  requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
93196
93542
  /*reservedInNestedScopes*/
@@ -93758,7 +94104,7 @@ function transformClassFields(context) {
93758
94104
  const alreadyTransformed = !!cacheAssignment || isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left);
93759
94105
  if (!alreadyTransformed && !inlinable && shouldHoist) {
93760
94106
  const generatedName = factory2.getGeneratedNameForNode(name);
93761
- if (resolver.getNodeCheckFlags(name) & 32768 /* BlockScopedBindingInLoop */) {
94107
+ if (resolver.hasNodeCheckFlag(name, 32768 /* BlockScopedBindingInLoop */)) {
93762
94108
  addBlockScopedVariable(generatedName);
93763
94109
  } else {
93764
94110
  hoistVariableDeclaration(generatedName);
@@ -93912,7 +94258,7 @@ function transformClassFields(context) {
93912
94258
  prefix,
93913
94259
  suffix
93914
94260
  );
93915
- if (resolver.getNodeCheckFlags(node) & 32768 /* BlockScopedBindingInLoop */) {
94261
+ if (resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */)) {
93916
94262
  addBlockScopedVariable(identifier);
93917
94263
  } else {
93918
94264
  hoistVariableDeclaration(identifier);
@@ -94151,7 +94497,7 @@ function transformClassFields(context) {
94151
94497
  }
94152
94498
  function trySubstituteClassAlias(node) {
94153
94499
  if (enabledSubstitutions & 1 /* ClassAliases */) {
94154
- if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
94500
+ if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
94155
94501
  const declaration = resolver.getReferencedValueDeclaration(node);
94156
94502
  if (declaration) {
94157
94503
  const classAlias = classAliases[declaration.id];
@@ -95018,7 +95364,7 @@ function transformLegacyDecorators(context) {
95018
95364
  }
95019
95365
  }
95020
95366
  function getClassAliasIfNeeded(node) {
95021
- if (resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */) {
95367
+ if (resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */)) {
95022
95368
  enableSubstitutionForClassAliases();
95023
95369
  const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
95024
95370
  classAliases[getOriginalNodeId(node)] = classAlias;
@@ -95051,7 +95397,7 @@ function transformLegacyDecorators(context) {
95051
95397
  }
95052
95398
  function trySubstituteClassAlias(node) {
95053
95399
  if (classAliases) {
95054
- if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
95400
+ if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
95055
95401
  const declaration = resolver.getReferencedValueDeclaration(node);
95056
95402
  if (declaration) {
95057
95403
  const classAlias = classAliases[declaration.id];
@@ -97360,7 +97706,7 @@ function transformES2017(context) {
97360
97706
  hasSuperElementAccess = false;
97361
97707
  let updated = visitFunctionBody(node.body, visitor, context);
97362
97708
  const originalMethod = getOriginalNode(node, isFunctionLikeDeclaration);
97363
- const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */) && (getFunctionFlags(originalMethod) & 3 /* AsyncGenerator */) !== 3 /* AsyncGenerator */;
97709
+ const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) && (getFunctionFlags(originalMethod) & 3 /* AsyncGenerator */) !== 3 /* AsyncGenerator */;
97364
97710
  if (emitSuperHelpers) {
97365
97711
  enableSubstitutionForAsyncMethodsWithSuper();
97366
97712
  if (capturedSuperProperties.size) {
@@ -97371,9 +97717,9 @@ function transformES2017(context) {
97371
97717
  updated = factory2.updateBlock(updated, statements);
97372
97718
  }
97373
97719
  if (hasSuperElementAccess) {
97374
- if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
97720
+ if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
97375
97721
  addEmitHelper(updated, advancedAsyncSuperHelper);
97376
- } else if (resolver.getNodeCheckFlags(node) & 128 /* MethodWithSuperPropertyAccessInAsync */) {
97722
+ } else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
97377
97723
  addEmitHelper(updated, asyncSuperHelper);
97378
97724
  }
97379
97725
  }
@@ -97440,7 +97786,7 @@ function transformES2017(context) {
97440
97786
  const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
97441
97787
  const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
97442
97788
  const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
97443
- const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0;
97789
+ const hasLexicalArguments = resolver.hasNodeCheckFlag(node, 512 /* CaptureArguments */);
97444
97790
  const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
97445
97791
  if (captureLexicalArguments) {
97446
97792
  lexicalArgumentsBinding = factory2.createUniqueName("arguments");
@@ -97495,7 +97841,7 @@ function transformES2017(context) {
97495
97841
  )
97496
97842
  )
97497
97843
  );
97498
- const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
97844
+ const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
97499
97845
  if (emitSuperHelpers) {
97500
97846
  enableSubstitutionForAsyncMethodsWithSuper();
97501
97847
  if (capturedSuperProperties.size) {
@@ -97514,9 +97860,9 @@ function transformES2017(context) {
97514
97860
  );
97515
97861
  setTextRange(block, node.body);
97516
97862
  if (emitSuperHelpers && hasSuperElementAccess) {
97517
- if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
97863
+ if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
97518
97864
  addEmitHelper(block, advancedAsyncSuperHelper);
97519
- } else if (resolver.getNodeCheckFlags(node) & 128 /* MethodWithSuperPropertyAccessInAsync */) {
97865
+ } else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
97520
97866
  addEmitHelper(block, asyncSuperHelper);
97521
97867
  }
97522
97868
  }
@@ -97575,7 +97921,7 @@ function transformES2017(context) {
97575
97921
  }
97576
97922
  function onEmitNode(hint, node, emitCallback) {
97577
97923
  if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
97578
- const superContainerFlags = resolver.getNodeCheckFlags(node) & (128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */);
97924
+ const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
97579
97925
  if (superContainerFlags !== enclosingSuperContainerFlags) {
97580
97926
  const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
97581
97927
  enclosingSuperContainerFlags = superContainerFlags;
@@ -97679,7 +98025,7 @@ function transformES2017(context) {
97679
98025
  }
97680
98026
  }
97681
98027
  function createSuperAccessVariableStatement(factory2, resolver, node, names) {
97682
- const hasBinding = (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) !== 0;
98028
+ const hasBinding = resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */);
97683
98029
  const accessors = [];
97684
98030
  names.forEach((_, key) => {
97685
98031
  const name = unescapeLeadingUnderscores(key);
@@ -98774,7 +99120,7 @@ function transformES2018(context) {
98774
99120
  !!(hierarchyFacts & 1 /* HasLexicalThis */)
98775
99121
  )
98776
99122
  );
98777
- const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
99123
+ const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
98778
99124
  if (emitSuperHelpers) {
98779
99125
  enableSubstitutionForAsyncMethodsWithSuper();
98780
99126
  const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
@@ -98784,9 +99130,9 @@ function transformES2018(context) {
98784
99130
  outerStatements.push(returnStatement);
98785
99131
  const block = factory2.updateBlock(node.body, outerStatements);
98786
99132
  if (emitSuperHelpers && hasSuperElementAccess) {
98787
- if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
99133
+ if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
98788
99134
  addEmitHelper(block, advancedAsyncSuperHelper);
98789
- } else if (resolver.getNodeCheckFlags(node) & 128 /* MethodWithSuperPropertyAccessInAsync */) {
99135
+ } else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
98790
99136
  addEmitHelper(block, asyncSuperHelper);
98791
99137
  }
98792
99138
  }
@@ -98919,7 +99265,7 @@ function transformES2018(context) {
98919
99265
  }
98920
99266
  function onEmitNode(hint, node, emitCallback) {
98921
99267
  if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
98922
- const superContainerFlags = resolver.getNodeCheckFlags(node) & (128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */);
99268
+ const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
98923
99269
  if (superContainerFlags !== enclosingSuperContainerFlags) {
98924
99270
  const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
98925
99271
  enclosingSuperContainerFlags = superContainerFlags;
@@ -99550,10 +99896,10 @@ function transformESNext(context) {
99550
99896
  function visitForOfStatement(node) {
99551
99897
  if (isUsingVariableDeclarationList(node.initializer)) {
99552
99898
  const forInitializer = node.initializer;
99553
- Debug.assertNode(forInitializer, isUsingVariableDeclarationList);
99554
- Debug.assert(forInitializer.declarations.length === 1, "ForInitializer may only have one declaration");
99555
- const forDecl = forInitializer.declarations[0];
99556
- Debug.assert(!forDecl.initializer, "ForInitializer may not have an initializer");
99899
+ const forDecl = firstOrUndefined(forInitializer.declarations) || factory2.createVariableDeclaration(factory2.createTempVariable(
99900
+ /*recordTempVariable*/
99901
+ void 0
99902
+ ));
99557
99903
  const isAwaitUsing = getUsingKindOfVariableDeclarationList(forInitializer) === 2 /* Async */;
99558
99904
  const temp = factory2.getGeneratedNameForNode(forDecl.name);
99559
99905
  const usingVar = factory2.updateVariableDeclaration(
@@ -102624,9 +102970,8 @@ function transformES2015(context) {
102624
102970
  return createRange(pos, end);
102625
102971
  }
102626
102972
  function shouldEmitExplicitInitializerForLetDeclaration(node) {
102627
- const flags = resolver.getNodeCheckFlags(node);
102628
- const isCapturedInFunction = flags & 16384 /* CapturedBlockScopedBinding */;
102629
- const isDeclaredInLoop = flags & 32768 /* BlockScopedBindingInLoop */;
102973
+ const isCapturedInFunction = resolver.hasNodeCheckFlag(node, 16384 /* CapturedBlockScopedBinding */);
102974
+ const isDeclaredInLoop = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
102630
102975
  const emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || isCapturedInFunction && isDeclaredInLoop && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0;
102631
102976
  const emitExplicitInitializer = !emittedAsTopLevel && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || isDeclaredInLoop && !isCapturedInFunction && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0);
102632
102977
  return emitExplicitInitializer;
@@ -103077,7 +103422,7 @@ function transformES2015(context) {
103077
103422
  return factory2.inlineExpressions(expressions);
103078
103423
  }
103079
103424
  function shouldConvertPartOfIterationStatement(node) {
103080
- return (resolver.getNodeCheckFlags(node) & 8192 /* ContainsCapturedBlockScopeBinding */) !== 0;
103425
+ return resolver.hasNodeCheckFlag(node, 8192 /* ContainsCapturedBlockScopeBinding */);
103081
103426
  }
103082
103427
  function shouldConvertInitializerOfForStatement(node) {
103083
103428
  return isForStatement(node) && !!node.initializer && shouldConvertPartOfIterationStatement(node.initializer);
@@ -103092,7 +103437,7 @@ function transformES2015(context) {
103092
103437
  return shouldConvertBodyOfIterationStatement(node) || shouldConvertInitializerOfForStatement(node);
103093
103438
  }
103094
103439
  function shouldConvertBodyOfIterationStatement(node) {
103095
- return (resolver.getNodeCheckFlags(node) & 4096 /* LoopWithCapturedBlockScopedBinding */) !== 0;
103440
+ return resolver.hasNodeCheckFlag(node, 4096 /* LoopWithCapturedBlockScopedBinding */);
103096
103441
  }
103097
103442
  function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
103098
103443
  if (!state.hoistedLocalVariables) {
@@ -103641,11 +103986,11 @@ function transformES2015(context) {
103641
103986
  void 0,
103642
103987
  name
103643
103988
  ));
103644
- const checkFlags = resolver.getNodeCheckFlags(decl);
103645
- if (checkFlags & 65536 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
103989
+ const needsOutParam = resolver.hasNodeCheckFlag(decl, 65536 /* NeedsLoopOutParameter */);
103990
+ if (needsOutParam || hasCapturedBindingsInForHead) {
103646
103991
  const outParamName = factory2.createUniqueName("out_" + idText(name));
103647
103992
  let flags = 0 /* None */;
103648
- if (checkFlags & 65536 /* NeedsLoopOutParameter */) {
103993
+ if (needsOutParam) {
103649
103994
  flags |= 1 /* Body */;
103650
103995
  }
103651
103996
  if (isForStatement(container)) {
@@ -106351,10 +106696,8 @@ function transformModule(context) {
106351
106696
  );
106352
106697
  }
106353
106698
  }
106354
- if (some(currentModuleInfo.exportedFunctions)) {
106355
- for (const f of currentModuleInfo.exportedFunctions) {
106356
- appendExportsOfHoistedDeclaration(statements, f);
106357
- }
106699
+ for (const f of currentModuleInfo.exportedFunctions) {
106700
+ appendExportsOfHoistedDeclaration(statements, f);
106358
106701
  }
106359
106702
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
106360
106703
  addRange(statements, visitNodes2(node.statements, topLevelVisitor, isStatement, statementOffset));
@@ -106671,10 +107014,8 @@ function transformModule(context) {
106671
107014
  if (some(currentModuleInfo.exportedNames)) {
106672
107015
  append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
106673
107016
  }
106674
- if (some(currentModuleInfo.exportedFunctions)) {
106675
- for (const f of currentModuleInfo.exportedFunctions) {
106676
- appendExportsOfHoistedDeclaration(statements, f);
106677
- }
107017
+ for (const f of currentModuleInfo.exportedFunctions) {
107018
+ appendExportsOfHoistedDeclaration(statements, f);
106678
107019
  }
106679
107020
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
106680
107021
  if (moduleKind === 2 /* AMD */) {
@@ -108388,7 +108729,7 @@ function transformSystemModule(context) {
108388
108729
  if (!moduleInfo.hasExportStarsToExportValues) {
108389
108730
  return;
108390
108731
  }
108391
- if (!some(moduleInfo.exportedNames) && !some(moduleInfo.exportedFunctions) && moduleInfo.exportSpecifiers.size === 0) {
108732
+ if (!some(moduleInfo.exportedNames) && moduleInfo.exportedFunctions.size === 0 && moduleInfo.exportSpecifiers.size === 0) {
108392
108733
  let hasExportDeclarationWithExportClause = false;
108393
108734
  for (const externalImport of moduleInfo.externalImports) {
108394
108735
  if (externalImport.kind === 278 /* ExportDeclaration */ && externalImport.exportClause) {
@@ -108419,19 +108760,17 @@ function transformSystemModule(context) {
108419
108760
  );
108420
108761
  }
108421
108762
  }
108422
- if (moduleInfo.exportedFunctions) {
108423
- for (const f of moduleInfo.exportedFunctions) {
108424
- if (hasSyntacticModifier(f, 2048 /* Default */)) {
108425
- continue;
108426
- }
108427
- Debug.assert(!!f.name);
108428
- exportedNames.push(
108429
- factory2.createPropertyAssignment(
108430
- factory2.createStringLiteralFromNode(f.name),
108431
- factory2.createTrue()
108432
- )
108433
- );
108763
+ for (const f of moduleInfo.exportedFunctions) {
108764
+ if (hasSyntacticModifier(f, 2048 /* Default */)) {
108765
+ continue;
108434
108766
  }
108767
+ Debug.assert(!!f.name);
108768
+ exportedNames.push(
108769
+ factory2.createPropertyAssignment(
108770
+ factory2.createStringLiteralFromNode(f.name),
108771
+ factory2.createTrue()
108772
+ )
108773
+ );
108435
108774
  }
108436
108775
  const exportedNamesStorageRef = factory2.createUniqueName("exportedNames");
108437
108776
  statements.push(
@@ -112674,6 +113013,11 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
112674
113013
  emitSkipped = true;
112675
113014
  return;
112676
113015
  }
113016
+ (isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : filter(sourceFileOrBundle.sourceFiles, isSourceFileNotJson)).forEach(
113017
+ (sourceFile) => {
113018
+ if (compilerOptions.noCheck || !canIncludeBindAndCheckDiagnsotics(sourceFile, compilerOptions)) markLinkedReferences(sourceFile);
113019
+ }
113020
+ );
112677
113021
  const transform = transformNodes(
112678
113022
  resolver,
112679
113023
  host,
@@ -112723,9 +113067,11 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
112723
113067
  const sourceFiles = isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
112724
113068
  const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson);
112725
113069
  const inputListOrBundle = compilerOptions.outFile ? [factory.createBundle(filesForEmit)] : filesForEmit;
112726
- if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck || emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit)) {
112727
- filesForEmit.forEach(collectLinkedAliases);
112728
- }
113070
+ filesForEmit.forEach((sourceFile) => {
113071
+ if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck || emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) || !canIncludeBindAndCheckDiagnsotics(sourceFile, compilerOptions)) {
113072
+ collectLinkedAliases(sourceFile);
113073
+ }
113074
+ });
112729
113075
  const declarationTransform = transformNodes(
112730
113076
  resolver,
112731
113077
  host,
@@ -112808,6 +113154,13 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
112808
113154
  }
112809
113155
  forEachChild(node, collectLinkedAliases);
112810
113156
  }
113157
+ function markLinkedReferences(file) {
113158
+ forEachChildRecursively(file, (n) => {
113159
+ if (isImportEqualsDeclaration(n) && !(getSyntacticModifierFlags(n) & 32 /* Export */)) return "skip";
113160
+ if (isImportDeclaration(n)) return "skip";
113161
+ resolver.markLinkedReferences(n);
113162
+ });
113163
+ }
112811
113164
  function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
112812
113165
  const sourceFileOrBundle = transform.transformed[0];
112813
113166
  const bundle = sourceFileOrBundle.kind === 308 /* Bundle */ ? sourceFileOrBundle : void 0;
@@ -112939,10 +113292,11 @@ var notImplementedResolver = {
112939
113292
  isValueAliasDeclaration: notImplemented,
112940
113293
  isReferencedAliasDeclaration: notImplemented,
112941
113294
  isTopLevelValueImportEqualsWithEntityName: notImplemented,
112942
- getNodeCheckFlags: notImplemented,
113295
+ hasNodeCheckFlag: notImplemented,
112943
113296
  isDeclarationVisible: notImplemented,
112944
113297
  isLateBound: (_node) => false,
112945
113298
  collectLinkedAliases: notImplemented,
113299
+ markLinkedReferences: notImplemented,
112946
113300
  isImplementationOfOverload: notImplemented,
112947
113301
  requiresAddingImplicitUndefined: notImplemented,
112948
113302
  isExpandoFunctionDeclaration: notImplemented,
@@ -119702,24 +120056,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119702
120056
  function getSyntacticDiagnostics(sourceFile, cancellationToken) {
119703
120057
  return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);
119704
120058
  }
119705
- function getSemanticDiagnostics(sourceFile, cancellationToken, nodesToCheck) {
119706
- return getDiagnosticsHelper(
119707
- sourceFile,
119708
- (sourceFile2, cancellationToken2) => getSemanticDiagnosticsForFile(sourceFile2, cancellationToken2, nodesToCheck),
119709
- cancellationToken
119710
- );
120059
+ function getSemanticDiagnostics(sourceFile, cancellationToken) {
120060
+ return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken);
119711
120061
  }
119712
120062
  function getCachedSemanticDiagnostics(sourceFile) {
119713
120063
  var _a2;
119714
120064
  return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
119715
120065
  }
119716
120066
  function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
119717
- return getBindAndCheckDiagnosticsForFile(
119718
- sourceFile,
119719
- cancellationToken,
119720
- /*nodesToCheck*/
119721
- void 0
119722
- );
120067
+ return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken);
119723
120068
  }
119724
120069
  function getProgramDiagnostics(sourceFile) {
119725
120070
  var _a2;
@@ -119759,19 +120104,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119759
120104
  throw e;
119760
120105
  }
119761
120106
  }
119762
- function getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
120107
+ function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
119763
120108
  return concatenate(
119764
- filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options),
120109
+ filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options),
119765
120110
  getProgramDiagnostics(sourceFile)
119766
120111
  );
119767
120112
  }
119768
- function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
119769
- if (nodesToCheck) {
119770
- return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
119771
- }
120113
+ function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken) {
119772
120114
  return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
119773
120115
  }
119774
- function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck) {
120116
+ function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
119775
120117
  return runWithCancellationToken(() => {
119776
120118
  if (skipTypeChecking(sourceFile, options, program)) {
119777
120119
  return emptyArray;
@@ -119779,35 +120121,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119779
120121
  const typeChecker2 = getTypeChecker();
119780
120122
  Debug.assert(!!sourceFile.bindDiagnostics);
119781
120123
  const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
119782
- const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
119783
120124
  const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
119784
- const includeBindAndCheckDiagnostics = shouldIncludeBindAndCheckDiagnostics(sourceFile, options);
119785
- let bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray;
119786
- let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker2.getDiagnostics(sourceFile, cancellationToken, nodesToCheck) : emptyArray;
120125
+ const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
120126
+ let bindDiagnostics = sourceFile.bindDiagnostics;
120127
+ let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken);
119787
120128
  if (isPlainJs) {
119788
120129
  bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
119789
120130
  checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
119790
120131
  }
119791
- return getMergedBindAndCheckDiagnostics(
119792
- sourceFile,
119793
- includeBindAndCheckDiagnostics && !isPlainJs,
119794
- !!nodesToCheck,
119795
- bindDiagnostics,
119796
- checkDiagnostics,
119797
- isCheckJs ? sourceFile.jsDocDiagnostics : void 0
119798
- );
120132
+ return getMergedBindAndCheckDiagnostics(sourceFile, !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : void 0);
119799
120133
  });
119800
120134
  }
119801
- function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, partialCheck, ...allDiagnostics) {
120135
+ function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
119802
120136
  var _a2;
119803
120137
  const flatDiagnostics = flatten(allDiagnostics);
119804
120138
  if (!includeBindAndCheckDiagnostics || !((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
119805
120139
  return flatDiagnostics;
119806
120140
  }
119807
120141
  const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics);
119808
- if (partialCheck) {
119809
- return diagnostics;
119810
- }
119811
120142
  for (const errorExpectation of directives.getUnusedExpectations()) {
119812
120143
  diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive));
119813
120144
  }
@@ -121053,9 +121384,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121053
121384
  if (options.noEmit) {
121054
121385
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
121055
121386
  }
121056
- if (!options.emitDeclarationOnly) {
121057
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "noCheck", "emitDeclarationOnly");
121058
- }
121059
121387
  }
121060
121388
  if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
121061
121389
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");