typescript 5.5.0-dev.20240529 → 5.5.0-dev.20240531

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.
Files changed (3) hide show
  1. package/lib/tsc.js +456 -125
  2. package/lib/typescript.js +464 -154
  3. package/package.json +11 -11
package/lib/typescript.js CHANGED
@@ -2370,7 +2370,7 @@ module.exports = __toCommonJS(typescript_exports);
2370
2370
 
2371
2371
  // src/compiler/corePublic.ts
2372
2372
  var versionMajorMinor = "5.5";
2373
- var version = `${versionMajorMinor}.0-dev.20240529`;
2373
+ var version = `${versionMajorMinor}.0-dev.20240531`;
2374
2374
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2375
2375
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2376
2376
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -4252,6 +4252,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
4252
4252
  );
4253
4253
  }
4254
4254
  Debug2.formatNodeFlags = formatNodeFlags;
4255
+ function formatNodeCheckFlags(flags) {
4256
+ return formatEnum(
4257
+ flags,
4258
+ NodeCheckFlags,
4259
+ /*isFlags*/
4260
+ true
4261
+ );
4262
+ }
4263
+ Debug2.formatNodeCheckFlags = formatNodeCheckFlags;
4255
4264
  function formatModifierFlags(flags) {
4256
4265
  return formatEnum(
4257
4266
  flags,
@@ -6544,32 +6553,33 @@ var InternalSymbolName = /* @__PURE__ */ ((InternalSymbolName2) => {
6544
6553
  InternalSymbolName2["ImportAttributes"] = "__importAttributes";
6545
6554
  return InternalSymbolName2;
6546
6555
  })(InternalSymbolName || {});
6547
- var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags2) => {
6548
- NodeCheckFlags2[NodeCheckFlags2["None"] = 0] = "None";
6549
- NodeCheckFlags2[NodeCheckFlags2["TypeChecked"] = 1] = "TypeChecked";
6550
- NodeCheckFlags2[NodeCheckFlags2["LexicalThis"] = 2] = "LexicalThis";
6551
- NodeCheckFlags2[NodeCheckFlags2["CaptureThis"] = 4] = "CaptureThis";
6552
- NodeCheckFlags2[NodeCheckFlags2["CaptureNewTarget"] = 8] = "CaptureNewTarget";
6553
- NodeCheckFlags2[NodeCheckFlags2["SuperInstance"] = 16] = "SuperInstance";
6554
- NodeCheckFlags2[NodeCheckFlags2["SuperStatic"] = 32] = "SuperStatic";
6555
- NodeCheckFlags2[NodeCheckFlags2["ContextChecked"] = 64] = "ContextChecked";
6556
- NodeCheckFlags2[NodeCheckFlags2["MethodWithSuperPropertyAccessInAsync"] = 128] = "MethodWithSuperPropertyAccessInAsync";
6557
- NodeCheckFlags2[NodeCheckFlags2["MethodWithSuperPropertyAssignmentInAsync"] = 256] = "MethodWithSuperPropertyAssignmentInAsync";
6558
- NodeCheckFlags2[NodeCheckFlags2["CaptureArguments"] = 512] = "CaptureArguments";
6559
- NodeCheckFlags2[NodeCheckFlags2["EnumValuesComputed"] = 1024] = "EnumValuesComputed";
6560
- NodeCheckFlags2[NodeCheckFlags2["LexicalModuleMergesWithClass"] = 2048] = "LexicalModuleMergesWithClass";
6561
- NodeCheckFlags2[NodeCheckFlags2["LoopWithCapturedBlockScopedBinding"] = 4096] = "LoopWithCapturedBlockScopedBinding";
6562
- NodeCheckFlags2[NodeCheckFlags2["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding";
6563
- NodeCheckFlags2[NodeCheckFlags2["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding";
6564
- NodeCheckFlags2[NodeCheckFlags2["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop";
6565
- NodeCheckFlags2[NodeCheckFlags2["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter";
6566
- NodeCheckFlags2[NodeCheckFlags2["AssignmentsMarked"] = 131072] = "AssignmentsMarked";
6567
- NodeCheckFlags2[NodeCheckFlags2["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference";
6568
- NodeCheckFlags2[NodeCheckFlags2["ConstructorReference"] = 536870912] = "ConstructorReference";
6569
- NodeCheckFlags2[NodeCheckFlags2["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
6570
- NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
6571
- NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
6572
- return NodeCheckFlags2;
6556
+ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => {
6557
+ NodeCheckFlags3[NodeCheckFlags3["None"] = 0] = "None";
6558
+ NodeCheckFlags3[NodeCheckFlags3["TypeChecked"] = 1] = "TypeChecked";
6559
+ NodeCheckFlags3[NodeCheckFlags3["LexicalThis"] = 2] = "LexicalThis";
6560
+ NodeCheckFlags3[NodeCheckFlags3["CaptureThis"] = 4] = "CaptureThis";
6561
+ NodeCheckFlags3[NodeCheckFlags3["CaptureNewTarget"] = 8] = "CaptureNewTarget";
6562
+ NodeCheckFlags3[NodeCheckFlags3["SuperInstance"] = 16] = "SuperInstance";
6563
+ NodeCheckFlags3[NodeCheckFlags3["SuperStatic"] = 32] = "SuperStatic";
6564
+ NodeCheckFlags3[NodeCheckFlags3["ContextChecked"] = 64] = "ContextChecked";
6565
+ NodeCheckFlags3[NodeCheckFlags3["MethodWithSuperPropertyAccessInAsync"] = 128] = "MethodWithSuperPropertyAccessInAsync";
6566
+ NodeCheckFlags3[NodeCheckFlags3["MethodWithSuperPropertyAssignmentInAsync"] = 256] = "MethodWithSuperPropertyAssignmentInAsync";
6567
+ NodeCheckFlags3[NodeCheckFlags3["CaptureArguments"] = 512] = "CaptureArguments";
6568
+ NodeCheckFlags3[NodeCheckFlags3["EnumValuesComputed"] = 1024] = "EnumValuesComputed";
6569
+ NodeCheckFlags3[NodeCheckFlags3["LexicalModuleMergesWithClass"] = 2048] = "LexicalModuleMergesWithClass";
6570
+ NodeCheckFlags3[NodeCheckFlags3["LoopWithCapturedBlockScopedBinding"] = 4096] = "LoopWithCapturedBlockScopedBinding";
6571
+ NodeCheckFlags3[NodeCheckFlags3["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding";
6572
+ NodeCheckFlags3[NodeCheckFlags3["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding";
6573
+ NodeCheckFlags3[NodeCheckFlags3["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop";
6574
+ NodeCheckFlags3[NodeCheckFlags3["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter";
6575
+ NodeCheckFlags3[NodeCheckFlags3["AssignmentsMarked"] = 131072] = "AssignmentsMarked";
6576
+ NodeCheckFlags3[NodeCheckFlags3["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference";
6577
+ NodeCheckFlags3[NodeCheckFlags3["ConstructorReference"] = 536870912] = "ConstructorReference";
6578
+ NodeCheckFlags3[NodeCheckFlags3["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
6579
+ NodeCheckFlags3[NodeCheckFlags3["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
6580
+ NodeCheckFlags3[NodeCheckFlags3["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
6581
+ NodeCheckFlags3[NodeCheckFlags3["LazyFlags"] = 539358128] = "LazyFlags";
6582
+ return NodeCheckFlags3;
6573
6583
  })(NodeCheckFlags || {});
6574
6584
  var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
6575
6585
  TypeFlags2[TypeFlags2["Any"] = 1] = "Any";
@@ -9700,8 +9710,10 @@ var Diagnostics = {
9700
9710
  _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."),
9701
9711
  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."),
9702
9712
  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."),
9703
- 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."),
9713
+ 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."),
9704
9714
  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."),
9715
+ 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."),
9716
+ 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."),
9705
9717
  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."),
9706
9718
  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."),
9707
9719
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -12445,12 +12457,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12445
12457
  }
12446
12458
  if (ch === 92 /* backslash */ && !jsxAttributeString) {
12447
12459
  result += text.substring(start2, pos);
12448
- result += scanEscapeSequence(
12449
- /*shouldEmitInvalidEscapeError*/
12450
- true,
12451
- /*isRegularExpression*/
12452
- false
12453
- );
12460
+ result += scanEscapeSequence(1 /* String */ | 2 /* ReportErrors */);
12454
12461
  start2 = pos;
12455
12462
  continue;
12456
12463
  }
@@ -12493,11 +12500,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12493
12500
  }
12494
12501
  if (currChar === 92 /* backslash */) {
12495
12502
  contents += text.substring(start2, pos);
12496
- contents += scanEscapeSequence(
12497
- shouldEmitInvalidEscapeError,
12498
- /*isRegularExpression*/
12499
- false
12500
- );
12503
+ contents += scanEscapeSequence(1 /* String */ | (shouldEmitInvalidEscapeError ? 2 /* ReportErrors */ : 0));
12501
12504
  start2 = pos;
12502
12505
  continue;
12503
12506
  }
@@ -12517,7 +12520,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12517
12520
  tokenValue = contents;
12518
12521
  return resultingToken;
12519
12522
  }
12520
- function scanEscapeSequence(shouldEmitInvalidEscapeError, isRegularExpression) {
12523
+ function scanEscapeSequence(flags) {
12521
12524
  const start2 = pos;
12522
12525
  pos++;
12523
12526
  if (pos >= end) {
@@ -12545,9 +12548,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12545
12548
  pos++;
12546
12549
  }
12547
12550
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12548
- if (isRegularExpression || shouldEmitInvalidEscapeError) {
12551
+ if (flags & 6 /* ReportInvalidEscapeErrors */) {
12549
12552
  const code = parseInt(text.substring(start2 + 1, pos), 8);
12550
- if (isRegularExpression !== "annex-b") {
12553
+ if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */) && ch !== 48 /* _0 */) {
12554
+ error2(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"));
12555
+ } else {
12551
12556
  error2(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
12552
12557
  }
12553
12558
  return String.fromCharCode(code);
@@ -12556,8 +12561,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12556
12561
  case 56 /* _8 */:
12557
12562
  case 57 /* _9 */:
12558
12563
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12559
- if (isRegularExpression || shouldEmitInvalidEscapeError) {
12560
- error2(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
12564
+ if (flags & 6 /* ReportInvalidEscapeErrors */) {
12565
+ if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */)) {
12566
+ error2(Diagnostics.Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class, start2, pos - start2);
12567
+ } else {
12568
+ error2(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
12569
+ }
12561
12570
  return String.fromCharCode(ch);
12562
12571
  }
12563
12572
  return text.substring(start2, pos);
@@ -12578,14 +12587,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12578
12587
  case 34 /* doubleQuote */:
12579
12588
  return '"';
12580
12589
  case 117 /* u */:
12581
- if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
12590
+ if (flags & 17 /* ScanExtendedUnicodeEscape */ && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
12582
12591
  pos -= 2;
12583
- return scanExtendedUnicodeEscape(!!isRegularExpression || shouldEmitInvalidEscapeError);
12592
+ return scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
12584
12593
  }
12585
12594
  for (; pos < start2 + 6; pos++) {
12586
12595
  if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
12587
12596
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12588
- if (isRegularExpression || shouldEmitInvalidEscapeError) {
12597
+ if (flags & 6 /* ReportInvalidEscapeErrors */) {
12589
12598
  error2(Diagnostics.Hexadecimal_digit_expected);
12590
12599
  }
12591
12600
  return text.substring(start2, pos);
@@ -12594,7 +12603,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12594
12603
  tokenFlags |= 1024 /* UnicodeEscape */;
12595
12604
  const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
12596
12605
  const escapedValueString = String.fromCharCode(escapedValue);
12597
- if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
12606
+ if (flags & 16 /* AnyUnicodeMode */ && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
12598
12607
  const nextStart = pos;
12599
12608
  let nextPos = pos + 2;
12600
12609
  for (; nextPos < nextStart + 6; nextPos++) {
@@ -12613,7 +12622,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12613
12622
  for (; pos < start2 + 4; pos++) {
12614
12623
  if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
12615
12624
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12616
- if (isRegularExpression || shouldEmitInvalidEscapeError) {
12625
+ if (flags & 6 /* ReportInvalidEscapeErrors */) {
12617
12626
  error2(Diagnostics.Hexadecimal_digit_expected);
12618
12627
  }
12619
12628
  return text.substring(start2, pos);
@@ -12630,7 +12639,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12630
12639
  case 8233 /* paragraphSeparator */:
12631
12640
  return "";
12632
12641
  default:
12633
- if (isRegularExpression === true && (shouldEmitInvalidEscapeError || isIdentifierPart(ch, languageVersion))) {
12642
+ if (flags & 16 /* AnyUnicodeMode */ || flags & 4 /* RegularExpression */ && !(flags & 8 /* AnnexB */) && isIdentifierPart(ch, languageVersion)) {
12634
12643
  error2(Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, pos - 2, 2);
12635
12644
  }
12636
12645
  return String.fromCharCode(ch);
@@ -13329,6 +13338,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13329
13338
  const startOfRegExpBody = tokenStart + 1;
13330
13339
  pos = startOfRegExpBody;
13331
13340
  let inEscape = false;
13341
+ let namedCaptureGroups = false;
13332
13342
  let inCharacterClass = false;
13333
13343
  while (true) {
13334
13344
  const ch = charCodeChecked(pos);
@@ -13346,6 +13356,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13346
13356
  inEscape = true;
13347
13357
  } else if (ch === 93 /* closeBracket */) {
13348
13358
  inCharacterClass = false;
13359
+ } 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 */) {
13360
+ namedCaptureGroups = true;
13349
13361
  }
13350
13362
  pos++;
13351
13363
  }
@@ -13413,7 +13425,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13413
13425
  scanRegularExpressionWorker(
13414
13426
  regExpFlags,
13415
13427
  /*annexB*/
13416
- true
13428
+ true,
13429
+ namedCaptureGroups
13417
13430
  );
13418
13431
  });
13419
13432
  }
@@ -13423,12 +13436,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13423
13436
  }
13424
13437
  return token;
13425
13438
  }
13426
- function scanRegularExpressionWorker(regExpFlags, annexB) {
13439
+ function scanRegularExpressionWorker(regExpFlags, annexB, namedCaptureGroups) {
13427
13440
  var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
13428
13441
  var anyUnicodeMode = !!(regExpFlags & 96 /* AnyUnicodeMode */);
13429
- if (anyUnicodeMode) {
13430
- annexB = false;
13431
- }
13442
+ var anyUnicodeModeOrNonAnnexB = anyUnicodeMode || !annexB;
13432
13443
  var mayContainStrings = false;
13433
13444
  var numberOfCapturingGroups = 0;
13434
13445
  var groupSpecifiers;
@@ -13483,7 +13494,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13483
13494
  case 61 /* equals */:
13484
13495
  case 33 /* exclamation */:
13485
13496
  pos++;
13486
- isPreviousTermQuantifiable = annexB;
13497
+ isPreviousTermQuantifiable = !anyUnicodeModeOrNonAnnexB;
13487
13498
  break;
13488
13499
  case 60 /* lessThan */:
13489
13500
  const groupNameStart = pos;
@@ -13537,6 +13548,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13537
13548
  const digitsStart = pos;
13538
13549
  scanDigits();
13539
13550
  const min2 = tokenValue;
13551
+ if (!anyUnicodeModeOrNonAnnexB && !min2) {
13552
+ isPreviousTermQuantifiable = true;
13553
+ break;
13554
+ }
13540
13555
  if (charCodeChecked(pos) === 44 /* comma */) {
13541
13556
  pos++;
13542
13557
  scanDigits();
@@ -13545,25 +13560,29 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13545
13560
  if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
13546
13561
  error2(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
13547
13562
  } else {
13548
- if (anyUnicodeMode) {
13549
- error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13550
- }
13563
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13551
13564
  isPreviousTermQuantifiable = true;
13552
13565
  break;
13553
13566
  }
13554
- }
13555
- if (max && Number.parseInt(min2) > Number.parseInt(max)) {
13567
+ } else if (max && Number.parseInt(min2) > Number.parseInt(max) && (anyUnicodeModeOrNonAnnexB || charCodeChecked(pos) === 125 /* closeBrace */)) {
13556
13568
  error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
13557
13569
  }
13558
13570
  } else if (!min2) {
13559
- if (anyUnicodeMode) {
13571
+ if (anyUnicodeModeOrNonAnnexB) {
13560
13572
  error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13561
13573
  }
13562
13574
  isPreviousTermQuantifiable = true;
13563
13575
  break;
13564
13576
  }
13565
- scanExpectedChar(125 /* closeBrace */);
13566
- pos--;
13577
+ if (charCodeChecked(pos) !== 125 /* closeBrace */) {
13578
+ if (anyUnicodeModeOrNonAnnexB) {
13579
+ error2(Diagnostics._0_expected, pos, 0, String.fromCharCode(125 /* closeBrace */));
13580
+ pos--;
13581
+ } else {
13582
+ isPreviousTermQuantifiable = true;
13583
+ break;
13584
+ }
13585
+ }
13567
13586
  case 42 /* asterisk */:
13568
13587
  case 43 /* plus */:
13569
13588
  case 63 /* question */:
@@ -13596,7 +13615,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13596
13615
  }
13597
13616
  case 93 /* closeBracket */:
13598
13617
  case 125 /* closeBrace */:
13599
- if (anyUnicodeMode || ch === 41 /* closeParen */) {
13618
+ if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
13600
13619
  error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13601
13620
  }
13602
13621
  pos++;
@@ -13645,7 +13664,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13645
13664
  true
13646
13665
  );
13647
13666
  scanExpectedChar(62 /* greaterThan */);
13648
- } else if (anyUnicodeMode) {
13667
+ } else if (anyUnicodeModeOrNonAnnexB || namedCaptureGroups) {
13649
13668
  error2(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
13650
13669
  }
13651
13670
  break;
@@ -13688,9 +13707,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13688
13707
  pos++;
13689
13708
  return String.fromCharCode(ch & 31);
13690
13709
  }
13691
- if (anyUnicodeMode) {
13710
+ if (anyUnicodeModeOrNonAnnexB) {
13692
13711
  error2(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
13693
- } else if (atomEscape && annexB) {
13712
+ } else if (atomEscape) {
13694
13713
  pos--;
13695
13714
  return "\\";
13696
13715
  }
@@ -13715,10 +13734,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13715
13734
  default:
13716
13735
  pos--;
13717
13736
  return scanEscapeSequence(
13718
- /*shouldEmitInvalidEscapeError*/
13719
- anyUnicodeMode,
13720
- /*isRegularExpression*/
13721
- annexB ? "annex-b" : true
13737
+ 4 /* RegularExpression */ | (annexB ? 8 /* AnnexB */ : 0) | (anyUnicodeMode ? 16 /* AnyUnicodeMode */ : 0) | (atomEscape ? 32 /* AtomEscape */ : 0)
13722
13738
  );
13723
13739
  }
13724
13740
  }
@@ -13760,12 +13776,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13760
13776
  if (isClassContentExit(ch2)) {
13761
13777
  return;
13762
13778
  }
13763
- if (!minCharacter && !annexB) {
13779
+ if (!minCharacter && anyUnicodeModeOrNonAnnexB) {
13764
13780
  error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
13765
13781
  }
13766
13782
  const maxStart = pos;
13767
13783
  const maxCharacter = scanClassAtom();
13768
- if (!maxCharacter && !annexB) {
13784
+ if (!maxCharacter && anyUnicodeModeOrNonAnnexB) {
13769
13785
  error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
13770
13786
  continue;
13771
13787
  }
@@ -14195,8 +14211,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14195
14211
  if (!anyUnicodeMode) {
14196
14212
  error2(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
14197
14213
  }
14198
- } else if (anyUnicodeMode) {
14214
+ } else if (anyUnicodeModeOrNonAnnexB) {
14199
14215
  error2(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
14216
+ } else {
14217
+ pos--;
14218
+ return false;
14200
14219
  }
14201
14220
  return true;
14202
14221
  }
@@ -14236,11 +14255,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14236
14255
  }
14237
14256
  });
14238
14257
  forEach(decimalEscapes, (escape) => {
14239
- if (!annexB && escape.value > numberOfCapturingGroups) {
14258
+ if (escape.value > numberOfCapturingGroups) {
14240
14259
  if (numberOfCapturingGroups) {
14241
14260
  error2(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);
14242
14261
  } else {
14243
- error2(Diagnostics.This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups, escape.pos, escape.end - escape.pos);
14262
+ error2(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);
14244
14263
  }
14245
14264
  }
14246
14265
  });
@@ -29801,7 +29820,7 @@ var addDisposableResourceHelper = {
29801
29820
  var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
29802
29821
  if (value !== null && value !== void 0) {
29803
29822
  if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
29804
- var dispose;
29823
+ var dispose, inner;
29805
29824
  if (async) {
29806
29825
  if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
29807
29826
  dispose = value[Symbol.asyncDispose];
@@ -29809,8 +29828,10 @@ var addDisposableResourceHelper = {
29809
29828
  if (dispose === void 0) {
29810
29829
  if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
29811
29830
  dispose = value[Symbol.dispose];
29831
+ if (async) inner = dispose;
29812
29832
  }
29813
29833
  if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
29834
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
29814
29835
  env.stack.push({ value: value, dispose: dispose, async: async });
29815
29836
  }
29816
29837
  else if (async) {
@@ -40326,7 +40347,7 @@ var commandOptionsWithoutBuild = [
40326
40347
  showInSimplifiedHelpView: false,
40327
40348
  category: Diagnostics.Compiler_Diagnostics,
40328
40349
  description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
40329
- transpileOptionValue: void 0,
40350
+ transpileOptionValue: true,
40330
40351
  defaultValueDescription: false,
40331
40352
  affectsSemanticDiagnostics: true,
40332
40353
  affectsBuildInfo: true,
@@ -52469,10 +52490,22 @@ function createTypeChecker(host) {
52469
52490
  return !!aliasDeclarationLinks.typeOnlyDeclaration;
52470
52491
  }
52471
52492
  function getTypeOnlyAliasDeclaration(symbol, include) {
52493
+ var _a;
52472
52494
  if (!(symbol.flags & 2097152 /* Alias */)) {
52473
52495
  return void 0;
52474
52496
  }
52475
52497
  const links = getSymbolLinks(symbol);
52498
+ if (links.typeOnlyDeclaration === void 0) {
52499
+ links.typeOnlyDeclaration = false;
52500
+ const resolved = resolveSymbol(symbol);
52501
+ markSymbolOfAliasDeclarationIfTypeOnly(
52502
+ (_a = symbol.declarations) == null ? void 0 : _a[0],
52503
+ getDeclarationOfAliasSymbol(symbol) && getImmediateAliasedSymbol(symbol),
52504
+ resolved,
52505
+ /*overwriteEmpty*/
52506
+ true
52507
+ );
52508
+ }
52476
52509
  if (include === void 0) {
52477
52510
  return links.typeOnlyDeclaration || void 0;
52478
52511
  }
@@ -56215,18 +56248,108 @@ function createTypeChecker(host) {
56215
56248
  cancellationToken.throwIfCancellationRequested();
56216
56249
  }
56217
56250
  let hadError = false;
56251
+ const { finalizeBoundary, startRecoveryScope } = createRecoveryBoundary();
56218
56252
  const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
56219
- if (hadError) {
56253
+ if (!finalizeBoundary()) {
56220
56254
  return void 0;
56221
56255
  }
56222
56256
  context.approximateLength += existing.end - existing.pos;
56223
56257
  return transformed;
56224
56258
  function visitExistingNodeTreeSymbols(node) {
56259
+ if (hadError) return node;
56260
+ const recover = startRecoveryScope();
56225
56261
  const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
56226
56262
  const result = visitExistingNodeTreeSymbolsWorker(node);
56227
56263
  onExitNewScope == null ? void 0 : onExitNewScope();
56264
+ if (hadError) {
56265
+ if (isTypeNode(node) && !isTypePredicateNode(node)) {
56266
+ recover();
56267
+ return serializeExistingTypeNode(context, node);
56268
+ }
56269
+ return node;
56270
+ }
56228
56271
  return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
56229
56272
  }
56273
+ function createRecoveryBoundary() {
56274
+ let unreportedErrors;
56275
+ const oldTracker = context.tracker;
56276
+ const oldTrackedSymbols = context.trackedSymbols;
56277
+ context.trackedSymbols = [];
56278
+ const oldEncounteredError = context.encounteredError;
56279
+ context.tracker = new SymbolTrackerImpl(context, {
56280
+ ...oldTracker.inner,
56281
+ reportCyclicStructureError() {
56282
+ markError(() => oldTracker.reportCyclicStructureError());
56283
+ },
56284
+ reportInaccessibleThisError() {
56285
+ markError(() => oldTracker.reportInaccessibleThisError());
56286
+ },
56287
+ reportInaccessibleUniqueSymbolError() {
56288
+ markError(() => oldTracker.reportInaccessibleUniqueSymbolError());
56289
+ },
56290
+ reportLikelyUnsafeImportRequiredError(specifier) {
56291
+ markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier));
56292
+ },
56293
+ reportNonSerializableProperty(name) {
56294
+ markError(() => oldTracker.reportNonSerializableProperty(name));
56295
+ },
56296
+ trackSymbol(sym, decl, meaning) {
56297
+ const accessibility = isSymbolAccessible(
56298
+ sym,
56299
+ decl,
56300
+ meaning,
56301
+ /*shouldComputeAliasesToMakeVisible*/
56302
+ false
56303
+ );
56304
+ if (accessibility.accessibility !== 0 /* Accessible */) {
56305
+ (context.trackedSymbols ?? (context.trackedSymbols = [])).push([sym, decl, meaning]);
56306
+ return true;
56307
+ }
56308
+ return false;
56309
+ },
56310
+ moduleResolverHost: context.tracker.moduleResolverHost
56311
+ }, context.tracker.moduleResolverHost);
56312
+ return {
56313
+ startRecoveryScope: startRecoveryScope2,
56314
+ finalizeBoundary: finalizeBoundary2
56315
+ };
56316
+ function markError(unreportedError) {
56317
+ hadError = true;
56318
+ (unreportedErrors ?? (unreportedErrors = [])).push(unreportedError);
56319
+ }
56320
+ function startRecoveryScope2() {
56321
+ var _a;
56322
+ const initialTrackedSymbolsTop = ((_a = context.trackedSymbols) == null ? void 0 : _a.length) ?? 0;
56323
+ const unreportedErrorsTop = (unreportedErrors == null ? void 0 : unreportedErrors.length) ?? 0;
56324
+ return () => {
56325
+ hadError = false;
56326
+ if (context.trackedSymbols) {
56327
+ context.trackedSymbols.length = initialTrackedSymbolsTop;
56328
+ }
56329
+ if (unreportedErrors) {
56330
+ unreportedErrors.length = unreportedErrorsTop;
56331
+ }
56332
+ };
56333
+ }
56334
+ function finalizeBoundary2() {
56335
+ context.tracker = oldTracker;
56336
+ const newTrackedSymbols = context.trackedSymbols;
56337
+ context.trackedSymbols = oldTrackedSymbols;
56338
+ context.encounteredError = oldEncounteredError;
56339
+ unreportedErrors == null ? void 0 : unreportedErrors.forEach((fn) => fn());
56340
+ if (hadError) {
56341
+ return false;
56342
+ }
56343
+ newTrackedSymbols == null ? void 0 : newTrackedSymbols.forEach(
56344
+ ([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
56345
+ symbol,
56346
+ enclosingDeclaration,
56347
+ meaning
56348
+ )
56349
+ );
56350
+ return true;
56351
+ }
56352
+ }
56230
56353
  function onEnterNewScope(node) {
56231
56354
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
56232
56355
  }
@@ -56500,13 +56623,39 @@ function createTypeChecker(host) {
56500
56623
  }
56501
56624
  function rewriteModuleSpecifier(parent2, lit) {
56502
56625
  if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
56503
- const targetFile = getExternalModuleFileFromDeclaration(parent2);
56504
- if (targetFile) {
56505
- const newName = getSpecifierForModuleSymbol(targetFile.symbol, context);
56506
- if (newName !== lit.text) {
56507
- return setOriginalNode(factory.createStringLiteral(newName), lit);
56626
+ let name = lit.text;
56627
+ const nodeSymbol = getNodeLinks(node).resolvedSymbol;
56628
+ const meaning = parent2.isTypeOf ? 111551 /* Value */ : 788968 /* Type */;
56629
+ const parentSymbol = nodeSymbol && isSymbolAccessible(
56630
+ nodeSymbol,
56631
+ context.enclosingDeclaration,
56632
+ meaning,
56633
+ /*shouldComputeAliasesToMakeVisible*/
56634
+ false
56635
+ ).accessibility === 0 /* Accessible */ && lookupSymbolChain(
56636
+ nodeSymbol,
56637
+ context,
56638
+ meaning,
56639
+ /*yieldModuleSymbol*/
56640
+ true
56641
+ )[0];
56642
+ if (parentSymbol && parentSymbol.flags & 1536 /* Module */) {
56643
+ name = getSpecifierForModuleSymbol(parentSymbol, context);
56644
+ } else {
56645
+ const targetFile = getExternalModuleFileFromDeclaration(parent2);
56646
+ if (targetFile) {
56647
+ name = getSpecifierForModuleSymbol(targetFile.symbol, context);
56508
56648
  }
56509
56649
  }
56650
+ if (name.includes("/node_modules/")) {
56651
+ context.encounteredError = true;
56652
+ if (context.tracker.reportLikelyUnsafeImportRequiredError) {
56653
+ context.tracker.reportLikelyUnsafeImportRequiredError(name);
56654
+ }
56655
+ }
56656
+ if (name !== lit.text) {
56657
+ return setOriginalNode(factory.createStringLiteral(name), lit);
56658
+ }
56510
56659
  }
56511
56660
  return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
56512
56661
  }
@@ -64474,7 +64623,6 @@ function createTypeChecker(host) {
64474
64623
  return links.resolvedType;
64475
64624
  }
64476
64625
  function getTemplateLiteralType(texts, types) {
64477
- var _a, _b;
64478
64626
  const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
64479
64627
  if (unionIndex >= 0) {
64480
64628
  return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
@@ -64482,9 +64630,6 @@ function createTypeChecker(host) {
64482
64630
  if (contains(types, wildcardType)) {
64483
64631
  return wildcardType;
64484
64632
  }
64485
- 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)) {
64486
- return types[0];
64487
- }
64488
64633
  const newTypes = [];
64489
64634
  const newTexts = [];
64490
64635
  let text = texts[0];
@@ -73974,9 +74119,6 @@ function createTypeChecker(host) {
73974
74119
  if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
73975
74120
  return markJsxAliasReferenced(location);
73976
74121
  }
73977
- if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
73978
- return markAsyncFunctionAliasReferenced(location);
73979
- }
73980
74122
  if (isImportEqualsDeclaration(location)) {
73981
74123
  if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
73982
74124
  return markImportEqualsAliasReferenced(location);
@@ -73986,6 +74128,9 @@ function createTypeChecker(host) {
73986
74128
  if (isExportSpecifier(location)) {
73987
74129
  return markExportSpecifierAliasReferenced(location);
73988
74130
  }
74131
+ if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
74132
+ markAsyncFunctionAliasReferenced(location);
74133
+ }
73989
74134
  if (!compilerOptions.emitDecoratorMetadata) {
73990
74135
  return;
73991
74136
  }
@@ -74323,18 +74468,12 @@ function createTypeChecker(host) {
74323
74468
  }
74324
74469
  return type;
74325
74470
  }
74326
- function checkIdentifier(node, checkMode) {
74327
- if (isThisInTypeQuery(node)) {
74328
- return checkThisExpression(node);
74329
- }
74330
- const symbol = getResolvedSymbol(node);
74331
- if (symbol === unknownSymbol) {
74332
- return errorType;
74333
- }
74471
+ function checkIdentifierCalculateNodeCheckFlags(node, symbol) {
74472
+ if (isThisInTypeQuery(node)) return;
74334
74473
  if (symbol === argumentsSymbol) {
74335
74474
  if (isInPropertyInitializerOrClassStaticBlock(node)) {
74336
74475
  error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
74337
- return errorType;
74476
+ return;
74338
74477
  }
74339
74478
  let container = getContainingFunction(node);
74340
74479
  if (container) {
@@ -74353,17 +74492,14 @@ function createTypeChecker(host) {
74353
74492
  }
74354
74493
  }
74355
74494
  }
74356
- return getTypeOfSymbol(symbol);
74357
- }
74358
- if (shouldMarkIdentifierAliasReferenced(node)) {
74359
- markLinkedReferences(node, 1 /* Identifier */);
74495
+ return;
74360
74496
  }
74361
74497
  const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
74362
74498
  const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
74363
74499
  if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
74364
74500
  addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
74365
74501
  }
74366
- let declaration = localOrExportSymbol.valueDeclaration;
74502
+ const declaration = localOrExportSymbol.valueDeclaration;
74367
74503
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
74368
74504
  if (isClassLike(declaration) && declaration.name !== node) {
74369
74505
  let container = getThisContainer(
@@ -74390,6 +74526,27 @@ function createTypeChecker(host) {
74390
74526
  }
74391
74527
  }
74392
74528
  checkNestedBlockScopedBinding(node, symbol);
74529
+ }
74530
+ function checkIdentifier(node, checkMode) {
74531
+ if (isThisInTypeQuery(node)) {
74532
+ return checkThisExpression(node);
74533
+ }
74534
+ const symbol = getResolvedSymbol(node);
74535
+ if (symbol === unknownSymbol) {
74536
+ return errorType;
74537
+ }
74538
+ checkIdentifierCalculateNodeCheckFlags(node, symbol);
74539
+ if (symbol === argumentsSymbol) {
74540
+ if (isInPropertyInitializerOrClassStaticBlock(node)) {
74541
+ return errorType;
74542
+ }
74543
+ return getTypeOfSymbol(symbol);
74544
+ }
74545
+ if (shouldMarkIdentifierAliasReferenced(node)) {
74546
+ markLinkedReferences(node, 1 /* Identifier */);
74547
+ }
74548
+ const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
74549
+ let declaration = localOrExportSymbol.valueDeclaration;
74393
74550
  let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node, checkMode);
74394
74551
  const assignmentKind = getAssignmentTargetKind(node);
74395
74552
  if (assignmentKind) {
@@ -75055,7 +75212,31 @@ function createTypeChecker(host) {
75055
75212
  if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
75056
75213
  contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator));
75057
75214
  }
75058
- return node.asteriskToken ? contextualReturnType : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator);
75215
+ if (node.asteriskToken) {
75216
+ const iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(contextualReturnType, isAsyncGenerator);
75217
+ const yieldType = (iterationTypes == null ? void 0 : iterationTypes.yieldType) ?? silentNeverType;
75218
+ const returnType = getContextualType2(node, contextFlags) ?? silentNeverType;
75219
+ const nextType = (iterationTypes == null ? void 0 : iterationTypes.nextType) ?? unknownType;
75220
+ const generatorType = createGeneratorType(
75221
+ yieldType,
75222
+ returnType,
75223
+ nextType,
75224
+ /*isAsyncGenerator*/
75225
+ false
75226
+ );
75227
+ if (isAsyncGenerator) {
75228
+ const asyncGeneratorType = createGeneratorType(
75229
+ yieldType,
75230
+ returnType,
75231
+ nextType,
75232
+ /*isAsyncGenerator*/
75233
+ true
75234
+ );
75235
+ return getUnionType([generatorType, asyncGeneratorType]);
75236
+ }
75237
+ return generatorType;
75238
+ }
75239
+ return getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator);
75059
75240
  }
75060
75241
  }
75061
75242
  return void 0;
@@ -80825,7 +81006,7 @@ function createTypeChecker(host) {
80825
81006
  if (nextType) nextType = getWidenedType(nextType);
80826
81007
  }
80827
81008
  if (isGenerator) {
80828
- return createGeneratorReturnType(
81009
+ return createGeneratorType(
80829
81010
  yieldType || neverType,
80830
81011
  returnType || fallbackReturnType,
80831
81012
  nextType || getContextualIterationType(2 /* Next */, func) || unknownType,
@@ -80835,7 +81016,7 @@ function createTypeChecker(host) {
80835
81016
  return isAsync ? createPromiseType(returnType || fallbackReturnType) : returnType || fallbackReturnType;
80836
81017
  }
80837
81018
  }
80838
- function createGeneratorReturnType(yieldType, returnType, nextType, isAsyncGenerator) {
81019
+ function createGeneratorType(yieldType, returnType, nextType, isAsyncGenerator) {
80839
81020
  const resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
80840
81021
  const globalGeneratorType = resolver.getGlobalGeneratorType(
80841
81022
  /*reportErrors*/
@@ -83220,7 +83401,7 @@ function createTypeChecker(host) {
83220
83401
  const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
83221
83402
  const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
83222
83403
  const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
83223
- const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
83404
+ const generatorInstantiation = createGeneratorType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
83224
83405
  return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
83225
83406
  }
83226
83407
  function checkClassForDuplicateDeclarations(node) {
@@ -89376,7 +89557,6 @@ function createTypeChecker(host) {
89376
89557
  if (links.isDeclarationWithCollidingName === void 0) {
89377
89558
  const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
89378
89559
  if (isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
89379
- const nodeLinks2 = getNodeLinks(symbol.valueDeclaration);
89380
89560
  if (resolveName(
89381
89561
  container.parent,
89382
89562
  symbol.escapedName,
@@ -89387,8 +89567,8 @@ function createTypeChecker(host) {
89387
89567
  false
89388
89568
  )) {
89389
89569
  links.isDeclarationWithCollidingName = true;
89390
- } else if (nodeLinks2.flags & 16384 /* CapturedBlockScopedBinding */) {
89391
- const isDeclaredInLoop = nodeLinks2.flags & 32768 /* BlockScopedBindingInLoop */;
89570
+ } else if (hasNodeCheckFlag(symbol.valueDeclaration, 16384 /* CapturedBlockScopedBinding */)) {
89571
+ const isDeclaredInLoop = hasNodeCheckFlag(symbol.valueDeclaration, 32768 /* BlockScopedBindingInLoop */);
89392
89572
  const inLoopInitializer = isIterationStatement(
89393
89573
  container,
89394
89574
  /*lookInLabeledStatements*/
@@ -89470,6 +89650,9 @@ function createTypeChecker(host) {
89470
89650
  if (!symbol) {
89471
89651
  return false;
89472
89652
  }
89653
+ const container = getSourceFileOfNode(symbol.valueDeclaration);
89654
+ const fileSymbol = container && getSymbolOfDeclaration(container);
89655
+ void resolveExternalModuleSymbol(fileSymbol);
89473
89656
  const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
89474
89657
  if (target === unknownSymbol) {
89475
89658
  return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
@@ -89568,6 +89751,108 @@ function createTypeChecker(host) {
89568
89751
  if (nodeId < 0 || nodeId >= nodeLinks.length) return 0;
89569
89752
  return ((_a = nodeLinks[nodeId]) == null ? void 0 : _a.flags) || 0;
89570
89753
  }
89754
+ function hasNodeCheckFlag(node, flag) {
89755
+ calculateNodeCheckFlagWorker(node, flag);
89756
+ return !!(getNodeCheckFlags(node) & flag);
89757
+ }
89758
+ function calculateNodeCheckFlagWorker(node, flag) {
89759
+ if (!compilerOptions.noCheck) {
89760
+ return;
89761
+ }
89762
+ const links = getNodeLinks(node);
89763
+ if (links.calculatedFlags & flag) {
89764
+ return;
89765
+ }
89766
+ switch (flag) {
89767
+ case 16 /* SuperInstance */:
89768
+ case 32 /* SuperStatic */:
89769
+ return checkSingleSuperExpression(node);
89770
+ case 128 /* MethodWithSuperPropertyAccessInAsync */:
89771
+ case 256 /* MethodWithSuperPropertyAssignmentInAsync */:
89772
+ case 2097152 /* ContainsSuperPropertyInStaticInitializer */:
89773
+ return checkChildSuperExpressions(node);
89774
+ case 512 /* CaptureArguments */:
89775
+ case 8192 /* ContainsCapturedBlockScopeBinding */:
89776
+ case 65536 /* NeedsLoopOutParameter */:
89777
+ case 262144 /* ContainsConstructorReference */:
89778
+ return checkChildIdentifiers(node);
89779
+ case 536870912 /* ConstructorReference */:
89780
+ return checkSingleIdentifier(node);
89781
+ case 4096 /* LoopWithCapturedBlockScopedBinding */:
89782
+ case 32768 /* BlockScopedBindingInLoop */:
89783
+ case 16384 /* CapturedBlockScopedBinding */:
89784
+ return checkContainingBlockScopeBindingUses(node);
89785
+ default:
89786
+ return Debug.assertNever(flag, `Unhandled node check flag calculation: ${Debug.formatNodeCheckFlags(flag)}`);
89787
+ }
89788
+ function forEachNodeRecursively(root, cb) {
89789
+ const rootResult = cb(root, root.parent);
89790
+ if (rootResult === "skip") return void 0;
89791
+ if (rootResult) return rootResult;
89792
+ return forEachChildRecursively(root, cb);
89793
+ }
89794
+ function checkSuperExpressions(node2) {
89795
+ const links2 = getNodeLinks(node2);
89796
+ if (links2.calculatedFlags & flag) return "skip";
89797
+ links2.calculatedFlags |= 128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */ | 2097152 /* ContainsSuperPropertyInStaticInitializer */;
89798
+ checkSingleSuperExpression(node2);
89799
+ return void 0;
89800
+ }
89801
+ function checkChildSuperExpressions(node2) {
89802
+ forEachNodeRecursively(node2, checkSuperExpressions);
89803
+ }
89804
+ function checkSingleSuperExpression(node2) {
89805
+ const nodeLinks2 = getNodeLinks(node2);
89806
+ nodeLinks2.calculatedFlags |= 16 /* SuperInstance */ | 32 /* SuperStatic */;
89807
+ if (node2.kind === 108 /* SuperKeyword */) {
89808
+ checkSuperExpression(node2);
89809
+ }
89810
+ }
89811
+ function checkIdentifiers(node2) {
89812
+ const links2 = getNodeLinks(node2);
89813
+ if (links2.calculatedFlags & flag) return "skip";
89814
+ links2.calculatedFlags |= 512 /* CaptureArguments */ | 8192 /* ContainsCapturedBlockScopeBinding */ | 65536 /* NeedsLoopOutParameter */ | 262144 /* ContainsConstructorReference */;
89815
+ checkSingleIdentifier(node2);
89816
+ return void 0;
89817
+ }
89818
+ function checkChildIdentifiers(node2) {
89819
+ forEachNodeRecursively(node2, checkIdentifiers);
89820
+ }
89821
+ function checkSingleIdentifier(node2) {
89822
+ const nodeLinks2 = getNodeLinks(node2);
89823
+ nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
89824
+ if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
89825
+ const s = getSymbolAtLocation(
89826
+ node2,
89827
+ /*ignoreErrors*/
89828
+ true
89829
+ );
89830
+ if (s && s !== unknownSymbol) {
89831
+ checkIdentifierCalculateNodeCheckFlags(node2, s);
89832
+ }
89833
+ }
89834
+ }
89835
+ function checkBlockScopeBindings(node2) {
89836
+ const links2 = getNodeLinks(node2);
89837
+ if (links2.calculatedFlags & flag) return "skip";
89838
+ links2.calculatedFlags |= 4096 /* LoopWithCapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */ | 16384 /* CapturedBlockScopedBinding */;
89839
+ checkSingleBlockScopeBinding(node2);
89840
+ return void 0;
89841
+ }
89842
+ function checkContainingBlockScopeBindingUses(node2) {
89843
+ const scope = getEnclosingBlockScopeContainer(isDeclarationName(node2) ? node2.parent : node2);
89844
+ forEachNodeRecursively(scope, checkBlockScopeBindings);
89845
+ }
89846
+ function checkSingleBlockScopeBinding(node2) {
89847
+ checkSingleIdentifier(node2);
89848
+ if (isComputedPropertyName(node2)) {
89849
+ checkComputedPropertyName(node2);
89850
+ }
89851
+ if (isPrivateIdentifier(node2) && isClassElement(node2.parent)) {
89852
+ setNodeLinksForPrivateIdentifierScope(node2.parent);
89853
+ }
89854
+ }
89855
+ }
89571
89856
  function getEnumMemberValue(node) {
89572
89857
  computeEnumMemberValues(node.parent);
89573
89858
  return getNodeLinks(node).enumMemberValue ?? evaluatorResult(
@@ -89588,7 +89873,15 @@ function createTypeChecker(host) {
89588
89873
  if (node.kind === 306 /* EnumMember */) {
89589
89874
  return getEnumMemberValue(node).value;
89590
89875
  }
89591
- const symbol = getNodeLinks(node).resolvedSymbol;
89876
+ if (!getNodeLinks(node).resolvedSymbol) {
89877
+ void checkExpressionCached(node);
89878
+ }
89879
+ const symbol = getNodeLinks(node).resolvedSymbol || (isEntityNameExpression(node) ? resolveEntityName(
89880
+ node,
89881
+ 111551 /* Value */,
89882
+ /*ignoreErrors*/
89883
+ true
89884
+ ) : void 0);
89592
89885
  if (symbol && symbol.flags & 8 /* EnumMember */) {
89593
89886
  const member = symbol.valueDeclaration;
89594
89887
  if (isEnumConst(member.parent)) {
@@ -89939,9 +90232,10 @@ function createTypeChecker(host) {
89939
90232
  const node = getParseTreeNode(nodeIn);
89940
90233
  return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
89941
90234
  },
89942
- getNodeCheckFlags: (nodeIn) => {
90235
+ hasNodeCheckFlag: (nodeIn, flag) => {
89943
90236
  const node = getParseTreeNode(nodeIn);
89944
- return node ? getNodeCheckFlags(node) : 0;
90237
+ if (!node) return false;
90238
+ return hasNodeCheckFlag(node, flag);
89945
90239
  },
89946
90240
  isTopLevelValueImportEqualsWithEntityName,
89947
90241
  isDeclarationVisible,
@@ -89964,6 +90258,10 @@ function createTypeChecker(host) {
89964
90258
  return node ? getEnumMemberValue(node) : void 0;
89965
90259
  },
89966
90260
  collectLinkedAliases,
90261
+ markLinkedReferences: (nodeIn) => {
90262
+ const node = getParseTreeNode(nodeIn);
90263
+ return node && markLinkedReferences(node, 0 /* Unspecified */);
90264
+ },
89967
90265
  getReferencedValueDeclaration,
89968
90266
  getReferencedValueDeclarations,
89969
90267
  getTypeReferenceSerializationKind,
@@ -97952,7 +98250,7 @@ function transformClassFields(context) {
97952
98250
  containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
97953
98251
  } else if (isPrivateIdentifierClassElementDeclaration(member)) {
97954
98252
  containsInstancePrivateElements = true;
97955
- if (resolver.getNodeCheckFlags(member) & 262144 /* ContainsConstructorReference */) {
98253
+ if (resolver.hasNodeCheckFlag(member, 262144 /* ContainsConstructorReference */)) {
97956
98254
  facts |= 2 /* NeedsClassConstructorReference */;
97957
98255
  }
97958
98256
  } else if (isPropertyDeclaration(member)) {
@@ -98059,7 +98357,7 @@ function transformClassFields(context) {
98059
98357
  if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
98060
98358
  getClassLexicalEnvironment().classThis = node.emitNode.classThis;
98061
98359
  }
98062
- const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */;
98360
+ const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
98063
98361
  const isExport = hasSyntacticModifier(node, 32 /* Export */);
98064
98362
  const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
98065
98363
  let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
@@ -98121,15 +98419,14 @@ function transformClassFields(context) {
98121
98419
  var _a, _b, _c;
98122
98420
  const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
98123
98421
  const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
98124
- const classCheckFlags = resolver.getNodeCheckFlags(node);
98125
- const isClassWithConstructorReference = classCheckFlags & 262144 /* ContainsConstructorReference */;
98422
+ const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
98423
+ const requiresBlockScopedVar = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
98126
98424
  let temp;
98127
98425
  function createClassTempVar() {
98128
98426
  var _a2;
98129
98427
  if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
98130
98428
  return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
98131
98429
  }
98132
- const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
98133
98430
  const temp2 = factory2.createTempVariable(
98134
98431
  requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
98135
98432
  /*reservedInNestedScopes*/
@@ -98697,7 +98994,7 @@ function transformClassFields(context) {
98697
98994
  const alreadyTransformed = !!cacheAssignment || isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left);
98698
98995
  if (!alreadyTransformed && !inlinable && shouldHoist) {
98699
98996
  const generatedName = factory2.getGeneratedNameForNode(name);
98700
- if (resolver.getNodeCheckFlags(name) & 32768 /* BlockScopedBindingInLoop */) {
98997
+ if (resolver.hasNodeCheckFlag(name, 32768 /* BlockScopedBindingInLoop */)) {
98701
98998
  addBlockScopedVariable(generatedName);
98702
98999
  } else {
98703
99000
  hoistVariableDeclaration(generatedName);
@@ -98851,7 +99148,7 @@ function transformClassFields(context) {
98851
99148
  prefix,
98852
99149
  suffix
98853
99150
  );
98854
- if (resolver.getNodeCheckFlags(node) & 32768 /* BlockScopedBindingInLoop */) {
99151
+ if (resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */)) {
98855
99152
  addBlockScopedVariable(identifier);
98856
99153
  } else {
98857
99154
  hoistVariableDeclaration(identifier);
@@ -99090,7 +99387,7 @@ function transformClassFields(context) {
99090
99387
  }
99091
99388
  function trySubstituteClassAlias(node) {
99092
99389
  if (enabledSubstitutions & 1 /* ClassAliases */) {
99093
- if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
99390
+ if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
99094
99391
  const declaration = resolver.getReferencedValueDeclaration(node);
99095
99392
  if (declaration) {
99096
99393
  const classAlias = classAliases[declaration.id];
@@ -99957,7 +100254,7 @@ function transformLegacyDecorators(context) {
99957
100254
  }
99958
100255
  }
99959
100256
  function getClassAliasIfNeeded(node) {
99960
- if (resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */) {
100257
+ if (resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */)) {
99961
100258
  enableSubstitutionForClassAliases();
99962
100259
  const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
99963
100260
  classAliases[getOriginalNodeId(node)] = classAlias;
@@ -99990,7 +100287,7 @@ function transformLegacyDecorators(context) {
99990
100287
  }
99991
100288
  function trySubstituteClassAlias(node) {
99992
100289
  if (classAliases) {
99993
- if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
100290
+ if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
99994
100291
  const declaration = resolver.getReferencedValueDeclaration(node);
99995
100292
  if (declaration) {
99996
100293
  const classAlias = classAliases[declaration.id];
@@ -102299,7 +102596,7 @@ function transformES2017(context) {
102299
102596
  hasSuperElementAccess = false;
102300
102597
  let updated = visitFunctionBody(node.body, visitor, context);
102301
102598
  const originalMethod = getOriginalNode(node, isFunctionLikeDeclaration);
102302
- const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */) && (getFunctionFlags(originalMethod) & 3 /* AsyncGenerator */) !== 3 /* AsyncGenerator */;
102599
+ const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) && (getFunctionFlags(originalMethod) & 3 /* AsyncGenerator */) !== 3 /* AsyncGenerator */;
102303
102600
  if (emitSuperHelpers) {
102304
102601
  enableSubstitutionForAsyncMethodsWithSuper();
102305
102602
  if (capturedSuperProperties.size) {
@@ -102310,9 +102607,9 @@ function transformES2017(context) {
102310
102607
  updated = factory2.updateBlock(updated, statements);
102311
102608
  }
102312
102609
  if (hasSuperElementAccess) {
102313
- if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
102610
+ if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
102314
102611
  addEmitHelper(updated, advancedAsyncSuperHelper);
102315
- } else if (resolver.getNodeCheckFlags(node) & 128 /* MethodWithSuperPropertyAccessInAsync */) {
102612
+ } else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
102316
102613
  addEmitHelper(updated, asyncSuperHelper);
102317
102614
  }
102318
102615
  }
@@ -102379,7 +102676,7 @@ function transformES2017(context) {
102379
102676
  const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
102380
102677
  const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
102381
102678
  const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
102382
- const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0;
102679
+ const hasLexicalArguments = resolver.hasNodeCheckFlag(node, 512 /* CaptureArguments */);
102383
102680
  const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
102384
102681
  if (captureLexicalArguments) {
102385
102682
  lexicalArgumentsBinding = factory2.createUniqueName("arguments");
@@ -102434,7 +102731,7 @@ function transformES2017(context) {
102434
102731
  )
102435
102732
  )
102436
102733
  );
102437
- const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
102734
+ const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
102438
102735
  if (emitSuperHelpers) {
102439
102736
  enableSubstitutionForAsyncMethodsWithSuper();
102440
102737
  if (capturedSuperProperties.size) {
@@ -102453,9 +102750,9 @@ function transformES2017(context) {
102453
102750
  );
102454
102751
  setTextRange(block, node.body);
102455
102752
  if (emitSuperHelpers && hasSuperElementAccess) {
102456
- if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
102753
+ if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
102457
102754
  addEmitHelper(block, advancedAsyncSuperHelper);
102458
- } else if (resolver.getNodeCheckFlags(node) & 128 /* MethodWithSuperPropertyAccessInAsync */) {
102755
+ } else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
102459
102756
  addEmitHelper(block, asyncSuperHelper);
102460
102757
  }
102461
102758
  }
@@ -102514,7 +102811,7 @@ function transformES2017(context) {
102514
102811
  }
102515
102812
  function onEmitNode(hint, node, emitCallback) {
102516
102813
  if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
102517
- const superContainerFlags = resolver.getNodeCheckFlags(node) & (128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */);
102814
+ const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
102518
102815
  if (superContainerFlags !== enclosingSuperContainerFlags) {
102519
102816
  const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
102520
102817
  enclosingSuperContainerFlags = superContainerFlags;
@@ -102618,7 +102915,7 @@ function transformES2017(context) {
102618
102915
  }
102619
102916
  }
102620
102917
  function createSuperAccessVariableStatement(factory2, resolver, node, names) {
102621
- const hasBinding = (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) !== 0;
102918
+ const hasBinding = resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */);
102622
102919
  const accessors = [];
102623
102920
  names.forEach((_, key) => {
102624
102921
  const name = unescapeLeadingUnderscores(key);
@@ -103713,7 +104010,7 @@ function transformES2018(context) {
103713
104010
  !!(hierarchyFacts & 1 /* HasLexicalThis */)
103714
104011
  )
103715
104012
  );
103716
- const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
104013
+ const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
103717
104014
  if (emitSuperHelpers) {
103718
104015
  enableSubstitutionForAsyncMethodsWithSuper();
103719
104016
  const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
@@ -103723,9 +104020,9 @@ function transformES2018(context) {
103723
104020
  outerStatements.push(returnStatement);
103724
104021
  const block = factory2.updateBlock(node.body, outerStatements);
103725
104022
  if (emitSuperHelpers && hasSuperElementAccess) {
103726
- if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
104023
+ if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
103727
104024
  addEmitHelper(block, advancedAsyncSuperHelper);
103728
- } else if (resolver.getNodeCheckFlags(node) & 128 /* MethodWithSuperPropertyAccessInAsync */) {
104025
+ } else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
103729
104026
  addEmitHelper(block, asyncSuperHelper);
103730
104027
  }
103731
104028
  }
@@ -103858,7 +104155,7 @@ function transformES2018(context) {
103858
104155
  }
103859
104156
  function onEmitNode(hint, node, emitCallback) {
103860
104157
  if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
103861
- const superContainerFlags = resolver.getNodeCheckFlags(node) & (128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */);
104158
+ const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
103862
104159
  if (superContainerFlags !== enclosingSuperContainerFlags) {
103863
104160
  const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
103864
104161
  enclosingSuperContainerFlags = superContainerFlags;
@@ -107563,9 +107860,8 @@ function transformES2015(context) {
107563
107860
  return createRange(pos, end);
107564
107861
  }
107565
107862
  function shouldEmitExplicitInitializerForLetDeclaration(node) {
107566
- const flags = resolver.getNodeCheckFlags(node);
107567
- const isCapturedInFunction = flags & 16384 /* CapturedBlockScopedBinding */;
107568
- const isDeclaredInLoop = flags & 32768 /* BlockScopedBindingInLoop */;
107863
+ const isCapturedInFunction = resolver.hasNodeCheckFlag(node, 16384 /* CapturedBlockScopedBinding */);
107864
+ const isDeclaredInLoop = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
107569
107865
  const emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || isCapturedInFunction && isDeclaredInLoop && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0;
107570
107866
  const emitExplicitInitializer = !emittedAsTopLevel && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || isDeclaredInLoop && !isCapturedInFunction && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0);
107571
107867
  return emitExplicitInitializer;
@@ -108016,7 +108312,7 @@ function transformES2015(context) {
108016
108312
  return factory2.inlineExpressions(expressions);
108017
108313
  }
108018
108314
  function shouldConvertPartOfIterationStatement(node) {
108019
- return (resolver.getNodeCheckFlags(node) & 8192 /* ContainsCapturedBlockScopeBinding */) !== 0;
108315
+ return resolver.hasNodeCheckFlag(node, 8192 /* ContainsCapturedBlockScopeBinding */);
108020
108316
  }
108021
108317
  function shouldConvertInitializerOfForStatement(node) {
108022
108318
  return isForStatement(node) && !!node.initializer && shouldConvertPartOfIterationStatement(node.initializer);
@@ -108031,7 +108327,7 @@ function transformES2015(context) {
108031
108327
  return shouldConvertBodyOfIterationStatement(node) || shouldConvertInitializerOfForStatement(node);
108032
108328
  }
108033
108329
  function shouldConvertBodyOfIterationStatement(node) {
108034
- return (resolver.getNodeCheckFlags(node) & 4096 /* LoopWithCapturedBlockScopedBinding */) !== 0;
108330
+ return resolver.hasNodeCheckFlag(node, 4096 /* LoopWithCapturedBlockScopedBinding */);
108035
108331
  }
108036
108332
  function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
108037
108333
  if (!state.hoistedLocalVariables) {
@@ -108580,11 +108876,11 @@ function transformES2015(context) {
108580
108876
  void 0,
108581
108877
  name
108582
108878
  ));
108583
- const checkFlags = resolver.getNodeCheckFlags(decl);
108584
- if (checkFlags & 65536 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
108879
+ const needsOutParam = resolver.hasNodeCheckFlag(decl, 65536 /* NeedsLoopOutParameter */);
108880
+ if (needsOutParam || hasCapturedBindingsInForHead) {
108585
108881
  const outParamName = factory2.createUniqueName("out_" + idText(name));
108586
108882
  let flags = 0 /* None */;
108587
- if (checkFlags & 65536 /* NeedsLoopOutParameter */) {
108883
+ if (needsOutParam) {
108588
108884
  flags |= 1 /* Body */;
108589
108885
  }
108590
108886
  if (isForStatement(container)) {
@@ -117618,6 +117914,9 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
117618
117914
  emitSkipped = true;
117619
117915
  return;
117620
117916
  }
117917
+ if (compilerOptions.noCheck) {
117918
+ (isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : filter(sourceFileOrBundle.sourceFiles, isSourceFileNotJson)).forEach(markLinkedReferences);
117919
+ }
117621
117920
  const transform2 = transformNodes(
117622
117921
  resolver,
117623
117922
  host,
@@ -117752,6 +118051,13 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
117752
118051
  }
117753
118052
  forEachChild(node, collectLinkedAliases);
117754
118053
  }
118054
+ function markLinkedReferences(file) {
118055
+ forEachChildRecursively(file, (n) => {
118056
+ if (isImportEqualsDeclaration(n) && !(getSyntacticModifierFlags(n) & 32 /* Export */)) return "skip";
118057
+ if (isImportDeclaration(n)) return "skip";
118058
+ resolver.markLinkedReferences(n);
118059
+ });
118060
+ }
117755
118061
  function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform2, printer, mapOptions) {
117756
118062
  const sourceFileOrBundle = transform2.transformed[0];
117757
118063
  const bundle = sourceFileOrBundle.kind === 308 /* Bundle */ ? sourceFileOrBundle : void 0;
@@ -117883,10 +118189,11 @@ var notImplementedResolver = {
117883
118189
  isValueAliasDeclaration: notImplemented,
117884
118190
  isReferencedAliasDeclaration: notImplemented,
117885
118191
  isTopLevelValueImportEqualsWithEntityName: notImplemented,
117886
- getNodeCheckFlags: notImplemented,
118192
+ hasNodeCheckFlag: notImplemented,
117887
118193
  isDeclarationVisible: notImplemented,
117888
118194
  isLateBound: (_node) => false,
117889
118195
  collectLinkedAliases: notImplemented,
118196
+ markLinkedReferences: notImplemented,
117890
118197
  isImplementationOfOverload: notImplemented,
117891
118198
  requiresAddingImplicitUndefined: notImplemented,
117892
118199
  isExpandoFunctionDeclaration: notImplemented,
@@ -126022,9 +126329,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126022
126329
  if (options.noEmit) {
126023
126330
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
126024
126331
  }
126025
- if (!options.emitDeclarationOnly) {
126026
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "noCheck", "emitDeclarationOnly");
126027
- }
126028
126332
  }
126029
126333
  if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
126030
126334
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
@@ -141150,7 +141454,6 @@ function transpileWorker(input, transpileOptions, declaration) {
141150
141454
  options.declaration = true;
141151
141455
  options.emitDeclarationOnly = true;
141152
141456
  options.isolatedDeclarations = true;
141153
- options.noCheck = true;
141154
141457
  } else {
141155
141458
  options.declaration = false;
141156
141459
  }
@@ -143828,7 +144131,7 @@ function getExistingLocals(sourceFile, statements, checker) {
143828
144131
  for (const statement of statements) {
143829
144132
  forEachReference(statement, checker, (s) => {
143830
144133
  const symbol = skipAlias(s, checker);
143831
- if (symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration) === sourceFile) {
144134
+ if (symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration).path === sourceFile.path) {
143832
144135
  existingLocals.add(symbol);
143833
144136
  }
143834
144137
  });
@@ -177780,7 +178083,14 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
177780
178083
  if (copiedFrom == null ? void 0 : copiedFrom.range) {
177781
178084
  Debug.assert(copiedFrom.range.length === pastedText.length);
177782
178085
  copiedFrom.range.forEach((copy) => {
177783
- addRange(statements, copiedFrom.file.statements, getLineOfLocalPosition(copiedFrom.file, copy.pos), getLineOfLocalPosition(copiedFrom.file, copy.end) + 1);
178086
+ const statementsInSourceFile = copiedFrom.file.statements;
178087
+ const startNodeIndex = findIndex(statementsInSourceFile, (s) => s.end > copy.pos);
178088
+ if (startNodeIndex === -1) return void 0;
178089
+ let endNodeIndex = findIndex(statementsInSourceFile, (s) => s.end >= copy.end, startNodeIndex);
178090
+ if (endNodeIndex !== -1 && copy.end <= statementsInSourceFile[endNodeIndex].getStart()) {
178091
+ endNodeIndex--;
178092
+ }
178093
+ statements.push(...statementsInSourceFile.slice(startNodeIndex, endNodeIndex === -1 ? statementsInSourceFile.length : endNodeIndex + 1));
177784
178094
  });
177785
178095
  const usage = getUsageInfo(copiedFrom.file, statements, originalProgram.getTypeChecker(), getExistingLocals(updatedFile, statements, originalProgram.getTypeChecker()));
177786
178096
  Debug.assertIsDefined(originalProgram);