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

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
@@ -6091,10 +6091,8 @@ var Diagnostics = {
6091
6091
  _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
6092
  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
6093
  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_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."),
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."),
6095
6095
  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."),
6096
- 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."),
6097
- 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."),
6098
6096
  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."),
6099
6097
  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."),
6100
6098
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -8814,7 +8812,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8814
8812
  }
8815
8813
  if (ch === 92 /* backslash */ && !jsxAttributeString) {
8816
8814
  result += text.substring(start2, pos);
8817
- result += scanEscapeSequence(1 /* String */ | 2 /* ReportErrors */);
8815
+ result += scanEscapeSequence(
8816
+ /*shouldEmitInvalidEscapeError*/
8817
+ true,
8818
+ /*isRegularExpression*/
8819
+ false
8820
+ );
8818
8821
  start2 = pos;
8819
8822
  continue;
8820
8823
  }
@@ -8857,7 +8860,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8857
8860
  }
8858
8861
  if (currChar === 92 /* backslash */) {
8859
8862
  contents += text.substring(start2, pos);
8860
- contents += scanEscapeSequence(1 /* String */ | (shouldEmitInvalidEscapeError ? 2 /* ReportErrors */ : 0));
8863
+ contents += scanEscapeSequence(
8864
+ shouldEmitInvalidEscapeError,
8865
+ /*isRegularExpression*/
8866
+ false
8867
+ );
8861
8868
  start2 = pos;
8862
8869
  continue;
8863
8870
  }
@@ -8877,7 +8884,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8877
8884
  tokenValue = contents;
8878
8885
  return resultingToken;
8879
8886
  }
8880
- function scanEscapeSequence(flags) {
8887
+ function scanEscapeSequence(shouldEmitInvalidEscapeError, isRegularExpression) {
8881
8888
  const start2 = pos;
8882
8889
  pos++;
8883
8890
  if (pos >= end) {
@@ -8905,11 +8912,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8905
8912
  pos++;
8906
8913
  }
8907
8914
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8908
- if (flags & 6 /* ReportInvalidEscapeErrors */) {
8915
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8909
8916
  const code = parseInt(text.substring(start2 + 1, pos), 8);
8910
- if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */) && ch !== 48 /* _0 */) {
8911
- 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"));
8912
- } else {
8917
+ if (isRegularExpression !== "annex-b") {
8913
8918
  error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
8914
8919
  }
8915
8920
  return String.fromCharCode(code);
@@ -8918,12 +8923,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8918
8923
  case 56 /* _8 */:
8919
8924
  case 57 /* _9 */:
8920
8925
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8921
- if (flags & 6 /* ReportInvalidEscapeErrors */) {
8922
- if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */)) {
8923
- error(Diagnostics.Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class, start2, pos - start2);
8924
- } else {
8925
- error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8926
- }
8926
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8927
+ error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8927
8928
  return String.fromCharCode(ch);
8928
8929
  }
8929
8930
  return text.substring(start2, pos);
@@ -8944,14 +8945,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8944
8945
  case 34 /* doubleQuote */:
8945
8946
  return '"';
8946
8947
  case 117 /* u */:
8947
- if (flags & 17 /* ScanExtendedUnicodeEscape */ && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
8948
+ if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
8948
8949
  pos -= 2;
8949
- return scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
8950
+ return scanExtendedUnicodeEscape(!!isRegularExpression || shouldEmitInvalidEscapeError);
8950
8951
  }
8951
8952
  for (; pos < start2 + 6; pos++) {
8952
8953
  if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
8953
8954
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8954
- if (flags & 6 /* ReportInvalidEscapeErrors */) {
8955
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8955
8956
  error(Diagnostics.Hexadecimal_digit_expected);
8956
8957
  }
8957
8958
  return text.substring(start2, pos);
@@ -8960,7 +8961,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8960
8961
  tokenFlags |= 1024 /* UnicodeEscape */;
8961
8962
  const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
8962
8963
  const escapedValueString = String.fromCharCode(escapedValue);
8963
- if (flags & 16 /* AnyUnicodeMode */ && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
8964
+ if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
8964
8965
  const nextStart = pos;
8965
8966
  let nextPos = pos + 2;
8966
8967
  for (; nextPos < nextStart + 6; nextPos++) {
@@ -8979,7 +8980,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8979
8980
  for (; pos < start2 + 4; pos++) {
8980
8981
  if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
8981
8982
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8982
- if (flags & 6 /* ReportInvalidEscapeErrors */) {
8983
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8983
8984
  error(Diagnostics.Hexadecimal_digit_expected);
8984
8985
  }
8985
8986
  return text.substring(start2, pos);
@@ -8996,7 +8997,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8996
8997
  case 8233 /* paragraphSeparator */:
8997
8998
  return "";
8998
8999
  default:
8999
- if (flags & 16 /* AnyUnicodeMode */ || flags & 4 /* RegularExpression */ && !(flags & 8 /* AnnexB */) && isIdentifierPart(ch, languageVersion)) {
9000
+ if (isRegularExpression === true && (shouldEmitInvalidEscapeError || isIdentifierPart(ch, languageVersion))) {
9000
9001
  error(Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, pos - 2, 2);
9001
9002
  }
9002
9003
  return String.fromCharCode(ch);
@@ -9695,7 +9696,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9695
9696
  const startOfRegExpBody = tokenStart + 1;
9696
9697
  pos = startOfRegExpBody;
9697
9698
  let inEscape = false;
9698
- let namedCaptureGroups = false;
9699
9699
  let inCharacterClass = false;
9700
9700
  while (true) {
9701
9701
  const ch = charCodeChecked(pos);
@@ -9713,8 +9713,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9713
9713
  inEscape = true;
9714
9714
  } else if (ch === 93 /* closeBracket */) {
9715
9715
  inCharacterClass = false;
9716
- } 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 */) {
9717
- namedCaptureGroups = true;
9718
9716
  }
9719
9717
  pos++;
9720
9718
  }
@@ -9782,8 +9780,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9782
9780
  scanRegularExpressionWorker(
9783
9781
  regExpFlags,
9784
9782
  /*annexB*/
9785
- true,
9786
- namedCaptureGroups
9783
+ true
9787
9784
  );
9788
9785
  });
9789
9786
  }
@@ -9793,10 +9790,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9793
9790
  }
9794
9791
  return token;
9795
9792
  }
9796
- function scanRegularExpressionWorker(regExpFlags, annexB, namedCaptureGroups) {
9793
+ function scanRegularExpressionWorker(regExpFlags, annexB) {
9797
9794
  var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
9798
9795
  var anyUnicodeMode = !!(regExpFlags & 96 /* AnyUnicodeMode */);
9799
- var anyUnicodeModeOrNonAnnexB = anyUnicodeMode || !annexB;
9796
+ if (anyUnicodeMode) {
9797
+ annexB = false;
9798
+ }
9800
9799
  var mayContainStrings = false;
9801
9800
  var numberOfCapturingGroups = 0;
9802
9801
  var groupSpecifiers;
@@ -9851,7 +9850,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9851
9850
  case 61 /* equals */:
9852
9851
  case 33 /* exclamation */:
9853
9852
  pos++;
9854
- isPreviousTermQuantifiable = !anyUnicodeModeOrNonAnnexB;
9853
+ isPreviousTermQuantifiable = annexB;
9855
9854
  break;
9856
9855
  case 60 /* lessThan */:
9857
9856
  const groupNameStart = pos;
@@ -9905,10 +9904,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9905
9904
  const digitsStart = pos;
9906
9905
  scanDigits();
9907
9906
  const min2 = tokenValue;
9908
- if (!anyUnicodeModeOrNonAnnexB && !min2) {
9909
- isPreviousTermQuantifiable = true;
9910
- break;
9911
- }
9912
9907
  if (charCodeChecked(pos) === 44 /* comma */) {
9913
9908
  pos++;
9914
9909
  scanDigits();
@@ -9917,29 +9912,25 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9917
9912
  if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
9918
9913
  error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
9919
9914
  } else {
9920
- error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9915
+ if (anyUnicodeMode) {
9916
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9917
+ }
9921
9918
  isPreviousTermQuantifiable = true;
9922
9919
  break;
9923
9920
  }
9924
- } else if (max && Number.parseInt(min2) > Number.parseInt(max) && (anyUnicodeModeOrNonAnnexB || charCodeChecked(pos) === 125 /* closeBrace */)) {
9921
+ }
9922
+ if (max && Number.parseInt(min2) > Number.parseInt(max)) {
9925
9923
  error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
9926
9924
  }
9927
9925
  } else if (!min2) {
9928
- if (anyUnicodeModeOrNonAnnexB) {
9926
+ if (anyUnicodeMode) {
9929
9927
  error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9930
9928
  }
9931
9929
  isPreviousTermQuantifiable = true;
9932
9930
  break;
9933
9931
  }
9934
- if (charCodeChecked(pos) !== 125 /* closeBrace */) {
9935
- if (anyUnicodeModeOrNonAnnexB) {
9936
- error(Diagnostics._0_expected, pos, 0, String.fromCharCode(125 /* closeBrace */));
9937
- pos--;
9938
- } else {
9939
- isPreviousTermQuantifiable = true;
9940
- break;
9941
- }
9942
- }
9932
+ scanExpectedChar(125 /* closeBrace */);
9933
+ pos--;
9943
9934
  case 42 /* asterisk */:
9944
9935
  case 43 /* plus */:
9945
9936
  case 63 /* question */:
@@ -9972,7 +9963,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9972
9963
  }
9973
9964
  case 93 /* closeBracket */:
9974
9965
  case 125 /* closeBrace */:
9975
- if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
9966
+ if (anyUnicodeMode || ch === 41 /* closeParen */) {
9976
9967
  error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
9977
9968
  }
9978
9969
  pos++;
@@ -10021,7 +10012,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10021
10012
  true
10022
10013
  );
10023
10014
  scanExpectedChar(62 /* greaterThan */);
10024
- } else if (anyUnicodeModeOrNonAnnexB || namedCaptureGroups) {
10015
+ } else if (anyUnicodeMode) {
10025
10016
  error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
10026
10017
  }
10027
10018
  break;
@@ -10064,9 +10055,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10064
10055
  pos++;
10065
10056
  return String.fromCharCode(ch & 31);
10066
10057
  }
10067
- if (anyUnicodeModeOrNonAnnexB) {
10058
+ if (anyUnicodeMode) {
10068
10059
  error(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
10069
- } else if (atomEscape) {
10060
+ } else if (atomEscape && annexB) {
10070
10061
  pos--;
10071
10062
  return "\\";
10072
10063
  }
@@ -10091,7 +10082,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10091
10082
  default:
10092
10083
  pos--;
10093
10084
  return scanEscapeSequence(
10094
- 4 /* RegularExpression */ | (annexB ? 8 /* AnnexB */ : 0) | (anyUnicodeMode ? 16 /* AnyUnicodeMode */ : 0) | (atomEscape ? 32 /* AtomEscape */ : 0)
10085
+ /*shouldEmitInvalidEscapeError*/
10086
+ anyUnicodeMode,
10087
+ /*isRegularExpression*/
10088
+ annexB ? "annex-b" : true
10095
10089
  );
10096
10090
  }
10097
10091
  }
@@ -10133,12 +10127,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10133
10127
  if (isClassContentExit(ch2)) {
10134
10128
  return;
10135
10129
  }
10136
- if (!minCharacter && anyUnicodeModeOrNonAnnexB) {
10130
+ if (!minCharacter && !annexB) {
10137
10131
  error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
10138
10132
  }
10139
10133
  const maxStart = pos;
10140
10134
  const maxCharacter = scanClassAtom();
10141
- if (!maxCharacter && anyUnicodeModeOrNonAnnexB) {
10135
+ if (!maxCharacter && !annexB) {
10142
10136
  error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
10143
10137
  continue;
10144
10138
  }
@@ -10568,11 +10562,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10568
10562
  if (!anyUnicodeMode) {
10569
10563
  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);
10570
10564
  }
10571
- } else if (anyUnicodeModeOrNonAnnexB) {
10565
+ } else if (anyUnicodeMode) {
10572
10566
  error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
10573
- } else {
10574
- pos--;
10575
- return false;
10576
10567
  }
10577
10568
  return true;
10578
10569
  }
@@ -10612,11 +10603,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10612
10603
  }
10613
10604
  });
10614
10605
  forEach(decimalEscapes, (escape) => {
10615
- if (escape.value > numberOfCapturingGroups) {
10606
+ if (!annexB && escape.value > numberOfCapturingGroups) {
10616
10607
  if (numberOfCapturingGroups) {
10617
10608
  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);
10618
10609
  } else {
10619
- 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);
10610
+ error(Diagnostics.This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups, escape.pos, escape.end - escape.pos);
10620
10611
  }
10621
10612
  }
10622
10613
  });
@@ -11056,8 +11047,8 @@ function textSpanIsEmpty(span) {
11056
11047
  function textSpanContainsPosition(span, position) {
11057
11048
  return position >= span.start && position < textSpanEnd(span);
11058
11049
  }
11059
- function textRangeContainsPositionInclusive(span, position) {
11060
- return position >= span.pos && position <= span.end;
11050
+ function textRangeContainsPositionInclusive(range, position) {
11051
+ return position >= range.pos && position <= range.end;
11061
11052
  }
11062
11053
  function createTextSpan(start, length2) {
11063
11054
  if (start < 0) {
@@ -18263,6 +18254,13 @@ function rangeOfTypeParameters(sourceFile, typeParameters) {
18263
18254
  function skipTypeChecking(sourceFile, options, host) {
18264
18255
  return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName);
18265
18256
  }
18257
+ function shouldIncludeBindAndCheckDiagnostics(sourceFile, options) {
18258
+ const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
18259
+ const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
18260
+ 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 */);
18263
+ }
18266
18264
  function isJsonEqual(a, b) {
18267
18265
  return a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && equalOwnProperties(a, b, isJsonEqual);
18268
18266
  }
@@ -25495,7 +25493,7 @@ var addDisposableResourceHelper = {
25495
25493
  var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
25496
25494
  if (value !== null && value !== void 0) {
25497
25495
  if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
25498
- var dispose, inner;
25496
+ var dispose;
25499
25497
  if (async) {
25500
25498
  if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
25501
25499
  dispose = value[Symbol.asyncDispose];
@@ -25503,10 +25501,8 @@ var addDisposableResourceHelper = {
25503
25501
  if (dispose === void 0) {
25504
25502
  if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
25505
25503
  dispose = value[Symbol.dispose];
25506
- if (async) inner = dispose;
25507
25504
  }
25508
25505
  if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
25509
- if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
25510
25506
  env.stack.push({ value: value, dispose: dispose, async: async });
25511
25507
  }
25512
25508
  else if (async) {
@@ -45043,6 +45039,9 @@ function createTypeChecker(host) {
45043
45039
  deferredDiagnosticsCallbacks.push(arg);
45044
45040
  };
45045
45041
  var cancellationToken;
45042
+ var requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
45043
+ var requestedExternalEmitHelpers;
45044
+ var externalHelpersModule;
45046
45045
  var scanner;
45047
45046
  var Symbol12 = objectAllocator.getSymbolConstructor();
45048
45047
  var Type7 = objectAllocator.getTypeConstructor();
@@ -59690,6 +59689,7 @@ function createTypeChecker(host) {
59690
59689
  return links.resolvedType;
59691
59690
  }
59692
59691
  function getTemplateLiteralType(texts, types) {
59692
+ var _a, _b;
59693
59693
  const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
59694
59694
  if (unionIndex >= 0) {
59695
59695
  return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
@@ -59697,6 +59697,9 @@ function createTypeChecker(host) {
59697
59697
  if (contains(types, wildcardType)) {
59698
59698
  return wildcardType;
59699
59699
  }
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
+ }
59700
59703
  const newTypes = [];
59701
59704
  const newTexts = [];
59702
59705
  let text = texts[0];
@@ -70267,31 +70270,7 @@ function createTypeChecker(host) {
70267
70270
  if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
70268
70271
  contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator));
70269
70272
  }
70270
- if (node.asteriskToken) {
70271
- const iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(contextualReturnType, isAsyncGenerator);
70272
- const yieldType = (iterationTypes == null ? void 0 : iterationTypes.yieldType) ?? silentNeverType;
70273
- const returnType = getContextualType(node, contextFlags) ?? silentNeverType;
70274
- const nextType = (iterationTypes == null ? void 0 : iterationTypes.nextType) ?? unknownType;
70275
- const generatorType = createGeneratorType(
70276
- yieldType,
70277
- returnType,
70278
- nextType,
70279
- /*isAsyncGenerator*/
70280
- false
70281
- );
70282
- if (isAsyncGenerator) {
70283
- const asyncGeneratorType = createGeneratorType(
70284
- yieldType,
70285
- returnType,
70286
- nextType,
70287
- /*isAsyncGenerator*/
70288
- true
70289
- );
70290
- return getUnionType([generatorType, asyncGeneratorType]);
70291
- }
70292
- return generatorType;
70293
- }
70294
- return getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator);
70273
+ return node.asteriskToken ? contextualReturnType : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator);
70295
70274
  }
70296
70275
  }
70297
70276
  return void 0;
@@ -76061,7 +76040,7 @@ function createTypeChecker(host) {
76061
76040
  if (nextType) nextType = getWidenedType(nextType);
76062
76041
  }
76063
76042
  if (isGenerator) {
76064
- return createGeneratorType(
76043
+ return createGeneratorReturnType(
76065
76044
  yieldType || neverType,
76066
76045
  returnType || fallbackReturnType,
76067
76046
  nextType || getContextualIterationType(2 /* Next */, func) || unknownType,
@@ -76071,7 +76050,7 @@ function createTypeChecker(host) {
76071
76050
  return isAsync ? createPromiseType(returnType || fallbackReturnType) : returnType || fallbackReturnType;
76072
76051
  }
76073
76052
  }
76074
- function createGeneratorType(yieldType, returnType, nextType, isAsyncGenerator) {
76053
+ function createGeneratorReturnType(yieldType, returnType, nextType, isAsyncGenerator) {
76075
76054
  const resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
76076
76055
  const globalGeneratorType = resolver.getGlobalGeneratorType(
76077
76056
  /*reportErrors*/
@@ -78456,7 +78435,7 @@ function createTypeChecker(host) {
78456
78435
  const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
78457
78436
  const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
78458
78437
  const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
78459
- const generatorInstantiation = createGeneratorType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
78438
+ const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
78460
78439
  return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
78461
78440
  }
78462
78441
  function checkClassForDuplicateDeclarations(node) {
@@ -83390,6 +83369,9 @@ function createTypeChecker(host) {
83390
83369
  }
83391
83370
  }
83392
83371
  function checkSourceElementWorker(node) {
83372
+ if (getNodeCheckFlags(node) & 8388608 /* PartiallyTypeChecked */) {
83373
+ return;
83374
+ }
83393
83375
  if (canHaveJSDoc(node)) {
83394
83376
  forEach(node.jsDoc, ({ comment, tags }) => {
83395
83377
  checkJSDocCommentWorker(comment);
@@ -83733,19 +83715,21 @@ function createTypeChecker(host) {
83733
83715
  currentNode = saveCurrentNode;
83734
83716
  (_b = tracing) == null ? void 0 : _b.pop();
83735
83717
  }
83736
- function checkSourceFile(node) {
83718
+ function checkSourceFile(node, nodesToCheck) {
83737
83719
  var _a, _b;
83738
83720
  (_a = tracing) == null ? void 0 : _a.push(
83739
83721
  tracing.Phase.Check,
83740
- "checkSourceFile",
83722
+ nodesToCheck ? "checkSourceFileNodes" : "checkSourceFile",
83741
83723
  { path: node.path },
83742
83724
  /*separateBeginAndEnd*/
83743
83725
  true
83744
83726
  );
83745
- mark("beforeCheck");
83746
- checkSourceFileWorker(node);
83747
- mark("afterCheck");
83748
- measure("Check", "beforeCheck", "afterCheck");
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);
83749
83733
  (_b = tracing) == null ? void 0 : _b.pop();
83750
83734
  }
83751
83735
  function unusedIsError(kind, isAmbient) {
@@ -83776,6 +83760,13 @@ function createTypeChecker(host) {
83776
83760
  clear(potentialWeakMapSetCollisions);
83777
83761
  clear(potentialReflectCollisions);
83778
83762
  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
+ }
83779
83770
  forEach(node.statements, checkSourceElement);
83780
83771
  checkSourceElement(node.endOfFileToken);
83781
83772
  checkDeferredNodes(node);
@@ -83816,10 +83807,38 @@ function createTypeChecker(host) {
83816
83807
  links.flags |= 1 /* TypeChecked */;
83817
83808
  }
83818
83809
  }
83819
- function getDiagnostics(sourceFile, ct) {
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) {
83820
83839
  try {
83821
83840
  cancellationToken = ct;
83822
- return getDiagnosticsWorker(sourceFile);
83841
+ return getDiagnosticsWorker(sourceFile, nodesToCheck);
83823
83842
  } finally {
83824
83843
  cancellationToken = void 0;
83825
83844
  }
@@ -83830,20 +83849,23 @@ function createTypeChecker(host) {
83830
83849
  }
83831
83850
  deferredDiagnosticsCallbacks = [];
83832
83851
  }
83833
- function checkSourceFileWithEagerDiagnostics(sourceFile) {
83852
+ function checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck) {
83834
83853
  ensurePendingDiagnosticWorkComplete();
83835
83854
  const oldAddLazyDiagnostics = addLazyDiagnostic;
83836
83855
  addLazyDiagnostic = (cb) => cb();
83837
- checkSourceFile(sourceFile);
83856
+ checkSourceFile(sourceFile, nodesToCheck);
83838
83857
  addLazyDiagnostic = oldAddLazyDiagnostics;
83839
83858
  }
83840
- function getDiagnosticsWorker(sourceFile) {
83859
+ function getDiagnosticsWorker(sourceFile, nodesToCheck) {
83841
83860
  if (sourceFile) {
83842
83861
  ensurePendingDiagnosticWorkComplete();
83843
83862
  const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
83844
83863
  const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
83845
- checkSourceFileWithEagerDiagnostics(sourceFile);
83864
+ checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck);
83846
83865
  const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
83866
+ if (nodesToCheck) {
83867
+ return semanticDiagnostics;
83868
+ }
83847
83869
  const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
83848
83870
  if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
83849
83871
  const deferredGlobalDiagnostics = relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, compareDiagnostics);
@@ -83853,7 +83875,7 @@ function createTypeChecker(host) {
83853
83875
  }
83854
83876
  return semanticDiagnostics;
83855
83877
  }
83856
- forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
83878
+ forEach(host.getSourceFiles(), (file) => checkSourceFileWithEagerDiagnostics(file));
83857
83879
  return diagnostics.getDiagnostics();
83858
83880
  }
83859
83881
  function getGlobalDiagnostics() {
@@ -85446,40 +85468,38 @@ function createTypeChecker(host) {
85446
85468
  amalgamatedDuplicates = void 0;
85447
85469
  }
85448
85470
  function checkExternalEmitHelpers(location, helpers) {
85449
- if (compilerOptions.importHelpers) {
85471
+ if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
85450
85472
  const sourceFile = getSourceFileOfNode(location);
85451
85473
  if (isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 33554432 /* Ambient */)) {
85452
85474
  const helpersModule = resolveHelpersModule(sourceFile, location);
85453
85475
  if (helpersModule !== unknownSymbol) {
85454
- const links = getSymbolLinks(helpersModule);
85455
- links.requestedExternalEmitHelpers ?? (links.requestedExternalEmitHelpers = 0);
85456
- if ((links.requestedExternalEmitHelpers & helpers) !== helpers) {
85457
- const uncheckedHelpers = helpers & ~links.requestedExternalEmitHelpers;
85458
- for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) {
85459
- if (uncheckedHelpers & helper) {
85460
- for (const name of getHelperNames(helper)) {
85461
- const symbol = resolveSymbol(getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
85462
- if (!symbol) {
85463
- 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);
85464
- } else if (helper & 524288 /* ClassPrivateFieldGet */) {
85465
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
85466
- 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);
85467
- }
85468
- } else if (helper & 1048576 /* ClassPrivateFieldSet */) {
85469
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
85470
- 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);
85471
- }
85472
- } else if (helper & 1024 /* SpreadArray */) {
85473
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
85474
- 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);
85475
- }
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);
85476
85496
  }
85477
85497
  }
85478
85498
  }
85479
85499
  }
85480
85500
  }
85481
- links.requestedExternalEmitHelpers |= helpers;
85482
85501
  }
85502
+ requestedExternalEmitHelpers |= helpers;
85483
85503
  }
85484
85504
  }
85485
85505
  }
@@ -85540,11 +85560,10 @@ function createTypeChecker(host) {
85540
85560
  }
85541
85561
  }
85542
85562
  function resolveHelpersModule(file, errorNode) {
85543
- const links = getNodeLinks(file);
85544
- if (!links.externalHelpersModule) {
85545
- links.externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
85563
+ if (!externalHelpersModule) {
85564
+ externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
85546
85565
  }
85547
- return links.externalHelpersModule;
85566
+ return externalHelpersModule;
85548
85567
  }
85549
85568
  function checkGrammarModifiers(node) {
85550
85569
  var _a;
@@ -88934,8 +88953,8 @@ function collectExternalModuleInfo(context, sourceFile) {
88934
88953
  const exportSpecifiers = new IdentifierNameMultiMap();
88935
88954
  const exportedBindings = [];
88936
88955
  const uniqueExports = /* @__PURE__ */ new Map();
88937
- const exportedFunctions = /* @__PURE__ */ new Set();
88938
88956
  let exportedNames;
88957
+ let exportedFunctions;
88939
88958
  let hasExportDefault = false;
88940
88959
  let exportEquals;
88941
88960
  let hasExportStarsToExportValues = false;
@@ -88995,12 +89014,19 @@ function collectExternalModuleInfo(context, sourceFile) {
88995
89014
  break;
88996
89015
  case 262 /* FunctionDeclaration */:
88997
89016
  if (hasSyntacticModifier(node, 32 /* Export */)) {
88998
- addExportedFunctionDeclaration(
88999
- node,
89000
- /*name*/
89001
- void 0,
89002
- hasSyntacticModifier(node, 2048 /* Default */)
89003
- );
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
+ }
89004
89030
  }
89005
89031
  break;
89006
89032
  case 263 /* ClassDeclaration */:
@@ -89036,10 +89062,6 @@ function collectExternalModuleInfo(context, sourceFile) {
89036
89062
  }
89037
89063
  const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
89038
89064
  if (decl) {
89039
- if (decl.kind === 262 /* FunctionDeclaration */) {
89040
- addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
89041
- continue;
89042
- }
89043
89065
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
89044
89066
  }
89045
89067
  uniqueExports.set(idText(specifier.name), true);
@@ -89047,21 +89069,6 @@ function collectExternalModuleInfo(context, sourceFile) {
89047
89069
  }
89048
89070
  }
89049
89071
  }
89050
- function addExportedFunctionDeclaration(node, name, isDefault) {
89051
- exportedFunctions.add(node);
89052
- if (isDefault) {
89053
- if (!hasExportDefault) {
89054
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context.factory.getDeclarationName(node));
89055
- hasExportDefault = true;
89056
- }
89057
- } else {
89058
- name ?? (name = node.name);
89059
- if (!uniqueExports.get(idText(name))) {
89060
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
89061
- uniqueExports.set(idText(name), true);
89062
- }
89063
- }
89064
- }
89065
89072
  }
89066
89073
  function collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings) {
89067
89074
  if (isBindingPattern(decl.name)) {
@@ -106344,8 +106351,10 @@ function transformModule(context) {
106344
106351
  );
106345
106352
  }
106346
106353
  }
106347
- for (const f of currentModuleInfo.exportedFunctions) {
106348
- appendExportsOfHoistedDeclaration(statements, f);
106354
+ if (some(currentModuleInfo.exportedFunctions)) {
106355
+ for (const f of currentModuleInfo.exportedFunctions) {
106356
+ appendExportsOfHoistedDeclaration(statements, f);
106357
+ }
106349
106358
  }
106350
106359
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
106351
106360
  addRange(statements, visitNodes2(node.statements, topLevelVisitor, isStatement, statementOffset));
@@ -106662,8 +106671,10 @@ function transformModule(context) {
106662
106671
  if (some(currentModuleInfo.exportedNames)) {
106663
106672
  append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
106664
106673
  }
106665
- for (const f of currentModuleInfo.exportedFunctions) {
106666
- appendExportsOfHoistedDeclaration(statements, f);
106674
+ if (some(currentModuleInfo.exportedFunctions)) {
106675
+ for (const f of currentModuleInfo.exportedFunctions) {
106676
+ appendExportsOfHoistedDeclaration(statements, f);
106677
+ }
106667
106678
  }
106668
106679
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
106669
106680
  if (moduleKind === 2 /* AMD */) {
@@ -108377,7 +108388,7 @@ function transformSystemModule(context) {
108377
108388
  if (!moduleInfo.hasExportStarsToExportValues) {
108378
108389
  return;
108379
108390
  }
108380
- if (!some(moduleInfo.exportedNames) && moduleInfo.exportedFunctions.size === 0 && moduleInfo.exportSpecifiers.size === 0) {
108391
+ if (!some(moduleInfo.exportedNames) && !some(moduleInfo.exportedFunctions) && moduleInfo.exportSpecifiers.size === 0) {
108381
108392
  let hasExportDeclarationWithExportClause = false;
108382
108393
  for (const externalImport of moduleInfo.externalImports) {
108383
108394
  if (externalImport.kind === 278 /* ExportDeclaration */ && externalImport.exportClause) {
@@ -108408,17 +108419,19 @@ function transformSystemModule(context) {
108408
108419
  );
108409
108420
  }
108410
108421
  }
108411
- for (const f of moduleInfo.exportedFunctions) {
108412
- if (hasSyntacticModifier(f, 2048 /* Default */)) {
108413
- continue;
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
+ );
108414
108434
  }
108415
- Debug.assert(!!f.name);
108416
- exportedNames.push(
108417
- factory2.createPropertyAssignment(
108418
- factory2.createStringLiteralFromNode(f.name),
108419
- factory2.createTrue()
108420
- )
108421
- );
108422
108435
  }
108423
108436
  const exportedNamesStorageRef = factory2.createUniqueName("exportedNames");
108424
108437
  statements.push(
@@ -119689,15 +119702,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119689
119702
  function getSyntacticDiagnostics(sourceFile, cancellationToken) {
119690
119703
  return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);
119691
119704
  }
119692
- function getSemanticDiagnostics(sourceFile, cancellationToken) {
119693
- return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken);
119705
+ function getSemanticDiagnostics(sourceFile, cancellationToken, nodesToCheck) {
119706
+ return getDiagnosticsHelper(
119707
+ sourceFile,
119708
+ (sourceFile2, cancellationToken2) => getSemanticDiagnosticsForFile(sourceFile2, cancellationToken2, nodesToCheck),
119709
+ cancellationToken
119710
+ );
119694
119711
  }
119695
119712
  function getCachedSemanticDiagnostics(sourceFile) {
119696
119713
  var _a2;
119697
119714
  return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
119698
119715
  }
119699
119716
  function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
119700
- return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken);
119717
+ return getBindAndCheckDiagnosticsForFile(
119718
+ sourceFile,
119719
+ cancellationToken,
119720
+ /*nodesToCheck*/
119721
+ void 0
119722
+ );
119701
119723
  }
119702
119724
  function getProgramDiagnostics(sourceFile) {
119703
119725
  var _a2;
@@ -119737,16 +119759,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119737
119759
  throw e;
119738
119760
  }
119739
119761
  }
119740
- function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
119762
+ function getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
119741
119763
  return concatenate(
119742
- filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options),
119764
+ filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options),
119743
119765
  getProgramDiagnostics(sourceFile)
119744
119766
  );
119745
119767
  }
119746
- function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken) {
119768
+ function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
119769
+ if (nodesToCheck) {
119770
+ return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
119771
+ }
119747
119772
  return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
119748
119773
  }
119749
- function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
119774
+ function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck) {
119750
119775
  return runWithCancellationToken(() => {
119751
119776
  if (skipTypeChecking(sourceFile, options, program)) {
119752
119777
  return emptyArray;
@@ -119754,26 +119779,35 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119754
119779
  const typeChecker2 = getTypeChecker();
119755
119780
  Debug.assert(!!sourceFile.bindDiagnostics);
119756
119781
  const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
119757
- const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
119758
119782
  const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
119759
- const isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
119760
- const includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */ || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
119783
+ const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
119784
+ const includeBindAndCheckDiagnostics = shouldIncludeBindAndCheckDiagnostics(sourceFile, options);
119761
119785
  let bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray;
119762
- let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker2.getDiagnostics(sourceFile, cancellationToken) : emptyArray;
119786
+ let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker2.getDiagnostics(sourceFile, cancellationToken, nodesToCheck) : emptyArray;
119763
119787
  if (isPlainJs) {
119764
119788
  bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
119765
119789
  checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
119766
119790
  }
119767
- return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : void 0);
119791
+ return getMergedBindAndCheckDiagnostics(
119792
+ sourceFile,
119793
+ includeBindAndCheckDiagnostics && !isPlainJs,
119794
+ !!nodesToCheck,
119795
+ bindDiagnostics,
119796
+ checkDiagnostics,
119797
+ isCheckJs ? sourceFile.jsDocDiagnostics : void 0
119798
+ );
119768
119799
  });
119769
119800
  }
119770
- function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
119801
+ function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, partialCheck, ...allDiagnostics) {
119771
119802
  var _a2;
119772
119803
  const flatDiagnostics = flatten(allDiagnostics);
119773
119804
  if (!includeBindAndCheckDiagnostics || !((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
119774
119805
  return flatDiagnostics;
119775
119806
  }
119776
119807
  const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics);
119808
+ if (partialCheck) {
119809
+ return diagnostics;
119810
+ }
119777
119811
  for (const errorExpectation of directives.getUnusedExpectations()) {
119778
119812
  diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive));
119779
119813
  }