@typescript-deploys/pr-build 5.7.0-pr-59767-2 → 5.7.0-pr-59860-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -633,7 +633,6 @@ __export(typescript_exports, {
633
633
  getAllKeys: () => getAllKeys,
634
634
  getAllProjectOutputs: () => getAllProjectOutputs,
635
635
  getAllSuperTypeNodes: () => getAllSuperTypeNodes,
636
- getAllowImportingTsExtensions: () => getAllowImportingTsExtensions,
637
636
  getAllowJSCompilerOption: () => getAllowJSCompilerOption,
638
637
  getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports,
639
638
  getAncestor: () => getAncestor,
@@ -2120,6 +2119,7 @@ __export(typescript_exports, {
2120
2119
  tagNamesAreEquivalent: () => tagNamesAreEquivalent,
2121
2120
  takeWhile: () => takeWhile,
2122
2121
  targetOptionDeclaration: () => targetOptionDeclaration,
2122
+ targetToLibMap: () => targetToLibMap,
2123
2123
  testFormatSettings: () => testFormatSettings,
2124
2124
  textChangeRangeIsUnchanged: () => textChangeRangeIsUnchanged,
2125
2125
  textChangeRangeNewSpan: () => textChangeRangeNewSpan,
@@ -2266,7 +2266,7 @@ module.exports = __toCommonJS(typescript_exports);
2266
2266
 
2267
2267
  // src/compiler/corePublic.ts
2268
2268
  var versionMajorMinor = "5.7";
2269
- var version = `${versionMajorMinor}.0-insiders.20240826`;
2269
+ var version = `${versionMajorMinor}.0-insiders.20240904`;
2270
2270
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2271
2271
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2272
2272
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -2734,7 +2734,10 @@ function deduplicateSorted(array, comparer) {
2734
2734
  for (let i = 1; i < array.length; i++) {
2735
2735
  const next = array[i];
2736
2736
  switch (comparer(next, last2)) {
2737
+ // equality comparison
2737
2738
  case true:
2739
+ // relational comparison
2740
+ // falls through
2738
2741
  case 0 /* EqualTo */:
2739
2742
  continue;
2740
2743
  case -1 /* LessThan */:
@@ -3619,7 +3622,7 @@ function findBestPatternMatch(values, getPattern, candidate) {
3619
3622
  for (let i = 0; i < values.length; i++) {
3620
3623
  const v = values[i];
3621
3624
  const pattern = getPattern(v);
3622
- if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
3625
+ if (pattern.prefix.length > longestMatchPrefixLength && isPatternMatch(pattern, candidate)) {
3623
3626
  longestMatchPrefixLength = pattern.prefix.length;
3624
3627
  matchedValue = v;
3625
3628
  }
@@ -5855,10 +5858,11 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind5) => {
5855
5858
  SyntaxKind5[SyntaxKind5["JSDocImportTag"] = 351] = "JSDocImportTag";
5856
5859
  SyntaxKind5[SyntaxKind5["SyntaxList"] = 352] = "SyntaxList";
5857
5860
  SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 353] = "NotEmittedStatement";
5858
- SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 354] = "PartiallyEmittedExpression";
5859
- SyntaxKind5[SyntaxKind5["CommaListExpression"] = 355] = "CommaListExpression";
5860
- SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 356] = "SyntheticReferenceExpression";
5861
- SyntaxKind5[SyntaxKind5["Count"] = 357] = "Count";
5861
+ SyntaxKind5[SyntaxKind5["NotEmittedTypeElement"] = 354] = "NotEmittedTypeElement";
5862
+ SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 355] = "PartiallyEmittedExpression";
5863
+ SyntaxKind5[SyntaxKind5["CommaListExpression"] = 356] = "CommaListExpression";
5864
+ SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression";
5865
+ SyntaxKind5[SyntaxKind5["Count"] = 358] = "Count";
5862
5866
  SyntaxKind5[SyntaxKind5["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
5863
5867
  SyntaxKind5[SyntaxKind5["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
5864
5868
  SyntaxKind5[SyntaxKind5["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
@@ -7998,6 +8002,7 @@ function createSystemWatchFunctions({
7998
8002
  return generateWatchFileOptions(4 /* UseFsEvents */, 2 /* DynamicPriority */, options);
7999
8003
  case "UseFsEventsOnParentDirectory":
8000
8004
  useNonPollingWatchers2 = true;
8005
+ // fall through
8001
8006
  default:
8002
8007
  return useNonPollingWatchers2 ? (
8003
8008
  // Use notifications from FS to watch with falling back to fs.watchFile
@@ -10670,7 +10675,6 @@ var Diagnostics = {
10670
10675
  Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
10671
10676
  Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors: diag(6419, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors_6419", "Project '{0}' is out of date because buildinfo file '{1}' indicates that program needs to report errors."),
10672
10677
  Project_0_is_out_of_date_because_1: diag(6420, 3 /* Message */, "Project_0_is_out_of_date_because_1_6420", "Project '{0}' is out of date because {1}."),
10673
- Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files: diag(6421, 3 /* Message */, "Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_i_6421", "Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files."),
10674
10678
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
10675
10679
  The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
10676
10680
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -11540,6 +11544,7 @@ function computeLineStarts(text) {
11540
11544
  if (text.charCodeAt(pos) === 10 /* lineFeed */) {
11541
11545
  pos++;
11542
11546
  }
11547
+ // falls through
11543
11548
  case 10 /* lineFeed */:
11544
11549
  result.push(lineStart);
11545
11550
  lineStart = pos;
@@ -11642,6 +11647,8 @@ function couldStartTrivia(text, pos) {
11642
11647
  case 12 /* formFeed */:
11643
11648
  case 32 /* space */:
11644
11649
  case 47 /* slash */:
11650
+ // starts of normal trivia
11651
+ // falls through
11645
11652
  case 60 /* lessThan */:
11646
11653
  case 124 /* bar */:
11647
11654
  case 61 /* equals */:
@@ -11665,6 +11672,7 @@ function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments, inJSDoc) {
11665
11672
  if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
11666
11673
  pos++;
11667
11674
  }
11675
+ // falls through
11668
11676
  case 10 /* lineFeed */:
11669
11677
  pos++;
11670
11678
  if (stopAfterLineBreak) {
@@ -11811,6 +11819,7 @@ function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
11811
11819
  if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
11812
11820
  pos++;
11813
11821
  }
11822
+ // falls through
11814
11823
  case 10 /* lineFeed */:
11815
11824
  pos++;
11816
11825
  if (trailing) {
@@ -12376,12 +12385,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12376
12385
  if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
12377
12386
  return "\0";
12378
12387
  }
12388
+ // '\01', '\011'
12389
+ // falls through
12379
12390
  case 49 /* _1 */:
12380
12391
  case 50 /* _2 */:
12381
12392
  case 51 /* _3 */:
12382
12393
  if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
12383
12394
  pos++;
12384
12395
  }
12396
+ // '\17', '\177'
12397
+ // falls through
12385
12398
  case 52 /* _4 */:
12386
12399
  case 53 /* _5 */:
12387
12400
  case 54 /* _6 */:
@@ -12479,10 +12492,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12479
12492
  }
12480
12493
  tokenFlags |= 4096 /* HexEscape */;
12481
12494
  return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
12495
+ // when encountering a LineContinuation (i.e. a backslash and a line terminator sequence),
12496
+ // the line terminator is interpreted to be "the empty code unit sequence".
12482
12497
  case 13 /* carriageReturn */:
12483
12498
  if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
12484
12499
  pos++;
12485
12500
  }
12501
+ // falls through
12486
12502
  case 10 /* lineFeed */:
12487
12503
  case 8232 /* lineSeparator */:
12488
12504
  case 8233 /* paragraphSeparator */:
@@ -12913,6 +12929,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12913
12929
  tokenFlags |= 256 /* OctalSpecifier */;
12914
12930
  return token = checkBigIntSuffix();
12915
12931
  }
12932
+ // falls through
12916
12933
  case 49 /* _1 */:
12917
12934
  case 50 /* _2 */:
12918
12935
  case 51 /* _3 */:
@@ -13432,6 +13449,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13432
13449
  break;
13433
13450
  }
13434
13451
  }
13452
+ // falls through
13435
13453
  case 42 /* asterisk */:
13436
13454
  case 43 /* plus */:
13437
13455
  case 63 /* question */:
@@ -13462,6 +13480,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13462
13480
  if (isInGroup) {
13463
13481
  return;
13464
13482
  }
13483
+ // falls through
13465
13484
  case 93 /* closeBracket */:
13466
13485
  case 125 /* closeBrace */:
13467
13486
  if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
@@ -13524,6 +13543,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13524
13543
  error2(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
13525
13544
  break;
13526
13545
  }
13546
+ // falls through
13527
13547
  default:
13528
13548
  Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
13529
13549
  /*atomEscape*/
@@ -13661,6 +13681,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13661
13681
  let start2 = pos;
13662
13682
  let operand;
13663
13683
  switch (text.slice(pos, pos + 2)) {
13684
+ // TODO: don't use slice
13664
13685
  case "--":
13665
13686
  case "&&":
13666
13687
  error2(Diagnostics.Expected_a_class_set_operand);
@@ -13766,6 +13787,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13766
13787
  }
13767
13788
  start2 = pos;
13768
13789
  switch (text.slice(pos, pos + 2)) {
13790
+ // TODO: don't use slice
13769
13791
  case "--":
13770
13792
  case "&&":
13771
13793
  error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
@@ -13863,6 +13885,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13863
13885
  }
13864
13886
  }
13865
13887
  pos--;
13888
+ // falls through
13866
13889
  default:
13867
13890
  return scanClassSetCharacter();
13868
13891
  }
@@ -14009,6 +14032,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14009
14032
  return true;
14010
14033
  case 80 /* P */:
14011
14034
  isCharacterComplement = true;
14035
+ // falls through
14012
14036
  case 112 /* p */:
14013
14037
  pos++;
14014
14038
  if (charCodeChecked(pos) === 123 /* openBrace */) {
@@ -14316,6 +14340,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14316
14340
  if (charCodeUnchecked(pos) === 10 /* lineFeed */) {
14317
14341
  pos++;
14318
14342
  }
14343
+ // falls through
14319
14344
  case 10 /* lineFeed */:
14320
14345
  tokenFlags |= 1 /* PrecedingLineBreak */;
14321
14346
  return token = 4 /* NewLineTrivia */;
@@ -14520,28 +14545,33 @@ function isExternalModuleNameRelative(moduleName) {
14520
14545
  function sortAndDeduplicateDiagnostics(diagnostics) {
14521
14546
  return sortAndDeduplicate(diagnostics, compareDiagnostics, diagnosticsEqualityComparer);
14522
14547
  }
14548
+ var targetToLibMap = /* @__PURE__ */ new Map([
14549
+ [99 /* ESNext */, "lib.esnext.full.d.ts"],
14550
+ [10 /* ES2023 */, "lib.es2023.full.d.ts"],
14551
+ [9 /* ES2022 */, "lib.es2022.full.d.ts"],
14552
+ [8 /* ES2021 */, "lib.es2021.full.d.ts"],
14553
+ [7 /* ES2020 */, "lib.es2020.full.d.ts"],
14554
+ [6 /* ES2019 */, "lib.es2019.full.d.ts"],
14555
+ [5 /* ES2018 */, "lib.es2018.full.d.ts"],
14556
+ [4 /* ES2017 */, "lib.es2017.full.d.ts"],
14557
+ [3 /* ES2016 */, "lib.es2016.full.d.ts"],
14558
+ [2 /* ES2015 */, "lib.es6.d.ts"]
14559
+ // We don't use lib.es2015.full.d.ts due to breaking change.
14560
+ ]);
14523
14561
  function getDefaultLibFileName(options) {
14524
- switch (getEmitScriptTarget(options)) {
14562
+ const target = getEmitScriptTarget(options);
14563
+ switch (target) {
14525
14564
  case 99 /* ESNext */:
14526
- return "lib.esnext.full.d.ts";
14527
14565
  case 10 /* ES2023 */:
14528
- return "lib.es2023.full.d.ts";
14529
14566
  case 9 /* ES2022 */:
14530
- return "lib.es2022.full.d.ts";
14531
14567
  case 8 /* ES2021 */:
14532
- return "lib.es2021.full.d.ts";
14533
14568
  case 7 /* ES2020 */:
14534
- return "lib.es2020.full.d.ts";
14535
14569
  case 6 /* ES2019 */:
14536
- return "lib.es2019.full.d.ts";
14537
14570
  case 5 /* ES2018 */:
14538
- return "lib.es2018.full.d.ts";
14539
14571
  case 4 /* ES2017 */:
14540
- return "lib.es2017.full.d.ts";
14541
14572
  case 3 /* ES2016 */:
14542
- return "lib.es2016.full.d.ts";
14543
14573
  case 2 /* ES2015 */:
14544
- return "lib.es6.d.ts";
14574
+ return targetToLibMap.get(target);
14545
14575
  default:
14546
14576
  return "lib.d.ts";
14547
14577
  }
@@ -15482,7 +15512,7 @@ function isModifierLike(node) {
15482
15512
  }
15483
15513
  function isTypeElement(node) {
15484
15514
  const kind = node.kind;
15485
- return kind === 180 /* ConstructSignature */ || kind === 179 /* CallSignature */ || kind === 171 /* PropertySignature */ || kind === 173 /* MethodSignature */ || kind === 181 /* IndexSignature */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */;
15515
+ return kind === 180 /* ConstructSignature */ || kind === 179 /* CallSignature */ || kind === 171 /* PropertySignature */ || kind === 173 /* MethodSignature */ || kind === 181 /* IndexSignature */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */ || kind === 354 /* NotEmittedTypeElement */;
15486
15516
  }
15487
15517
  function isClassOrTypeElement(node) {
15488
15518
  return isTypeElement(node) || isClassElement(node);
@@ -15544,7 +15574,9 @@ function isObjectBindingOrAssignmentElement(node) {
15544
15574
  switch (node.kind) {
15545
15575
  case 208 /* BindingElement */:
15546
15576
  case 303 /* PropertyAssignment */:
15577
+ // AssignmentProperty
15547
15578
  case 304 /* ShorthandPropertyAssignment */:
15579
+ // AssignmentProperty
15548
15580
  case 305 /* SpreadAssignment */:
15549
15581
  return true;
15550
15582
  }
@@ -15562,11 +15594,17 @@ function isArrayBindingOrAssignmentElement(node) {
15562
15594
  switch (node.kind) {
15563
15595
  case 208 /* BindingElement */:
15564
15596
  case 232 /* OmittedExpression */:
15597
+ // Elision
15565
15598
  case 230 /* SpreadElement */:
15599
+ // AssignmentRestElement
15566
15600
  case 209 /* ArrayLiteralExpression */:
15601
+ // ArrayAssignmentPattern
15567
15602
  case 210 /* ObjectLiteralExpression */:
15603
+ // ObjectAssignmentPattern
15568
15604
  case 80 /* Identifier */:
15605
+ // DestructuringAssignmentTarget
15569
15606
  case 211 /* PropertyAccessExpression */:
15607
+ // DestructuringAssignmentTarget
15570
15608
  case 212 /* ElementAccessExpression */:
15571
15609
  return true;
15572
15610
  }
@@ -15627,6 +15665,7 @@ function isLeftHandSideExpressionKind(kind) {
15627
15665
  case 218 /* FunctionExpression */:
15628
15666
  case 80 /* Identifier */:
15629
15667
  case 81 /* PrivateIdentifier */:
15668
+ // technically this is only an Expression if it's in a `#field in expr` BinaryExpression
15630
15669
  case 14 /* RegularExpressionLiteral */:
15631
15670
  case 9 /* NumericLiteral */:
15632
15671
  case 10 /* BigIntLiteral */:
@@ -15642,6 +15681,7 @@ function isLeftHandSideExpressionKind(kind) {
15642
15681
  case 233 /* ExpressionWithTypeArguments */:
15643
15682
  case 236 /* MetaProperty */:
15644
15683
  case 102 /* ImportKeyword */:
15684
+ // technically this is only an Expression if it's in a CallExpression
15645
15685
  case 282 /* MissingDeclaration */:
15646
15686
  return true;
15647
15687
  default:
@@ -15698,8 +15738,8 @@ function isExpressionKind(kind) {
15698
15738
  case 230 /* SpreadElement */:
15699
15739
  case 234 /* AsExpression */:
15700
15740
  case 232 /* OmittedExpression */:
15701
- case 355 /* CommaListExpression */:
15702
- case 354 /* PartiallyEmittedExpression */:
15741
+ case 356 /* CommaListExpression */:
15742
+ case 355 /* PartiallyEmittedExpression */:
15703
15743
  case 238 /* SatisfiesExpression */:
15704
15744
  return true;
15705
15745
  default:
@@ -17438,6 +17478,8 @@ function getErrorSpanForNode(sourceFile, node) {
17438
17478
  }
17439
17479
  return getSpanOfTokenAtPosition(sourceFile, pos2);
17440
17480
  }
17481
+ // This list is a work in progress. Add missing node kinds to improve their error
17482
+ // spans.
17441
17483
  case 260 /* VariableDeclaration */:
17442
17484
  case 208 /* BindingElement */:
17443
17485
  case 263 /* ClassDeclaration */:
@@ -17609,6 +17651,8 @@ function isPartOfTypeNode(node) {
17609
17651
  return isPartOfTypeExpressionWithTypeArguments(node);
17610
17652
  case 168 /* TypeParameter */:
17611
17653
  return node.parent.kind === 200 /* MappedType */ || node.parent.kind === 195 /* InferType */;
17654
+ // Identifiers and qualified names may be type nodes, depending on their context. Climb
17655
+ // above them to find the lowest container
17612
17656
  case 80 /* Identifier */:
17613
17657
  if (node.parent.kind === 166 /* QualifiedName */ && node.parent.right === node) {
17614
17658
  node = node.parent;
@@ -17616,6 +17660,7 @@ function isPartOfTypeNode(node) {
17616
17660
  node = node.parent;
17617
17661
  }
17618
17662
  Debug.assert(node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */ || node.kind === 211 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
17663
+ // falls through
17619
17664
  case 166 /* QualifiedName */:
17620
17665
  case 211 /* PropertyAccessExpression */:
17621
17666
  case 110 /* ThisKeyword */: {
@@ -17884,6 +17929,7 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
17884
17929
  if (!includeArrowFunctions) {
17885
17930
  continue;
17886
17931
  }
17932
+ // falls through
17887
17933
  case 262 /* FunctionDeclaration */:
17888
17934
  case 218 /* FunctionExpression */:
17889
17935
  case 267 /* ModuleDeclaration */:
@@ -17906,6 +17952,8 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
17906
17952
  }
17907
17953
  function isThisContainerOrFunctionBlock(node) {
17908
17954
  switch (node.kind) {
17955
+ // Arrow functions use the same scope, but may do so in a "delayed" manner
17956
+ // For example, `const getThis = () => this` may be before a super() call in a derived constructor
17909
17957
  case 219 /* ArrowFunction */:
17910
17958
  case 262 /* FunctionDeclaration */:
17911
17959
  case 218 /* FunctionExpression */:
@@ -17972,6 +18020,7 @@ function getSuperContainer(node, stopOnFunctions) {
17972
18020
  if (!stopOnFunctions) {
17973
18021
  continue;
17974
18022
  }
18023
+ // falls through
17975
18024
  case 172 /* PropertyDeclaration */:
17976
18025
  case 171 /* PropertySignature */:
17977
18026
  case 174 /* MethodDeclaration */:
@@ -18025,6 +18074,7 @@ function getEntityNameFromTypeNode(node) {
18025
18074
  return node.typeName;
18026
18075
  case 233 /* ExpressionWithTypeArguments */:
18027
18076
  return isEntityNameExpression(node.expression) ? node.expression : void 0;
18077
+ // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s.
18028
18078
  case 80 /* Identifier */:
18029
18079
  case 166 /* QualifiedName */:
18030
18080
  return node;
@@ -18189,6 +18239,7 @@ function isExpressionNode(node) {
18189
18239
  if (node.parent.kind === 186 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) {
18190
18240
  return true;
18191
18241
  }
18242
+ // falls through
18192
18243
  case 9 /* NumericLiteral */:
18193
18244
  case 10 /* BigIntLiteral */:
18194
18245
  case 11 /* StringLiteral */:
@@ -19103,6 +19154,7 @@ function getDeclarationFromName(name) {
19103
19154
  case 15 /* NoSubstitutionTemplateLiteral */:
19104
19155
  case 9 /* NumericLiteral */:
19105
19156
  if (isComputedPropertyName(parent2)) return parent2.parent;
19157
+ // falls through
19106
19158
  case 80 /* Identifier */:
19107
19159
  if (isDeclaration(parent2)) {
19108
19160
  return parent2.name === name ? parent2 : void 0;
@@ -19273,6 +19325,7 @@ function getFunctionFlags(node) {
19273
19325
  if (node.asteriskToken) {
19274
19326
  flags |= 1 /* Generator */;
19275
19327
  }
19328
+ // falls through
19276
19329
  case 219 /* ArrowFunction */:
19277
19330
  if (hasSyntacticModifier(node, 1024 /* Async */)) {
19278
19331
  flags |= 2 /* Async */;
@@ -19543,7 +19596,7 @@ var OperatorPrecedence = /* @__PURE__ */ ((OperatorPrecedence2) => {
19543
19596
  })(OperatorPrecedence || {});
19544
19597
  function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
19545
19598
  switch (nodeKind) {
19546
- case 355 /* CommaListExpression */:
19599
+ case 356 /* CommaListExpression */:
19547
19600
  return 0 /* Comma */;
19548
19601
  case 230 /* SpreadElement */:
19549
19602
  return 1 /* Spread */;
@@ -19575,6 +19628,7 @@ function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
19575
19628
  default:
19576
19629
  return getBinaryOperatorPrecedence(operatorKind);
19577
19630
  }
19631
+ // TODO: Should prefix `++` and `--` be moved to the `Update` precedence?
19578
19632
  case 216 /* TypeAssertionExpression */:
19579
19633
  case 235 /* NonNullExpression */:
19580
19634
  case 224 /* PrefixUnaryExpression */:
@@ -21209,11 +21263,12 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
21209
21263
  if (stopAtCallExpressions) {
21210
21264
  return node;
21211
21265
  }
21266
+ // falls through
21212
21267
  case 234 /* AsExpression */:
21213
21268
  case 212 /* ElementAccessExpression */:
21214
21269
  case 211 /* PropertyAccessExpression */:
21215
21270
  case 235 /* NonNullExpression */:
21216
- case 354 /* PartiallyEmittedExpression */:
21271
+ case 355 /* PartiallyEmittedExpression */:
21217
21272
  case 238 /* SatisfiesExpression */:
21218
21273
  node = node.expression;
21219
21274
  continue;
@@ -21614,12 +21669,6 @@ function createComputedCompilerOptions(options) {
21614
21669
  return options;
21615
21670
  }
21616
21671
  var computedOptions = createComputedCompilerOptions({
21617
- allowImportingTsExtensions: {
21618
- dependencies: ["rewriteRelativeImportExtensions"],
21619
- computeValue: (compilerOptions) => {
21620
- return !!(compilerOptions.allowImportingTsExtensions || compilerOptions.rewriteRelativeImportExtensions);
21621
- }
21622
- },
21623
21672
  target: {
21624
21673
  dependencies: ["module"],
21625
21674
  computeValue: (compilerOptions) => {
@@ -21833,7 +21882,6 @@ var computedOptions = createComputedCompilerOptions({
21833
21882
  }
21834
21883
  }
21835
21884
  });
21836
- var getAllowImportingTsExtensions = computedOptions.allowImportingTsExtensions.computeValue;
21837
21885
  var getEmitScriptTarget = computedOptions.target.computeValue;
21838
21886
  var getEmitModuleKind = computedOptions.module.computeValue;
21839
21887
  var getEmitModuleResolutionKind = computedOptions.moduleResolution.computeValue;
@@ -22394,8 +22442,33 @@ function tryParsePattern(pattern) {
22394
22442
  suffix: pattern.substr(indexOfStar + 1)
22395
22443
  };
22396
22444
  }
22445
+ var parsedPatternsCache = /* @__PURE__ */ new WeakMap();
22397
22446
  function tryParsePatterns(paths) {
22398
- return mapDefined(getOwnKeys(paths), (path) => tryParsePattern(path));
22447
+ let result = parsedPatternsCache.get(paths);
22448
+ if (result !== void 0) {
22449
+ return result;
22450
+ }
22451
+ let matchableStringSet;
22452
+ let patterns;
22453
+ const pathList = getOwnKeys(paths);
22454
+ for (const path of pathList) {
22455
+ const patternOrStr = tryParsePattern(path);
22456
+ if (patternOrStr === void 0) {
22457
+ continue;
22458
+ } else if (typeof patternOrStr === "string") {
22459
+ (matchableStringSet ?? (matchableStringSet = /* @__PURE__ */ new Set())).add(patternOrStr);
22460
+ } else {
22461
+ (patterns ?? (patterns = [])).push(patternOrStr);
22462
+ }
22463
+ }
22464
+ parsedPatternsCache.set(
22465
+ paths,
22466
+ result = {
22467
+ matchableStringSet,
22468
+ patterns
22469
+ }
22470
+ );
22471
+ return result;
22399
22472
  }
22400
22473
  function positionIsSynthesized(pos) {
22401
22474
  return !(pos >= 0);
@@ -22423,15 +22496,13 @@ var emptyFileSystemEntries = {
22423
22496
  files: emptyArray,
22424
22497
  directories: emptyArray
22425
22498
  };
22426
- function matchPatternOrExact(patternOrStrings, candidate) {
22427
- const patterns = [];
22428
- for (const patternOrString of patternOrStrings) {
22429
- if (patternOrString === candidate) {
22430
- return candidate;
22431
- }
22432
- if (!isString(patternOrString)) {
22433
- patterns.push(patternOrString);
22434
- }
22499
+ function matchPatternOrExact(parsedPatterns, candidate) {
22500
+ const { matchableStringSet, patterns } = parsedPatterns;
22501
+ if (matchableStringSet == null ? void 0 : matchableStringSet.has(candidate)) {
22502
+ return candidate;
22503
+ }
22504
+ if (patterns === void 0 || patterns.length === 0) {
22505
+ return void 0;
22435
22506
  }
22436
22507
  return findBestPatternMatch(patterns, (_) => _, candidate);
22437
22508
  }
@@ -22508,6 +22579,7 @@ function isJsonEqual(a, b) {
22508
22579
  function parsePseudoBigInt(stringValue) {
22509
22580
  let log2Base;
22510
22581
  switch (stringValue.charCodeAt(1)) {
22582
+ // "x" in "0x123"
22511
22583
  case 98 /* b */:
22512
22584
  case 66 /* B */:
22513
22585
  log2Base = 1;
@@ -22755,7 +22827,7 @@ function getContainingNodeArray(node) {
22755
22827
  return parent2.types;
22756
22828
  case 189 /* TupleType */:
22757
22829
  case 209 /* ArrayLiteralExpression */:
22758
- case 355 /* CommaListExpression */:
22830
+ case 356 /* CommaListExpression */:
22759
22831
  case 275 /* NamedImports */:
22760
22832
  case 279 /* NamedExports */:
22761
22833
  return parent2.elements;
@@ -23294,6 +23366,7 @@ function createNameResolver({
23294
23366
  switch (location.kind) {
23295
23367
  case 307 /* SourceFile */:
23296
23368
  if (!isExternalOrCommonJsModule(location)) break;
23369
+ // falls through
23297
23370
  case 267 /* ModuleDeclaration */:
23298
23371
  const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
23299
23372
  if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
@@ -23377,6 +23450,14 @@ function createNameResolver({
23377
23450
  }
23378
23451
  }
23379
23452
  break;
23453
+ // It is not legal to reference a class's own type parameters from a computed property name that
23454
+ // belongs to the class. For example:
23455
+ //
23456
+ // function foo<T>() { return '' }
23457
+ // class C<T> { // <-- Class's own type parameter T
23458
+ // [foo<T>()]() { } // <-- Reference to T from class's own computed property
23459
+ // }
23460
+ //
23380
23461
  case 167 /* ComputedPropertyName */:
23381
23462
  grandparent = location.parent.parent;
23382
23463
  if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
@@ -23392,6 +23473,7 @@ function createNameResolver({
23392
23473
  if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
23393
23474
  break;
23394
23475
  }
23476
+ // falls through
23395
23477
  case 174 /* MethodDeclaration */:
23396
23478
  case 176 /* Constructor */:
23397
23479
  case 177 /* GetAccessor */:
@@ -24036,6 +24118,7 @@ function createParenthesizerRules(factory2) {
24036
24118
  function parenthesizeConstituentTypeOfUnionType(type) {
24037
24119
  switch (type.kind) {
24038
24120
  case 192 /* UnionType */:
24121
+ // Not strictly necessary, but a union containing a union should have been flattened
24039
24122
  case 193 /* IntersectionType */:
24040
24123
  return factory2.createParenthesizedType(type);
24041
24124
  }
@@ -24817,6 +24900,7 @@ function createNodeFactory(flags, baseFactory2) {
24817
24900
  createSyntheticExpression,
24818
24901
  createSyntaxList: createSyntaxList3,
24819
24902
  createNotEmittedStatement,
24903
+ createNotEmittedTypeElement,
24820
24904
  createPartiallyEmittedExpression,
24821
24905
  updatePartiallyEmittedExpression,
24822
24906
  createCommaListExpression,
@@ -27843,7 +27927,7 @@ function createNodeFactory(flags, baseFactory2) {
27843
27927
  return node;
27844
27928
  }
27845
27929
  function createPartiallyEmittedExpression(expression, original) {
27846
- const node = createBaseNode(354 /* PartiallyEmittedExpression */);
27930
+ const node = createBaseNode(355 /* PartiallyEmittedExpression */);
27847
27931
  node.expression = expression;
27848
27932
  node.original = original;
27849
27933
  node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
@@ -27853,6 +27937,9 @@ function createNodeFactory(flags, baseFactory2) {
27853
27937
  function updatePartiallyEmittedExpression(node, expression) {
27854
27938
  return node.expression !== expression ? update(createPartiallyEmittedExpression(expression, node.original), node) : node;
27855
27939
  }
27940
+ function createNotEmittedTypeElement() {
27941
+ return createBaseNode(354 /* NotEmittedTypeElement */);
27942
+ }
27856
27943
  function flattenCommaElements(node) {
27857
27944
  if (nodeIsSynthesized(node) && !isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
27858
27945
  if (isCommaListExpression(node)) {
@@ -27865,7 +27952,7 @@ function createNodeFactory(flags, baseFactory2) {
27865
27952
  return node;
27866
27953
  }
27867
27954
  function createCommaListExpression(elements) {
27868
- const node = createBaseNode(355 /* CommaListExpression */);
27955
+ const node = createBaseNode(356 /* CommaListExpression */);
27869
27956
  node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
27870
27957
  node.transformFlags |= propagateChildrenFlags(node.elements);
27871
27958
  return node;
@@ -27874,7 +27961,7 @@ function createNodeFactory(flags, baseFactory2) {
27874
27961
  return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
27875
27962
  }
27876
27963
  function createSyntheticReferenceExpression(expression, thisArg) {
27877
- const node = createBaseNode(356 /* SyntheticReferenceExpression */);
27964
+ const node = createBaseNode(357 /* SyntheticReferenceExpression */);
27878
27965
  node.expression = expression;
27879
27966
  node.thisArg = thisArg;
27880
27967
  node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
@@ -28121,7 +28208,7 @@ function createNodeFactory(flags, baseFactory2) {
28121
28208
  return updateNonNullExpression(outerExpression, expression);
28122
28209
  case 233 /* ExpressionWithTypeArguments */:
28123
28210
  return updateExpressionWithTypeArguments(outerExpression, expression, outerExpression.typeArguments);
28124
- case 354 /* PartiallyEmittedExpression */:
28211
+ case 355 /* PartiallyEmittedExpression */:
28125
28212
  return updatePartiallyEmittedExpression(outerExpression, expression);
28126
28213
  }
28127
28214
  }
@@ -28666,7 +28753,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
28666
28753
  case 216 /* TypeAssertionExpression */:
28667
28754
  case 238 /* SatisfiesExpression */:
28668
28755
  case 234 /* AsExpression */:
28669
- case 354 /* PartiallyEmittedExpression */:
28756
+ case 355 /* PartiallyEmittedExpression */:
28670
28757
  case 217 /* ParenthesizedExpression */:
28671
28758
  case 108 /* SuperKeyword */:
28672
28759
  return -2147483648 /* OuterExpressionExcludes */;
@@ -30375,10 +30462,10 @@ function isSyntheticExpression(node) {
30375
30462
  return node.kind === 237 /* SyntheticExpression */;
30376
30463
  }
30377
30464
  function isPartiallyEmittedExpression(node) {
30378
- return node.kind === 354 /* PartiallyEmittedExpression */;
30465
+ return node.kind === 355 /* PartiallyEmittedExpression */;
30379
30466
  }
30380
30467
  function isCommaListExpression(node) {
30381
- return node.kind === 355 /* CommaListExpression */;
30468
+ return node.kind === 356 /* CommaListExpression */;
30382
30469
  }
30383
30470
  function isTemplateSpan(node) {
30384
30471
  return node.kind === 239 /* TemplateSpan */;
@@ -30534,7 +30621,7 @@ function isNotEmittedStatement(node) {
30534
30621
  return node.kind === 353 /* NotEmittedStatement */;
30535
30622
  }
30536
30623
  function isSyntheticReference(node) {
30537
- return node.kind === 356 /* SyntheticReferenceExpression */;
30624
+ return node.kind === 357 /* SyntheticReferenceExpression */;
30538
30625
  }
30539
30626
  function isExternalModuleReference(node) {
30540
30627
  return node.kind === 283 /* ExternalModuleReference */;
@@ -31157,7 +31244,7 @@ function isOuterExpression(node, kinds = 31 /* All */) {
31157
31244
  return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
31158
31245
  case 235 /* NonNullExpression */:
31159
31246
  return (kinds & 4 /* NonNullAssertions */) !== 0;
31160
- case 354 /* PartiallyEmittedExpression */:
31247
+ case 355 /* PartiallyEmittedExpression */:
31161
31248
  return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
31162
31249
  }
31163
31250
  return false;
@@ -31601,10 +31688,13 @@ var BinaryExpressionState;
31601
31688
  switch (currentState) {
31602
31689
  case enter:
31603
31690
  if (machine.onLeft) return left;
31691
+ // falls through
31604
31692
  case left:
31605
31693
  if (machine.onOperator) return operator;
31694
+ // falls through
31606
31695
  case operator:
31607
31696
  if (machine.onRight) return right;
31697
+ // falls through
31608
31698
  case right:
31609
31699
  return exit;
31610
31700
  case exit:
@@ -32232,7 +32322,7 @@ var forEachChildTable = {
32232
32322
  [282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
32233
32323
  return visitNodes(cbNode, cbNodes, node.modifiers);
32234
32324
  },
32235
- [355 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
32325
+ [356 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
32236
32326
  return visitNodes(cbNode, cbNodes, node.elements);
32237
32327
  },
32238
32328
  [284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
@@ -32328,7 +32418,7 @@ var forEachChildTable = {
32328
32418
  [331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
32329
32419
  [337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
32330
32420
  [351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
32331
- [354 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
32421
+ [355 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
32332
32422
  };
32333
32423
  function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
32334
32424
  return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
@@ -32698,6 +32788,7 @@ var Parser;
32698
32788
  expression2 = parseLiteralNode();
32699
32789
  break;
32700
32790
  }
32791
+ // falls through
32701
32792
  default:
32702
32793
  expression2 = parseObjectLiteralExpression();
32703
32794
  break;
@@ -33619,6 +33710,7 @@ var Parser;
33619
33710
  case 25 /* DotToken */:
33620
33711
  return true;
33621
33712
  }
33713
+ // falls through
33622
33714
  case 11 /* ArgumentExpressions */:
33623
33715
  return token() === 26 /* DotDotDotToken */ || isStartOfExpression();
33624
33716
  case 16 /* Parameters */:
@@ -33652,6 +33744,7 @@ var Parser;
33652
33744
  return true;
33653
33745
  case 26 /* Count */:
33654
33746
  return Debug.fail("ParsingContext.Count used as a context");
33747
+ // Not a real context, only a marker.
33655
33748
  default:
33656
33749
  Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
33657
33750
  }
@@ -33968,6 +34061,7 @@ var Parser;
33968
34061
  case 3 /* SwitchClauseStatements */:
33969
34062
  return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
33970
34063
  case 18 /* RestProperties */:
34064
+ // fallthrough
33971
34065
  case 4 /* TypeMembers */:
33972
34066
  return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
33973
34067
  case 5 /* ClassMembers */:
@@ -34015,6 +34109,7 @@ var Parser;
34015
34109
  return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
34016
34110
  case 26 /* Count */:
34017
34111
  return Debug.fail("ParsingContext.Count used as a context");
34112
+ // Not a real context, only a marker.
34018
34113
  default:
34019
34114
  Debug.assertNever(context);
34020
34115
  }
@@ -34939,10 +35034,12 @@ var Parser;
34939
35034
  return tryParse(parseKeywordAndNoDot) || parseTypeReference();
34940
35035
  case 67 /* AsteriskEqualsToken */:
34941
35036
  scanner2.reScanAsteriskEqualsToken();
35037
+ // falls through
34942
35038
  case 42 /* AsteriskToken */:
34943
35039
  return parseJSDocAllType();
34944
35040
  case 61 /* QuestionQuestionToken */:
34945
35041
  scanner2.reScanQuestionToken();
35042
+ // falls through
34946
35043
  case 58 /* QuestionToken */:
34947
35044
  return parseJSDocUnknownOrNullableType();
34948
35045
  case 100 /* FunctionKeyword */:
@@ -35820,6 +35917,7 @@ var Parser;
35820
35917
  if (isAwaitExpression2()) {
35821
35918
  return parseAwaitExpression();
35822
35919
  }
35920
+ // falls through
35823
35921
  default:
35824
35922
  return parseUpdateExpression();
35825
35923
  }
@@ -35839,6 +35937,8 @@ var Parser;
35839
35937
  if (languageVariant !== 1 /* JSX */) {
35840
35938
  return false;
35841
35939
  }
35940
+ // We are in JSX context and the token is part of JSXElement.
35941
+ // falls through
35842
35942
  default:
35843
35943
  return true;
35844
35944
  }
@@ -36412,10 +36512,16 @@ var Parser;
36412
36512
  }
36413
36513
  function canFollowTypeArgumentsInExpression() {
36414
36514
  switch (token()) {
36515
+ // These tokens can follow a type argument list in a call expression.
36415
36516
  case 21 /* OpenParenToken */:
36517
+ // foo<x>(
36416
36518
  case 15 /* NoSubstitutionTemplateLiteral */:
36519
+ // foo<T> `...`
36417
36520
  case 16 /* TemplateHead */:
36418
36521
  return true;
36522
+ // A type argument list followed by `<` never makes sense, and a type argument list followed
36523
+ // by `>` is ambiguous with a (re-scanned) `>>` operator, so we disqualify both. Also, in
36524
+ // this context, `+` and `-` are unary operators, not binary operators.
36419
36525
  case 30 /* LessThanToken */:
36420
36526
  case 32 /* GreaterThanToken */:
36421
36527
  case 40 /* PlusToken */:
@@ -36433,6 +36539,7 @@ var Parser;
36433
36539
  false
36434
36540
  );
36435
36541
  }
36542
+ // falls through
36436
36543
  case 9 /* NumericLiteral */:
36437
36544
  case 10 /* BigIntLiteral */:
36438
36545
  case 11 /* StringLiteral */:
@@ -36936,6 +37043,27 @@ var Parser;
36936
37043
  return isUsingDeclaration();
36937
37044
  case 135 /* AwaitKeyword */:
36938
37045
  return isAwaitUsingDeclaration();
37046
+ // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
37047
+ // however, an identifier cannot be followed by another identifier on the same line. This is what we
37048
+ // count on to parse out the respective declarations. For instance, we exploit this to say that
37049
+ //
37050
+ // namespace n
37051
+ //
37052
+ // can be none other than the beginning of a namespace declaration, but need to respect that JavaScript sees
37053
+ //
37054
+ // namespace
37055
+ // n
37056
+ //
37057
+ // as the identifier 'namespace' on one line followed by the identifier 'n' on another.
37058
+ // We need to look one token ahead to see if it permissible to try parsing a declaration.
37059
+ //
37060
+ // *Note*: 'interface' is actually a strict mode reserved word. So while
37061
+ //
37062
+ // "use strict"
37063
+ // interface
37064
+ // I {}
37065
+ //
37066
+ // could be legal, it would add complexity for very little gain.
36939
37067
  case 120 /* InterfaceKeyword */:
36940
37068
  case 156 /* TypeKeyword */:
36941
37069
  return nextTokenIsIdentifierOnSameLine();
@@ -37008,6 +37136,9 @@ var Parser;
37008
37136
  case 111 /* ThrowKeyword */:
37009
37137
  case 113 /* TryKeyword */:
37010
37138
  case 89 /* DebuggerKeyword */:
37139
+ // 'catch' and 'finally' do not actually indicate that the code is part of a statement,
37140
+ // however, we say they are here so that we may gracefully parse them and error later.
37141
+ // falls through
37011
37142
  case 85 /* CatchKeyword */:
37012
37143
  case 98 /* FinallyKeyword */:
37013
37144
  return true;
@@ -37146,6 +37277,8 @@ var Parser;
37146
37277
  case 111 /* ThrowKeyword */:
37147
37278
  return parseThrowStatement();
37148
37279
  case 113 /* TryKeyword */:
37280
+ // Include 'catch' and 'finally' for error recovery.
37281
+ // falls through
37149
37282
  case 85 /* CatchKeyword */:
37150
37283
  case 98 /* FinallyKeyword */:
37151
37284
  return parseTryStatement();
@@ -37564,10 +37697,15 @@ var Parser;
37564
37697
  }
37565
37698
  switch (token()) {
37566
37699
  case 21 /* OpenParenToken */:
37700
+ // Method declaration
37567
37701
  case 30 /* LessThanToken */:
37702
+ // Generic Method declaration
37568
37703
  case 54 /* ExclamationToken */:
37704
+ // Non-null assertion on property name
37569
37705
  case 59 /* ColonToken */:
37706
+ // Type Annotation for declaration
37570
37707
  case 64 /* EqualsToken */:
37708
+ // Initializer for declaration
37571
37709
  case 58 /* QuestionToken */:
37572
37710
  return true;
37573
37711
  default:
@@ -38474,6 +38612,7 @@ var Parser;
38474
38612
  linkEnd = scanner2.getTokenEnd();
38475
38613
  break;
38476
38614
  }
38615
+ // fallthrough if it's not a {@link sequence
38477
38616
  default:
38478
38617
  state = 2 /* SavingComments */;
38479
38618
  pushComment(scanner2.getTokenText());
@@ -38732,6 +38871,8 @@ var Parser;
38732
38871
  indent3 += 1;
38733
38872
  break;
38734
38873
  }
38874
+ // record the * as a comment
38875
+ // falls through
38735
38876
  default:
38736
38877
  if (state !== 3 /* SavingBackticks */) {
38737
38878
  state = 2 /* SavingComments */;
@@ -39812,6 +39953,7 @@ function processPragmasIntoFields(context, reportDiagnostic) {
39812
39953
  case "jsximportsource":
39813
39954
  case "jsxruntime":
39814
39955
  return;
39956
+ // Accessed directly
39815
39957
  default:
39816
39958
  Debug.fail("Unhandled pragma kind");
39817
39959
  }
@@ -40933,15 +41075,6 @@ var commandOptionsWithoutBuild = [
40933
41075
  defaultValueDescription: false,
40934
41076
  transpileOptionValue: void 0
40935
41077
  },
40936
- {
40937
- name: "rewriteRelativeImportExtensions",
40938
- type: "boolean",
40939
- affectsSemanticDiagnostics: true,
40940
- affectsBuildInfo: true,
40941
- category: Diagnostics.Modules,
40942
- description: Diagnostics.Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files,
40943
- defaultValueDescription: false
40944
- },
40945
41078
  {
40946
41079
  name: "resolvePackageJsonExports",
40947
41080
  type: "boolean",
@@ -41677,6 +41810,7 @@ function parseOptionValue(args, i, diagnostics, opt, options, errors) {
41677
41810
  case "listOrElement":
41678
41811
  Debug.fail("listOrElement not supported here");
41679
41812
  break;
41813
+ // If not a primitive, the possible types are specified in what is effectively a map of options.
41680
41814
  default:
41681
41815
  options[opt.name] = parseCustomTypeOption(opt, args[i], errors);
41682
41816
  i++;
@@ -42017,6 +42151,7 @@ function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConv
42017
42151
  return false;
42018
42152
  case 106 /* NullKeyword */:
42019
42153
  return null;
42154
+ // eslint-disable-line no-restricted-syntax
42020
42155
  case 11 /* StringLiteral */:
42021
42156
  if (!isDoubleQuotedString(valueExpression)) {
42022
42157
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
@@ -42496,8 +42631,6 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
42496
42631
  validatedFilesSpecBeforeSubstitution,
42497
42632
  validatedIncludeSpecsBeforeSubstitution,
42498
42633
  validatedExcludeSpecsBeforeSubstitution,
42499
- pathPatterns: void 0,
42500
- // Initialized on first use
42501
42634
  isDefaultIncludeSpec
42502
42635
  };
42503
42636
  }
@@ -43225,6 +43358,7 @@ function getOptionValueWithEmptyStrings(value, option) {
43225
43358
  return typeof value === "boolean" ? value : "";
43226
43359
  case "listOrElement":
43227
43360
  if (!isArray(value)) return getOptionValueWithEmptyStrings(value, option.element);
43361
+ // fall through to list
43228
43362
  case "list":
43229
43363
  const elementType = option.element;
43230
43364
  return isArray(value) ? mapDefined(value, (v) => getOptionValueWithEmptyStrings(v, elementType)) : "";
@@ -44201,8 +44335,7 @@ function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, co
44201
44335
  }
44202
44336
  }
44203
44337
  function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state) {
44204
- var _a;
44205
- const { baseUrl, paths, configFile } = state.compilerOptions;
44338
+ const { baseUrl, paths } = state.compilerOptions;
44206
44339
  if (paths && !pathIsRelative(moduleName)) {
44207
44340
  if (state.traceEnabled) {
44208
44341
  if (baseUrl) {
@@ -44211,7 +44344,7 @@ function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state
44211
44344
  trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
44212
44345
  }
44213
44346
  const baseDirectory = getPathsBasePath(state.compilerOptions, state.host);
44214
- const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = tryParsePatterns(paths)) : void 0;
44347
+ const pathPatterns = tryParsePatterns(paths);
44215
44348
  return tryLoadModuleUsingPaths(
44216
44349
  extensions,
44217
44350
  moduleName,
@@ -45010,17 +45143,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
45010
45143
  if (state.traceEnabled) {
45011
45144
  trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, moduleName);
45012
45145
  }
45013
- const result = tryLoadModuleUsingPaths(
45014
- extensions,
45015
- moduleName,
45016
- candidate,
45017
- versionPaths.paths,
45018
- /*pathPatterns*/
45019
- void 0,
45020
- loader,
45021
- onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex,
45022
- state
45023
- );
45146
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
45147
+ const result = tryLoadModuleUsingPaths(extensions, moduleName, candidate, versionPaths.paths, pathPatterns, loader, onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex, state);
45024
45148
  if (result) {
45025
45149
  return removeIgnoredPackageId(result.value);
45026
45150
  }
@@ -45612,17 +45736,8 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
45612
45736
  trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
45613
45737
  }
45614
45738
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
45615
- const fromPaths = tryLoadModuleUsingPaths(
45616
- extensions,
45617
- rest,
45618
- packageDirectory,
45619
- versionPaths.paths,
45620
- /*pathPatterns*/
45621
- void 0,
45622
- loader,
45623
- !packageDirectoryExists,
45624
- state
45625
- );
45739
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
45740
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, pathPatterns, loader, !packageDirectoryExists, state);
45626
45741
  if (fromPaths) {
45627
45742
  return fromPaths.value;
45628
45743
  }
@@ -45630,7 +45745,6 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
45630
45745
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
45631
45746
  }
45632
45747
  function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
45633
- pathPatterns || (pathPatterns = tryParsePatterns(paths));
45634
45748
  const matchedPattern = matchPatternOrExact(pathPatterns, moduleName);
45635
45749
  if (matchedPattern) {
45636
45750
  const matchedStar = isString(matchedPattern) ? void 0 : matchedText(matchedPattern, moduleName);
@@ -45806,7 +45920,7 @@ function resolveFromTypeRoot(moduleName, state) {
45806
45920
  }
45807
45921
  }
45808
45922
  function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
45809
- return getAllowImportingTsExtensions(compilerOptions) || fromFileName && isDeclarationFileName(fromFileName);
45923
+ return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
45810
45924
  }
45811
45925
  function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
45812
45926
  const traceEnabled = isTraceEnabled(compilerOptions, host);
@@ -45897,20 +46011,24 @@ function getModuleInstanceStateCached(node, visited = /* @__PURE__ */ new Map())
45897
46011
  }
45898
46012
  function getModuleInstanceStateWorker(node, visited) {
45899
46013
  switch (node.kind) {
46014
+ // 1. interface declarations, type alias declarations
45900
46015
  case 264 /* InterfaceDeclaration */:
45901
46016
  case 265 /* TypeAliasDeclaration */:
45902
46017
  return 0 /* NonInstantiated */;
46018
+ // 2. const enum declarations
45903
46019
  case 266 /* EnumDeclaration */:
45904
46020
  if (isEnumConst(node)) {
45905
46021
  return 2 /* ConstEnumOnly */;
45906
46022
  }
45907
46023
  break;
46024
+ // 3. non-exported import declarations
45908
46025
  case 272 /* ImportDeclaration */:
45909
46026
  case 271 /* ImportEqualsDeclaration */:
45910
46027
  if (!hasSyntacticModifier(node, 32 /* Export */)) {
45911
46028
  return 0 /* NonInstantiated */;
45912
46029
  }
45913
46030
  break;
46031
+ // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain
45914
46032
  case 278 /* ExportDeclaration */:
45915
46033
  const exportDeclaration = node;
45916
46034
  if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 279 /* NamedExports */) {
@@ -45927,6 +46045,7 @@ function getModuleInstanceStateWorker(node, visited) {
45927
46045
  return state;
45928
46046
  }
45929
46047
  break;
46048
+ // 5. other uninstantiated module declarations.
45930
46049
  case 268 /* ModuleBlock */: {
45931
46050
  let state = 0 /* NonInstantiated */;
45932
46051
  forEachChild(node, (n) => {
@@ -46537,6 +46656,7 @@ function createBinder() {
46537
46656
  case 351 /* JSDocImportTag */:
46538
46657
  bindJSDocImportTag(node);
46539
46658
  break;
46659
+ // In source files and blocks, bind functions first to match hoisting that occurs at runtime
46540
46660
  case 307 /* SourceFile */: {
46541
46661
  bindEachFunctionsFirst(node.statements);
46542
46662
  bind(node.endOfFileToken);
@@ -46557,6 +46677,7 @@ function createBinder() {
46557
46677
  case 303 /* PropertyAssignment */:
46558
46678
  case 230 /* SpreadElement */:
46559
46679
  inAssignmentPattern = saveInAssignmentPattern;
46680
+ // falls through
46560
46681
  default:
46561
46682
  bindEachChild(node);
46562
46683
  break;
@@ -46578,6 +46699,7 @@ function createBinder() {
46578
46699
  if (isJSDocTypeAssertion(expr)) {
46579
46700
  return false;
46580
46701
  }
46702
+ // fallthrough
46581
46703
  case 235 /* NonNullExpression */:
46582
46704
  return isNarrowingExpression(expr.expression);
46583
46705
  case 226 /* BinaryExpression */:
@@ -47409,6 +47531,10 @@ function createBinder() {
47409
47531
  }
47410
47532
  function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
47411
47533
  switch (container.kind) {
47534
+ // Modules, source files, and classes need specialized handling for how their
47535
+ // members are declared (for example, a member of a class will go into a specific
47536
+ // symbol table depending on if it is static or not). We defer to specialized
47537
+ // handlers to take care of declaring these child members.
47412
47538
  case 267 /* ModuleDeclaration */:
47413
47539
  return declareModuleMember(node, symbolFlags, symbolExcludes);
47414
47540
  case 307 /* SourceFile */:
@@ -47550,6 +47676,7 @@ function createBinder() {
47550
47676
  declareModuleMember(node, symbolFlags, symbolExcludes);
47551
47677
  break;
47552
47678
  }
47679
+ // falls through
47553
47680
  default:
47554
47681
  Debug.assertNode(blockScopeContainer, canHaveLocals);
47555
47682
  if (!blockScopeContainer.locals) {
@@ -47870,6 +47997,7 @@ function createBinder() {
47870
47997
  }
47871
47998
  function bindWorker(node) {
47872
47999
  switch (node.kind) {
48000
+ /* Strict mode checks */
47873
48001
  case 80 /* Identifier */:
47874
48002
  if (node.flags & 4096 /* IdentifierIsInJSDocNamespace */) {
47875
48003
  let parentNode = node.parent;
@@ -47879,6 +48007,7 @@ function createBinder() {
47879
48007
  bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
47880
48008
  break;
47881
48009
  }
48010
+ // falls through
47882
48011
  case 110 /* ThisKeyword */:
47883
48012
  if (currentFlow && (isExpression(node) || parent2.kind === 304 /* ShorthandPropertyAssignment */)) {
47884
48013
  node.flowNode = currentFlow;
@@ -47967,6 +48096,7 @@ function createBinder() {
47967
48096
  return;
47968
48097
  case 182 /* TypePredicate */:
47969
48098
  break;
48099
+ // Binding the children will handle everything
47970
48100
  case 168 /* TypeParameter */:
47971
48101
  return bindTypeParameter(node);
47972
48102
  case 169 /* Parameter */:
@@ -48031,6 +48161,7 @@ function createBinder() {
48031
48161
  return bindObjectDefinePrototypeProperty(node);
48032
48162
  case 0 /* None */:
48033
48163
  break;
48164
+ // Nothing to do
48034
48165
  default:
48035
48166
  return Debug.fail("Unknown call expression assignment declaration kind");
48036
48167
  }
@@ -48038,6 +48169,7 @@ function createBinder() {
48038
48169
  bindCallExpression(node);
48039
48170
  }
48040
48171
  break;
48172
+ // Members of classes, interfaces, and modules
48041
48173
  case 231 /* ClassExpression */:
48042
48174
  case 263 /* ClassDeclaration */:
48043
48175
  inStrictMode = true;
@@ -48050,10 +48182,12 @@ function createBinder() {
48050
48182
  return bindEnumDeclaration(node);
48051
48183
  case 267 /* ModuleDeclaration */:
48052
48184
  return bindModuleDeclaration(node);
48185
+ // Jsx-attributes
48053
48186
  case 292 /* JsxAttributes */:
48054
48187
  return bindJsxAttributes(node);
48055
48188
  case 291 /* JsxAttribute */:
48056
48189
  return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
48190
+ // Imports and exports
48057
48191
  case 271 /* ImportEqualsDeclaration */:
48058
48192
  case 274 /* NamespaceImport */:
48059
48193
  case 276 /* ImportSpecifier */:
@@ -48074,6 +48208,7 @@ function createBinder() {
48074
48208
  if (!isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) {
48075
48209
  return;
48076
48210
  }
48211
+ // falls through
48077
48212
  case 268 /* ModuleBlock */:
48078
48213
  return updateStrictModeStatementList(node.statements);
48079
48214
  case 341 /* JSDocParameterTag */:
@@ -48083,6 +48218,7 @@ function createBinder() {
48083
48218
  if (node.parent.kind !== 322 /* JSDocTypeLiteral */) {
48084
48219
  break;
48085
48220
  }
48221
+ // falls through
48086
48222
  case 348 /* JSDocPropertyTag */:
48087
48223
  const propTag = node;
48088
48224
  const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */;
@@ -48295,6 +48431,7 @@ function createBinder() {
48295
48431
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
48296
48432
  }
48297
48433
  break;
48434
+ // Namespaces are not allowed in javascript files, so do nothing here
48298
48435
  case 267 /* ModuleDeclaration */:
48299
48436
  break;
48300
48437
  default:
@@ -48791,6 +48928,7 @@ function getContainerFlags(node) {
48791
48928
  if (isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
48792
48929
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */;
48793
48930
  }
48931
+ // falls through
48794
48932
  case 176 /* Constructor */:
48795
48933
  case 262 /* FunctionDeclaration */:
48796
48934
  case 173 /* MethodSignature */:
@@ -51944,6 +52082,7 @@ function createTypeChecker(host) {
51944
52082
  if (isEntityNameExpression(node.expression)) {
51945
52083
  return node.expression;
51946
52084
  }
52085
+ // falls through
51947
52086
  default:
51948
52087
  return void 0;
51949
52088
  }
@@ -53799,6 +53938,7 @@ function createTypeChecker(host) {
53799
53938
  if (!isExternalOrCommonJsModule(location)) {
53800
53939
  break;
53801
53940
  }
53941
+ // falls through
53802
53942
  case 267 /* ModuleDeclaration */:
53803
53943
  const sym = getSymbolOfDeclaration(location);
53804
53944
  if (result = callback(
@@ -55221,6 +55361,9 @@ function createTypeChecker(host) {
55221
55361
  }
55222
55362
  function createTypeNodesFromResolvedType(resolvedType) {
55223
55363
  if (checkTruncationLength(context)) {
55364
+ if (context.flags & 1 /* NoTruncation */) {
55365
+ return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, "elided")];
55366
+ }
55224
55367
  return [factory.createPropertySignature(
55225
55368
  /*modifiers*/
55226
55369
  void 0,
@@ -55258,15 +55401,20 @@ function createTypeChecker(host) {
55258
55401
  }
55259
55402
  }
55260
55403
  if (checkTruncationLength(context) && i + 2 < properties.length - 1) {
55261
- typeElements.push(factory.createPropertySignature(
55262
- /*modifiers*/
55263
- void 0,
55264
- `... ${properties.length - i} more ...`,
55265
- /*questionToken*/
55266
- void 0,
55267
- /*type*/
55268
- void 0
55269
- ));
55404
+ if (context.flags & 1 /* NoTruncation */) {
55405
+ const typeElement = typeElements.pop();
55406
+ typeElements.push(addSyntheticTrailingComment(typeElement, 3 /* MultiLineCommentTrivia */, `... ${properties.length - i} more elided ...`));
55407
+ } else {
55408
+ typeElements.push(factory.createPropertySignature(
55409
+ /*modifiers*/
55410
+ void 0,
55411
+ `... ${properties.length - i} more ...`,
55412
+ /*questionToken*/
55413
+ void 0,
55414
+ /*type*/
55415
+ void 0
55416
+ ));
55417
+ }
55270
55418
  addPropertyToElementList(properties[properties.length - 1], context, typeElements);
55271
55419
  break;
55272
55420
  }
@@ -55284,7 +55432,7 @@ function createTypeChecker(host) {
55284
55432
  void 0
55285
55433
  );
55286
55434
  }
55287
- return factory.createKeywordTypeNode(133 /* AnyKeyword */);
55435
+ return addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided");
55288
55436
  }
55289
55437
  function shouldUsePlaceholderForProperty(propertySymbol, context) {
55290
55438
  var _a;
@@ -55420,15 +55568,17 @@ function createTypeChecker(host) {
55420
55568
  if (some(types)) {
55421
55569
  if (checkTruncationLength(context)) {
55422
55570
  if (!isBareList) {
55423
- return [factory.createTypeReferenceNode(
55424
- "...",
55425
- /*typeArguments*/
55426
- void 0
55427
- )];
55571
+ return [
55572
+ context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided") : factory.createTypeReferenceNode(
55573
+ "...",
55574
+ /*typeArguments*/
55575
+ void 0
55576
+ )
55577
+ ];
55428
55578
  } else if (types.length > 2) {
55429
55579
  return [
55430
55580
  typeToTypeNodeHelper(types[0], context),
55431
- factory.createTypeReferenceNode(
55581
+ context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - 2} more elided ...`) : factory.createTypeReferenceNode(
55432
55582
  `... ${types.length - 2} more ...`,
55433
55583
  /*typeArguments*/
55434
55584
  void 0
@@ -55444,11 +55594,13 @@ function createTypeChecker(host) {
55444
55594
  for (const type of types) {
55445
55595
  i++;
55446
55596
  if (checkTruncationLength(context) && i + 2 < types.length - 1) {
55447
- result.push(factory.createTypeReferenceNode(
55448
- `... ${types.length - i} more ...`,
55449
- /*typeArguments*/
55450
- void 0
55451
- ));
55597
+ result.push(
55598
+ context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - i} more elided ...`) : factory.createTypeReferenceNode(
55599
+ `... ${types.length - i} more ...`,
55600
+ /*typeArguments*/
55601
+ void 0
55602
+ )
55603
+ );
55452
55604
  const typeNode2 = typeToTypeNodeHelper(types[types.length - 1], context);
55453
55605
  if (typeNode2) {
55454
55606
  result.push(typeNode2);
@@ -58043,6 +58195,7 @@ function createTypeChecker(host) {
58043
58195
  );
58044
58196
  break;
58045
58197
  }
58198
+ // else fall through and treat commonjs require just like import=
58046
58199
  case 271 /* ImportEqualsDeclaration */:
58047
58200
  if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, (d) => isSourceFile(d) && isJsonSourceFile(d))) {
58048
58201
  serializeMaybeAliasAssignment(symbol);
@@ -58815,6 +58968,7 @@ function createTypeChecker(host) {
58815
58968
  if (isBindingPattern(node.name) && !node.name.elements.length) {
58816
58969
  return false;
58817
58970
  }
58971
+ // falls through
58818
58972
  case 267 /* ModuleDeclaration */:
58819
58973
  case 263 /* ClassDeclaration */:
58820
58974
  case 264 /* InterfaceDeclaration */:
@@ -58839,6 +58993,8 @@ function createTypeChecker(host) {
58839
58993
  if (hasEffectiveModifier(node, 2 /* Private */ | 4 /* Protected */)) {
58840
58994
  return false;
58841
58995
  }
58996
+ // Public properties/methods are visible if its parents are visible, so:
58997
+ // falls through
58842
58998
  case 176 /* Constructor */:
58843
58999
  case 180 /* ConstructSignature */:
58844
59000
  case 179 /* CallSignature */:
@@ -58856,14 +59012,20 @@ function createTypeChecker(host) {
58856
59012
  case 196 /* ParenthesizedType */:
58857
59013
  case 202 /* NamedTupleMember */:
58858
59014
  return isDeclarationVisible(node.parent);
59015
+ // Default binding, import specifier and namespace import is visible
59016
+ // only on demand so by default it is not visible
58859
59017
  case 273 /* ImportClause */:
58860
59018
  case 274 /* NamespaceImport */:
58861
59019
  case 276 /* ImportSpecifier */:
58862
59020
  return false;
59021
+ // Type parameters are always visible
58863
59022
  case 168 /* TypeParameter */:
59023
+ // Source file and namespace export are always visible
59024
+ // falls through
58864
59025
  case 307 /* SourceFile */:
58865
59026
  case 270 /* NamespaceExportDeclaration */:
58866
59027
  return true;
59028
+ // Export assignments do not create name bindings outside the module
58867
59029
  case 277 /* ExportAssignment */:
58868
59030
  return false;
58869
59031
  default:
@@ -60808,11 +60970,20 @@ function createTypeChecker(host) {
60808
60970
  return type;
60809
60971
  }
60810
60972
  function isLateBindableName(node) {
60973
+ return isLateBindableAST(node) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(node.argumentExpression));
60974
+ }
60975
+ function isLateBindableIndexSignature(node) {
60976
+ return isLateBindableAST(node) && isTypeUsableAsIndexSignature(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(node.argumentExpression));
60977
+ }
60978
+ function isLateBindableAST(node) {
60811
60979
  if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
60812
60980
  return false;
60813
60981
  }
60814
60982
  const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
60815
- return isEntityNameExpression(expr) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(expr));
60983
+ return isEntityNameExpression(expr);
60984
+ }
60985
+ function isTypeUsableAsIndexSignature(type) {
60986
+ return isTypeAssignableTo(type, stringNumberSymbolType);
60816
60987
  }
60817
60988
  function isLateBoundName(name) {
60818
60989
  return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) === 64 /* at */;
@@ -60821,6 +60992,10 @@ function createTypeChecker(host) {
60821
60992
  const name = getNameOfDeclaration(node);
60822
60993
  return !!name && isLateBindableName(name);
60823
60994
  }
60995
+ function hasLateBindableIndexSignature(node) {
60996
+ const name = getNameOfDeclaration(node);
60997
+ return !!name && isLateBindableIndexSignature(name);
60998
+ }
60824
60999
  function hasBindableName(node) {
60825
61000
  return !hasDynamicName(node) || hasLateBindableName(node);
60826
61001
  }
@@ -60874,6 +61049,24 @@ function createTypeChecker(host) {
60874
61049
  }
60875
61050
  return links.resolvedSymbol;
60876
61051
  }
61052
+ function lateBindIndexSignature(parent2, earlySymbols, lateSymbols, decl) {
61053
+ let indexSymbol = lateSymbols.get("__index" /* Index */);
61054
+ if (!indexSymbol) {
61055
+ const early = earlySymbols == null ? void 0 : earlySymbols.get("__index" /* Index */);
61056
+ if (!early) {
61057
+ indexSymbol = createSymbol(0 /* None */, "__index" /* Index */, 4096 /* Late */);
61058
+ } else {
61059
+ indexSymbol = cloneSymbol(early);
61060
+ indexSymbol.links.checkFlags |= 4096 /* Late */;
61061
+ }
61062
+ lateSymbols.set("__index" /* Index */, indexSymbol);
61063
+ }
61064
+ if (!indexSymbol.declarations) {
61065
+ indexSymbol.declarations = [decl];
61066
+ } else if (!decl.symbol.isReplaceableByMethod) {
61067
+ indexSymbol.declarations.push(decl);
61068
+ }
61069
+ }
60877
61070
  function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
60878
61071
  const links = getSymbolLinks(symbol);
60879
61072
  if (!links[resolutionKind]) {
@@ -60888,6 +61081,8 @@ function createTypeChecker(host) {
60888
61081
  if (isStatic2 === hasStaticModifier(member)) {
60889
61082
  if (hasLateBindableName(member)) {
60890
61083
  lateBindMember(symbol, earlySymbols, lateSymbols, member);
61084
+ } else if (hasLateBindableIndexSignature(member)) {
61085
+ lateBindIndexSignature(symbol, earlySymbols, lateSymbols, member);
60891
61086
  }
60892
61087
  }
60893
61088
  }
@@ -63151,7 +63346,7 @@ function createTypeChecker(host) {
63151
63346
  return signature.isolatedSignatureType;
63152
63347
  }
63153
63348
  function getIndexSymbol(symbol) {
63154
- return symbol.members ? getIndexSymbolFromSymbolTable(symbol.members) : void 0;
63349
+ return symbol.members ? getIndexSymbolFromSymbolTable(getMembersOfSymbol(symbol)) : void 0;
63155
63350
  }
63156
63351
  function getIndexSymbolFromSymbolTable(symbolTable) {
63157
63352
  return symbolTable.get("__index" /* Index */);
@@ -63167,15 +63362,25 @@ function createTypeChecker(host) {
63167
63362
  if (indexSymbol.declarations) {
63168
63363
  const indexInfos = [];
63169
63364
  for (const declaration of indexSymbol.declarations) {
63170
- if (declaration.parameters.length === 1) {
63171
- const parameter = declaration.parameters[0];
63172
- if (parameter.type) {
63173
- forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
63174
- if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
63175
- indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 8 /* Readonly */), declaration));
63176
- }
63177
- });
63365
+ if (isIndexSignatureDeclaration(declaration)) {
63366
+ if (declaration.parameters.length === 1) {
63367
+ const parameter = declaration.parameters[0];
63368
+ if (parameter.type) {
63369
+ forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
63370
+ if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
63371
+ indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 8 /* Readonly */), declaration));
63372
+ }
63373
+ });
63374
+ }
63178
63375
  }
63376
+ } else if (hasLateBindableIndexSignature(declaration)) {
63377
+ const declName = isBinaryExpression(declaration) ? declaration.left : declaration.name;
63378
+ const keyType = isElementAccessExpression(declName) ? checkExpressionCached(declName.argumentExpression) : checkComputedPropertyName(declName);
63379
+ forEachType(keyType, (keyType2) => {
63380
+ if (isValidIndexKeyType(keyType2) && !findIndexInfo(indexInfos, keyType2)) {
63381
+ indexInfos.push(createIndexInfo(keyType2, getTypeOfVariableOrParameterOrProperty(declaration.symbol), hasEffectiveModifier(declaration, 8 /* Readonly */)));
63382
+ }
63383
+ });
63179
63384
  }
63180
63385
  }
63181
63386
  return indexInfos;
@@ -66413,6 +66618,9 @@ function createTypeChecker(host) {
66413
66618
  return getTypeFromTemplateTypeNode(node);
66414
66619
  case 205 /* ImportType */:
66415
66620
  return getTypeFromImportTypeNode(node);
66621
+ // This function assumes that an identifier, qualified name, or property access expression is a type expression
66622
+ // Callers should first ensure this by calling `isPartOfTypeNode`
66623
+ // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s.
66416
66624
  case 80 /* Identifier */:
66417
66625
  case 166 /* QualifiedName */:
66418
66626
  case 211 /* PropertyAccessExpression */:
@@ -66660,6 +66868,7 @@ function createTypeChecker(host) {
66660
66868
  return !!tp.isThisType;
66661
66869
  case 80 /* Identifier */:
66662
66870
  return !tp.isThisType && isPartOfTypeNode(node2) && maybeTypeParameterReference(node2) && getTypeFromTypeNodeWorker(node2) === tp;
66871
+ // use worker because we're looking for === equality
66663
66872
  case 186 /* TypeQuery */:
66664
66873
  const entityName = node2.exprName;
66665
66874
  const firstIdentifier = getFirstIdentifier(entityName);
@@ -67079,6 +67288,7 @@ function createTypeChecker(host) {
67079
67288
  if (!isConstAssertion(node)) {
67080
67289
  break;
67081
67290
  }
67291
+ // fallthrough
67082
67292
  case 294 /* JsxExpression */:
67083
67293
  case 217 /* ParenthesizedExpression */:
67084
67294
  return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
@@ -68174,7 +68384,7 @@ function createTypeChecker(host) {
68174
68384
  const [sourceType, targetType] = getTypeNamesForErrorDisplay(source2, target2);
68175
68385
  let generalizedSource = source2;
68176
68386
  let generalizedSourceType = sourceType;
68177
- if (isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) {
68387
+ if (!(target2.flags & 131072 /* Never */) && isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) {
68178
68388
  generalizedSource = getBaseTypeOfLiteralType(source2);
68179
68389
  Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
68180
68390
  generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
@@ -72398,6 +72608,7 @@ function createTypeChecker(host) {
72398
72608
  if (isCallExpression(node.parent)) {
72399
72609
  return Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function;
72400
72610
  }
72611
+ // falls through
72401
72612
  default:
72402
72613
  if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) {
72403
72614
  return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
@@ -72431,6 +72642,7 @@ function createTypeChecker(host) {
72431
72642
  const symbol = getResolvedSymbol(node);
72432
72643
  return symbol !== unknownSymbol ? `${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}|${getSymbolId(symbol)}` : void 0;
72433
72644
  }
72645
+ // falls through
72434
72646
  case 110 /* ThisKeyword */:
72435
72647
  return `0|${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}`;
72436
72648
  case 235 /* NonNullExpression */:
@@ -73984,6 +74196,9 @@ function createTypeChecker(host) {
73984
74196
  break;
73985
74197
  case 28 /* CommaToken */:
73986
74198
  return narrowType(type, expr.right, assumeTrue);
74199
+ // Ordinarily we won't see && and || expressions in control flow analysis because the Binder breaks those
74200
+ // expressions down to individual conditional control flows. However, we may encounter them when analyzing
74201
+ // aliased conditional expressions.
73987
74202
  case 56 /* AmpersandAmpersandToken */:
73988
74203
  return assumeTrue ? narrowType(
73989
74204
  narrowType(
@@ -74427,6 +74642,7 @@ function createTypeChecker(host) {
74427
74642
  }
74428
74643
  }
74429
74644
  }
74645
+ // falls through
74430
74646
  case 110 /* ThisKeyword */:
74431
74647
  case 108 /* SuperKeyword */:
74432
74648
  case 211 /* PropertyAccessExpression */:
@@ -82245,6 +82461,7 @@ function createTypeChecker(host) {
82245
82461
  hasError = true;
82246
82462
  break;
82247
82463
  }
82464
+ // fallthrough
82248
82465
  case 7 /* ES2022 */:
82249
82466
  case 99 /* ESNext */:
82250
82467
  case 200 /* Preserve */:
@@ -82252,6 +82469,7 @@ function createTypeChecker(host) {
82252
82469
  if (languageVersion >= 4 /* ES2017 */) {
82253
82470
  break;
82254
82471
  }
82472
+ // fallthrough
82255
82473
  default:
82256
82474
  span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
82257
82475
  const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher : Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher;
@@ -82669,9 +82887,13 @@ function createTypeChecker(host) {
82669
82887
  return true;
82670
82888
  }
82671
82889
  return false;
82890
+ // Some forms listed here for clarity
82672
82891
  case 222 /* VoidExpression */:
82892
+ // Explicit opt-out
82673
82893
  case 216 /* TypeAssertionExpression */:
82894
+ // Not SEF, but can produce useful type warnings
82674
82895
  case 234 /* AsExpression */:
82896
+ // Not SEF, but can produce useful type warnings
82675
82897
  default:
82676
82898
  return false;
82677
82899
  }
@@ -83917,6 +84139,7 @@ function createTypeChecker(host) {
83917
84139
  if (node.expression.kind === 102 /* ImportKeyword */) {
83918
84140
  return checkImportCallExpression(node);
83919
84141
  }
84142
+ // falls through
83920
84143
  case 214 /* NewExpression */:
83921
84144
  return checkCallExpression(node, checkMode);
83922
84145
  case 215 /* TaggedTemplateExpression */:
@@ -84005,7 +84228,7 @@ function createTypeChecker(host) {
84005
84228
  const modifiers = getTypeParameterModifiers(typeParameter) & (8192 /* In */ | 16384 /* Out */);
84006
84229
  if (modifiers) {
84007
84230
  const symbol = getSymbolOfDeclaration(node.parent);
84008
- if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (4 /* Reference */ | 16 /* Anonymous */ | 32 /* Mapped */))) {
84231
+ if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
84009
84232
  error2(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
84010
84233
  } else if (modifiers === 8192 /* In */ || modifiers === 16384 /* Out */) {
84011
84234
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
@@ -84286,6 +84509,7 @@ function createTypeChecker(host) {
84286
84509
  if (useDefineForClassFields) {
84287
84510
  break;
84288
84511
  }
84512
+ // fall through
84289
84513
  case "prototype":
84290
84514
  const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
84291
84515
  const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
@@ -84332,15 +84556,17 @@ function createTypeChecker(host) {
84332
84556
  if (indexSymbol == null ? void 0 : indexSymbol.declarations) {
84333
84557
  const indexSignatureMap = /* @__PURE__ */ new Map();
84334
84558
  for (const declaration of indexSymbol.declarations) {
84335
- if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
84336
- forEachType(getTypeFromTypeNode(declaration.parameters[0].type), (type) => {
84337
- const entry = indexSignatureMap.get(getTypeId(type));
84338
- if (entry) {
84339
- entry.declarations.push(declaration);
84340
- } else {
84341
- indexSignatureMap.set(getTypeId(type), { type, declarations: [declaration] });
84342
- }
84343
- });
84559
+ if (isIndexSignatureDeclaration(declaration)) {
84560
+ if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
84561
+ forEachType(getTypeFromTypeNode(declaration.parameters[0].type), (type) => {
84562
+ const entry = indexSignatureMap.get(getTypeId(type));
84563
+ if (entry) {
84564
+ entry.declarations.push(declaration);
84565
+ } else {
84566
+ indexSignatureMap.set(getTypeId(type), { type, declarations: [declaration] });
84567
+ }
84568
+ });
84569
+ }
84344
84570
  }
84345
84571
  }
84346
84572
  indexSignatureMap.forEach((entry) => {
@@ -85029,6 +85255,8 @@ function createTypeChecker(host) {
85029
85255
  switch (d.kind) {
85030
85256
  case 264 /* InterfaceDeclaration */:
85031
85257
  case 265 /* TypeAliasDeclaration */:
85258
+ // A jsdoc typedef and callback are, by definition, type aliases.
85259
+ // falls through
85032
85260
  case 346 /* JSDocTypedefTag */:
85033
85261
  case 338 /* JSDocCallbackTag */:
85034
85262
  case 340 /* JSDocEnumTag */:
@@ -85049,6 +85277,8 @@ function createTypeChecker(host) {
85049
85277
  return 1 /* ExportValue */;
85050
85278
  }
85051
85279
  d = expression;
85280
+ // The below options all declare an Alias, which is allowed to merge with other values within the importing module.
85281
+ // falls through
85052
85282
  case 271 /* ImportEqualsDeclaration */:
85053
85283
  case 274 /* NamespaceImport */:
85054
85284
  case 273 /* ImportClause */:
@@ -85062,6 +85292,7 @@ function createTypeChecker(host) {
85062
85292
  case 208 /* BindingElement */:
85063
85293
  case 262 /* FunctionDeclaration */:
85064
85294
  case 276 /* ImportSpecifier */:
85295
+ // https://github.com/Microsoft/TypeScript/pull/7591
85065
85296
  case 80 /* Identifier */:
85066
85297
  return 1 /* ExportValue */;
85067
85298
  case 173 /* MethodSignature */:
@@ -85410,6 +85641,7 @@ function createTypeChecker(host) {
85410
85641
  headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
85411
85642
  break;
85412
85643
  }
85644
+ // falls through
85413
85645
  case 169 /* Parameter */:
85414
85646
  headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
85415
85647
  break;
@@ -88631,6 +88863,7 @@ function createTypeChecker(host) {
88631
88863
  break;
88632
88864
  case 271 /* ImportEqualsDeclaration */:
88633
88865
  if (isInternalModuleImportEqualsDeclaration(node)) break;
88866
+ // falls through
88634
88867
  case 272 /* ImportDeclaration */:
88635
88868
  grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
88636
88869
  break;
@@ -88643,6 +88876,7 @@ function createTypeChecker(host) {
88643
88876
  }
88644
88877
  break;
88645
88878
  }
88879
+ // falls through
88646
88880
  case 263 /* ClassDeclaration */:
88647
88881
  case 266 /* EnumDeclaration */:
88648
88882
  case 262 /* FunctionDeclaration */:
@@ -89319,6 +89553,7 @@ function createTypeChecker(host) {
89319
89553
  return checkJSDocPropertyTag(node);
89320
89554
  case 317 /* JSDocFunctionType */:
89321
89555
  checkJSDocFunctionType(node);
89556
+ // falls through
89322
89557
  case 315 /* JSDocNonNullableType */:
89323
89558
  case 314 /* JSDocNullableType */:
89324
89559
  case 312 /* JSDocAllType */:
@@ -89742,6 +89977,7 @@ function createTypeChecker(host) {
89742
89977
  switch (location.kind) {
89743
89978
  case 307 /* SourceFile */:
89744
89979
  if (!isExternalModule(location)) break;
89980
+ // falls through
89745
89981
  case 267 /* ModuleDeclaration */:
89746
89982
  copyLocallyVisibleExportSymbols(getSymbolOfDeclaration(location).exports, meaning & 2623475 /* ModuleMember */);
89747
89983
  break;
@@ -89753,6 +89989,9 @@ function createTypeChecker(host) {
89753
89989
  if (className) {
89754
89990
  copySymbol(location.symbol, meaning);
89755
89991
  }
89992
+ // this fall-through is necessary because we would like to handle
89993
+ // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration.
89994
+ // falls through
89756
89995
  case 263 /* ClassDeclaration */:
89757
89996
  case 264 /* InterfaceDeclaration */:
89758
89997
  if (!isStaticSymbol) {
@@ -89861,6 +90100,7 @@ function createTypeChecker(host) {
89861
90100
  if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
89862
90101
  return void 0;
89863
90102
  }
90103
+ // falls through
89864
90104
  case 4 /* ThisProperty */:
89865
90105
  case 2 /* ModuleExports */:
89866
90106
  return getSymbolOfDeclaration(entityName.parent.parent);
@@ -90154,6 +90394,7 @@ function createTypeChecker(host) {
90154
90394
  if (!isThisInTypeQuery(node)) {
90155
90395
  return getSymbolOfNameOrPropertyAccessExpression(node);
90156
90396
  }
90397
+ // falls through
90157
90398
  case 110 /* ThisKeyword */:
90158
90399
  const container = getThisContainer(
90159
90400
  node,
@@ -90171,6 +90412,7 @@ function createTypeChecker(host) {
90171
90412
  if (isInExpressionContext(node)) {
90172
90413
  return checkExpression(node).symbol;
90173
90414
  }
90415
+ // falls through
90174
90416
  case 197 /* ThisType */:
90175
90417
  return getTypeFromThisTypeNode(node).symbol;
90176
90418
  case 108 /* SuperKeyword */:
@@ -90193,6 +90435,7 @@ function createTypeChecker(host) {
90193
90435
  if (isCallExpression(parent2) && isBindableObjectDefinePropertyCall(parent2) && parent2.arguments[1] === node) {
90194
90436
  return getSymbolOfDeclaration(parent2);
90195
90437
  }
90438
+ // falls through
90196
90439
  case 9 /* NumericLiteral */:
90197
90440
  const objectType = isElementAccessExpression(parent2) ? parent2.argumentExpression === node ? getTypeOfExpression(parent2.expression) : void 0 : isLiteralTypeNode(parent2) && isIndexedAccessTypeNode(grandParent) ? getTypeFromTypeNode(grandParent.objectType) : void 0;
90198
90441
  return objectType && getPropertyOfType(objectType, escapeLeadingUnderscores(node.text));
@@ -90222,6 +90465,7 @@ function createTypeChecker(host) {
90222
90465
  const symbol = getIntrinsicTagSymbol(node.parent);
90223
90466
  return symbol === unknownSymbol ? void 0 : symbol;
90224
90467
  }
90468
+ // falls through
90225
90469
  default:
90226
90470
  return void 0;
90227
90471
  }
@@ -91230,7 +91474,29 @@ function createTypeChecker(host) {
91230
91474
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
91231
91475
  },
91232
91476
  isImportRequiredByAugmentation,
91233
- isDefinitelyReferenceToGlobalSymbolObject
91477
+ isDefinitelyReferenceToGlobalSymbolObject,
91478
+ createLateBoundIndexSignatures: (cls, enclosing, flags, internalFlags, tracker) => {
91479
+ const sym = cls.symbol;
91480
+ const staticInfos = getIndexInfosOfType(getTypeOfSymbol(sym));
91481
+ const instanceIndexSymbol = getIndexSymbol(sym);
91482
+ const instanceInfos = instanceIndexSymbol && getIndexInfosOfIndexSymbol(instanceIndexSymbol);
91483
+ let result;
91484
+ for (const infoList of [staticInfos, instanceInfos]) {
91485
+ if (!length(infoList)) continue;
91486
+ result || (result = []);
91487
+ for (const info of infoList) {
91488
+ if (info.declaration) continue;
91489
+ const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
91490
+ if (node && infoList === staticInfos) {
91491
+ (node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
91492
+ }
91493
+ if (node) {
91494
+ result.push(node);
91495
+ }
91496
+ }
91497
+ }
91498
+ return result;
91499
+ }
91234
91500
  };
91235
91501
  function isImportRequiredByAugmentation(node) {
91236
91502
  const file = getSourceFileOfNode(node);
@@ -92316,6 +92582,7 @@ function createTypeChecker(host) {
92316
92582
  );
92317
92583
  break;
92318
92584
  }
92585
+ // fallthrough
92319
92586
  case 7 /* ES2022 */:
92320
92587
  case 99 /* ESNext */:
92321
92588
  case 200 /* Preserve */:
@@ -92323,6 +92590,7 @@ function createTypeChecker(host) {
92323
92590
  if (languageVersion >= 4 /* ES2017 */) {
92324
92591
  break;
92325
92592
  }
92593
+ // fallthrough
92326
92594
  default:
92327
92595
  diagnostics.add(
92328
92596
  createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher)
@@ -94499,13 +94767,13 @@ var visitEachChildTable = {
94499
94767
  );
94500
94768
  },
94501
94769
  // Transformation nodes
94502
- [354 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
94770
+ [355 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
94503
94771
  return context.factory.updatePartiallyEmittedExpression(
94504
94772
  node,
94505
94773
  Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
94506
94774
  );
94507
94775
  },
94508
- [355 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
94776
+ [356 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
94509
94777
  return context.factory.updateCommaListExpression(
94510
94778
  node,
94511
94779
  nodesVisitor(node.elements, visitor, isExpression)
@@ -96611,6 +96879,8 @@ function transformTypeScript(context) {
96611
96879
  case 148 /* ReadonlyKeyword */:
96612
96880
  case 103 /* InKeyword */:
96613
96881
  case 147 /* OutKeyword */:
96882
+ // TypeScript accessibility and readonly modifiers are elided
96883
+ // falls through
96614
96884
  case 188 /* ArrayType */:
96615
96885
  case 189 /* TupleType */:
96616
96886
  case 190 /* OptionalType */:
@@ -96639,6 +96909,8 @@ function transformTypeScript(context) {
96639
96909
  case 199 /* IndexedAccessType */:
96640
96910
  case 200 /* MappedType */:
96641
96911
  case 201 /* LiteralType */:
96912
+ // TypeScript type nodes are elided.
96913
+ // falls through
96642
96914
  case 181 /* IndexSignature */:
96643
96915
  return void 0;
96644
96916
  case 265 /* TypeAliasDeclaration */:
@@ -97846,17 +98118,10 @@ function transformTypeScript(context) {
97846
98118
  /*modifiers*/
97847
98119
  void 0,
97848
98120
  importClause,
97849
- rewriteModuleSpecifier(node.moduleSpecifier),
98121
+ node.moduleSpecifier,
97850
98122
  node.attributes
97851
98123
  ) : void 0;
97852
98124
  }
97853
- function rewriteModuleSpecifier(node) {
97854
- if (!node || !compilerOptions.rewriteRelativeImportExtensions || !isStringLiteral(node) || !pathIsRelative(node.text) || isDeclarationFileName(node.text)) {
97855
- return node;
97856
- }
97857
- const updatedText = changeExtension(node.text, getOutputExtension(node.text, compilerOptions));
97858
- return updatedText !== node.text ? setOriginalNode(setTextRange(factory2.createStringLiteral(updatedText, node.singleQuote), node), node) : node;
97859
- }
97860
98125
  function visitImportClause(node) {
97861
98126
  Debug.assert(!node.isTypeOnly);
97862
98127
  const name = shouldEmitAliasDeclaration(node) ? node.name : void 0;
@@ -97889,14 +98154,7 @@ function transformTypeScript(context) {
97889
98154
  return void 0;
97890
98155
  }
97891
98156
  if (!node.exportClause || isNamespaceExport(node.exportClause)) {
97892
- return factory2.updateExportDeclaration(
97893
- node,
97894
- node.modifiers,
97895
- node.isTypeOnly,
97896
- node.exportClause,
97897
- rewriteModuleSpecifier(node.moduleSpecifier),
97898
- node.attributes
97899
- );
98157
+ return node;
97900
98158
  }
97901
98159
  const allowEmpty = !!compilerOptions.verbatimModuleSyntax;
97902
98160
  const exportClause = visitNode(
@@ -97910,7 +98168,7 @@ function transformTypeScript(context) {
97910
98168
  void 0,
97911
98169
  node.isTypeOnly,
97912
98170
  exportClause,
97913
- rewriteModuleSpecifier(node.moduleSpecifier),
98171
+ node.moduleSpecifier,
97914
98172
  node.attributes
97915
98173
  ) : void 0;
97916
98174
  }
@@ -97935,24 +98193,8 @@ function transformTypeScript(context) {
97935
98193
  return void 0;
97936
98194
  }
97937
98195
  if (isExternalModuleImportEqualsDeclaration(node)) {
97938
- if (!shouldEmitAliasDeclaration(node)) {
97939
- return void 0;
97940
- }
97941
- const updatedModuleSpecifier = rewriteModuleSpecifier(node.moduleReference.expression);
97942
- if (updatedModuleSpecifier !== node.moduleReference.expression) {
97943
- return visitEachChild(
97944
- factory2.updateImportEqualsDeclaration(
97945
- node,
97946
- node.modifiers,
97947
- node.isTypeOnly,
97948
- node.name,
97949
- factory2.updateExternalModuleReference(node.moduleReference, updatedModuleSpecifier)
97950
- ),
97951
- visitor,
97952
- context
97953
- );
97954
- }
97955
- return visitEachChild(node, visitor, context);
98196
+ const isReferenced = shouldEmitAliasDeclaration(node);
98197
+ return isReferenced ? visitEachChild(node, visitor, context) : void 0;
97956
98198
  }
97957
98199
  if (!shouldEmitImportEqualsDeclaration(node)) {
97958
98200
  return void 0;
@@ -98351,7 +98593,7 @@ function transformClassFields(context) {
98351
98593
  /*discarded*/
98352
98594
  true
98353
98595
  );
98354
- case 355 /* CommaListExpression */:
98596
+ case 356 /* CommaListExpression */:
98355
98597
  return visitCommaListExpression(
98356
98598
  node,
98357
98599
  /*discarded*/
@@ -100291,6 +100533,7 @@ function transformClassFields(context) {
100291
100533
  if (isArrowFunction(original) || getEmitFlags(node) & 524288 /* AsyncFunctionBody */) {
100292
100534
  break;
100293
100535
  }
100536
+ // falls through
100294
100537
  case 262 /* FunctionDeclaration */:
100295
100538
  case 176 /* Constructor */:
100296
100539
  case 177 /* GetAccessor */:
@@ -100566,6 +100809,7 @@ function createRuntimeTypeSerializer(context) {
100566
100809
  case 197 /* ThisType */:
100567
100810
  case 205 /* ImportType */:
100568
100811
  break;
100812
+ // handle JSDoc types from an invalid parse
100569
100813
  case 312 /* JSDocAllType */:
100570
100814
  case 313 /* JSDocUnknownType */:
100571
100815
  case 317 /* JSDocFunctionType */:
@@ -101411,6 +101655,7 @@ function transformESDecorators(context) {
101411
101655
  return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead.");
101412
101656
  case 169 /* Parameter */:
101413
101657
  return visitParameterDeclaration(node);
101658
+ // Support NamedEvaluation to ensure the correct class name for class expressions.
101414
101659
  case 226 /* BinaryExpression */:
101415
101660
  return visitBinaryExpression(
101416
101661
  node,
@@ -101431,7 +101676,7 @@ function transformESDecorators(context) {
101431
101676
  return visitForStatement(node);
101432
101677
  case 244 /* ExpressionStatement */:
101433
101678
  return visitExpressionStatement(node);
101434
- case 355 /* CommaListExpression */:
101679
+ case 356 /* CommaListExpression */:
101435
101680
  return visitCommaListExpression(
101436
101681
  node,
101437
101682
  /*discarded*/
@@ -101443,7 +101688,7 @@ function transformESDecorators(context) {
101443
101688
  /*discarded*/
101444
101689
  false
101445
101690
  );
101446
- case 354 /* PartiallyEmittedExpression */:
101691
+ case 355 /* PartiallyEmittedExpression */:
101447
101692
  return visitPartiallyEmittedExpression(
101448
101693
  node,
101449
101694
  /*discarded*/
@@ -101467,6 +101712,7 @@ function transformESDecorators(context) {
101467
101712
  case 167 /* ComputedPropertyName */:
101468
101713
  return visitComputedPropertyName(node);
101469
101714
  case 174 /* MethodDeclaration */:
101715
+ // object literal methods and accessors
101470
101716
  case 178 /* SetAccessor */:
101471
101717
  case 177 /* GetAccessor */:
101472
101718
  case 218 /* FunctionExpression */:
@@ -101529,7 +101775,7 @@ function transformESDecorators(context) {
101529
101775
  /*discarded*/
101530
101776
  true
101531
101777
  );
101532
- case 355 /* CommaListExpression */:
101778
+ case 356 /* CommaListExpression */:
101533
101779
  return visitCommaListExpression(
101534
101780
  node,
101535
101781
  /*discarded*/
@@ -104111,7 +104357,7 @@ function transformES2018(context) {
104111
104357
  return visitObjectLiteralExpression(node);
104112
104358
  case 226 /* BinaryExpression */:
104113
104359
  return visitBinaryExpression(node, expressionResultIsUnused2);
104114
- case 355 /* CommaListExpression */:
104360
+ case 356 /* CommaListExpression */:
104115
104361
  return visitCommaListExpression(node, expressionResultIsUnused2);
104116
104362
  case 299 /* CatchClause */:
104117
104363
  return visitCatchClause(node);
@@ -107251,6 +107497,7 @@ function transformES2015(context) {
107251
107497
  switch (node.kind) {
107252
107498
  case 126 /* StaticKeyword */:
107253
107499
  return void 0;
107500
+ // elide static keyword
107254
107501
  case 263 /* ClassDeclaration */:
107255
107502
  return visitClassDeclaration(node);
107256
107503
  case 231 /* ClassExpression */:
@@ -107329,7 +107576,7 @@ function transformES2015(context) {
107329
107576
  return visitParenthesizedExpression(node, expressionResultIsUnused2);
107330
107577
  case 226 /* BinaryExpression */:
107331
107578
  return visitBinaryExpression(node, expressionResultIsUnused2);
107332
- case 355 /* CommaListExpression */:
107579
+ case 356 /* CommaListExpression */:
107333
107580
  return visitCommaListExpression(node, expressionResultIsUnused2);
107334
107581
  case 15 /* NoSubstitutionTemplateLiteral */:
107335
107582
  case 16 /* TemplateHead */:
@@ -107713,12 +107960,14 @@ function transformES2015(context) {
107713
107960
  return false;
107714
107961
  }
107715
107962
  switch (node.kind) {
107963
+ // stop at function boundaries
107716
107964
  case 219 /* ArrowFunction */:
107717
107965
  case 218 /* FunctionExpression */:
107718
107966
  case 262 /* FunctionDeclaration */:
107719
107967
  case 176 /* Constructor */:
107720
107968
  case 175 /* ClassStaticBlockDeclaration */:
107721
107969
  return false;
107970
+ // only step into computed property names for class and object literal elements
107722
107971
  case 177 /* GetAccessor */:
107723
107972
  case 178 /* SetAccessor */:
107724
107973
  case 174 /* MethodDeclaration */:
@@ -107927,12 +108176,14 @@ function transformES2015(context) {
107927
108176
  return factory2.createPartiallyEmittedExpression(node.right, node);
107928
108177
  }
107929
108178
  switch (node.kind) {
108179
+ // stop at function boundaries
107930
108180
  case 219 /* ArrowFunction */:
107931
108181
  case 218 /* FunctionExpression */:
107932
108182
  case 262 /* FunctionDeclaration */:
107933
108183
  case 176 /* Constructor */:
107934
108184
  case 175 /* ClassStaticBlockDeclaration */:
107935
108185
  return node;
108186
+ // only step into computed property names for class and object literal elements
107936
108187
  case 177 /* GetAccessor */:
107937
108188
  case 178 /* SetAccessor */:
107938
108189
  case 174 /* MethodDeclaration */:
@@ -107978,12 +108229,14 @@ function transformES2015(context) {
107978
108229
  );
107979
108230
  }
107980
108231
  switch (node.kind) {
108232
+ // stop at function boundaries
107981
108233
  case 219 /* ArrowFunction */:
107982
108234
  case 218 /* FunctionExpression */:
107983
108235
  case 262 /* FunctionDeclaration */:
107984
108236
  case 176 /* Constructor */:
107985
108237
  case 175 /* ClassStaticBlockDeclaration */:
107986
108238
  return node;
108239
+ // only step into computed property names for class and object literal elements
107987
108240
  case 177 /* GetAccessor */:
107988
108241
  case 178 /* SetAccessor */:
107989
108242
  case 174 /* MethodDeclaration */:
@@ -110615,7 +110868,7 @@ function transformGenerators(context) {
110615
110868
  switch (node.kind) {
110616
110869
  case 226 /* BinaryExpression */:
110617
110870
  return visitBinaryExpression(node);
110618
- case 355 /* CommaListExpression */:
110871
+ case 356 /* CommaListExpression */:
110619
110872
  return visitCommaListExpression(node);
110620
110873
  case 227 /* ConditionalExpression */:
110621
110874
  return visitConditionalExpression(node);
@@ -113006,7 +113259,7 @@ function transformModule(context) {
113006
113259
  return visitExpressionStatement(node);
113007
113260
  case 217 /* ParenthesizedExpression */:
113008
113261
  return visitParenthesizedExpression(node, valueIsDiscarded);
113009
- case 354 /* PartiallyEmittedExpression */:
113262
+ case 355 /* PartiallyEmittedExpression */:
113010
113263
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
113011
113264
  case 213 /* CallExpression */:
113012
113265
  if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
@@ -114766,6 +115019,7 @@ function transformSystemModule(context) {
114766
115019
  if (!entry.importClause) {
114767
115020
  break;
114768
115021
  }
115022
+ // falls through
114769
115023
  case 271 /* ImportEqualsDeclaration */:
114770
115024
  Debug.assert(importVariableName !== void 0);
114771
115025
  statements.push(
@@ -115400,7 +115654,7 @@ function transformSystemModule(context) {
115400
115654
  return visitExpressionStatement(node);
115401
115655
  case 217 /* ParenthesizedExpression */:
115402
115656
  return visitParenthesizedExpression(node, valueIsDiscarded);
115403
- case 354 /* PartiallyEmittedExpression */:
115657
+ case 355 /* PartiallyEmittedExpression */:
115404
115658
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
115405
115659
  case 226 /* BinaryExpression */:
115406
115660
  if (isDestructuringAssignment(node)) {
@@ -116999,6 +117253,7 @@ function transformDeclarations(context) {
116999
117253
  case 265 /* TypeAliasDeclaration */:
117000
117254
  case 266 /* EnumDeclaration */:
117001
117255
  return !resolver.isDeclarationVisible(node);
117256
+ // The following should be doing their own visibility checks based on filtering their members
117002
117257
  case 260 /* VariableDeclaration */:
117003
117258
  return !getBindingNameVisible(node);
117004
117259
  case 271 /* ImportEqualsDeclaration */:
@@ -117893,7 +118148,8 @@ function transformDeclarations(context) {
117893
118148
  void 0
117894
118149
  )
117895
118150
  ] : void 0;
117896
- const memberNodes = concatenate(concatenate(privateIdentifier, parameterProperties), visitNodes2(input.members, visitDeclarationSubtree, isClassElement));
118151
+ const lateIndexes = resolver.createLateBoundIndexSignatures(input, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
118152
+ const memberNodes = concatenate(concatenate(concatenate(privateIdentifier, lateIndexes), parameterProperties), visitNodes2(input.members, visitDeclarationSubtree, isClassElement));
117897
118153
  const members = factory2.createNodeArray(memberNodes);
117898
118154
  const extendsClause = getEffectiveBaseTypeNode(input);
117899
118155
  if (extendsClause && !isEntityNameExpression(extendsClause.expression) && extendsClause.expression.kind !== 106 /* NullKeyword */) {
@@ -118280,7 +118536,7 @@ function noEmitNotification(hint, node, callback) {
118280
118536
  }
118281
118537
  function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
118282
118538
  var _a, _b;
118283
- const enabledSyntaxKindFeatures = new Array(357 /* Count */);
118539
+ const enabledSyntaxKindFeatures = new Array(358 /* Count */);
118284
118540
  let lexicalEnvironmentVariableDeclarations;
118285
118541
  let lexicalEnvironmentFunctionDeclarations;
118286
118542
  let lexicalEnvironmentStatements;
@@ -119209,7 +119465,8 @@ var notImplementedResolver = {
119209
119465
  isBindingCapturedByNode: notImplemented,
119210
119466
  getDeclarationStatementsForSourceFile: notImplemented,
119211
119467
  isImportRequiredByAugmentation: notImplemented,
119212
- isDefinitelyReferenceToGlobalSymbolObject: notImplemented
119468
+ isDefinitelyReferenceToGlobalSymbolObject: notImplemented,
119469
+ createLateBoundIndexSignatures: notImplemented
119213
119470
  };
119214
119471
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
119215
119472
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -119494,6 +119751,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119494
119751
  if (onEmitNode !== noEmitNotification && (!isEmitNotificationEnabled || isEmitNotificationEnabled(node))) {
119495
119752
  return pipelineEmitWithNotification;
119496
119753
  }
119754
+ // falls through
119497
119755
  case 1 /* Substitution */:
119498
119756
  if (substituteNode !== noEmitSubstitution && (lastSubstitution = substituteNode(emitHint, node) || node) !== node) {
119499
119757
  if (currentParenthesizerRule) {
@@ -119501,14 +119759,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119501
119759
  }
119502
119760
  return pipelineEmitWithSubstitution;
119503
119761
  }
119762
+ // falls through
119504
119763
  case 2 /* Comments */:
119505
119764
  if (shouldEmitComments(node)) {
119506
119765
  return pipelineEmitWithComments;
119507
119766
  }
119767
+ // falls through
119508
119768
  case 3 /* SourceMaps */:
119509
119769
  if (shouldEmitSourceMaps(node)) {
119510
119770
  return pipelineEmitWithSourceMaps;
119511
119771
  }
119772
+ // falls through
119512
119773
  case 4 /* Emit */:
119513
119774
  return pipelineEmitWithHint;
119514
119775
  default:
@@ -119560,6 +119821,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119560
119821
  }
119561
119822
  if (hint === 4 /* Unspecified */) {
119562
119823
  switch (node.kind) {
119824
+ // Pseudo-literals
119563
119825
  case 16 /* TemplateHead */:
119564
119826
  case 17 /* TemplateMiddle */:
119565
119827
  case 18 /* TemplateTail */:
@@ -119568,20 +119830,26 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119568
119830
  /*jsxAttributeEscape*/
119569
119831
  false
119570
119832
  );
119833
+ // Identifiers
119571
119834
  case 80 /* Identifier */:
119572
119835
  return emitIdentifier(node);
119836
+ // PrivateIdentifiers
119573
119837
  case 81 /* PrivateIdentifier */:
119574
119838
  return emitPrivateIdentifier(node);
119839
+ // Parse tree nodes
119840
+ // Names
119575
119841
  case 166 /* QualifiedName */:
119576
119842
  return emitQualifiedName(node);
119577
119843
  case 167 /* ComputedPropertyName */:
119578
119844
  return emitComputedPropertyName(node);
119845
+ // Signature elements
119579
119846
  case 168 /* TypeParameter */:
119580
119847
  return emitTypeParameter(node);
119581
119848
  case 169 /* Parameter */:
119582
119849
  return emitParameter(node);
119583
119850
  case 170 /* Decorator */:
119584
119851
  return emitDecorator(node);
119852
+ // Type members
119585
119853
  case 171 /* PropertySignature */:
119586
119854
  return emitPropertySignature(node);
119587
119855
  case 172 /* PropertyDeclaration */:
@@ -119603,6 +119871,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119603
119871
  return emitConstructSignature(node);
119604
119872
  case 181 /* IndexSignature */:
119605
119873
  return emitIndexSignature(node);
119874
+ // Types
119606
119875
  case 182 /* TypePredicate */:
119607
119876
  return emitTypePredicate(node);
119608
119877
  case 183 /* TypeReference */:
@@ -119621,6 +119890,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119621
119890
  return emitTupleType(node);
119622
119891
  case 190 /* OptionalType */:
119623
119892
  return emitOptionalType(node);
119893
+ // SyntaxKind.RestType is handled below
119624
119894
  case 192 /* UnionType */:
119625
119895
  return emitUnionType(node);
119626
119896
  case 193 /* IntersectionType */:
@@ -119651,16 +119921,19 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119651
119921
  return emitTemplateTypeSpan(node);
119652
119922
  case 205 /* ImportType */:
119653
119923
  return emitImportTypeNode(node);
119924
+ // Binding patterns
119654
119925
  case 206 /* ObjectBindingPattern */:
119655
119926
  return emitObjectBindingPattern(node);
119656
119927
  case 207 /* ArrayBindingPattern */:
119657
119928
  return emitArrayBindingPattern(node);
119658
119929
  case 208 /* BindingElement */:
119659
119930
  return emitBindingElement(node);
119931
+ // Misc
119660
119932
  case 239 /* TemplateSpan */:
119661
119933
  return emitTemplateSpan(node);
119662
119934
  case 240 /* SemicolonClassElement */:
119663
119935
  return emitSemicolonClassElement();
119936
+ // Statements
119664
119937
  case 241 /* Block */:
119665
119938
  return emitBlock(node);
119666
119939
  case 243 /* VariableStatement */:
@@ -119702,6 +119975,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119702
119975
  return emitTryStatement(node);
119703
119976
  case 259 /* DebuggerStatement */:
119704
119977
  return emitDebuggerStatement(node);
119978
+ // Declarations
119705
119979
  case 260 /* VariableDeclaration */:
119706
119980
  return emitVariableDeclaration(node);
119707
119981
  case 261 /* VariableDeclarationList */:
@@ -119752,8 +120026,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119752
120026
  return emitImportAttribute(node);
119753
120027
  case 282 /* MissingDeclaration */:
119754
120028
  return;
120029
+ // Module references
119755
120030
  case 283 /* ExternalModuleReference */:
119756
120031
  return emitExternalModuleReference(node);
120032
+ // JSX (non-expression)
119757
120033
  case 12 /* JsxText */:
119758
120034
  return emitJsxText(node);
119759
120035
  case 286 /* JsxOpeningElement */:
@@ -119772,6 +120048,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119772
120048
  return emitJsxExpression(node);
119773
120049
  case 295 /* JsxNamespacedName */:
119774
120050
  return emitJsxNamespacedName(node);
120051
+ // Clauses
119775
120052
  case 296 /* CaseClause */:
119776
120053
  return emitCaseClause(node);
119777
120054
  case 297 /* DefaultClause */:
@@ -119780,18 +120057,22 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119780
120057
  return emitHeritageClause(node);
119781
120058
  case 299 /* CatchClause */:
119782
120059
  return emitCatchClause(node);
120060
+ // Property assignments
119783
120061
  case 303 /* PropertyAssignment */:
119784
120062
  return emitPropertyAssignment(node);
119785
120063
  case 304 /* ShorthandPropertyAssignment */:
119786
120064
  return emitShorthandPropertyAssignment(node);
119787
120065
  case 305 /* SpreadAssignment */:
119788
120066
  return emitSpreadAssignment(node);
120067
+ // Enum
119789
120068
  case 306 /* EnumMember */:
119790
120069
  return emitEnumMember(node);
120070
+ // Top-level nodes
119791
120071
  case 307 /* SourceFile */:
119792
120072
  return emitSourceFile(node);
119793
120073
  case 308 /* Bundle */:
119794
120074
  return Debug.fail("Bundles should be printed using printBundle");
120075
+ // JSDoc nodes (only used in codefixes currently)
119795
120076
  case 309 /* JSDocTypeExpression */:
119796
120077
  return emitJSDocTypeExpression(node);
119797
120078
  case 310 /* JSDocNameReference */:
@@ -119829,6 +120110,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119829
120110
  case 330 /* JSDocAuthorTag */:
119830
120111
  case 331 /* JSDocDeprecatedTag */:
119831
120112
  return;
120113
+ // SyntaxKind.JSDocClassTag (see JSDocTag, above)
119832
120114
  case 333 /* JSDocPublicTag */:
119833
120115
  case 334 /* JSDocPrivateTag */:
119834
120116
  case 335 /* JSDocProtectedTag */:
@@ -119838,6 +120120,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119838
120120
  return emitJSDocCallbackTag(node);
119839
120121
  case 339 /* JSDocOverloadTag */:
119840
120122
  return emitJSDocOverloadTag(node);
120123
+ // SyntaxKind.JSDocEnumTag (see below)
119841
120124
  case 341 /* JSDocParameterTag */:
119842
120125
  case 348 /* JSDocPropertyTag */:
119843
120126
  return emitJSDocPropertyLikeTag(node);
@@ -119856,7 +120139,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119856
120139
  return emitJSDocSeeTag(node);
119857
120140
  case 351 /* JSDocImportTag */:
119858
120141
  return emitJSDocImportTag(node);
120142
+ // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above)
120143
+ // Transformation nodes
119859
120144
  case 353 /* NotEmittedStatement */:
120145
+ case 354 /* NotEmittedTypeElement */:
119860
120146
  return;
119861
120147
  }
119862
120148
  if (isExpression(node)) {
@@ -119874,6 +120160,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119874
120160
  }
119875
120161
  if (hint === 1 /* Expression */) {
119876
120162
  switch (node.kind) {
120163
+ // Literals
119877
120164
  case 9 /* NumericLiteral */:
119878
120165
  case 10 /* BigIntLiteral */:
119879
120166
  return emitNumericOrBigIntLiteral(node);
@@ -119885,10 +120172,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119885
120172
  /*jsxAttributeEscape*/
119886
120173
  false
119887
120174
  );
120175
+ // Identifiers
119888
120176
  case 80 /* Identifier */:
119889
120177
  return emitIdentifier(node);
119890
120178
  case 81 /* PrivateIdentifier */:
119891
120179
  return emitPrivateIdentifier(node);
120180
+ // Expressions
119892
120181
  case 209 /* ArrayLiteralExpression */:
119893
120182
  return emitArrayLiteralExpression(node);
119894
120183
  case 210 /* ObjectLiteralExpression */:
@@ -119951,21 +120240,24 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119951
120240
  return Debug.fail("SyntheticExpression should never be printed.");
119952
120241
  case 282 /* MissingDeclaration */:
119953
120242
  return;
120243
+ // JSX
119954
120244
  case 284 /* JsxElement */:
119955
120245
  return emitJsxElement(node);
119956
120246
  case 285 /* JsxSelfClosingElement */:
119957
120247
  return emitJsxSelfClosingElement(node);
119958
120248
  case 288 /* JsxFragment */:
119959
120249
  return emitJsxFragment(node);
120250
+ // Synthesized list
119960
120251
  case 352 /* SyntaxList */:
119961
120252
  return Debug.fail("SyntaxList should not be printed");
120253
+ // Transformation nodes
119962
120254
  case 353 /* NotEmittedStatement */:
119963
120255
  return;
119964
- case 354 /* PartiallyEmittedExpression */:
120256
+ case 355 /* PartiallyEmittedExpression */:
119965
120257
  return emitPartiallyEmittedExpression(node);
119966
- case 355 /* CommaListExpression */:
120258
+ case 356 /* CommaListExpression */:
119967
120259
  return emitCommaList(node);
119968
- case 356 /* SyntheticReferenceExpression */:
120260
+ case 357 /* SyntheticReferenceExpression */:
119969
120261
  return Debug.fail("SyntheticReferenceExpression should not be printed");
119970
120262
  }
119971
120263
  }
@@ -126148,6 +126440,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126148
126440
  diagnostics.push(createDiagnosticForNode2(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
126149
126441
  return "skip";
126150
126442
  }
126443
+ // falls through
126151
126444
  case 173 /* MethodSignature */:
126152
126445
  case 176 /* Constructor */:
126153
126446
  case 177 /* GetAccessor */:
@@ -126279,6 +126572,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126279
126572
  diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
126280
126573
  return "skip";
126281
126574
  }
126575
+ // falls through
126282
126576
  case 243 /* VariableStatement */:
126283
126577
  if (nodes === parent2.modifiers) {
126284
126578
  checkModifiers(parent2.modifiers, parent2.kind === 243 /* VariableStatement */);
@@ -126321,6 +126615,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126321
126615
  if (isConstValid) {
126322
126616
  continue;
126323
126617
  }
126618
+ // to report error,
126619
+ // falls through
126324
126620
  case 125 /* PublicKeyword */:
126325
126621
  case 123 /* PrivateKeyword */:
126326
126622
  case 124 /* ProtectedKeyword */:
@@ -126332,6 +126628,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126332
126628
  case 147 /* OutKeyword */:
126333
126629
  diagnostics.push(createDiagnosticForNode2(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
126334
126630
  break;
126631
+ // These are all legal modifiers.
126335
126632
  case 126 /* StaticKeyword */:
126336
126633
  case 95 /* ExportKeyword */:
126337
126634
  case 90 /* DefaultKeyword */:
@@ -127378,7 +127675,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127378
127675
  createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
127379
127676
  }
127380
127677
  }
127381
- if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly || options.rewriteRelativeImportExtensions)) {
127678
+ if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
127382
127679
  createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set);
127383
127680
  }
127384
127681
  const moduleResolution = getEmitModuleResolutionKind(options);
@@ -131798,6 +132095,7 @@ function getSourceFileVersionAsHashFromText(host, text) {
131798
132095
  if (pos && text.charCodeAt(pos - 1) === 13 /* carriageReturn */) {
131799
132096
  pos--;
131800
132097
  }
132098
+ // falls through
131801
132099
  case 13 /* carriageReturn */:
131802
132100
  break;
131803
132101
  default:
@@ -133335,6 +133633,7 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
133335
133633
  queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
133336
133634
  step++;
133337
133635
  break;
133636
+ // Should never be done
133338
133637
  case 3 /* Done */:
133339
133638
  default:
133340
133639
  assertType(step);
@@ -133875,6 +134174,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
133875
134174
  status.type = 2 /* UpToDateWithUpstreamTypes */;
133876
134175
  break;
133877
134176
  }
134177
+ // falls through
133878
134178
  case 15 /* UpToDateWithInputFileText */:
133879
134179
  case 2 /* UpToDateWithUpstreamTypes */:
133880
134180
  if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
@@ -134392,6 +134692,8 @@ function reportUpToDateStatus(state, configFileName, status) {
134392
134692
  relName(state, configFileName)
134393
134693
  );
134394
134694
  case 16 /* ContainerOnly */:
134695
+ // Don't report status on "solution" projects
134696
+ // falls through
134395
134697
  case 13 /* ComputingUpstream */:
134396
134698
  break;
134397
134699
  default:
@@ -136224,6 +136526,7 @@ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeN
136224
136526
  return `'${typing}':: ${kind} name '${name}' contains non URI safe characters`;
136225
136527
  case 0 /* Ok */:
136226
136528
  return Debug.fail();
136529
+ // Shouldn't have called this.
136227
136530
  default:
136228
136531
  Debug.assertNever(result);
136229
136532
  }
@@ -136600,6 +136903,7 @@ function getMeaningFromDeclaration(node) {
136600
136903
  case 277 /* ExportAssignment */:
136601
136904
  case 278 /* ExportDeclaration */:
136602
136905
  return 7 /* All */;
136906
+ // An external module can be a Value
136603
136907
  case 307 /* SourceFile */:
136604
136908
  return 4 /* Namespace */ | 1 /* Value */;
136605
136909
  }
@@ -136908,6 +137212,7 @@ function getNodeKind(node) {
136908
137212
  return isFunctionExpression(right) ? "method" /* memberFunctionElement */ : "property" /* memberVariableElement */;
136909
137213
  case 4 /* ThisProperty */:
136910
137214
  return "property" /* memberVariableElement */;
137215
+ // property
136911
137216
  case 5 /* Property */:
136912
137217
  return isFunctionExpression(right) ? "method" /* memberFunctionElement */ : "property" /* memberVariableElement */;
136913
137218
  case 6 /* Prototype */:
@@ -137001,6 +137306,7 @@ function isCompletedNode(n, sourceFile) {
137001
137306
  if (!n.arguments) {
137002
137307
  return true;
137003
137308
  }
137309
+ // falls through
137004
137310
  case 213 /* CallExpression */:
137005
137311
  case 217 /* ParenthesizedExpression */:
137006
137312
  case 196 /* ParenthesizedType */:
@@ -137729,16 +138035,19 @@ function getPossibleTypeArgumentsInfo(tokenIn, sourceFile) {
137729
138035
  token = findPrecedingMatchingToken(token, 23 /* OpenBracketToken */, sourceFile);
137730
138036
  if (!token) return void 0;
137731
138037
  break;
138038
+ // Valid tokens in a type name. Skip.
137732
138039
  case 28 /* CommaToken */:
137733
138040
  nTypeArguments++;
137734
138041
  break;
137735
138042
  case 39 /* EqualsGreaterThanToken */:
138043
+ // falls through
137736
138044
  case 80 /* Identifier */:
137737
138045
  case 11 /* StringLiteral */:
137738
138046
  case 9 /* NumericLiteral */:
137739
138047
  case 10 /* BigIntLiteral */:
137740
138048
  case 112 /* TrueKeyword */:
137741
138049
  case 97 /* FalseKeyword */:
138050
+ // falls through
137742
138051
  case 114 /* TypeOfKeyword */:
137743
138052
  case 96 /* ExtendsKeyword */:
137744
138053
  case 143 /* KeyOfKeyword */:
@@ -140012,6 +140321,7 @@ function canFollow(keyword1, keyword2) {
140012
140321
  case 126 /* StaticKeyword */:
140013
140322
  case 129 /* AccessorKeyword */:
140014
140323
  return true;
140324
+ // Allow things like "public get", "public constructor" and "public static".
140015
140325
  default:
140016
140326
  return false;
140017
140327
  }
@@ -140822,6 +141132,7 @@ var DocumentHighlights;
140822
141132
  if (statement.kind === 251 /* ContinueStatement */) {
140823
141133
  return false;
140824
141134
  }
141135
+ // falls through
140825
141136
  case 248 /* ForStatement */:
140826
141137
  case 249 /* ForInStatement */:
140827
141138
  case 250 /* ForOfStatement */:
@@ -140867,6 +141178,7 @@ var DocumentHighlights;
140867
141178
  return [...nodes, container];
140868
141179
  }
140869
141180
  return nodes;
141181
+ // Syntactically invalid positions that the parser might produce anyway
140870
141182
  default:
140871
141183
  return void 0;
140872
141184
  }
@@ -142446,8 +142758,10 @@ function isFixablePromiseArgument(arg, checker) {
142446
142758
  if (functionFlags & 1 /* Generator */) {
142447
142759
  return false;
142448
142760
  }
142761
+ // falls through
142449
142762
  case 219 /* ArrowFunction */:
142450
142763
  visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true);
142764
+ // falls through
142451
142765
  case 106 /* NullKeyword */:
142452
142766
  return true;
142453
142767
  case 80 /* Identifier */:
@@ -143120,6 +143434,7 @@ function addChildrenRecursively(node) {
143120
143434
  Debug.assertNever(special);
143121
143435
  }
143122
143436
  }
143437
+ // falls through
143123
143438
  default:
143124
143439
  if (hasJSDocNodes(node)) {
143125
143440
  forEach(node.jsDoc, (jsDoc) => {
@@ -143712,6 +144027,7 @@ function changeExport(exportingSourceFile, { wasDefault, exportNode, exportName
143712
144027
  changes.replaceNode(exportingSourceFile, exportNode, factory.createExportDefault(Debug.checkDefined(decl.initializer, "Initializer was previously known to be present")));
143713
144028
  break;
143714
144029
  }
144030
+ // falls through
143715
144031
  case 266 /* EnumDeclaration */:
143716
144032
  case 265 /* TypeAliasDeclaration */:
143717
144033
  case 267 /* ModuleDeclaration */:
@@ -144818,6 +145134,7 @@ function getNamesToExportInCommonJS(decl) {
144818
145134
  case 262 /* FunctionDeclaration */:
144819
145135
  case 263 /* ClassDeclaration */:
144820
145136
  return [decl.name.text];
145137
+ // TODO: GH#18217
144821
145138
  case 243 /* VariableStatement */:
144822
145139
  return mapDefined(decl.declarationList.declarations, (d) => isIdentifier(d.name) ? d.name.text : void 0);
144823
145140
  case 267 /* ModuleDeclaration */:
@@ -146280,6 +146597,7 @@ function entryToFunctionCall(entry) {
146280
146597
  const functionReference = entry.node;
146281
146598
  const parent2 = functionReference.parent;
146282
146599
  switch (parent2.kind) {
146600
+ // foo(...) or super(...) or new Foo(...)
146283
146601
  case 213 /* CallExpression */:
146284
146602
  case 214 /* NewExpression */:
146285
146603
  const callOrNewExpression = tryCast(parent2, isCallOrNewExpression);
@@ -146287,6 +146605,7 @@ function entryToFunctionCall(entry) {
146287
146605
  return callOrNewExpression;
146288
146606
  }
146289
146607
  break;
146608
+ // x.foo(...)
146290
146609
  case 211 /* PropertyAccessExpression */:
146291
146610
  const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression);
146292
146611
  if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) {
@@ -146296,6 +146615,7 @@ function entryToFunctionCall(entry) {
146296
146615
  }
146297
146616
  }
146298
146617
  break;
146618
+ // x["foo"](...)
146299
146619
  case 212 /* ElementAccessExpression */:
146300
146620
  const elementAccessExpression = tryCast(parent2, isElementAccessExpression);
146301
146621
  if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) {
@@ -146314,12 +146634,14 @@ function entryToAccessExpression(entry) {
146314
146634
  const reference = entry.node;
146315
146635
  const parent2 = reference.parent;
146316
146636
  switch (parent2.kind) {
146637
+ // `C.foo`
146317
146638
  case 211 /* PropertyAccessExpression */:
146318
146639
  const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression);
146319
146640
  if (propertyAccessExpression && propertyAccessExpression.expression === reference) {
146320
146641
  return propertyAccessExpression;
146321
146642
  }
146322
146643
  break;
146644
+ // `C["foo"]`
146323
146645
  case 212 /* ElementAccessExpression */:
146324
146646
  const elementAccessExpression = tryCast(parent2, isElementAccessExpression);
146325
146647
  if (elementAccessExpression && elementAccessExpression.expression === reference) {
@@ -147412,11 +147734,13 @@ function getRangeToExtract2(sourceFile, span, invoked = true) {
147412
147734
  forEachChild(n, check);
147413
147735
  }
147414
147736
  });
147737
+ // falls through
147415
147738
  case 263 /* ClassDeclaration */:
147416
147739
  case 262 /* FunctionDeclaration */:
147417
147740
  if (isSourceFile(node2.parent) && node2.parent.externalModuleIndicator === void 0) {
147418
147741
  (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.functionWillNotBeVisibleInTheNewScope));
147419
147742
  }
147743
+ // falls through
147420
147744
  case 231 /* ClassExpression */:
147421
147745
  case 218 /* FunctionExpression */:
147422
147746
  case 174 /* MethodDeclaration */:
@@ -149591,6 +149915,7 @@ var SourceFileObject = class extends NodeObject {
149591
149915
  if (!hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
149592
149916
  break;
149593
149917
  }
149918
+ // falls through
149594
149919
  case 260 /* VariableDeclaration */:
149595
149920
  case 208 /* BindingElement */: {
149596
149921
  const decl = node;
@@ -149602,6 +149927,7 @@ var SourceFileObject = class extends NodeObject {
149602
149927
  visit(decl.initializer);
149603
149928
  }
149604
149929
  }
149930
+ // falls through
149605
149931
  case 306 /* EnumMember */:
149606
149932
  case 172 /* PropertyDeclaration */:
149607
149933
  case 171 /* PropertySignature */:
@@ -149636,6 +149962,7 @@ var SourceFileObject = class extends NodeObject {
149636
149962
  if (getAssignmentDeclarationKind(node) !== 0 /* None */) {
149637
149963
  addDeclaration(node);
149638
149964
  }
149965
+ // falls through
149639
149966
  default:
149640
149967
  forEachChild(node, visit);
149641
149968
  }
@@ -150523,6 +150850,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
150523
150850
  case 197 /* ThisType */:
150524
150851
  case 80 /* Identifier */:
150525
150852
  break;
150853
+ // Cant create the text span
150526
150854
  default:
150527
150855
  return void 0;
150528
150856
  }
@@ -151240,6 +151568,7 @@ function getContainingObjectLiteralElementWorker(node) {
151240
151568
  if (node.parent.kind === 167 /* ComputedPropertyName */) {
151241
151569
  return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : void 0;
151242
151570
  }
151571
+ // falls through
151243
151572
  case 80 /* Identifier */:
151244
151573
  return isObjectLiteralElement(node.parent) && (node.parent.parent.kind === 210 /* ObjectLiteralExpression */ || node.parent.parent.kind === 292 /* JsxAttributes */) && node.parent.name === node ? node.parent : void 0;
151245
151574
  }
@@ -151394,6 +151723,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151394
151723
  if (isFunctionBlock(node)) {
151395
151724
  return spanInFunctionBlock(node);
151396
151725
  }
151726
+ // falls through
151397
151727
  case 268 /* ModuleBlock */:
151398
151728
  return spanInBlock(node);
151399
151729
  case 299 /* CatchClause */:
@@ -151442,6 +151772,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151442
151772
  if (getModuleInstanceState(node) !== 1 /* Instantiated */) {
151443
151773
  return void 0;
151444
151774
  }
151775
+ // falls through
151445
151776
  case 263 /* ClassDeclaration */:
151446
151777
  case 266 /* EnumDeclaration */:
151447
151778
  case 306 /* EnumMember */:
@@ -151454,9 +151785,11 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151454
151785
  case 206 /* ObjectBindingPattern */:
151455
151786
  case 207 /* ArrayBindingPattern */:
151456
151787
  return spanInBindingPattern(node);
151788
+ // No breakpoint in interface, type alias
151457
151789
  case 264 /* InterfaceDeclaration */:
151458
151790
  case 265 /* TypeAliasDeclaration */:
151459
151791
  return void 0;
151792
+ // Tokens:
151460
151793
  case 27 /* SemicolonToken */:
151461
151794
  case 1 /* EndOfFileToken */:
151462
151795
  return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile));
@@ -151477,6 +151810,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151477
151810
  case 32 /* GreaterThanToken */:
151478
151811
  case 30 /* LessThanToken */:
151479
151812
  return spanInGreaterThanOrLessThanToken(node);
151813
+ // Keywords:
151480
151814
  case 117 /* WhileKeyword */:
151481
151815
  return spanInWhileKeyword(node);
151482
151816
  case 93 /* ElseKeyword */:
@@ -151627,10 +151961,13 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151627
151961
  if (getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {
151628
151962
  return void 0;
151629
151963
  }
151964
+ // Set on parent if on same line otherwise on first statement
151965
+ // falls through
151630
151966
  case 247 /* WhileStatement */:
151631
151967
  case 245 /* IfStatement */:
151632
151968
  case 249 /* ForInStatement */:
151633
151969
  return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
151970
+ // Set span on previous token if it starts on same line otherwise on the first statement of the block
151634
151971
  case 248 /* ForStatement */:
151635
151972
  case 250 /* ForOfStatement */:
151636
151973
  return spanInNodeIfStartsOnSameLine(findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
@@ -151696,6 +152033,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151696
152033
  if (getModuleInstanceState(node2.parent.parent) !== 1 /* Instantiated */) {
151697
152034
  return void 0;
151698
152035
  }
152036
+ // falls through
151699
152037
  case 266 /* EnumDeclaration */:
151700
152038
  case 263 /* ClassDeclaration */:
151701
152039
  return textSpan(node2);
@@ -151703,6 +152041,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151703
152041
  if (isFunctionBlock(node2.parent)) {
151704
152042
  return textSpan(node2);
151705
152043
  }
152044
+ // falls through
151706
152045
  case 299 /* CatchClause */:
151707
152046
  return spanInNode(lastOrUndefined(node2.parent.statements));
151708
152047
  case 269 /* CaseBlock */:
@@ -151715,6 +152054,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151715
152054
  case 206 /* ObjectBindingPattern */:
151716
152055
  const bindingPattern = node2.parent;
151717
152056
  return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern);
152057
+ // Default to parent node
151718
152058
  default:
151719
152059
  if (isArrayLiteralOrObjectLiteralDestructuringPattern(node2.parent)) {
151720
152060
  const objectLiteral = node2.parent;
@@ -151764,6 +152104,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151764
152104
  case 214 /* NewExpression */:
151765
152105
  case 217 /* ParenthesizedExpression */:
151766
152106
  return spanInPreviousNode(node2);
152107
+ // Default to parent node
151767
152108
  default:
151768
152109
  return spanInNode(node2.parent);
151769
152110
  }
@@ -154356,6 +154697,7 @@ function convertStatement(sourceFile, statement, checker, changes, identifiers,
154356
154697
  }
154357
154698
  }
154358
154699
  }
154700
+ // falls through
154359
154701
  default:
154360
154702
  return false;
154361
154703
  }
@@ -154455,6 +154797,8 @@ function tryChangeModuleExportsObject(object, useSitesToUnqualify) {
154455
154797
  switch (prop.kind) {
154456
154798
  case 177 /* GetAccessor */:
154457
154799
  case 178 /* SetAccessor */:
154800
+ // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`.
154801
+ // falls through
154458
154802
  case 304 /* ShorthandPropertyAssignment */:
154459
154803
  case 305 /* SpreadAssignment */:
154460
154804
  return void 0;
@@ -154536,6 +154880,7 @@ function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualif
154536
154880
  return exportConst();
154537
154881
  }
154538
154882
  }
154883
+ // falls through
154539
154884
  case 219 /* ArrowFunction */:
154540
154885
  return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify);
154541
154886
  case 231 /* ClassExpression */:
@@ -154584,6 +154929,7 @@ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target
154584
154929
  )]);
154585
154930
  }
154586
154931
  }
154932
+ // falls through -- object destructuring has an interesting pattern and must be a variable declaration
154587
154933
  case 207 /* ArrayBindingPattern */: {
154588
154934
  const tmp = makeUniqueName(moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers);
154589
154935
  return convertedImports([
@@ -159660,6 +160006,7 @@ function doChange27(changes, sourceFile, start, length2, errorCode) {
159660
160006
  }
159661
160007
  return;
159662
160008
  }
160009
+ // falls through
159663
160010
  case 247 /* WhileStatement */:
159664
160011
  case 248 /* ForStatement */:
159665
160012
  changes.delete(sourceFile, container);
@@ -160924,6 +161271,7 @@ function getDiagnostic(errorCode, token) {
160924
161271
  case Diagnostics.Parameter_0_implicitly_has_an_1_type.code:
160925
161272
  case Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code:
160926
161273
  return isSetAccessorDeclaration(getContainingFunction(token)) ? Diagnostics.Infer_type_of_0_from_usage : Diagnostics.Infer_parameter_types_from_usage;
161274
+ // TODO: GH#18217
160927
161275
  case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
160928
161276
  case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage.code:
160929
161277
  return Diagnostics.Infer_parameter_types_from_usage;
@@ -160962,6 +161310,7 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
160962
161310
  const importAdder = createImportAdder(sourceFile, program, preferences, host);
160963
161311
  errorCode = mapSuggestionDiagnostic(errorCode);
160964
161312
  switch (errorCode) {
161313
+ // Variable and Property declarations
160965
161314
  case Diagnostics.Member_0_implicitly_has_an_1_type.code:
160966
161315
  case Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code:
160967
161316
  if (isVariableDeclaration(parent2) && markSeen(parent2) || isPropertyDeclaration(parent2) || isPropertySignature(parent2)) {
@@ -161002,12 +161351,14 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
161002
161351
  }
161003
161352
  let declaration;
161004
161353
  switch (errorCode) {
161354
+ // Parameter declarations
161005
161355
  case Diagnostics.Parameter_0_implicitly_has_an_1_type.code:
161006
161356
  if (isSetAccessorDeclaration(containingFunction)) {
161007
161357
  annotateSetAccessor(changes, importAdder, sourceFile, containingFunction, program, host, cancellationToken);
161008
161358
  declaration = containingFunction;
161009
161359
  break;
161010
161360
  }
161361
+ // falls through
161011
161362
  case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
161012
161363
  if (markSeen(containingFunction)) {
161013
161364
  const param = cast(parent2, isParameter);
@@ -161015,6 +161366,7 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
161015
161366
  declaration = param;
161016
161367
  }
161017
161368
  break;
161369
+ // Get Accessor declarations
161018
161370
  case Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code:
161019
161371
  case Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code:
161020
161372
  if (isGetAccessorDeclaration(containingFunction) && isIdentifier(containingFunction.name)) {
@@ -161022,12 +161374,14 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
161022
161374
  declaration = containingFunction;
161023
161375
  }
161024
161376
  break;
161377
+ // Set Accessor declarations
161025
161378
  case Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code:
161026
161379
  if (isSetAccessorDeclaration(containingFunction)) {
161027
161380
  annotateSetAccessor(changes, importAdder, sourceFile, containingFunction, program, host, cancellationToken);
161028
161381
  declaration = containingFunction;
161029
161382
  }
161030
161383
  break;
161384
+ // Function 'this'
161031
161385
  case Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code:
161032
161386
  if (ts_textChanges_exports.isThisTypeAnnotatable(containingFunction) && markSeen(containingFunction)) {
161033
161387
  annotateThis(changes, sourceFile, containingFunction, program, host, cancellationToken);
@@ -161409,6 +161763,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161409
161763
  break;
161410
161764
  }
161411
161765
  }
161766
+ // falls through
161412
161767
  default:
161413
161768
  return inferTypeFromContextualType(node, usage);
161414
161769
  }
@@ -161436,16 +161791,25 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161436
161791
  }
161437
161792
  function inferTypeFromBinaryExpression(node, parent2, usage) {
161438
161793
  switch (parent2.operatorToken.kind) {
161794
+ // ExponentiationOperator
161439
161795
  case 43 /* AsteriskAsteriskToken */:
161796
+ // MultiplicativeOperator
161797
+ // falls through
161440
161798
  case 42 /* AsteriskToken */:
161441
161799
  case 44 /* SlashToken */:
161442
161800
  case 45 /* PercentToken */:
161801
+ // ShiftOperator
161802
+ // falls through
161443
161803
  case 48 /* LessThanLessThanToken */:
161444
161804
  case 49 /* GreaterThanGreaterThanToken */:
161445
161805
  case 50 /* GreaterThanGreaterThanGreaterThanToken */:
161806
+ // BitwiseOperator
161807
+ // falls through
161446
161808
  case 51 /* AmpersandToken */:
161447
161809
  case 52 /* BarToken */:
161448
161810
  case 53 /* CaretToken */:
161811
+ // CompoundAssignmentOperator
161812
+ // falls through
161449
161813
  case 66 /* MinusEqualsToken */:
161450
161814
  case 68 /* AsteriskAsteriskEqualsToken */:
161451
161815
  case 67 /* AsteriskEqualsToken */:
@@ -161457,7 +161821,11 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161457
161821
  case 71 /* LessThanLessThanEqualsToken */:
161458
161822
  case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
161459
161823
  case 72 /* GreaterThanGreaterThanEqualsToken */:
161824
+ // AdditiveOperator
161825
+ // falls through
161460
161826
  case 41 /* MinusToken */:
161827
+ // RelationalOperator
161828
+ // falls through
161461
161829
  case 30 /* LessThanToken */:
161462
161830
  case 33 /* LessThanEqualsToken */:
161463
161831
  case 32 /* GreaterThanToken */:
@@ -161483,6 +161851,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161483
161851
  usage.isNumberOrString = true;
161484
161852
  }
161485
161853
  break;
161854
+ // AssignmentOperators
161486
161855
  case 64 /* EqualsToken */:
161487
161856
  case 35 /* EqualsEqualsToken */:
161488
161857
  case 37 /* EqualsEqualsEqualsToken */:
@@ -161498,6 +161867,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161498
161867
  usage.isString = true;
161499
161868
  }
161500
161869
  break;
161870
+ // LogicalOperator Or NullishCoalescing
161501
161871
  case 57 /* BarBarToken */:
161502
161872
  case 61 /* QuestionQuestionToken */:
161503
161873
  if (node === parent2.left && (node.parent.parent.kind === 260 /* VariableDeclaration */ || isAssignmentExpression(
@@ -162002,11 +162372,10 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
162002
162372
  const optional = !!(symbol.flags & 16777216 /* Optional */);
162003
162373
  const ambient = !!(enclosingDeclaration.flags & 33554432 /* Ambient */) || isAmbient;
162004
162374
  const quotePreference = getQuotePreference(sourceFile, preferences);
162375
+ const flags = 1 /* NoTruncation */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
162005
162376
  switch (kind) {
162006
162377
  case 171 /* PropertySignature */:
162007
162378
  case 172 /* PropertyDeclaration */:
162008
- let flags = 1 /* NoTruncation */;
162009
- flags |= quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0;
162010
162379
  let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
162011
162380
  if (importAdder) {
162012
162381
  const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
@@ -162030,8 +162399,7 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
162030
162399
  let typeNode2 = checker.typeToTypeNode(
162031
162400
  type,
162032
162401
  enclosingDeclaration,
162033
- /*flags*/
162034
- void 0,
162402
+ flags,
162035
162403
  /*internalFlags*/
162036
162404
  void 0,
162037
162405
  getNoopSymbolTrackerWithResolver(context)
@@ -165751,6 +166119,7 @@ function getContextualType(previousToken, position, sourceFile, checker) {
165751
166119
  switch (parent2.kind) {
165752
166120
  case 260 /* VariableDeclaration */:
165753
166121
  return checker.getContextualType(parent2.initializer);
166122
+ // TODO: GH#18217
165754
166123
  case 226 /* BinaryExpression */:
165755
166124
  return checker.getTypeAtLocation(parent2.left);
165756
166125
  case 291 /* JsxAttribute */:
@@ -165937,6 +166306,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
165937
166306
  if (!binaryExpressionMayBeOpenTag(parent2)) {
165938
166307
  break;
165939
166308
  }
166309
+ // falls through
165940
166310
  case 285 /* JsxSelfClosingElement */:
165941
166311
  case 284 /* JsxElement */:
165942
166312
  case 286 /* JsxOpeningElement */:
@@ -166556,6 +166926,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166556
166926
  case 28 /* CommaToken */:
166557
166927
  switch (containingNodeKind) {
166558
166928
  case 213 /* CallExpression */:
166929
+ // func( a, |
166559
166930
  case 214 /* NewExpression */: {
166560
166931
  const expression = contextToken.parent.expression;
166561
166932
  if (getLineAndCharacterOfPosition(sourceFile, expression.end).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
@@ -166566,7 +166937,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166566
166937
  case 226 /* BinaryExpression */:
166567
166938
  return { defaultCommitCharacters: noCommaCommitCharacters, isNewIdentifierLocation: true };
166568
166939
  case 176 /* Constructor */:
166940
+ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
166569
166941
  case 184 /* FunctionType */:
166942
+ // var x: (s: string, list|
166570
166943
  case 210 /* ObjectLiteralExpression */:
166571
166944
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166572
166945
  case 209 /* ArrayLiteralExpression */:
@@ -166577,6 +166950,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166577
166950
  case 21 /* OpenParenToken */:
166578
166951
  switch (containingNodeKind) {
166579
166952
  case 213 /* CallExpression */:
166953
+ // func( |
166580
166954
  case 214 /* NewExpression */: {
166581
166955
  const expression = contextToken.parent.expression;
166582
166956
  if (getLineAndCharacterOfPosition(sourceFile, expression.end).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
@@ -166587,6 +166961,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166587
166961
  case 217 /* ParenthesizedExpression */:
166588
166962
  return { defaultCommitCharacters: noCommaCommitCharacters, isNewIdentifierLocation: true };
166589
166963
  case 176 /* Constructor */:
166964
+ // constructor( |
166590
166965
  case 196 /* ParenthesizedType */:
166591
166966
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166592
166967
  default:
@@ -166595,15 +166970,20 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166595
166970
  case 23 /* OpenBracketToken */:
166596
166971
  switch (containingNodeKind) {
166597
166972
  case 209 /* ArrayLiteralExpression */:
166973
+ // [ |
166598
166974
  case 181 /* IndexSignature */:
166975
+ // [ | : string ]
166599
166976
  case 189 /* TupleType */:
166977
+ // [ | : string ]
166600
166978
  case 167 /* ComputedPropertyName */:
166601
166979
  return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: true };
166602
166980
  default:
166603
166981
  return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: false };
166604
166982
  }
166605
166983
  case 144 /* ModuleKeyword */:
166984
+ // module |
166606
166985
  case 145 /* NamespaceKeyword */:
166986
+ // namespace |
166607
166987
  case 102 /* ImportKeyword */:
166608
166988
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166609
166989
  case 25 /* DotToken */:
@@ -166616,6 +166996,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166616
166996
  case 19 /* OpenBraceToken */:
166617
166997
  switch (containingNodeKind) {
166618
166998
  case 263 /* ClassDeclaration */:
166999
+ // class A { |
166619
167000
  case 210 /* ObjectLiteralExpression */:
166620
167001
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166621
167002
  default:
@@ -166624,6 +167005,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166624
167005
  case 64 /* EqualsToken */:
166625
167006
  switch (containingNodeKind) {
166626
167007
  case 260 /* VariableDeclaration */:
167008
+ // const x = a|
166627
167009
  case 226 /* BinaryExpression */:
166628
167010
  return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: true };
166629
167011
  default:
@@ -166878,6 +167260,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166878
167260
  const parent2 = contextToken2.parent;
166879
167261
  switch (contextToken2.kind) {
166880
167262
  case 32 /* GreaterThanToken */:
167263
+ // End of a type argument list
166881
167264
  case 31 /* LessThanSlashToken */:
166882
167265
  case 44 /* SlashToken */:
166883
167266
  case 80 /* Identifier */:
@@ -166900,6 +167283,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166900
167283
  return parent2.parent.parent;
166901
167284
  }
166902
167285
  break;
167286
+ // The context token is the closing } or " of an attribute, which means
167287
+ // its parent is a JsxExpression, whose parent is a JsxAttribute,
167288
+ // whose parent is a JsxOpeningLikeElement
166903
167289
  case 11 /* StringLiteral */:
166904
167290
  if (parent2 && (parent2.kind === 291 /* JsxAttribute */ || parent2.kind === 293 /* JsxSpreadAttribute */)) {
166905
167291
  return parent2.parent.parent;
@@ -166934,14 +167320,18 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166934
167320
  isClassLike(parent2) && !!parent2.typeParameters && parent2.typeParameters.end >= contextToken2.pos;
166935
167321
  case 25 /* DotToken */:
166936
167322
  return containingNodeKind === 207 /* ArrayBindingPattern */;
167323
+ // var [.|
166937
167324
  case 59 /* ColonToken */:
166938
167325
  return containingNodeKind === 208 /* BindingElement */;
167326
+ // var {x :html|
166939
167327
  case 23 /* OpenBracketToken */:
166940
167328
  return containingNodeKind === 207 /* ArrayBindingPattern */;
167329
+ // var [x|
166941
167330
  case 21 /* OpenParenToken */:
166942
167331
  return containingNodeKind === 299 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind);
166943
167332
  case 19 /* OpenBraceToken */:
166944
167333
  return containingNodeKind === 266 /* EnumDeclaration */;
167334
+ // enum a { |
166945
167335
  case 30 /* LessThanToken */:
166946
167336
  return containingNodeKind === 263 /* ClassDeclaration */ || // class A< |
166947
167337
  containingNodeKind === 231 /* ClassExpression */ || // var C = class D< |
@@ -166952,6 +167342,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166952
167342
  return containingNodeKind === 172 /* PropertyDeclaration */ && !isClassLike(parent2.parent);
166953
167343
  case 26 /* DotDotDotToken */:
166954
167344
  return containingNodeKind === 169 /* Parameter */ || !!parent2.parent && parent2.parent.kind === 207 /* ArrayBindingPattern */;
167345
+ // var [...z|
166955
167346
  case 125 /* PublicKeyword */:
166956
167347
  case 123 /* PrivateKeyword */:
166957
167348
  case 124 /* ProtectedKeyword */:
@@ -167178,6 +167569,7 @@ function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile)
167178
167569
  const { parent: parent2 } = contextToken;
167179
167570
  switch (contextToken.kind) {
167180
167571
  case 19 /* OpenBraceToken */:
167572
+ // const x = { |
167181
167573
  case 28 /* CommaToken */:
167182
167574
  if (isObjectLiteralExpression(parent2) || isObjectBindingPattern(parent2)) {
167183
167575
  return parent2;
@@ -167455,9 +167847,11 @@ function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken
167455
167847
  case 64 /* EqualsToken */:
167456
167848
  return void 0;
167457
167849
  case 27 /* SemicolonToken */:
167850
+ // class c {getValue(): number; | }
167458
167851
  case 20 /* CloseBraceToken */:
167459
167852
  return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : tryCast(location, isObjectTypeDeclaration);
167460
167853
  case 19 /* OpenBraceToken */:
167854
+ // class c { |
167461
167855
  case 28 /* CommaToken */:
167462
167856
  return tryCast(contextToken.parent, isObjectTypeDeclaration);
167463
167857
  default:
@@ -167963,6 +168357,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
167963
168357
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 291 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile, typeChecker);
167964
168358
  return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
167965
168359
  }
168360
+ // falls through (is `require("")` or `require(""` or `import("")`)
167966
168361
  case 272 /* ImportDeclaration */:
167967
168362
  case 278 /* ExportDeclaration */:
167968
168363
  case 283 /* ExternalModuleReference */:
@@ -168769,6 +169164,7 @@ function getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, {
168769
169164
  break;
168770
169165
  case 80 /* Identifier */:
168771
169166
  break;
169167
+ // TODO: GH#23879
168772
169168
  case 271 /* ImportEqualsDeclaration */:
168773
169169
  handleNamespaceImport(
168774
169170
  direct,
@@ -169663,6 +170059,7 @@ function declarationIsWriteAccess(decl) {
169663
170059
  case 306 /* EnumMember */:
169664
170060
  case 281 /* ExportSpecifier */:
169665
170061
  case 273 /* ImportClause */:
170062
+ // default import
169666
170063
  case 271 /* ImportEqualsDeclaration */:
169667
170064
  case 276 /* ImportSpecifier */:
169668
170065
  case 264 /* InterfaceDeclaration */:
@@ -170049,6 +170446,7 @@ var Core;
170049
170446
  Debug.assert(node.parent.name === node);
170050
170447
  return 2 /* Class */;
170051
170448
  }
170449
+ // falls through
170052
170450
  default:
170053
170451
  return 0 /* None */;
170054
170452
  }
@@ -170380,6 +170778,7 @@ var Core;
170380
170778
  if (isJSDocMemberName(node.parent)) {
170381
170779
  return true;
170382
170780
  }
170781
+ // falls through I guess
170383
170782
  case 80 /* Identifier */:
170384
170783
  return node.text.length === searchSymbolName.length;
170385
170784
  case 15 /* NoSubstitutionTemplateLiteral */:
@@ -170805,6 +171204,7 @@ var Core;
170805
171204
  searchSpaceNode = searchSpaceNode.parent;
170806
171205
  break;
170807
171206
  }
171207
+ // falls through
170808
171208
  case 172 /* PropertyDeclaration */:
170809
171209
  case 171 /* PropertySignature */:
170810
171210
  case 176 /* Constructor */:
@@ -170817,9 +171217,12 @@ var Core;
170817
171217
  if (isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) {
170818
171218
  return void 0;
170819
171219
  }
171220
+ // falls through
170820
171221
  case 262 /* FunctionDeclaration */:
170821
171222
  case 218 /* FunctionExpression */:
170822
171223
  break;
171224
+ // Computed properties in classes are not handled here because references to this are illegal,
171225
+ // so there is no point finding references to them.
170823
171226
  default:
170824
171227
  return void 0;
170825
171228
  }
@@ -171159,6 +171562,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
171159
171562
  if (!isDefaultClause(node.parent)) {
171160
171563
  break;
171161
171564
  }
171565
+ // falls through
171162
171566
  case 84 /* CaseKeyword */:
171163
171567
  const switchStatement = findAncestor(node.parent, isSwitchStatement);
171164
171568
  if (switchStatement) {
@@ -171603,6 +172007,8 @@ function isDefinitionVisible(checker, declaration) {
171603
172007
  case 178 /* SetAccessor */:
171604
172008
  case 174 /* MethodDeclaration */:
171605
172009
  if (hasEffectiveModifier(declaration, 2 /* Private */)) return false;
172010
+ // Public properties/methods are visible if its parents are visible, so:
172011
+ // falls through
171606
172012
  case 176 /* Constructor */:
171607
172013
  case 303 /* PropertyAssignment */:
171608
172014
  case 304 /* ShorthandPropertyAssignment */:
@@ -172579,6 +172985,7 @@ function getCommentHavingNodes(declaration) {
172579
172985
  if (isJSDocOverloadTag(declaration.parent)) {
172580
172986
  return [declaration.parent.parent];
172581
172987
  }
172988
+ // falls through
172582
172989
  default:
172583
172990
  return getJSDocCommentsAndTags(declaration);
172584
172991
  }
@@ -173916,6 +174323,7 @@ function getOutliningSpanForNode(n, sourceFile) {
173916
174323
  const node = findChildOfKind(tryStatement, 98 /* FinallyKeyword */, sourceFile);
173917
174324
  if (node) return spanForNode(node);
173918
174325
  }
174326
+ // falls through
173919
174327
  default:
173920
174328
  return createOutliningSpan(createTextSpanFromNode(n, sourceFile), "code" /* Code */);
173921
174329
  }
@@ -177741,19 +178149,34 @@ function isBinaryOpContext(context) {
177741
178149
  case 193 /* IntersectionType */:
177742
178150
  case 238 /* SatisfiesExpression */:
177743
178151
  return true;
178152
+ // equals in binding elements: function foo([[x, y] = [1, 2]])
177744
178153
  case 208 /* BindingElement */:
178154
+ // equals in type X = ...
178155
+ // falls through
177745
178156
  case 265 /* TypeAliasDeclaration */:
178157
+ // equal in import a = module('a');
178158
+ // falls through
177746
178159
  case 271 /* ImportEqualsDeclaration */:
178160
+ // equal in export = 1
178161
+ // falls through
177747
178162
  case 277 /* ExportAssignment */:
178163
+ // equal in let a = 0
178164
+ // falls through
177748
178165
  case 260 /* VariableDeclaration */:
178166
+ // equal in p = 0
178167
+ // falls through
177749
178168
  case 169 /* Parameter */:
177750
178169
  case 306 /* EnumMember */:
177751
178170
  case 172 /* PropertyDeclaration */:
177752
178171
  case 171 /* PropertySignature */:
177753
178172
  return context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */;
178173
+ // "in" keyword in for (let x in []) { }
177754
178174
  case 249 /* ForInStatement */:
178175
+ // "in" keyword in [P in keyof T]: T[P]
178176
+ // falls through
177755
178177
  case 168 /* TypeParameter */:
177756
178178
  return context.currentTokenSpan.kind === 103 /* InKeyword */ || context.nextTokenSpan.kind === 103 /* InKeyword */ || context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */;
178179
+ // Technically, "of" is not a binary operator, but format it the same way as "in"
177757
178180
  case 250 /* ForOfStatement */:
177758
178181
  return context.currentTokenSpan.kind === 165 /* OfKeyword */ || context.nextTokenSpan.kind === 165 /* OfKeyword */;
177759
178182
  }
@@ -177817,12 +178240,20 @@ function isFunctionDeclContext(context) {
177817
178240
  case 262 /* FunctionDeclaration */:
177818
178241
  case 174 /* MethodDeclaration */:
177819
178242
  case 173 /* MethodSignature */:
178243
+ // case SyntaxKind.MemberFunctionDeclaration:
178244
+ // falls through
177820
178245
  case 177 /* GetAccessor */:
177821
178246
  case 178 /* SetAccessor */:
178247
+ // case SyntaxKind.MethodSignature:
178248
+ // falls through
177822
178249
  case 179 /* CallSignature */:
177823
178250
  case 218 /* FunctionExpression */:
177824
178251
  case 176 /* Constructor */:
177825
178252
  case 219 /* ArrowFunction */:
178253
+ // case SyntaxKind.ConstructorDeclaration:
178254
+ // case SyntaxKind.SimpleArrowFunctionExpression:
178255
+ // case SyntaxKind.ParenthesizedArrowFunctionExpression:
178256
+ // falls through
177826
178257
  case 264 /* InterfaceDeclaration */:
177827
178258
  return true;
177828
178259
  }
@@ -177882,6 +178313,9 @@ function isControlDeclContext(context) {
177882
178313
  case 258 /* TryStatement */:
177883
178314
  case 246 /* DoStatement */:
177884
178315
  case 254 /* WithStatement */:
178316
+ // TODO
178317
+ // case SyntaxKind.ElseClause:
178318
+ // falls through
177885
178319
  case 299 /* CatchClause */:
177886
178320
  return true;
177887
178321
  default:
@@ -178510,6 +178944,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178510
178944
  if (node.asteriskToken) {
178511
178945
  return 42 /* AsteriskToken */;
178512
178946
  }
178947
+ // falls through
178513
178948
  case 172 /* PropertyDeclaration */:
178514
178949
  case 169 /* Parameter */:
178515
178950
  const name = getNameOfDeclaration(node);
@@ -178522,6 +178957,10 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178522
178957
  return {
178523
178958
  getIndentationForComment: (kind, tokenIndentation, container) => {
178524
178959
  switch (kind) {
178960
+ // preceding comment to the token that closes the indentation scope inherits the indentation from the scope
178961
+ // .. {
178962
+ // // comment
178963
+ // }
178525
178964
  case 20 /* CloseBraceToken */:
178526
178965
  case 24 /* CloseBracketToken */:
178527
178966
  case 22 /* CloseParenToken */:
@@ -178551,6 +178990,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178551
178990
  };
178552
178991
  function shouldAddDelta(line, kind, container) {
178553
178992
  switch (kind) {
178993
+ // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent
178554
178994
  case 19 /* OpenBraceToken */:
178555
178995
  case 20 /* CloseBraceToken */:
178556
178996
  case 22 /* CloseParenToken */:
@@ -180407,7 +180847,6 @@ __export(ts_exports2, {
180407
180847
  getAllKeys: () => getAllKeys,
180408
180848
  getAllProjectOutputs: () => getAllProjectOutputs,
180409
180849
  getAllSuperTypeNodes: () => getAllSuperTypeNodes,
180410
- getAllowImportingTsExtensions: () => getAllowImportingTsExtensions,
180411
180850
  getAllowJSCompilerOption: () => getAllowJSCompilerOption,
180412
180851
  getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports,
180413
180852
  getAncestor: () => getAncestor,
@@ -181894,6 +182333,7 @@ __export(ts_exports2, {
181894
182333
  tagNamesAreEquivalent: () => tagNamesAreEquivalent,
181895
182334
  takeWhile: () => takeWhile,
181896
182335
  targetOptionDeclaration: () => targetOptionDeclaration,
182336
+ targetToLibMap: () => targetToLibMap,
181897
182337
  testFormatSettings: () => testFormatSettings,
181898
182338
  textChangeRangeIsUnchanged: () => textChangeRangeIsUnchanged,
181899
182339
  textChangeRangeNewSpan: () => textChangeRangeNewSpan,
@@ -183680,6 +184120,7 @@ var Project2 = class _Project {
183680
184120
  this.globalCacheResolutionModuleName = ts_JsTyping_exports.nonRelativeModuleNameForTypingCache;
183681
184121
  /** @internal */
183682
184122
  this.updateFromProjectInProgress = false;
184123
+ projectService.logger.info(`Creating ${ProjectKind[projectKind]}Project: ${projectName}, currentDirectory: ${currentDirectory}`);
183683
184124
  this.projectName = projectName;
183684
184125
  this.directoryStructureHost = directoryStructureHost;
183685
184126
  this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
@@ -184604,7 +185045,7 @@ var Project2 = class _Project {
184604
185045
  }
184605
185046
  removeExistingTypings(include) {
184606
185047
  if (!include.length) return include;
184607
- const existing = getAutomaticTypeDirectiveNames(this.getCompilerOptions(), this.directoryStructureHost);
185048
+ const existing = getAutomaticTypeDirectiveNames(this.getCompilerOptions(), this);
184608
185049
  return filter(include, (i) => !existing.includes(i));
184609
185050
  }
184610
185051
  updateGraphWorker() {
@@ -186479,6 +186920,9 @@ var _ProjectService = class _ProjectService {
186479
186920
  this.toCanonicalFileName = createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
186480
186921
  this.globalCacheLocationDirectoryPath = this.typingsInstaller.globalTypingsCacheLocation ? ensureTrailingDirectorySeparator(this.toPath(this.typingsInstaller.globalTypingsCacheLocation)) : void 0;
186481
186922
  this.throttledOperations = new ThrottledOperations(this.host, this.logger);
186923
+ this.logger.info(`currentDirectory:: ${this.host.getCurrentDirectory()} useCaseSensitiveFileNames:: ${this.host.useCaseSensitiveFileNames}`);
186924
+ this.logger.info(`libs Location:: ${getDirectoryPath(this.host.getExecutingFilePath())}`);
186925
+ this.logger.info(`globalTypingsCacheLocation:: ${this.typingsInstaller.globalTypingsCacheLocation}`);
186482
186926
  if (this.typesMapLocation) {
186483
186927
  this.loadTypesMap();
186484
186928
  } else {
@@ -187546,7 +187990,6 @@ var _ProjectService = class _ProjectService {
187546
187990
  createConfiguredProject(configFileName, reason) {
187547
187991
  var _a;
187548
187992
  (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.Session, "createConfiguredProject", { configFilePath: configFileName });
187549
- this.logger.info(`Creating configuration project ${configFileName}`);
187550
187993
  const canonicalConfigFilePath = asNormalizedPath(this.toCanonicalFileName(configFileName));
187551
187994
  let configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
187552
187995
  if (!configFileExistenceInfo) {
@@ -189465,9 +189908,11 @@ Dynamic files must always be opened with service's current directory or service
189465
189908
  const result = [];
189466
189909
  const processDirectory = (directory) => {
189467
189910
  switch (packageJsonCache.directoryHasPackageJson(directory)) {
189911
+ // Sync and check same directory again
189468
189912
  case 3 /* Maybe */:
189469
189913
  packageJsonCache.searchDirectoryAndAncestors(directory);
189470
189914
  return processDirectory(directory);
189915
+ // Check package.json
189471
189916
  case -1 /* True */:
189472
189917
  const packageJsonFileName = combinePaths(directory, "package.json");
189473
189918
  this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project);
@@ -194766,7 +195211,6 @@ if (typeof console !== "undefined") {
194766
195211
  getAllKeys,
194767
195212
  getAllProjectOutputs,
194768
195213
  getAllSuperTypeNodes,
194769
- getAllowImportingTsExtensions,
194770
195214
  getAllowJSCompilerOption,
194771
195215
  getAllowSyntheticDefaultImports,
194772
195216
  getAncestor,
@@ -196253,6 +196697,7 @@ if (typeof console !== "undefined") {
196253
196697
  tagNamesAreEquivalent,
196254
196698
  takeWhile,
196255
196699
  targetOptionDeclaration,
196700
+ targetToLibMap,
196256
196701
  testFormatSettings,
196257
196702
  textChangeRangeIsUnchanged,
196258
196703
  textChangeRangeNewSpan,