@typescript-deploys/pr-build 5.7.0-pr-59736-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
@@ -2119,6 +2119,7 @@ __export(typescript_exports, {
2119
2119
  tagNamesAreEquivalent: () => tagNamesAreEquivalent,
2120
2120
  takeWhile: () => takeWhile,
2121
2121
  targetOptionDeclaration: () => targetOptionDeclaration,
2122
+ targetToLibMap: () => targetToLibMap,
2122
2123
  testFormatSettings: () => testFormatSettings,
2123
2124
  textChangeRangeIsUnchanged: () => textChangeRangeIsUnchanged,
2124
2125
  textChangeRangeNewSpan: () => textChangeRangeNewSpan,
@@ -2265,7 +2266,7 @@ module.exports = __toCommonJS(typescript_exports);
2265
2266
 
2266
2267
  // src/compiler/corePublic.ts
2267
2268
  var versionMajorMinor = "5.7";
2268
- var version = `${versionMajorMinor}.0-insiders.20240827`;
2269
+ var version = `${versionMajorMinor}.0-insiders.20240904`;
2269
2270
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2270
2271
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2271
2272
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -2733,7 +2734,10 @@ function deduplicateSorted(array, comparer) {
2733
2734
  for (let i = 1; i < array.length; i++) {
2734
2735
  const next = array[i];
2735
2736
  switch (comparer(next, last2)) {
2737
+ // equality comparison
2736
2738
  case true:
2739
+ // relational comparison
2740
+ // falls through
2737
2741
  case 0 /* EqualTo */:
2738
2742
  continue;
2739
2743
  case -1 /* LessThan */:
@@ -3618,7 +3622,7 @@ function findBestPatternMatch(values, getPattern, candidate) {
3618
3622
  for (let i = 0; i < values.length; i++) {
3619
3623
  const v = values[i];
3620
3624
  const pattern = getPattern(v);
3621
- if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
3625
+ if (pattern.prefix.length > longestMatchPrefixLength && isPatternMatch(pattern, candidate)) {
3622
3626
  longestMatchPrefixLength = pattern.prefix.length;
3623
3627
  matchedValue = v;
3624
3628
  }
@@ -5854,10 +5858,11 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind5) => {
5854
5858
  SyntaxKind5[SyntaxKind5["JSDocImportTag"] = 351] = "JSDocImportTag";
5855
5859
  SyntaxKind5[SyntaxKind5["SyntaxList"] = 352] = "SyntaxList";
5856
5860
  SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 353] = "NotEmittedStatement";
5857
- SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 354] = "PartiallyEmittedExpression";
5858
- SyntaxKind5[SyntaxKind5["CommaListExpression"] = 355] = "CommaListExpression";
5859
- SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 356] = "SyntheticReferenceExpression";
5860
- 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";
5861
5866
  SyntaxKind5[SyntaxKind5["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
5862
5867
  SyntaxKind5[SyntaxKind5["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
5863
5868
  SyntaxKind5[SyntaxKind5["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
@@ -7997,6 +8002,7 @@ function createSystemWatchFunctions({
7997
8002
  return generateWatchFileOptions(4 /* UseFsEvents */, 2 /* DynamicPriority */, options);
7998
8003
  case "UseFsEventsOnParentDirectory":
7999
8004
  useNonPollingWatchers2 = true;
8005
+ // fall through
8000
8006
  default:
8001
8007
  return useNonPollingWatchers2 ? (
8002
8008
  // Use notifications from FS to watch with falling back to fs.watchFile
@@ -11538,6 +11544,7 @@ function computeLineStarts(text) {
11538
11544
  if (text.charCodeAt(pos) === 10 /* lineFeed */) {
11539
11545
  pos++;
11540
11546
  }
11547
+ // falls through
11541
11548
  case 10 /* lineFeed */:
11542
11549
  result.push(lineStart);
11543
11550
  lineStart = pos;
@@ -11640,6 +11647,8 @@ function couldStartTrivia(text, pos) {
11640
11647
  case 12 /* formFeed */:
11641
11648
  case 32 /* space */:
11642
11649
  case 47 /* slash */:
11650
+ // starts of normal trivia
11651
+ // falls through
11643
11652
  case 60 /* lessThan */:
11644
11653
  case 124 /* bar */:
11645
11654
  case 61 /* equals */:
@@ -11663,6 +11672,7 @@ function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments, inJSDoc) {
11663
11672
  if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
11664
11673
  pos++;
11665
11674
  }
11675
+ // falls through
11666
11676
  case 10 /* lineFeed */:
11667
11677
  pos++;
11668
11678
  if (stopAfterLineBreak) {
@@ -11809,6 +11819,7 @@ function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
11809
11819
  if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
11810
11820
  pos++;
11811
11821
  }
11822
+ // falls through
11812
11823
  case 10 /* lineFeed */:
11813
11824
  pos++;
11814
11825
  if (trailing) {
@@ -12374,12 +12385,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12374
12385
  if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
12375
12386
  return "\0";
12376
12387
  }
12388
+ // '\01', '\011'
12389
+ // falls through
12377
12390
  case 49 /* _1 */:
12378
12391
  case 50 /* _2 */:
12379
12392
  case 51 /* _3 */:
12380
12393
  if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
12381
12394
  pos++;
12382
12395
  }
12396
+ // '\17', '\177'
12397
+ // falls through
12383
12398
  case 52 /* _4 */:
12384
12399
  case 53 /* _5 */:
12385
12400
  case 54 /* _6 */:
@@ -12477,10 +12492,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12477
12492
  }
12478
12493
  tokenFlags |= 4096 /* HexEscape */;
12479
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".
12480
12497
  case 13 /* carriageReturn */:
12481
12498
  if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
12482
12499
  pos++;
12483
12500
  }
12501
+ // falls through
12484
12502
  case 10 /* lineFeed */:
12485
12503
  case 8232 /* lineSeparator */:
12486
12504
  case 8233 /* paragraphSeparator */:
@@ -12911,6 +12929,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12911
12929
  tokenFlags |= 256 /* OctalSpecifier */;
12912
12930
  return token = checkBigIntSuffix();
12913
12931
  }
12932
+ // falls through
12914
12933
  case 49 /* _1 */:
12915
12934
  case 50 /* _2 */:
12916
12935
  case 51 /* _3 */:
@@ -13430,6 +13449,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13430
13449
  break;
13431
13450
  }
13432
13451
  }
13452
+ // falls through
13433
13453
  case 42 /* asterisk */:
13434
13454
  case 43 /* plus */:
13435
13455
  case 63 /* question */:
@@ -13460,6 +13480,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13460
13480
  if (isInGroup) {
13461
13481
  return;
13462
13482
  }
13483
+ // falls through
13463
13484
  case 93 /* closeBracket */:
13464
13485
  case 125 /* closeBrace */:
13465
13486
  if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
@@ -13522,6 +13543,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13522
13543
  error2(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
13523
13544
  break;
13524
13545
  }
13546
+ // falls through
13525
13547
  default:
13526
13548
  Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
13527
13549
  /*atomEscape*/
@@ -13659,6 +13681,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13659
13681
  let start2 = pos;
13660
13682
  let operand;
13661
13683
  switch (text.slice(pos, pos + 2)) {
13684
+ // TODO: don't use slice
13662
13685
  case "--":
13663
13686
  case "&&":
13664
13687
  error2(Diagnostics.Expected_a_class_set_operand);
@@ -13764,6 +13787,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13764
13787
  }
13765
13788
  start2 = pos;
13766
13789
  switch (text.slice(pos, pos + 2)) {
13790
+ // TODO: don't use slice
13767
13791
  case "--":
13768
13792
  case "&&":
13769
13793
  error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
@@ -13861,6 +13885,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13861
13885
  }
13862
13886
  }
13863
13887
  pos--;
13888
+ // falls through
13864
13889
  default:
13865
13890
  return scanClassSetCharacter();
13866
13891
  }
@@ -14007,6 +14032,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14007
14032
  return true;
14008
14033
  case 80 /* P */:
14009
14034
  isCharacterComplement = true;
14035
+ // falls through
14010
14036
  case 112 /* p */:
14011
14037
  pos++;
14012
14038
  if (charCodeChecked(pos) === 123 /* openBrace */) {
@@ -14314,6 +14340,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14314
14340
  if (charCodeUnchecked(pos) === 10 /* lineFeed */) {
14315
14341
  pos++;
14316
14342
  }
14343
+ // falls through
14317
14344
  case 10 /* lineFeed */:
14318
14345
  tokenFlags |= 1 /* PrecedingLineBreak */;
14319
14346
  return token = 4 /* NewLineTrivia */;
@@ -14518,28 +14545,33 @@ function isExternalModuleNameRelative(moduleName) {
14518
14545
  function sortAndDeduplicateDiagnostics(diagnostics) {
14519
14546
  return sortAndDeduplicate(diagnostics, compareDiagnostics, diagnosticsEqualityComparer);
14520
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
+ ]);
14521
14561
  function getDefaultLibFileName(options) {
14522
- switch (getEmitScriptTarget(options)) {
14562
+ const target = getEmitScriptTarget(options);
14563
+ switch (target) {
14523
14564
  case 99 /* ESNext */:
14524
- return "lib.esnext.full.d.ts";
14525
14565
  case 10 /* ES2023 */:
14526
- return "lib.es2023.full.d.ts";
14527
14566
  case 9 /* ES2022 */:
14528
- return "lib.es2022.full.d.ts";
14529
14567
  case 8 /* ES2021 */:
14530
- return "lib.es2021.full.d.ts";
14531
14568
  case 7 /* ES2020 */:
14532
- return "lib.es2020.full.d.ts";
14533
14569
  case 6 /* ES2019 */:
14534
- return "lib.es2019.full.d.ts";
14535
14570
  case 5 /* ES2018 */:
14536
- return "lib.es2018.full.d.ts";
14537
14571
  case 4 /* ES2017 */:
14538
- return "lib.es2017.full.d.ts";
14539
14572
  case 3 /* ES2016 */:
14540
- return "lib.es2016.full.d.ts";
14541
14573
  case 2 /* ES2015 */:
14542
- return "lib.es6.d.ts";
14574
+ return targetToLibMap.get(target);
14543
14575
  default:
14544
14576
  return "lib.d.ts";
14545
14577
  }
@@ -15480,7 +15512,7 @@ function isModifierLike(node) {
15480
15512
  }
15481
15513
  function isTypeElement(node) {
15482
15514
  const kind = node.kind;
15483
- 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 */;
15484
15516
  }
15485
15517
  function isClassOrTypeElement(node) {
15486
15518
  return isTypeElement(node) || isClassElement(node);
@@ -15542,7 +15574,9 @@ function isObjectBindingOrAssignmentElement(node) {
15542
15574
  switch (node.kind) {
15543
15575
  case 208 /* BindingElement */:
15544
15576
  case 303 /* PropertyAssignment */:
15577
+ // AssignmentProperty
15545
15578
  case 304 /* ShorthandPropertyAssignment */:
15579
+ // AssignmentProperty
15546
15580
  case 305 /* SpreadAssignment */:
15547
15581
  return true;
15548
15582
  }
@@ -15560,11 +15594,17 @@ function isArrayBindingOrAssignmentElement(node) {
15560
15594
  switch (node.kind) {
15561
15595
  case 208 /* BindingElement */:
15562
15596
  case 232 /* OmittedExpression */:
15597
+ // Elision
15563
15598
  case 230 /* SpreadElement */:
15599
+ // AssignmentRestElement
15564
15600
  case 209 /* ArrayLiteralExpression */:
15601
+ // ArrayAssignmentPattern
15565
15602
  case 210 /* ObjectLiteralExpression */:
15603
+ // ObjectAssignmentPattern
15566
15604
  case 80 /* Identifier */:
15605
+ // DestructuringAssignmentTarget
15567
15606
  case 211 /* PropertyAccessExpression */:
15607
+ // DestructuringAssignmentTarget
15568
15608
  case 212 /* ElementAccessExpression */:
15569
15609
  return true;
15570
15610
  }
@@ -15625,6 +15665,7 @@ function isLeftHandSideExpressionKind(kind) {
15625
15665
  case 218 /* FunctionExpression */:
15626
15666
  case 80 /* Identifier */:
15627
15667
  case 81 /* PrivateIdentifier */:
15668
+ // technically this is only an Expression if it's in a `#field in expr` BinaryExpression
15628
15669
  case 14 /* RegularExpressionLiteral */:
15629
15670
  case 9 /* NumericLiteral */:
15630
15671
  case 10 /* BigIntLiteral */:
@@ -15640,6 +15681,7 @@ function isLeftHandSideExpressionKind(kind) {
15640
15681
  case 233 /* ExpressionWithTypeArguments */:
15641
15682
  case 236 /* MetaProperty */:
15642
15683
  case 102 /* ImportKeyword */:
15684
+ // technically this is only an Expression if it's in a CallExpression
15643
15685
  case 282 /* MissingDeclaration */:
15644
15686
  return true;
15645
15687
  default:
@@ -15696,8 +15738,8 @@ function isExpressionKind(kind) {
15696
15738
  case 230 /* SpreadElement */:
15697
15739
  case 234 /* AsExpression */:
15698
15740
  case 232 /* OmittedExpression */:
15699
- case 355 /* CommaListExpression */:
15700
- case 354 /* PartiallyEmittedExpression */:
15741
+ case 356 /* CommaListExpression */:
15742
+ case 355 /* PartiallyEmittedExpression */:
15701
15743
  case 238 /* SatisfiesExpression */:
15702
15744
  return true;
15703
15745
  default:
@@ -17436,6 +17478,8 @@ function getErrorSpanForNode(sourceFile, node) {
17436
17478
  }
17437
17479
  return getSpanOfTokenAtPosition(sourceFile, pos2);
17438
17480
  }
17481
+ // This list is a work in progress. Add missing node kinds to improve their error
17482
+ // spans.
17439
17483
  case 260 /* VariableDeclaration */:
17440
17484
  case 208 /* BindingElement */:
17441
17485
  case 263 /* ClassDeclaration */:
@@ -17607,6 +17651,8 @@ function isPartOfTypeNode(node) {
17607
17651
  return isPartOfTypeExpressionWithTypeArguments(node);
17608
17652
  case 168 /* TypeParameter */:
17609
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
17610
17656
  case 80 /* Identifier */:
17611
17657
  if (node.parent.kind === 166 /* QualifiedName */ && node.parent.right === node) {
17612
17658
  node = node.parent;
@@ -17614,6 +17660,7 @@ function isPartOfTypeNode(node) {
17614
17660
  node = node.parent;
17615
17661
  }
17616
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
17617
17664
  case 166 /* QualifiedName */:
17618
17665
  case 211 /* PropertyAccessExpression */:
17619
17666
  case 110 /* ThisKeyword */: {
@@ -17882,6 +17929,7 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
17882
17929
  if (!includeArrowFunctions) {
17883
17930
  continue;
17884
17931
  }
17932
+ // falls through
17885
17933
  case 262 /* FunctionDeclaration */:
17886
17934
  case 218 /* FunctionExpression */:
17887
17935
  case 267 /* ModuleDeclaration */:
@@ -17904,6 +17952,8 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
17904
17952
  }
17905
17953
  function isThisContainerOrFunctionBlock(node) {
17906
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
17907
17957
  case 219 /* ArrowFunction */:
17908
17958
  case 262 /* FunctionDeclaration */:
17909
17959
  case 218 /* FunctionExpression */:
@@ -17970,6 +18020,7 @@ function getSuperContainer(node, stopOnFunctions) {
17970
18020
  if (!stopOnFunctions) {
17971
18021
  continue;
17972
18022
  }
18023
+ // falls through
17973
18024
  case 172 /* PropertyDeclaration */:
17974
18025
  case 171 /* PropertySignature */:
17975
18026
  case 174 /* MethodDeclaration */:
@@ -18023,6 +18074,7 @@ function getEntityNameFromTypeNode(node) {
18023
18074
  return node.typeName;
18024
18075
  case 233 /* ExpressionWithTypeArguments */:
18025
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.
18026
18078
  case 80 /* Identifier */:
18027
18079
  case 166 /* QualifiedName */:
18028
18080
  return node;
@@ -18187,6 +18239,7 @@ function isExpressionNode(node) {
18187
18239
  if (node.parent.kind === 186 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) {
18188
18240
  return true;
18189
18241
  }
18242
+ // falls through
18190
18243
  case 9 /* NumericLiteral */:
18191
18244
  case 10 /* BigIntLiteral */:
18192
18245
  case 11 /* StringLiteral */:
@@ -19101,6 +19154,7 @@ function getDeclarationFromName(name) {
19101
19154
  case 15 /* NoSubstitutionTemplateLiteral */:
19102
19155
  case 9 /* NumericLiteral */:
19103
19156
  if (isComputedPropertyName(parent2)) return parent2.parent;
19157
+ // falls through
19104
19158
  case 80 /* Identifier */:
19105
19159
  if (isDeclaration(parent2)) {
19106
19160
  return parent2.name === name ? parent2 : void 0;
@@ -19271,6 +19325,7 @@ function getFunctionFlags(node) {
19271
19325
  if (node.asteriskToken) {
19272
19326
  flags |= 1 /* Generator */;
19273
19327
  }
19328
+ // falls through
19274
19329
  case 219 /* ArrowFunction */:
19275
19330
  if (hasSyntacticModifier(node, 1024 /* Async */)) {
19276
19331
  flags |= 2 /* Async */;
@@ -19541,7 +19596,7 @@ var OperatorPrecedence = /* @__PURE__ */ ((OperatorPrecedence2) => {
19541
19596
  })(OperatorPrecedence || {});
19542
19597
  function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
19543
19598
  switch (nodeKind) {
19544
- case 355 /* CommaListExpression */:
19599
+ case 356 /* CommaListExpression */:
19545
19600
  return 0 /* Comma */;
19546
19601
  case 230 /* SpreadElement */:
19547
19602
  return 1 /* Spread */;
@@ -19573,6 +19628,7 @@ function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
19573
19628
  default:
19574
19629
  return getBinaryOperatorPrecedence(operatorKind);
19575
19630
  }
19631
+ // TODO: Should prefix `++` and `--` be moved to the `Update` precedence?
19576
19632
  case 216 /* TypeAssertionExpression */:
19577
19633
  case 235 /* NonNullExpression */:
19578
19634
  case 224 /* PrefixUnaryExpression */:
@@ -21207,11 +21263,12 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
21207
21263
  if (stopAtCallExpressions) {
21208
21264
  return node;
21209
21265
  }
21266
+ // falls through
21210
21267
  case 234 /* AsExpression */:
21211
21268
  case 212 /* ElementAccessExpression */:
21212
21269
  case 211 /* PropertyAccessExpression */:
21213
21270
  case 235 /* NonNullExpression */:
21214
- case 354 /* PartiallyEmittedExpression */:
21271
+ case 355 /* PartiallyEmittedExpression */:
21215
21272
  case 238 /* SatisfiesExpression */:
21216
21273
  node = node.expression;
21217
21274
  continue;
@@ -22385,8 +22442,33 @@ function tryParsePattern(pattern) {
22385
22442
  suffix: pattern.substr(indexOfStar + 1)
22386
22443
  };
22387
22444
  }
22445
+ var parsedPatternsCache = /* @__PURE__ */ new WeakMap();
22388
22446
  function tryParsePatterns(paths) {
22389
- 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;
22390
22472
  }
22391
22473
  function positionIsSynthesized(pos) {
22392
22474
  return !(pos >= 0);
@@ -22414,15 +22496,13 @@ var emptyFileSystemEntries = {
22414
22496
  files: emptyArray,
22415
22497
  directories: emptyArray
22416
22498
  };
22417
- function matchPatternOrExact(patternOrStrings, candidate) {
22418
- const patterns = [];
22419
- for (const patternOrString of patternOrStrings) {
22420
- if (patternOrString === candidate) {
22421
- return candidate;
22422
- }
22423
- if (!isString(patternOrString)) {
22424
- patterns.push(patternOrString);
22425
- }
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;
22426
22506
  }
22427
22507
  return findBestPatternMatch(patterns, (_) => _, candidate);
22428
22508
  }
@@ -22499,6 +22579,7 @@ function isJsonEqual(a, b) {
22499
22579
  function parsePseudoBigInt(stringValue) {
22500
22580
  let log2Base;
22501
22581
  switch (stringValue.charCodeAt(1)) {
22582
+ // "x" in "0x123"
22502
22583
  case 98 /* b */:
22503
22584
  case 66 /* B */:
22504
22585
  log2Base = 1;
@@ -22746,7 +22827,7 @@ function getContainingNodeArray(node) {
22746
22827
  return parent2.types;
22747
22828
  case 189 /* TupleType */:
22748
22829
  case 209 /* ArrayLiteralExpression */:
22749
- case 355 /* CommaListExpression */:
22830
+ case 356 /* CommaListExpression */:
22750
22831
  case 275 /* NamedImports */:
22751
22832
  case 279 /* NamedExports */:
22752
22833
  return parent2.elements;
@@ -23285,6 +23366,7 @@ function createNameResolver({
23285
23366
  switch (location.kind) {
23286
23367
  case 307 /* SourceFile */:
23287
23368
  if (!isExternalOrCommonJsModule(location)) break;
23369
+ // falls through
23288
23370
  case 267 /* ModuleDeclaration */:
23289
23371
  const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
23290
23372
  if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
@@ -23368,6 +23450,14 @@ function createNameResolver({
23368
23450
  }
23369
23451
  }
23370
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
+ //
23371
23461
  case 167 /* ComputedPropertyName */:
23372
23462
  grandparent = location.parent.parent;
23373
23463
  if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
@@ -23383,6 +23473,7 @@ function createNameResolver({
23383
23473
  if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
23384
23474
  break;
23385
23475
  }
23476
+ // falls through
23386
23477
  case 174 /* MethodDeclaration */:
23387
23478
  case 176 /* Constructor */:
23388
23479
  case 177 /* GetAccessor */:
@@ -24027,6 +24118,7 @@ function createParenthesizerRules(factory2) {
24027
24118
  function parenthesizeConstituentTypeOfUnionType(type) {
24028
24119
  switch (type.kind) {
24029
24120
  case 192 /* UnionType */:
24121
+ // Not strictly necessary, but a union containing a union should have been flattened
24030
24122
  case 193 /* IntersectionType */:
24031
24123
  return factory2.createParenthesizedType(type);
24032
24124
  }
@@ -24808,6 +24900,7 @@ function createNodeFactory(flags, baseFactory2) {
24808
24900
  createSyntheticExpression,
24809
24901
  createSyntaxList: createSyntaxList3,
24810
24902
  createNotEmittedStatement,
24903
+ createNotEmittedTypeElement,
24811
24904
  createPartiallyEmittedExpression,
24812
24905
  updatePartiallyEmittedExpression,
24813
24906
  createCommaListExpression,
@@ -27834,7 +27927,7 @@ function createNodeFactory(flags, baseFactory2) {
27834
27927
  return node;
27835
27928
  }
27836
27929
  function createPartiallyEmittedExpression(expression, original) {
27837
- const node = createBaseNode(354 /* PartiallyEmittedExpression */);
27930
+ const node = createBaseNode(355 /* PartiallyEmittedExpression */);
27838
27931
  node.expression = expression;
27839
27932
  node.original = original;
27840
27933
  node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
@@ -27844,6 +27937,9 @@ function createNodeFactory(flags, baseFactory2) {
27844
27937
  function updatePartiallyEmittedExpression(node, expression) {
27845
27938
  return node.expression !== expression ? update(createPartiallyEmittedExpression(expression, node.original), node) : node;
27846
27939
  }
27940
+ function createNotEmittedTypeElement() {
27941
+ return createBaseNode(354 /* NotEmittedTypeElement */);
27942
+ }
27847
27943
  function flattenCommaElements(node) {
27848
27944
  if (nodeIsSynthesized(node) && !isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
27849
27945
  if (isCommaListExpression(node)) {
@@ -27856,7 +27952,7 @@ function createNodeFactory(flags, baseFactory2) {
27856
27952
  return node;
27857
27953
  }
27858
27954
  function createCommaListExpression(elements) {
27859
- const node = createBaseNode(355 /* CommaListExpression */);
27955
+ const node = createBaseNode(356 /* CommaListExpression */);
27860
27956
  node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
27861
27957
  node.transformFlags |= propagateChildrenFlags(node.elements);
27862
27958
  return node;
@@ -27865,7 +27961,7 @@ function createNodeFactory(flags, baseFactory2) {
27865
27961
  return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
27866
27962
  }
27867
27963
  function createSyntheticReferenceExpression(expression, thisArg) {
27868
- const node = createBaseNode(356 /* SyntheticReferenceExpression */);
27964
+ const node = createBaseNode(357 /* SyntheticReferenceExpression */);
27869
27965
  node.expression = expression;
27870
27966
  node.thisArg = thisArg;
27871
27967
  node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
@@ -28112,7 +28208,7 @@ function createNodeFactory(flags, baseFactory2) {
28112
28208
  return updateNonNullExpression(outerExpression, expression);
28113
28209
  case 233 /* ExpressionWithTypeArguments */:
28114
28210
  return updateExpressionWithTypeArguments(outerExpression, expression, outerExpression.typeArguments);
28115
- case 354 /* PartiallyEmittedExpression */:
28211
+ case 355 /* PartiallyEmittedExpression */:
28116
28212
  return updatePartiallyEmittedExpression(outerExpression, expression);
28117
28213
  }
28118
28214
  }
@@ -28657,7 +28753,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
28657
28753
  case 216 /* TypeAssertionExpression */:
28658
28754
  case 238 /* SatisfiesExpression */:
28659
28755
  case 234 /* AsExpression */:
28660
- case 354 /* PartiallyEmittedExpression */:
28756
+ case 355 /* PartiallyEmittedExpression */:
28661
28757
  case 217 /* ParenthesizedExpression */:
28662
28758
  case 108 /* SuperKeyword */:
28663
28759
  return -2147483648 /* OuterExpressionExcludes */;
@@ -30366,10 +30462,10 @@ function isSyntheticExpression(node) {
30366
30462
  return node.kind === 237 /* SyntheticExpression */;
30367
30463
  }
30368
30464
  function isPartiallyEmittedExpression(node) {
30369
- return node.kind === 354 /* PartiallyEmittedExpression */;
30465
+ return node.kind === 355 /* PartiallyEmittedExpression */;
30370
30466
  }
30371
30467
  function isCommaListExpression(node) {
30372
- return node.kind === 355 /* CommaListExpression */;
30468
+ return node.kind === 356 /* CommaListExpression */;
30373
30469
  }
30374
30470
  function isTemplateSpan(node) {
30375
30471
  return node.kind === 239 /* TemplateSpan */;
@@ -30525,7 +30621,7 @@ function isNotEmittedStatement(node) {
30525
30621
  return node.kind === 353 /* NotEmittedStatement */;
30526
30622
  }
30527
30623
  function isSyntheticReference(node) {
30528
- return node.kind === 356 /* SyntheticReferenceExpression */;
30624
+ return node.kind === 357 /* SyntheticReferenceExpression */;
30529
30625
  }
30530
30626
  function isExternalModuleReference(node) {
30531
30627
  return node.kind === 283 /* ExternalModuleReference */;
@@ -31148,7 +31244,7 @@ function isOuterExpression(node, kinds = 31 /* All */) {
31148
31244
  return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
31149
31245
  case 235 /* NonNullExpression */:
31150
31246
  return (kinds & 4 /* NonNullAssertions */) !== 0;
31151
- case 354 /* PartiallyEmittedExpression */:
31247
+ case 355 /* PartiallyEmittedExpression */:
31152
31248
  return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
31153
31249
  }
31154
31250
  return false;
@@ -31592,10 +31688,13 @@ var BinaryExpressionState;
31592
31688
  switch (currentState) {
31593
31689
  case enter:
31594
31690
  if (machine.onLeft) return left;
31691
+ // falls through
31595
31692
  case left:
31596
31693
  if (machine.onOperator) return operator;
31694
+ // falls through
31597
31695
  case operator:
31598
31696
  if (machine.onRight) return right;
31697
+ // falls through
31599
31698
  case right:
31600
31699
  return exit;
31601
31700
  case exit:
@@ -32223,7 +32322,7 @@ var forEachChildTable = {
32223
32322
  [282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
32224
32323
  return visitNodes(cbNode, cbNodes, node.modifiers);
32225
32324
  },
32226
- [355 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
32325
+ [356 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
32227
32326
  return visitNodes(cbNode, cbNodes, node.elements);
32228
32327
  },
32229
32328
  [284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
@@ -32319,7 +32418,7 @@ var forEachChildTable = {
32319
32418
  [331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
32320
32419
  [337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
32321
32420
  [351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
32322
- [354 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
32421
+ [355 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
32323
32422
  };
32324
32423
  function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
32325
32424
  return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
@@ -32689,6 +32788,7 @@ var Parser;
32689
32788
  expression2 = parseLiteralNode();
32690
32789
  break;
32691
32790
  }
32791
+ // falls through
32692
32792
  default:
32693
32793
  expression2 = parseObjectLiteralExpression();
32694
32794
  break;
@@ -33610,6 +33710,7 @@ var Parser;
33610
33710
  case 25 /* DotToken */:
33611
33711
  return true;
33612
33712
  }
33713
+ // falls through
33613
33714
  case 11 /* ArgumentExpressions */:
33614
33715
  return token() === 26 /* DotDotDotToken */ || isStartOfExpression();
33615
33716
  case 16 /* Parameters */:
@@ -33643,6 +33744,7 @@ var Parser;
33643
33744
  return true;
33644
33745
  case 26 /* Count */:
33645
33746
  return Debug.fail("ParsingContext.Count used as a context");
33747
+ // Not a real context, only a marker.
33646
33748
  default:
33647
33749
  Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
33648
33750
  }
@@ -33959,6 +34061,7 @@ var Parser;
33959
34061
  case 3 /* SwitchClauseStatements */:
33960
34062
  return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
33961
34063
  case 18 /* RestProperties */:
34064
+ // fallthrough
33962
34065
  case 4 /* TypeMembers */:
33963
34066
  return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
33964
34067
  case 5 /* ClassMembers */:
@@ -34006,6 +34109,7 @@ var Parser;
34006
34109
  return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
34007
34110
  case 26 /* Count */:
34008
34111
  return Debug.fail("ParsingContext.Count used as a context");
34112
+ // Not a real context, only a marker.
34009
34113
  default:
34010
34114
  Debug.assertNever(context);
34011
34115
  }
@@ -34930,10 +35034,12 @@ var Parser;
34930
35034
  return tryParse(parseKeywordAndNoDot) || parseTypeReference();
34931
35035
  case 67 /* AsteriskEqualsToken */:
34932
35036
  scanner2.reScanAsteriskEqualsToken();
35037
+ // falls through
34933
35038
  case 42 /* AsteriskToken */:
34934
35039
  return parseJSDocAllType();
34935
35040
  case 61 /* QuestionQuestionToken */:
34936
35041
  scanner2.reScanQuestionToken();
35042
+ // falls through
34937
35043
  case 58 /* QuestionToken */:
34938
35044
  return parseJSDocUnknownOrNullableType();
34939
35045
  case 100 /* FunctionKeyword */:
@@ -35811,6 +35917,7 @@ var Parser;
35811
35917
  if (isAwaitExpression2()) {
35812
35918
  return parseAwaitExpression();
35813
35919
  }
35920
+ // falls through
35814
35921
  default:
35815
35922
  return parseUpdateExpression();
35816
35923
  }
@@ -35830,6 +35937,8 @@ var Parser;
35830
35937
  if (languageVariant !== 1 /* JSX */) {
35831
35938
  return false;
35832
35939
  }
35940
+ // We are in JSX context and the token is part of JSXElement.
35941
+ // falls through
35833
35942
  default:
35834
35943
  return true;
35835
35944
  }
@@ -36403,10 +36512,16 @@ var Parser;
36403
36512
  }
36404
36513
  function canFollowTypeArgumentsInExpression() {
36405
36514
  switch (token()) {
36515
+ // These tokens can follow a type argument list in a call expression.
36406
36516
  case 21 /* OpenParenToken */:
36517
+ // foo<x>(
36407
36518
  case 15 /* NoSubstitutionTemplateLiteral */:
36519
+ // foo<T> `...`
36408
36520
  case 16 /* TemplateHead */:
36409
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.
36410
36525
  case 30 /* LessThanToken */:
36411
36526
  case 32 /* GreaterThanToken */:
36412
36527
  case 40 /* PlusToken */:
@@ -36424,6 +36539,7 @@ var Parser;
36424
36539
  false
36425
36540
  );
36426
36541
  }
36542
+ // falls through
36427
36543
  case 9 /* NumericLiteral */:
36428
36544
  case 10 /* BigIntLiteral */:
36429
36545
  case 11 /* StringLiteral */:
@@ -36927,6 +37043,27 @@ var Parser;
36927
37043
  return isUsingDeclaration();
36928
37044
  case 135 /* AwaitKeyword */:
36929
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.
36930
37067
  case 120 /* InterfaceKeyword */:
36931
37068
  case 156 /* TypeKeyword */:
36932
37069
  return nextTokenIsIdentifierOnSameLine();
@@ -36999,6 +37136,9 @@ var Parser;
36999
37136
  case 111 /* ThrowKeyword */:
37000
37137
  case 113 /* TryKeyword */:
37001
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
37002
37142
  case 85 /* CatchKeyword */:
37003
37143
  case 98 /* FinallyKeyword */:
37004
37144
  return true;
@@ -37137,6 +37277,8 @@ var Parser;
37137
37277
  case 111 /* ThrowKeyword */:
37138
37278
  return parseThrowStatement();
37139
37279
  case 113 /* TryKeyword */:
37280
+ // Include 'catch' and 'finally' for error recovery.
37281
+ // falls through
37140
37282
  case 85 /* CatchKeyword */:
37141
37283
  case 98 /* FinallyKeyword */:
37142
37284
  return parseTryStatement();
@@ -37555,10 +37697,15 @@ var Parser;
37555
37697
  }
37556
37698
  switch (token()) {
37557
37699
  case 21 /* OpenParenToken */:
37700
+ // Method declaration
37558
37701
  case 30 /* LessThanToken */:
37702
+ // Generic Method declaration
37559
37703
  case 54 /* ExclamationToken */:
37704
+ // Non-null assertion on property name
37560
37705
  case 59 /* ColonToken */:
37706
+ // Type Annotation for declaration
37561
37707
  case 64 /* EqualsToken */:
37708
+ // Initializer for declaration
37562
37709
  case 58 /* QuestionToken */:
37563
37710
  return true;
37564
37711
  default:
@@ -38465,6 +38612,7 @@ var Parser;
38465
38612
  linkEnd = scanner2.getTokenEnd();
38466
38613
  break;
38467
38614
  }
38615
+ // fallthrough if it's not a {@link sequence
38468
38616
  default:
38469
38617
  state = 2 /* SavingComments */;
38470
38618
  pushComment(scanner2.getTokenText());
@@ -38723,6 +38871,8 @@ var Parser;
38723
38871
  indent3 += 1;
38724
38872
  break;
38725
38873
  }
38874
+ // record the * as a comment
38875
+ // falls through
38726
38876
  default:
38727
38877
  if (state !== 3 /* SavingBackticks */) {
38728
38878
  state = 2 /* SavingComments */;
@@ -39803,6 +39953,7 @@ function processPragmasIntoFields(context, reportDiagnostic) {
39803
39953
  case "jsximportsource":
39804
39954
  case "jsxruntime":
39805
39955
  return;
39956
+ // Accessed directly
39806
39957
  default:
39807
39958
  Debug.fail("Unhandled pragma kind");
39808
39959
  }
@@ -41659,6 +41810,7 @@ function parseOptionValue(args, i, diagnostics, opt, options, errors) {
41659
41810
  case "listOrElement":
41660
41811
  Debug.fail("listOrElement not supported here");
41661
41812
  break;
41813
+ // If not a primitive, the possible types are specified in what is effectively a map of options.
41662
41814
  default:
41663
41815
  options[opt.name] = parseCustomTypeOption(opt, args[i], errors);
41664
41816
  i++;
@@ -41999,6 +42151,7 @@ function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConv
41999
42151
  return false;
42000
42152
  case 106 /* NullKeyword */:
42001
42153
  return null;
42154
+ // eslint-disable-line no-restricted-syntax
42002
42155
  case 11 /* StringLiteral */:
42003
42156
  if (!isDoubleQuotedString(valueExpression)) {
42004
42157
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
@@ -42478,8 +42631,6 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
42478
42631
  validatedFilesSpecBeforeSubstitution,
42479
42632
  validatedIncludeSpecsBeforeSubstitution,
42480
42633
  validatedExcludeSpecsBeforeSubstitution,
42481
- pathPatterns: void 0,
42482
- // Initialized on first use
42483
42634
  isDefaultIncludeSpec
42484
42635
  };
42485
42636
  }
@@ -43207,6 +43358,7 @@ function getOptionValueWithEmptyStrings(value, option) {
43207
43358
  return typeof value === "boolean" ? value : "";
43208
43359
  case "listOrElement":
43209
43360
  if (!isArray(value)) return getOptionValueWithEmptyStrings(value, option.element);
43361
+ // fall through to list
43210
43362
  case "list":
43211
43363
  const elementType = option.element;
43212
43364
  return isArray(value) ? mapDefined(value, (v) => getOptionValueWithEmptyStrings(v, elementType)) : "";
@@ -44183,8 +44335,7 @@ function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, co
44183
44335
  }
44184
44336
  }
44185
44337
  function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state) {
44186
- var _a;
44187
- const { baseUrl, paths, configFile } = state.compilerOptions;
44338
+ const { baseUrl, paths } = state.compilerOptions;
44188
44339
  if (paths && !pathIsRelative(moduleName)) {
44189
44340
  if (state.traceEnabled) {
44190
44341
  if (baseUrl) {
@@ -44193,7 +44344,7 @@ function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state
44193
44344
  trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
44194
44345
  }
44195
44346
  const baseDirectory = getPathsBasePath(state.compilerOptions, state.host);
44196
- const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = tryParsePatterns(paths)) : void 0;
44347
+ const pathPatterns = tryParsePatterns(paths);
44197
44348
  return tryLoadModuleUsingPaths(
44198
44349
  extensions,
44199
44350
  moduleName,
@@ -44992,17 +45143,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
44992
45143
  if (state.traceEnabled) {
44993
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);
44994
45145
  }
44995
- const result = tryLoadModuleUsingPaths(
44996
- extensions,
44997
- moduleName,
44998
- candidate,
44999
- versionPaths.paths,
45000
- /*pathPatterns*/
45001
- void 0,
45002
- loader,
45003
- onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex,
45004
- state
45005
- );
45146
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
45147
+ const result = tryLoadModuleUsingPaths(extensions, moduleName, candidate, versionPaths.paths, pathPatterns, loader, onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex, state);
45006
45148
  if (result) {
45007
45149
  return removeIgnoredPackageId(result.value);
45008
45150
  }
@@ -45594,17 +45736,8 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
45594
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);
45595
45737
  }
45596
45738
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
45597
- const fromPaths = tryLoadModuleUsingPaths(
45598
- extensions,
45599
- rest,
45600
- packageDirectory,
45601
- versionPaths.paths,
45602
- /*pathPatterns*/
45603
- void 0,
45604
- loader,
45605
- !packageDirectoryExists,
45606
- state
45607
- );
45739
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
45740
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, pathPatterns, loader, !packageDirectoryExists, state);
45608
45741
  if (fromPaths) {
45609
45742
  return fromPaths.value;
45610
45743
  }
@@ -45612,7 +45745,6 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
45612
45745
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
45613
45746
  }
45614
45747
  function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
45615
- pathPatterns || (pathPatterns = tryParsePatterns(paths));
45616
45748
  const matchedPattern = matchPatternOrExact(pathPatterns, moduleName);
45617
45749
  if (matchedPattern) {
45618
45750
  const matchedStar = isString(matchedPattern) ? void 0 : matchedText(matchedPattern, moduleName);
@@ -45879,20 +46011,24 @@ function getModuleInstanceStateCached(node, visited = /* @__PURE__ */ new Map())
45879
46011
  }
45880
46012
  function getModuleInstanceStateWorker(node, visited) {
45881
46013
  switch (node.kind) {
46014
+ // 1. interface declarations, type alias declarations
45882
46015
  case 264 /* InterfaceDeclaration */:
45883
46016
  case 265 /* TypeAliasDeclaration */:
45884
46017
  return 0 /* NonInstantiated */;
46018
+ // 2. const enum declarations
45885
46019
  case 266 /* EnumDeclaration */:
45886
46020
  if (isEnumConst(node)) {
45887
46021
  return 2 /* ConstEnumOnly */;
45888
46022
  }
45889
46023
  break;
46024
+ // 3. non-exported import declarations
45890
46025
  case 272 /* ImportDeclaration */:
45891
46026
  case 271 /* ImportEqualsDeclaration */:
45892
46027
  if (!hasSyntacticModifier(node, 32 /* Export */)) {
45893
46028
  return 0 /* NonInstantiated */;
45894
46029
  }
45895
46030
  break;
46031
+ // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain
45896
46032
  case 278 /* ExportDeclaration */:
45897
46033
  const exportDeclaration = node;
45898
46034
  if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 279 /* NamedExports */) {
@@ -45909,6 +46045,7 @@ function getModuleInstanceStateWorker(node, visited) {
45909
46045
  return state;
45910
46046
  }
45911
46047
  break;
46048
+ // 5. other uninstantiated module declarations.
45912
46049
  case 268 /* ModuleBlock */: {
45913
46050
  let state = 0 /* NonInstantiated */;
45914
46051
  forEachChild(node, (n) => {
@@ -46519,6 +46656,7 @@ function createBinder() {
46519
46656
  case 351 /* JSDocImportTag */:
46520
46657
  bindJSDocImportTag(node);
46521
46658
  break;
46659
+ // In source files and blocks, bind functions first to match hoisting that occurs at runtime
46522
46660
  case 307 /* SourceFile */: {
46523
46661
  bindEachFunctionsFirst(node.statements);
46524
46662
  bind(node.endOfFileToken);
@@ -46539,6 +46677,7 @@ function createBinder() {
46539
46677
  case 303 /* PropertyAssignment */:
46540
46678
  case 230 /* SpreadElement */:
46541
46679
  inAssignmentPattern = saveInAssignmentPattern;
46680
+ // falls through
46542
46681
  default:
46543
46682
  bindEachChild(node);
46544
46683
  break;
@@ -46560,6 +46699,7 @@ function createBinder() {
46560
46699
  if (isJSDocTypeAssertion(expr)) {
46561
46700
  return false;
46562
46701
  }
46702
+ // fallthrough
46563
46703
  case 235 /* NonNullExpression */:
46564
46704
  return isNarrowingExpression(expr.expression);
46565
46705
  case 226 /* BinaryExpression */:
@@ -47391,6 +47531,10 @@ function createBinder() {
47391
47531
  }
47392
47532
  function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
47393
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.
47394
47538
  case 267 /* ModuleDeclaration */:
47395
47539
  return declareModuleMember(node, symbolFlags, symbolExcludes);
47396
47540
  case 307 /* SourceFile */:
@@ -47532,6 +47676,7 @@ function createBinder() {
47532
47676
  declareModuleMember(node, symbolFlags, symbolExcludes);
47533
47677
  break;
47534
47678
  }
47679
+ // falls through
47535
47680
  default:
47536
47681
  Debug.assertNode(blockScopeContainer, canHaveLocals);
47537
47682
  if (!blockScopeContainer.locals) {
@@ -47852,6 +47997,7 @@ function createBinder() {
47852
47997
  }
47853
47998
  function bindWorker(node) {
47854
47999
  switch (node.kind) {
48000
+ /* Strict mode checks */
47855
48001
  case 80 /* Identifier */:
47856
48002
  if (node.flags & 4096 /* IdentifierIsInJSDocNamespace */) {
47857
48003
  let parentNode = node.parent;
@@ -47861,6 +48007,7 @@ function createBinder() {
47861
48007
  bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
47862
48008
  break;
47863
48009
  }
48010
+ // falls through
47864
48011
  case 110 /* ThisKeyword */:
47865
48012
  if (currentFlow && (isExpression(node) || parent2.kind === 304 /* ShorthandPropertyAssignment */)) {
47866
48013
  node.flowNode = currentFlow;
@@ -47949,6 +48096,7 @@ function createBinder() {
47949
48096
  return;
47950
48097
  case 182 /* TypePredicate */:
47951
48098
  break;
48099
+ // Binding the children will handle everything
47952
48100
  case 168 /* TypeParameter */:
47953
48101
  return bindTypeParameter(node);
47954
48102
  case 169 /* Parameter */:
@@ -48013,6 +48161,7 @@ function createBinder() {
48013
48161
  return bindObjectDefinePrototypeProperty(node);
48014
48162
  case 0 /* None */:
48015
48163
  break;
48164
+ // Nothing to do
48016
48165
  default:
48017
48166
  return Debug.fail("Unknown call expression assignment declaration kind");
48018
48167
  }
@@ -48020,6 +48169,7 @@ function createBinder() {
48020
48169
  bindCallExpression(node);
48021
48170
  }
48022
48171
  break;
48172
+ // Members of classes, interfaces, and modules
48023
48173
  case 231 /* ClassExpression */:
48024
48174
  case 263 /* ClassDeclaration */:
48025
48175
  inStrictMode = true;
@@ -48032,10 +48182,12 @@ function createBinder() {
48032
48182
  return bindEnumDeclaration(node);
48033
48183
  case 267 /* ModuleDeclaration */:
48034
48184
  return bindModuleDeclaration(node);
48185
+ // Jsx-attributes
48035
48186
  case 292 /* JsxAttributes */:
48036
48187
  return bindJsxAttributes(node);
48037
48188
  case 291 /* JsxAttribute */:
48038
48189
  return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
48190
+ // Imports and exports
48039
48191
  case 271 /* ImportEqualsDeclaration */:
48040
48192
  case 274 /* NamespaceImport */:
48041
48193
  case 276 /* ImportSpecifier */:
@@ -48056,6 +48208,7 @@ function createBinder() {
48056
48208
  if (!isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) {
48057
48209
  return;
48058
48210
  }
48211
+ // falls through
48059
48212
  case 268 /* ModuleBlock */:
48060
48213
  return updateStrictModeStatementList(node.statements);
48061
48214
  case 341 /* JSDocParameterTag */:
@@ -48065,6 +48218,7 @@ function createBinder() {
48065
48218
  if (node.parent.kind !== 322 /* JSDocTypeLiteral */) {
48066
48219
  break;
48067
48220
  }
48221
+ // falls through
48068
48222
  case 348 /* JSDocPropertyTag */:
48069
48223
  const propTag = node;
48070
48224
  const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */;
@@ -48277,6 +48431,7 @@ function createBinder() {
48277
48431
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
48278
48432
  }
48279
48433
  break;
48434
+ // Namespaces are not allowed in javascript files, so do nothing here
48280
48435
  case 267 /* ModuleDeclaration */:
48281
48436
  break;
48282
48437
  default:
@@ -48773,6 +48928,7 @@ function getContainerFlags(node) {
48773
48928
  if (isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
48774
48929
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */;
48775
48930
  }
48931
+ // falls through
48776
48932
  case 176 /* Constructor */:
48777
48933
  case 262 /* FunctionDeclaration */:
48778
48934
  case 173 /* MethodSignature */:
@@ -51926,6 +52082,7 @@ function createTypeChecker(host) {
51926
52082
  if (isEntityNameExpression(node.expression)) {
51927
52083
  return node.expression;
51928
52084
  }
52085
+ // falls through
51929
52086
  default:
51930
52087
  return void 0;
51931
52088
  }
@@ -53781,6 +53938,7 @@ function createTypeChecker(host) {
53781
53938
  if (!isExternalOrCommonJsModule(location)) {
53782
53939
  break;
53783
53940
  }
53941
+ // falls through
53784
53942
  case 267 /* ModuleDeclaration */:
53785
53943
  const sym = getSymbolOfDeclaration(location);
53786
53944
  if (result = callback(
@@ -55203,6 +55361,9 @@ function createTypeChecker(host) {
55203
55361
  }
55204
55362
  function createTypeNodesFromResolvedType(resolvedType) {
55205
55363
  if (checkTruncationLength(context)) {
55364
+ if (context.flags & 1 /* NoTruncation */) {
55365
+ return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, "elided")];
55366
+ }
55206
55367
  return [factory.createPropertySignature(
55207
55368
  /*modifiers*/
55208
55369
  void 0,
@@ -55240,15 +55401,20 @@ function createTypeChecker(host) {
55240
55401
  }
55241
55402
  }
55242
55403
  if (checkTruncationLength(context) && i + 2 < properties.length - 1) {
55243
- typeElements.push(factory.createPropertySignature(
55244
- /*modifiers*/
55245
- void 0,
55246
- `... ${properties.length - i} more ...`,
55247
- /*questionToken*/
55248
- void 0,
55249
- /*type*/
55250
- void 0
55251
- ));
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
+ }
55252
55418
  addPropertyToElementList(properties[properties.length - 1], context, typeElements);
55253
55419
  break;
55254
55420
  }
@@ -55266,7 +55432,7 @@ function createTypeChecker(host) {
55266
55432
  void 0
55267
55433
  );
55268
55434
  }
55269
- return factory.createKeywordTypeNode(133 /* AnyKeyword */);
55435
+ return addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided");
55270
55436
  }
55271
55437
  function shouldUsePlaceholderForProperty(propertySymbol, context) {
55272
55438
  var _a;
@@ -55402,15 +55568,17 @@ function createTypeChecker(host) {
55402
55568
  if (some(types)) {
55403
55569
  if (checkTruncationLength(context)) {
55404
55570
  if (!isBareList) {
55405
- return [factory.createTypeReferenceNode(
55406
- "...",
55407
- /*typeArguments*/
55408
- void 0
55409
- )];
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
+ ];
55410
55578
  } else if (types.length > 2) {
55411
55579
  return [
55412
55580
  typeToTypeNodeHelper(types[0], context),
55413
- factory.createTypeReferenceNode(
55581
+ context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - 2} more elided ...`) : factory.createTypeReferenceNode(
55414
55582
  `... ${types.length - 2} more ...`,
55415
55583
  /*typeArguments*/
55416
55584
  void 0
@@ -55426,11 +55594,13 @@ function createTypeChecker(host) {
55426
55594
  for (const type of types) {
55427
55595
  i++;
55428
55596
  if (checkTruncationLength(context) && i + 2 < types.length - 1) {
55429
- result.push(factory.createTypeReferenceNode(
55430
- `... ${types.length - i} more ...`,
55431
- /*typeArguments*/
55432
- void 0
55433
- ));
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
+ );
55434
55604
  const typeNode2 = typeToTypeNodeHelper(types[types.length - 1], context);
55435
55605
  if (typeNode2) {
55436
55606
  result.push(typeNode2);
@@ -58025,6 +58195,7 @@ function createTypeChecker(host) {
58025
58195
  );
58026
58196
  break;
58027
58197
  }
58198
+ // else fall through and treat commonjs require just like import=
58028
58199
  case 271 /* ImportEqualsDeclaration */:
58029
58200
  if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, (d) => isSourceFile(d) && isJsonSourceFile(d))) {
58030
58201
  serializeMaybeAliasAssignment(symbol);
@@ -58797,6 +58968,7 @@ function createTypeChecker(host) {
58797
58968
  if (isBindingPattern(node.name) && !node.name.elements.length) {
58798
58969
  return false;
58799
58970
  }
58971
+ // falls through
58800
58972
  case 267 /* ModuleDeclaration */:
58801
58973
  case 263 /* ClassDeclaration */:
58802
58974
  case 264 /* InterfaceDeclaration */:
@@ -58821,6 +58993,8 @@ function createTypeChecker(host) {
58821
58993
  if (hasEffectiveModifier(node, 2 /* Private */ | 4 /* Protected */)) {
58822
58994
  return false;
58823
58995
  }
58996
+ // Public properties/methods are visible if its parents are visible, so:
58997
+ // falls through
58824
58998
  case 176 /* Constructor */:
58825
58999
  case 180 /* ConstructSignature */:
58826
59000
  case 179 /* CallSignature */:
@@ -58838,14 +59012,20 @@ function createTypeChecker(host) {
58838
59012
  case 196 /* ParenthesizedType */:
58839
59013
  case 202 /* NamedTupleMember */:
58840
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
58841
59017
  case 273 /* ImportClause */:
58842
59018
  case 274 /* NamespaceImport */:
58843
59019
  case 276 /* ImportSpecifier */:
58844
59020
  return false;
59021
+ // Type parameters are always visible
58845
59022
  case 168 /* TypeParameter */:
59023
+ // Source file and namespace export are always visible
59024
+ // falls through
58846
59025
  case 307 /* SourceFile */:
58847
59026
  case 270 /* NamespaceExportDeclaration */:
58848
59027
  return true;
59028
+ // Export assignments do not create name bindings outside the module
58849
59029
  case 277 /* ExportAssignment */:
58850
59030
  return false;
58851
59031
  default:
@@ -60790,11 +60970,20 @@ function createTypeChecker(host) {
60790
60970
  return type;
60791
60971
  }
60792
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) {
60793
60979
  if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
60794
60980
  return false;
60795
60981
  }
60796
60982
  const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
60797
- return isEntityNameExpression(expr) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(expr));
60983
+ return isEntityNameExpression(expr);
60984
+ }
60985
+ function isTypeUsableAsIndexSignature(type) {
60986
+ return isTypeAssignableTo(type, stringNumberSymbolType);
60798
60987
  }
60799
60988
  function isLateBoundName(name) {
60800
60989
  return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) === 64 /* at */;
@@ -60803,6 +60992,10 @@ function createTypeChecker(host) {
60803
60992
  const name = getNameOfDeclaration(node);
60804
60993
  return !!name && isLateBindableName(name);
60805
60994
  }
60995
+ function hasLateBindableIndexSignature(node) {
60996
+ const name = getNameOfDeclaration(node);
60997
+ return !!name && isLateBindableIndexSignature(name);
60998
+ }
60806
60999
  function hasBindableName(node) {
60807
61000
  return !hasDynamicName(node) || hasLateBindableName(node);
60808
61001
  }
@@ -60856,6 +61049,24 @@ function createTypeChecker(host) {
60856
61049
  }
60857
61050
  return links.resolvedSymbol;
60858
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
+ }
60859
61070
  function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
60860
61071
  const links = getSymbolLinks(symbol);
60861
61072
  if (!links[resolutionKind]) {
@@ -60870,6 +61081,8 @@ function createTypeChecker(host) {
60870
61081
  if (isStatic2 === hasStaticModifier(member)) {
60871
61082
  if (hasLateBindableName(member)) {
60872
61083
  lateBindMember(symbol, earlySymbols, lateSymbols, member);
61084
+ } else if (hasLateBindableIndexSignature(member)) {
61085
+ lateBindIndexSignature(symbol, earlySymbols, lateSymbols, member);
60873
61086
  }
60874
61087
  }
60875
61088
  }
@@ -63133,7 +63346,7 @@ function createTypeChecker(host) {
63133
63346
  return signature.isolatedSignatureType;
63134
63347
  }
63135
63348
  function getIndexSymbol(symbol) {
63136
- return symbol.members ? getIndexSymbolFromSymbolTable(symbol.members) : void 0;
63349
+ return symbol.members ? getIndexSymbolFromSymbolTable(getMembersOfSymbol(symbol)) : void 0;
63137
63350
  }
63138
63351
  function getIndexSymbolFromSymbolTable(symbolTable) {
63139
63352
  return symbolTable.get("__index" /* Index */);
@@ -63149,15 +63362,25 @@ function createTypeChecker(host) {
63149
63362
  if (indexSymbol.declarations) {
63150
63363
  const indexInfos = [];
63151
63364
  for (const declaration of indexSymbol.declarations) {
63152
- if (declaration.parameters.length === 1) {
63153
- const parameter = declaration.parameters[0];
63154
- if (parameter.type) {
63155
- forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
63156
- if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
63157
- indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 8 /* Readonly */), declaration));
63158
- }
63159
- });
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
+ }
63160
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
+ });
63161
63384
  }
63162
63385
  }
63163
63386
  return indexInfos;
@@ -66395,6 +66618,9 @@ function createTypeChecker(host) {
66395
66618
  return getTypeFromTemplateTypeNode(node);
66396
66619
  case 205 /* ImportType */:
66397
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.
66398
66624
  case 80 /* Identifier */:
66399
66625
  case 166 /* QualifiedName */:
66400
66626
  case 211 /* PropertyAccessExpression */:
@@ -66642,6 +66868,7 @@ function createTypeChecker(host) {
66642
66868
  return !!tp.isThisType;
66643
66869
  case 80 /* Identifier */:
66644
66870
  return !tp.isThisType && isPartOfTypeNode(node2) && maybeTypeParameterReference(node2) && getTypeFromTypeNodeWorker(node2) === tp;
66871
+ // use worker because we're looking for === equality
66645
66872
  case 186 /* TypeQuery */:
66646
66873
  const entityName = node2.exprName;
66647
66874
  const firstIdentifier = getFirstIdentifier(entityName);
@@ -67061,6 +67288,7 @@ function createTypeChecker(host) {
67061
67288
  if (!isConstAssertion(node)) {
67062
67289
  break;
67063
67290
  }
67291
+ // fallthrough
67064
67292
  case 294 /* JsxExpression */:
67065
67293
  case 217 /* ParenthesizedExpression */:
67066
67294
  return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
@@ -68156,7 +68384,7 @@ function createTypeChecker(host) {
68156
68384
  const [sourceType, targetType] = getTypeNamesForErrorDisplay(source2, target2);
68157
68385
  let generalizedSource = source2;
68158
68386
  let generalizedSourceType = sourceType;
68159
- if (isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) {
68387
+ if (!(target2.flags & 131072 /* Never */) && isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) {
68160
68388
  generalizedSource = getBaseTypeOfLiteralType(source2);
68161
68389
  Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
68162
68390
  generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
@@ -72380,6 +72608,7 @@ function createTypeChecker(host) {
72380
72608
  if (isCallExpression(node.parent)) {
72381
72609
  return Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function;
72382
72610
  }
72611
+ // falls through
72383
72612
  default:
72384
72613
  if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) {
72385
72614
  return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
@@ -72413,6 +72642,7 @@ function createTypeChecker(host) {
72413
72642
  const symbol = getResolvedSymbol(node);
72414
72643
  return symbol !== unknownSymbol ? `${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}|${getSymbolId(symbol)}` : void 0;
72415
72644
  }
72645
+ // falls through
72416
72646
  case 110 /* ThisKeyword */:
72417
72647
  return `0|${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}`;
72418
72648
  case 235 /* NonNullExpression */:
@@ -73966,6 +74196,9 @@ function createTypeChecker(host) {
73966
74196
  break;
73967
74197
  case 28 /* CommaToken */:
73968
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.
73969
74202
  case 56 /* AmpersandAmpersandToken */:
73970
74203
  return assumeTrue ? narrowType(
73971
74204
  narrowType(
@@ -74409,6 +74642,7 @@ function createTypeChecker(host) {
74409
74642
  }
74410
74643
  }
74411
74644
  }
74645
+ // falls through
74412
74646
  case 110 /* ThisKeyword */:
74413
74647
  case 108 /* SuperKeyword */:
74414
74648
  case 211 /* PropertyAccessExpression */:
@@ -82227,6 +82461,7 @@ function createTypeChecker(host) {
82227
82461
  hasError = true;
82228
82462
  break;
82229
82463
  }
82464
+ // fallthrough
82230
82465
  case 7 /* ES2022 */:
82231
82466
  case 99 /* ESNext */:
82232
82467
  case 200 /* Preserve */:
@@ -82234,6 +82469,7 @@ function createTypeChecker(host) {
82234
82469
  if (languageVersion >= 4 /* ES2017 */) {
82235
82470
  break;
82236
82471
  }
82472
+ // fallthrough
82237
82473
  default:
82238
82474
  span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
82239
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;
@@ -82651,9 +82887,13 @@ function createTypeChecker(host) {
82651
82887
  return true;
82652
82888
  }
82653
82889
  return false;
82890
+ // Some forms listed here for clarity
82654
82891
  case 222 /* VoidExpression */:
82892
+ // Explicit opt-out
82655
82893
  case 216 /* TypeAssertionExpression */:
82894
+ // Not SEF, but can produce useful type warnings
82656
82895
  case 234 /* AsExpression */:
82896
+ // Not SEF, but can produce useful type warnings
82657
82897
  default:
82658
82898
  return false;
82659
82899
  }
@@ -83899,6 +84139,7 @@ function createTypeChecker(host) {
83899
84139
  if (node.expression.kind === 102 /* ImportKeyword */) {
83900
84140
  return checkImportCallExpression(node);
83901
84141
  }
84142
+ // falls through
83902
84143
  case 214 /* NewExpression */:
83903
84144
  return checkCallExpression(node, checkMode);
83904
84145
  case 215 /* TaggedTemplateExpression */:
@@ -83987,7 +84228,7 @@ function createTypeChecker(host) {
83987
84228
  const modifiers = getTypeParameterModifiers(typeParameter) & (8192 /* In */ | 16384 /* Out */);
83988
84229
  if (modifiers) {
83989
84230
  const symbol = getSymbolOfDeclaration(node.parent);
83990
- 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 */))) {
83991
84232
  error2(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
83992
84233
  } else if (modifiers === 8192 /* In */ || modifiers === 16384 /* Out */) {
83993
84234
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
@@ -84268,6 +84509,7 @@ function createTypeChecker(host) {
84268
84509
  if (useDefineForClassFields) {
84269
84510
  break;
84270
84511
  }
84512
+ // fall through
84271
84513
  case "prototype":
84272
84514
  const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
84273
84515
  const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
@@ -84314,15 +84556,17 @@ function createTypeChecker(host) {
84314
84556
  if (indexSymbol == null ? void 0 : indexSymbol.declarations) {
84315
84557
  const indexSignatureMap = /* @__PURE__ */ new Map();
84316
84558
  for (const declaration of indexSymbol.declarations) {
84317
- if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
84318
- forEachType(getTypeFromTypeNode(declaration.parameters[0].type), (type) => {
84319
- const entry = indexSignatureMap.get(getTypeId(type));
84320
- if (entry) {
84321
- entry.declarations.push(declaration);
84322
- } else {
84323
- indexSignatureMap.set(getTypeId(type), { type, declarations: [declaration] });
84324
- }
84325
- });
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
+ }
84326
84570
  }
84327
84571
  }
84328
84572
  indexSignatureMap.forEach((entry) => {
@@ -85011,6 +85255,8 @@ function createTypeChecker(host) {
85011
85255
  switch (d.kind) {
85012
85256
  case 264 /* InterfaceDeclaration */:
85013
85257
  case 265 /* TypeAliasDeclaration */:
85258
+ // A jsdoc typedef and callback are, by definition, type aliases.
85259
+ // falls through
85014
85260
  case 346 /* JSDocTypedefTag */:
85015
85261
  case 338 /* JSDocCallbackTag */:
85016
85262
  case 340 /* JSDocEnumTag */:
@@ -85031,6 +85277,8 @@ function createTypeChecker(host) {
85031
85277
  return 1 /* ExportValue */;
85032
85278
  }
85033
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
85034
85282
  case 271 /* ImportEqualsDeclaration */:
85035
85283
  case 274 /* NamespaceImport */:
85036
85284
  case 273 /* ImportClause */:
@@ -85044,6 +85292,7 @@ function createTypeChecker(host) {
85044
85292
  case 208 /* BindingElement */:
85045
85293
  case 262 /* FunctionDeclaration */:
85046
85294
  case 276 /* ImportSpecifier */:
85295
+ // https://github.com/Microsoft/TypeScript/pull/7591
85047
85296
  case 80 /* Identifier */:
85048
85297
  return 1 /* ExportValue */;
85049
85298
  case 173 /* MethodSignature */:
@@ -85392,6 +85641,7 @@ function createTypeChecker(host) {
85392
85641
  headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
85393
85642
  break;
85394
85643
  }
85644
+ // falls through
85395
85645
  case 169 /* Parameter */:
85396
85646
  headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
85397
85647
  break;
@@ -88613,6 +88863,7 @@ function createTypeChecker(host) {
88613
88863
  break;
88614
88864
  case 271 /* ImportEqualsDeclaration */:
88615
88865
  if (isInternalModuleImportEqualsDeclaration(node)) break;
88866
+ // falls through
88616
88867
  case 272 /* ImportDeclaration */:
88617
88868
  grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
88618
88869
  break;
@@ -88625,6 +88876,7 @@ function createTypeChecker(host) {
88625
88876
  }
88626
88877
  break;
88627
88878
  }
88879
+ // falls through
88628
88880
  case 263 /* ClassDeclaration */:
88629
88881
  case 266 /* EnumDeclaration */:
88630
88882
  case 262 /* FunctionDeclaration */:
@@ -89301,6 +89553,7 @@ function createTypeChecker(host) {
89301
89553
  return checkJSDocPropertyTag(node);
89302
89554
  case 317 /* JSDocFunctionType */:
89303
89555
  checkJSDocFunctionType(node);
89556
+ // falls through
89304
89557
  case 315 /* JSDocNonNullableType */:
89305
89558
  case 314 /* JSDocNullableType */:
89306
89559
  case 312 /* JSDocAllType */:
@@ -89724,6 +89977,7 @@ function createTypeChecker(host) {
89724
89977
  switch (location.kind) {
89725
89978
  case 307 /* SourceFile */:
89726
89979
  if (!isExternalModule(location)) break;
89980
+ // falls through
89727
89981
  case 267 /* ModuleDeclaration */:
89728
89982
  copyLocallyVisibleExportSymbols(getSymbolOfDeclaration(location).exports, meaning & 2623475 /* ModuleMember */);
89729
89983
  break;
@@ -89735,6 +89989,9 @@ function createTypeChecker(host) {
89735
89989
  if (className) {
89736
89990
  copySymbol(location.symbol, meaning);
89737
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
89738
89995
  case 263 /* ClassDeclaration */:
89739
89996
  case 264 /* InterfaceDeclaration */:
89740
89997
  if (!isStaticSymbol) {
@@ -89843,6 +90100,7 @@ function createTypeChecker(host) {
89843
90100
  if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
89844
90101
  return void 0;
89845
90102
  }
90103
+ // falls through
89846
90104
  case 4 /* ThisProperty */:
89847
90105
  case 2 /* ModuleExports */:
89848
90106
  return getSymbolOfDeclaration(entityName.parent.parent);
@@ -90136,6 +90394,7 @@ function createTypeChecker(host) {
90136
90394
  if (!isThisInTypeQuery(node)) {
90137
90395
  return getSymbolOfNameOrPropertyAccessExpression(node);
90138
90396
  }
90397
+ // falls through
90139
90398
  case 110 /* ThisKeyword */:
90140
90399
  const container = getThisContainer(
90141
90400
  node,
@@ -90153,6 +90412,7 @@ function createTypeChecker(host) {
90153
90412
  if (isInExpressionContext(node)) {
90154
90413
  return checkExpression(node).symbol;
90155
90414
  }
90415
+ // falls through
90156
90416
  case 197 /* ThisType */:
90157
90417
  return getTypeFromThisTypeNode(node).symbol;
90158
90418
  case 108 /* SuperKeyword */:
@@ -90175,6 +90435,7 @@ function createTypeChecker(host) {
90175
90435
  if (isCallExpression(parent2) && isBindableObjectDefinePropertyCall(parent2) && parent2.arguments[1] === node) {
90176
90436
  return getSymbolOfDeclaration(parent2);
90177
90437
  }
90438
+ // falls through
90178
90439
  case 9 /* NumericLiteral */:
90179
90440
  const objectType = isElementAccessExpression(parent2) ? parent2.argumentExpression === node ? getTypeOfExpression(parent2.expression) : void 0 : isLiteralTypeNode(parent2) && isIndexedAccessTypeNode(grandParent) ? getTypeFromTypeNode(grandParent.objectType) : void 0;
90180
90441
  return objectType && getPropertyOfType(objectType, escapeLeadingUnderscores(node.text));
@@ -90204,6 +90465,7 @@ function createTypeChecker(host) {
90204
90465
  const symbol = getIntrinsicTagSymbol(node.parent);
90205
90466
  return symbol === unknownSymbol ? void 0 : symbol;
90206
90467
  }
90468
+ // falls through
90207
90469
  default:
90208
90470
  return void 0;
90209
90471
  }
@@ -91212,7 +91474,29 @@ function createTypeChecker(host) {
91212
91474
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
91213
91475
  },
91214
91476
  isImportRequiredByAugmentation,
91215
- 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
+ }
91216
91500
  };
91217
91501
  function isImportRequiredByAugmentation(node) {
91218
91502
  const file = getSourceFileOfNode(node);
@@ -92298,6 +92582,7 @@ function createTypeChecker(host) {
92298
92582
  );
92299
92583
  break;
92300
92584
  }
92585
+ // fallthrough
92301
92586
  case 7 /* ES2022 */:
92302
92587
  case 99 /* ESNext */:
92303
92588
  case 200 /* Preserve */:
@@ -92305,6 +92590,7 @@ function createTypeChecker(host) {
92305
92590
  if (languageVersion >= 4 /* ES2017 */) {
92306
92591
  break;
92307
92592
  }
92593
+ // fallthrough
92308
92594
  default:
92309
92595
  diagnostics.add(
92310
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)
@@ -94481,13 +94767,13 @@ var visitEachChildTable = {
94481
94767
  );
94482
94768
  },
94483
94769
  // Transformation nodes
94484
- [354 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
94770
+ [355 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
94485
94771
  return context.factory.updatePartiallyEmittedExpression(
94486
94772
  node,
94487
94773
  Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
94488
94774
  );
94489
94775
  },
94490
- [355 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
94776
+ [356 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
94491
94777
  return context.factory.updateCommaListExpression(
94492
94778
  node,
94493
94779
  nodesVisitor(node.elements, visitor, isExpression)
@@ -96593,6 +96879,8 @@ function transformTypeScript(context) {
96593
96879
  case 148 /* ReadonlyKeyword */:
96594
96880
  case 103 /* InKeyword */:
96595
96881
  case 147 /* OutKeyword */:
96882
+ // TypeScript accessibility and readonly modifiers are elided
96883
+ // falls through
96596
96884
  case 188 /* ArrayType */:
96597
96885
  case 189 /* TupleType */:
96598
96886
  case 190 /* OptionalType */:
@@ -96621,6 +96909,8 @@ function transformTypeScript(context) {
96621
96909
  case 199 /* IndexedAccessType */:
96622
96910
  case 200 /* MappedType */:
96623
96911
  case 201 /* LiteralType */:
96912
+ // TypeScript type nodes are elided.
96913
+ // falls through
96624
96914
  case 181 /* IndexSignature */:
96625
96915
  return void 0;
96626
96916
  case 265 /* TypeAliasDeclaration */:
@@ -98303,7 +98593,7 @@ function transformClassFields(context) {
98303
98593
  /*discarded*/
98304
98594
  true
98305
98595
  );
98306
- case 355 /* CommaListExpression */:
98596
+ case 356 /* CommaListExpression */:
98307
98597
  return visitCommaListExpression(
98308
98598
  node,
98309
98599
  /*discarded*/
@@ -100243,6 +100533,7 @@ function transformClassFields(context) {
100243
100533
  if (isArrowFunction(original) || getEmitFlags(node) & 524288 /* AsyncFunctionBody */) {
100244
100534
  break;
100245
100535
  }
100536
+ // falls through
100246
100537
  case 262 /* FunctionDeclaration */:
100247
100538
  case 176 /* Constructor */:
100248
100539
  case 177 /* GetAccessor */:
@@ -100518,6 +100809,7 @@ function createRuntimeTypeSerializer(context) {
100518
100809
  case 197 /* ThisType */:
100519
100810
  case 205 /* ImportType */:
100520
100811
  break;
100812
+ // handle JSDoc types from an invalid parse
100521
100813
  case 312 /* JSDocAllType */:
100522
100814
  case 313 /* JSDocUnknownType */:
100523
100815
  case 317 /* JSDocFunctionType */:
@@ -101363,6 +101655,7 @@ function transformESDecorators(context) {
101363
101655
  return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead.");
101364
101656
  case 169 /* Parameter */:
101365
101657
  return visitParameterDeclaration(node);
101658
+ // Support NamedEvaluation to ensure the correct class name for class expressions.
101366
101659
  case 226 /* BinaryExpression */:
101367
101660
  return visitBinaryExpression(
101368
101661
  node,
@@ -101383,7 +101676,7 @@ function transformESDecorators(context) {
101383
101676
  return visitForStatement(node);
101384
101677
  case 244 /* ExpressionStatement */:
101385
101678
  return visitExpressionStatement(node);
101386
- case 355 /* CommaListExpression */:
101679
+ case 356 /* CommaListExpression */:
101387
101680
  return visitCommaListExpression(
101388
101681
  node,
101389
101682
  /*discarded*/
@@ -101395,7 +101688,7 @@ function transformESDecorators(context) {
101395
101688
  /*discarded*/
101396
101689
  false
101397
101690
  );
101398
- case 354 /* PartiallyEmittedExpression */:
101691
+ case 355 /* PartiallyEmittedExpression */:
101399
101692
  return visitPartiallyEmittedExpression(
101400
101693
  node,
101401
101694
  /*discarded*/
@@ -101419,6 +101712,7 @@ function transformESDecorators(context) {
101419
101712
  case 167 /* ComputedPropertyName */:
101420
101713
  return visitComputedPropertyName(node);
101421
101714
  case 174 /* MethodDeclaration */:
101715
+ // object literal methods and accessors
101422
101716
  case 178 /* SetAccessor */:
101423
101717
  case 177 /* GetAccessor */:
101424
101718
  case 218 /* FunctionExpression */:
@@ -101481,7 +101775,7 @@ function transformESDecorators(context) {
101481
101775
  /*discarded*/
101482
101776
  true
101483
101777
  );
101484
- case 355 /* CommaListExpression */:
101778
+ case 356 /* CommaListExpression */:
101485
101779
  return visitCommaListExpression(
101486
101780
  node,
101487
101781
  /*discarded*/
@@ -104063,7 +104357,7 @@ function transformES2018(context) {
104063
104357
  return visitObjectLiteralExpression(node);
104064
104358
  case 226 /* BinaryExpression */:
104065
104359
  return visitBinaryExpression(node, expressionResultIsUnused2);
104066
- case 355 /* CommaListExpression */:
104360
+ case 356 /* CommaListExpression */:
104067
104361
  return visitCommaListExpression(node, expressionResultIsUnused2);
104068
104362
  case 299 /* CatchClause */:
104069
104363
  return visitCatchClause(node);
@@ -107203,6 +107497,7 @@ function transformES2015(context) {
107203
107497
  switch (node.kind) {
107204
107498
  case 126 /* StaticKeyword */:
107205
107499
  return void 0;
107500
+ // elide static keyword
107206
107501
  case 263 /* ClassDeclaration */:
107207
107502
  return visitClassDeclaration(node);
107208
107503
  case 231 /* ClassExpression */:
@@ -107281,7 +107576,7 @@ function transformES2015(context) {
107281
107576
  return visitParenthesizedExpression(node, expressionResultIsUnused2);
107282
107577
  case 226 /* BinaryExpression */:
107283
107578
  return visitBinaryExpression(node, expressionResultIsUnused2);
107284
- case 355 /* CommaListExpression */:
107579
+ case 356 /* CommaListExpression */:
107285
107580
  return visitCommaListExpression(node, expressionResultIsUnused2);
107286
107581
  case 15 /* NoSubstitutionTemplateLiteral */:
107287
107582
  case 16 /* TemplateHead */:
@@ -107665,12 +107960,14 @@ function transformES2015(context) {
107665
107960
  return false;
107666
107961
  }
107667
107962
  switch (node.kind) {
107963
+ // stop at function boundaries
107668
107964
  case 219 /* ArrowFunction */:
107669
107965
  case 218 /* FunctionExpression */:
107670
107966
  case 262 /* FunctionDeclaration */:
107671
107967
  case 176 /* Constructor */:
107672
107968
  case 175 /* ClassStaticBlockDeclaration */:
107673
107969
  return false;
107970
+ // only step into computed property names for class and object literal elements
107674
107971
  case 177 /* GetAccessor */:
107675
107972
  case 178 /* SetAccessor */:
107676
107973
  case 174 /* MethodDeclaration */:
@@ -107879,12 +108176,14 @@ function transformES2015(context) {
107879
108176
  return factory2.createPartiallyEmittedExpression(node.right, node);
107880
108177
  }
107881
108178
  switch (node.kind) {
108179
+ // stop at function boundaries
107882
108180
  case 219 /* ArrowFunction */:
107883
108181
  case 218 /* FunctionExpression */:
107884
108182
  case 262 /* FunctionDeclaration */:
107885
108183
  case 176 /* Constructor */:
107886
108184
  case 175 /* ClassStaticBlockDeclaration */:
107887
108185
  return node;
108186
+ // only step into computed property names for class and object literal elements
107888
108187
  case 177 /* GetAccessor */:
107889
108188
  case 178 /* SetAccessor */:
107890
108189
  case 174 /* MethodDeclaration */:
@@ -107930,12 +108229,14 @@ function transformES2015(context) {
107930
108229
  );
107931
108230
  }
107932
108231
  switch (node.kind) {
108232
+ // stop at function boundaries
107933
108233
  case 219 /* ArrowFunction */:
107934
108234
  case 218 /* FunctionExpression */:
107935
108235
  case 262 /* FunctionDeclaration */:
107936
108236
  case 176 /* Constructor */:
107937
108237
  case 175 /* ClassStaticBlockDeclaration */:
107938
108238
  return node;
108239
+ // only step into computed property names for class and object literal elements
107939
108240
  case 177 /* GetAccessor */:
107940
108241
  case 178 /* SetAccessor */:
107941
108242
  case 174 /* MethodDeclaration */:
@@ -110567,7 +110868,7 @@ function transformGenerators(context) {
110567
110868
  switch (node.kind) {
110568
110869
  case 226 /* BinaryExpression */:
110569
110870
  return visitBinaryExpression(node);
110570
- case 355 /* CommaListExpression */:
110871
+ case 356 /* CommaListExpression */:
110571
110872
  return visitCommaListExpression(node);
110572
110873
  case 227 /* ConditionalExpression */:
110573
110874
  return visitConditionalExpression(node);
@@ -112958,7 +113259,7 @@ function transformModule(context) {
112958
113259
  return visitExpressionStatement(node);
112959
113260
  case 217 /* ParenthesizedExpression */:
112960
113261
  return visitParenthesizedExpression(node, valueIsDiscarded);
112961
- case 354 /* PartiallyEmittedExpression */:
113262
+ case 355 /* PartiallyEmittedExpression */:
112962
113263
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
112963
113264
  case 213 /* CallExpression */:
112964
113265
  if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
@@ -114718,6 +115019,7 @@ function transformSystemModule(context) {
114718
115019
  if (!entry.importClause) {
114719
115020
  break;
114720
115021
  }
115022
+ // falls through
114721
115023
  case 271 /* ImportEqualsDeclaration */:
114722
115024
  Debug.assert(importVariableName !== void 0);
114723
115025
  statements.push(
@@ -115352,7 +115654,7 @@ function transformSystemModule(context) {
115352
115654
  return visitExpressionStatement(node);
115353
115655
  case 217 /* ParenthesizedExpression */:
115354
115656
  return visitParenthesizedExpression(node, valueIsDiscarded);
115355
- case 354 /* PartiallyEmittedExpression */:
115657
+ case 355 /* PartiallyEmittedExpression */:
115356
115658
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
115357
115659
  case 226 /* BinaryExpression */:
115358
115660
  if (isDestructuringAssignment(node)) {
@@ -116951,6 +117253,7 @@ function transformDeclarations(context) {
116951
117253
  case 265 /* TypeAliasDeclaration */:
116952
117254
  case 266 /* EnumDeclaration */:
116953
117255
  return !resolver.isDeclarationVisible(node);
117256
+ // The following should be doing their own visibility checks based on filtering their members
116954
117257
  case 260 /* VariableDeclaration */:
116955
117258
  return !getBindingNameVisible(node);
116956
117259
  case 271 /* ImportEqualsDeclaration */:
@@ -117845,7 +118148,8 @@ function transformDeclarations(context) {
117845
118148
  void 0
117846
118149
  )
117847
118150
  ] : void 0;
117848
- 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));
117849
118153
  const members = factory2.createNodeArray(memberNodes);
117850
118154
  const extendsClause = getEffectiveBaseTypeNode(input);
117851
118155
  if (extendsClause && !isEntityNameExpression(extendsClause.expression) && extendsClause.expression.kind !== 106 /* NullKeyword */) {
@@ -118232,7 +118536,7 @@ function noEmitNotification(hint, node, callback) {
118232
118536
  }
118233
118537
  function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
118234
118538
  var _a, _b;
118235
- const enabledSyntaxKindFeatures = new Array(357 /* Count */);
118539
+ const enabledSyntaxKindFeatures = new Array(358 /* Count */);
118236
118540
  let lexicalEnvironmentVariableDeclarations;
118237
118541
  let lexicalEnvironmentFunctionDeclarations;
118238
118542
  let lexicalEnvironmentStatements;
@@ -119161,7 +119465,8 @@ var notImplementedResolver = {
119161
119465
  isBindingCapturedByNode: notImplemented,
119162
119466
  getDeclarationStatementsForSourceFile: notImplemented,
119163
119467
  isImportRequiredByAugmentation: notImplemented,
119164
- isDefinitelyReferenceToGlobalSymbolObject: notImplemented
119468
+ isDefinitelyReferenceToGlobalSymbolObject: notImplemented,
119469
+ createLateBoundIndexSignatures: notImplemented
119165
119470
  };
119166
119471
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
119167
119472
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -119446,6 +119751,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119446
119751
  if (onEmitNode !== noEmitNotification && (!isEmitNotificationEnabled || isEmitNotificationEnabled(node))) {
119447
119752
  return pipelineEmitWithNotification;
119448
119753
  }
119754
+ // falls through
119449
119755
  case 1 /* Substitution */:
119450
119756
  if (substituteNode !== noEmitSubstitution && (lastSubstitution = substituteNode(emitHint, node) || node) !== node) {
119451
119757
  if (currentParenthesizerRule) {
@@ -119453,14 +119759,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119453
119759
  }
119454
119760
  return pipelineEmitWithSubstitution;
119455
119761
  }
119762
+ // falls through
119456
119763
  case 2 /* Comments */:
119457
119764
  if (shouldEmitComments(node)) {
119458
119765
  return pipelineEmitWithComments;
119459
119766
  }
119767
+ // falls through
119460
119768
  case 3 /* SourceMaps */:
119461
119769
  if (shouldEmitSourceMaps(node)) {
119462
119770
  return pipelineEmitWithSourceMaps;
119463
119771
  }
119772
+ // falls through
119464
119773
  case 4 /* Emit */:
119465
119774
  return pipelineEmitWithHint;
119466
119775
  default:
@@ -119512,6 +119821,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119512
119821
  }
119513
119822
  if (hint === 4 /* Unspecified */) {
119514
119823
  switch (node.kind) {
119824
+ // Pseudo-literals
119515
119825
  case 16 /* TemplateHead */:
119516
119826
  case 17 /* TemplateMiddle */:
119517
119827
  case 18 /* TemplateTail */:
@@ -119520,20 +119830,26 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119520
119830
  /*jsxAttributeEscape*/
119521
119831
  false
119522
119832
  );
119833
+ // Identifiers
119523
119834
  case 80 /* Identifier */:
119524
119835
  return emitIdentifier(node);
119836
+ // PrivateIdentifiers
119525
119837
  case 81 /* PrivateIdentifier */:
119526
119838
  return emitPrivateIdentifier(node);
119839
+ // Parse tree nodes
119840
+ // Names
119527
119841
  case 166 /* QualifiedName */:
119528
119842
  return emitQualifiedName(node);
119529
119843
  case 167 /* ComputedPropertyName */:
119530
119844
  return emitComputedPropertyName(node);
119845
+ // Signature elements
119531
119846
  case 168 /* TypeParameter */:
119532
119847
  return emitTypeParameter(node);
119533
119848
  case 169 /* Parameter */:
119534
119849
  return emitParameter(node);
119535
119850
  case 170 /* Decorator */:
119536
119851
  return emitDecorator(node);
119852
+ // Type members
119537
119853
  case 171 /* PropertySignature */:
119538
119854
  return emitPropertySignature(node);
119539
119855
  case 172 /* PropertyDeclaration */:
@@ -119555,6 +119871,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119555
119871
  return emitConstructSignature(node);
119556
119872
  case 181 /* IndexSignature */:
119557
119873
  return emitIndexSignature(node);
119874
+ // Types
119558
119875
  case 182 /* TypePredicate */:
119559
119876
  return emitTypePredicate(node);
119560
119877
  case 183 /* TypeReference */:
@@ -119573,6 +119890,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119573
119890
  return emitTupleType(node);
119574
119891
  case 190 /* OptionalType */:
119575
119892
  return emitOptionalType(node);
119893
+ // SyntaxKind.RestType is handled below
119576
119894
  case 192 /* UnionType */:
119577
119895
  return emitUnionType(node);
119578
119896
  case 193 /* IntersectionType */:
@@ -119603,16 +119921,19 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119603
119921
  return emitTemplateTypeSpan(node);
119604
119922
  case 205 /* ImportType */:
119605
119923
  return emitImportTypeNode(node);
119924
+ // Binding patterns
119606
119925
  case 206 /* ObjectBindingPattern */:
119607
119926
  return emitObjectBindingPattern(node);
119608
119927
  case 207 /* ArrayBindingPattern */:
119609
119928
  return emitArrayBindingPattern(node);
119610
119929
  case 208 /* BindingElement */:
119611
119930
  return emitBindingElement(node);
119931
+ // Misc
119612
119932
  case 239 /* TemplateSpan */:
119613
119933
  return emitTemplateSpan(node);
119614
119934
  case 240 /* SemicolonClassElement */:
119615
119935
  return emitSemicolonClassElement();
119936
+ // Statements
119616
119937
  case 241 /* Block */:
119617
119938
  return emitBlock(node);
119618
119939
  case 243 /* VariableStatement */:
@@ -119654,6 +119975,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119654
119975
  return emitTryStatement(node);
119655
119976
  case 259 /* DebuggerStatement */:
119656
119977
  return emitDebuggerStatement(node);
119978
+ // Declarations
119657
119979
  case 260 /* VariableDeclaration */:
119658
119980
  return emitVariableDeclaration(node);
119659
119981
  case 261 /* VariableDeclarationList */:
@@ -119704,8 +120026,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119704
120026
  return emitImportAttribute(node);
119705
120027
  case 282 /* MissingDeclaration */:
119706
120028
  return;
120029
+ // Module references
119707
120030
  case 283 /* ExternalModuleReference */:
119708
120031
  return emitExternalModuleReference(node);
120032
+ // JSX (non-expression)
119709
120033
  case 12 /* JsxText */:
119710
120034
  return emitJsxText(node);
119711
120035
  case 286 /* JsxOpeningElement */:
@@ -119724,6 +120048,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119724
120048
  return emitJsxExpression(node);
119725
120049
  case 295 /* JsxNamespacedName */:
119726
120050
  return emitJsxNamespacedName(node);
120051
+ // Clauses
119727
120052
  case 296 /* CaseClause */:
119728
120053
  return emitCaseClause(node);
119729
120054
  case 297 /* DefaultClause */:
@@ -119732,18 +120057,22 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119732
120057
  return emitHeritageClause(node);
119733
120058
  case 299 /* CatchClause */:
119734
120059
  return emitCatchClause(node);
120060
+ // Property assignments
119735
120061
  case 303 /* PropertyAssignment */:
119736
120062
  return emitPropertyAssignment(node);
119737
120063
  case 304 /* ShorthandPropertyAssignment */:
119738
120064
  return emitShorthandPropertyAssignment(node);
119739
120065
  case 305 /* SpreadAssignment */:
119740
120066
  return emitSpreadAssignment(node);
120067
+ // Enum
119741
120068
  case 306 /* EnumMember */:
119742
120069
  return emitEnumMember(node);
120070
+ // Top-level nodes
119743
120071
  case 307 /* SourceFile */:
119744
120072
  return emitSourceFile(node);
119745
120073
  case 308 /* Bundle */:
119746
120074
  return Debug.fail("Bundles should be printed using printBundle");
120075
+ // JSDoc nodes (only used in codefixes currently)
119747
120076
  case 309 /* JSDocTypeExpression */:
119748
120077
  return emitJSDocTypeExpression(node);
119749
120078
  case 310 /* JSDocNameReference */:
@@ -119781,6 +120110,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119781
120110
  case 330 /* JSDocAuthorTag */:
119782
120111
  case 331 /* JSDocDeprecatedTag */:
119783
120112
  return;
120113
+ // SyntaxKind.JSDocClassTag (see JSDocTag, above)
119784
120114
  case 333 /* JSDocPublicTag */:
119785
120115
  case 334 /* JSDocPrivateTag */:
119786
120116
  case 335 /* JSDocProtectedTag */:
@@ -119790,6 +120120,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119790
120120
  return emitJSDocCallbackTag(node);
119791
120121
  case 339 /* JSDocOverloadTag */:
119792
120122
  return emitJSDocOverloadTag(node);
120123
+ // SyntaxKind.JSDocEnumTag (see below)
119793
120124
  case 341 /* JSDocParameterTag */:
119794
120125
  case 348 /* JSDocPropertyTag */:
119795
120126
  return emitJSDocPropertyLikeTag(node);
@@ -119808,7 +120139,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119808
120139
  return emitJSDocSeeTag(node);
119809
120140
  case 351 /* JSDocImportTag */:
119810
120141
  return emitJSDocImportTag(node);
120142
+ // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above)
120143
+ // Transformation nodes
119811
120144
  case 353 /* NotEmittedStatement */:
120145
+ case 354 /* NotEmittedTypeElement */:
119812
120146
  return;
119813
120147
  }
119814
120148
  if (isExpression(node)) {
@@ -119826,6 +120160,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119826
120160
  }
119827
120161
  if (hint === 1 /* Expression */) {
119828
120162
  switch (node.kind) {
120163
+ // Literals
119829
120164
  case 9 /* NumericLiteral */:
119830
120165
  case 10 /* BigIntLiteral */:
119831
120166
  return emitNumericOrBigIntLiteral(node);
@@ -119837,10 +120172,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119837
120172
  /*jsxAttributeEscape*/
119838
120173
  false
119839
120174
  );
120175
+ // Identifiers
119840
120176
  case 80 /* Identifier */:
119841
120177
  return emitIdentifier(node);
119842
120178
  case 81 /* PrivateIdentifier */:
119843
120179
  return emitPrivateIdentifier(node);
120180
+ // Expressions
119844
120181
  case 209 /* ArrayLiteralExpression */:
119845
120182
  return emitArrayLiteralExpression(node);
119846
120183
  case 210 /* ObjectLiteralExpression */:
@@ -119903,21 +120240,24 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119903
120240
  return Debug.fail("SyntheticExpression should never be printed.");
119904
120241
  case 282 /* MissingDeclaration */:
119905
120242
  return;
120243
+ // JSX
119906
120244
  case 284 /* JsxElement */:
119907
120245
  return emitJsxElement(node);
119908
120246
  case 285 /* JsxSelfClosingElement */:
119909
120247
  return emitJsxSelfClosingElement(node);
119910
120248
  case 288 /* JsxFragment */:
119911
120249
  return emitJsxFragment(node);
120250
+ // Synthesized list
119912
120251
  case 352 /* SyntaxList */:
119913
120252
  return Debug.fail("SyntaxList should not be printed");
120253
+ // Transformation nodes
119914
120254
  case 353 /* NotEmittedStatement */:
119915
120255
  return;
119916
- case 354 /* PartiallyEmittedExpression */:
120256
+ case 355 /* PartiallyEmittedExpression */:
119917
120257
  return emitPartiallyEmittedExpression(node);
119918
- case 355 /* CommaListExpression */:
120258
+ case 356 /* CommaListExpression */:
119919
120259
  return emitCommaList(node);
119920
- case 356 /* SyntheticReferenceExpression */:
120260
+ case 357 /* SyntheticReferenceExpression */:
119921
120261
  return Debug.fail("SyntheticReferenceExpression should not be printed");
119922
120262
  }
119923
120263
  }
@@ -126100,6 +126440,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126100
126440
  diagnostics.push(createDiagnosticForNode2(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
126101
126441
  return "skip";
126102
126442
  }
126443
+ // falls through
126103
126444
  case 173 /* MethodSignature */:
126104
126445
  case 176 /* Constructor */:
126105
126446
  case 177 /* GetAccessor */:
@@ -126231,6 +126572,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126231
126572
  diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
126232
126573
  return "skip";
126233
126574
  }
126575
+ // falls through
126234
126576
  case 243 /* VariableStatement */:
126235
126577
  if (nodes === parent2.modifiers) {
126236
126578
  checkModifiers(parent2.modifiers, parent2.kind === 243 /* VariableStatement */);
@@ -126273,6 +126615,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126273
126615
  if (isConstValid) {
126274
126616
  continue;
126275
126617
  }
126618
+ // to report error,
126619
+ // falls through
126276
126620
  case 125 /* PublicKeyword */:
126277
126621
  case 123 /* PrivateKeyword */:
126278
126622
  case 124 /* ProtectedKeyword */:
@@ -126284,6 +126628,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126284
126628
  case 147 /* OutKeyword */:
126285
126629
  diagnostics.push(createDiagnosticForNode2(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
126286
126630
  break;
126631
+ // These are all legal modifiers.
126287
126632
  case 126 /* StaticKeyword */:
126288
126633
  case 95 /* ExportKeyword */:
126289
126634
  case 90 /* DefaultKeyword */:
@@ -131750,6 +132095,7 @@ function getSourceFileVersionAsHashFromText(host, text) {
131750
132095
  if (pos && text.charCodeAt(pos - 1) === 13 /* carriageReturn */) {
131751
132096
  pos--;
131752
132097
  }
132098
+ // falls through
131753
132099
  case 13 /* carriageReturn */:
131754
132100
  break;
131755
132101
  default:
@@ -133287,6 +133633,7 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
133287
133633
  queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
133288
133634
  step++;
133289
133635
  break;
133636
+ // Should never be done
133290
133637
  case 3 /* Done */:
133291
133638
  default:
133292
133639
  assertType(step);
@@ -133827,6 +134174,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
133827
134174
  status.type = 2 /* UpToDateWithUpstreamTypes */;
133828
134175
  break;
133829
134176
  }
134177
+ // falls through
133830
134178
  case 15 /* UpToDateWithInputFileText */:
133831
134179
  case 2 /* UpToDateWithUpstreamTypes */:
133832
134180
  if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
@@ -134344,6 +134692,8 @@ function reportUpToDateStatus(state, configFileName, status) {
134344
134692
  relName(state, configFileName)
134345
134693
  );
134346
134694
  case 16 /* ContainerOnly */:
134695
+ // Don't report status on "solution" projects
134696
+ // falls through
134347
134697
  case 13 /* ComputingUpstream */:
134348
134698
  break;
134349
134699
  default:
@@ -136176,6 +136526,7 @@ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeN
136176
136526
  return `'${typing}':: ${kind} name '${name}' contains non URI safe characters`;
136177
136527
  case 0 /* Ok */:
136178
136528
  return Debug.fail();
136529
+ // Shouldn't have called this.
136179
136530
  default:
136180
136531
  Debug.assertNever(result);
136181
136532
  }
@@ -136552,6 +136903,7 @@ function getMeaningFromDeclaration(node) {
136552
136903
  case 277 /* ExportAssignment */:
136553
136904
  case 278 /* ExportDeclaration */:
136554
136905
  return 7 /* All */;
136906
+ // An external module can be a Value
136555
136907
  case 307 /* SourceFile */:
136556
136908
  return 4 /* Namespace */ | 1 /* Value */;
136557
136909
  }
@@ -136860,6 +137212,7 @@ function getNodeKind(node) {
136860
137212
  return isFunctionExpression(right) ? "method" /* memberFunctionElement */ : "property" /* memberVariableElement */;
136861
137213
  case 4 /* ThisProperty */:
136862
137214
  return "property" /* memberVariableElement */;
137215
+ // property
136863
137216
  case 5 /* Property */:
136864
137217
  return isFunctionExpression(right) ? "method" /* memberFunctionElement */ : "property" /* memberVariableElement */;
136865
137218
  case 6 /* Prototype */:
@@ -136953,6 +137306,7 @@ function isCompletedNode(n, sourceFile) {
136953
137306
  if (!n.arguments) {
136954
137307
  return true;
136955
137308
  }
137309
+ // falls through
136956
137310
  case 213 /* CallExpression */:
136957
137311
  case 217 /* ParenthesizedExpression */:
136958
137312
  case 196 /* ParenthesizedType */:
@@ -137681,16 +138035,19 @@ function getPossibleTypeArgumentsInfo(tokenIn, sourceFile) {
137681
138035
  token = findPrecedingMatchingToken(token, 23 /* OpenBracketToken */, sourceFile);
137682
138036
  if (!token) return void 0;
137683
138037
  break;
138038
+ // Valid tokens in a type name. Skip.
137684
138039
  case 28 /* CommaToken */:
137685
138040
  nTypeArguments++;
137686
138041
  break;
137687
138042
  case 39 /* EqualsGreaterThanToken */:
138043
+ // falls through
137688
138044
  case 80 /* Identifier */:
137689
138045
  case 11 /* StringLiteral */:
137690
138046
  case 9 /* NumericLiteral */:
137691
138047
  case 10 /* BigIntLiteral */:
137692
138048
  case 112 /* TrueKeyword */:
137693
138049
  case 97 /* FalseKeyword */:
138050
+ // falls through
137694
138051
  case 114 /* TypeOfKeyword */:
137695
138052
  case 96 /* ExtendsKeyword */:
137696
138053
  case 143 /* KeyOfKeyword */:
@@ -139964,6 +140321,7 @@ function canFollow(keyword1, keyword2) {
139964
140321
  case 126 /* StaticKeyword */:
139965
140322
  case 129 /* AccessorKeyword */:
139966
140323
  return true;
140324
+ // Allow things like "public get", "public constructor" and "public static".
139967
140325
  default:
139968
140326
  return false;
139969
140327
  }
@@ -140774,6 +141132,7 @@ var DocumentHighlights;
140774
141132
  if (statement.kind === 251 /* ContinueStatement */) {
140775
141133
  return false;
140776
141134
  }
141135
+ // falls through
140777
141136
  case 248 /* ForStatement */:
140778
141137
  case 249 /* ForInStatement */:
140779
141138
  case 250 /* ForOfStatement */:
@@ -140819,6 +141178,7 @@ var DocumentHighlights;
140819
141178
  return [...nodes, container];
140820
141179
  }
140821
141180
  return nodes;
141181
+ // Syntactically invalid positions that the parser might produce anyway
140822
141182
  default:
140823
141183
  return void 0;
140824
141184
  }
@@ -142398,8 +142758,10 @@ function isFixablePromiseArgument(arg, checker) {
142398
142758
  if (functionFlags & 1 /* Generator */) {
142399
142759
  return false;
142400
142760
  }
142761
+ // falls through
142401
142762
  case 219 /* ArrowFunction */:
142402
142763
  visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true);
142764
+ // falls through
142403
142765
  case 106 /* NullKeyword */:
142404
142766
  return true;
142405
142767
  case 80 /* Identifier */:
@@ -143072,6 +143434,7 @@ function addChildrenRecursively(node) {
143072
143434
  Debug.assertNever(special);
143073
143435
  }
143074
143436
  }
143437
+ // falls through
143075
143438
  default:
143076
143439
  if (hasJSDocNodes(node)) {
143077
143440
  forEach(node.jsDoc, (jsDoc) => {
@@ -143664,6 +144027,7 @@ function changeExport(exportingSourceFile, { wasDefault, exportNode, exportName
143664
144027
  changes.replaceNode(exportingSourceFile, exportNode, factory.createExportDefault(Debug.checkDefined(decl.initializer, "Initializer was previously known to be present")));
143665
144028
  break;
143666
144029
  }
144030
+ // falls through
143667
144031
  case 266 /* EnumDeclaration */:
143668
144032
  case 265 /* TypeAliasDeclaration */:
143669
144033
  case 267 /* ModuleDeclaration */:
@@ -144770,6 +145134,7 @@ function getNamesToExportInCommonJS(decl) {
144770
145134
  case 262 /* FunctionDeclaration */:
144771
145135
  case 263 /* ClassDeclaration */:
144772
145136
  return [decl.name.text];
145137
+ // TODO: GH#18217
144773
145138
  case 243 /* VariableStatement */:
144774
145139
  return mapDefined(decl.declarationList.declarations, (d) => isIdentifier(d.name) ? d.name.text : void 0);
144775
145140
  case 267 /* ModuleDeclaration */:
@@ -146232,6 +146597,7 @@ function entryToFunctionCall(entry) {
146232
146597
  const functionReference = entry.node;
146233
146598
  const parent2 = functionReference.parent;
146234
146599
  switch (parent2.kind) {
146600
+ // foo(...) or super(...) or new Foo(...)
146235
146601
  case 213 /* CallExpression */:
146236
146602
  case 214 /* NewExpression */:
146237
146603
  const callOrNewExpression = tryCast(parent2, isCallOrNewExpression);
@@ -146239,6 +146605,7 @@ function entryToFunctionCall(entry) {
146239
146605
  return callOrNewExpression;
146240
146606
  }
146241
146607
  break;
146608
+ // x.foo(...)
146242
146609
  case 211 /* PropertyAccessExpression */:
146243
146610
  const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression);
146244
146611
  if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) {
@@ -146248,6 +146615,7 @@ function entryToFunctionCall(entry) {
146248
146615
  }
146249
146616
  }
146250
146617
  break;
146618
+ // x["foo"](...)
146251
146619
  case 212 /* ElementAccessExpression */:
146252
146620
  const elementAccessExpression = tryCast(parent2, isElementAccessExpression);
146253
146621
  if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) {
@@ -146266,12 +146634,14 @@ function entryToAccessExpression(entry) {
146266
146634
  const reference = entry.node;
146267
146635
  const parent2 = reference.parent;
146268
146636
  switch (parent2.kind) {
146637
+ // `C.foo`
146269
146638
  case 211 /* PropertyAccessExpression */:
146270
146639
  const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression);
146271
146640
  if (propertyAccessExpression && propertyAccessExpression.expression === reference) {
146272
146641
  return propertyAccessExpression;
146273
146642
  }
146274
146643
  break;
146644
+ // `C["foo"]`
146275
146645
  case 212 /* ElementAccessExpression */:
146276
146646
  const elementAccessExpression = tryCast(parent2, isElementAccessExpression);
146277
146647
  if (elementAccessExpression && elementAccessExpression.expression === reference) {
@@ -147364,11 +147734,13 @@ function getRangeToExtract2(sourceFile, span, invoked = true) {
147364
147734
  forEachChild(n, check);
147365
147735
  }
147366
147736
  });
147737
+ // falls through
147367
147738
  case 263 /* ClassDeclaration */:
147368
147739
  case 262 /* FunctionDeclaration */:
147369
147740
  if (isSourceFile(node2.parent) && node2.parent.externalModuleIndicator === void 0) {
147370
147741
  (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.functionWillNotBeVisibleInTheNewScope));
147371
147742
  }
147743
+ // falls through
147372
147744
  case 231 /* ClassExpression */:
147373
147745
  case 218 /* FunctionExpression */:
147374
147746
  case 174 /* MethodDeclaration */:
@@ -149543,6 +149915,7 @@ var SourceFileObject = class extends NodeObject {
149543
149915
  if (!hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
149544
149916
  break;
149545
149917
  }
149918
+ // falls through
149546
149919
  case 260 /* VariableDeclaration */:
149547
149920
  case 208 /* BindingElement */: {
149548
149921
  const decl = node;
@@ -149554,6 +149927,7 @@ var SourceFileObject = class extends NodeObject {
149554
149927
  visit(decl.initializer);
149555
149928
  }
149556
149929
  }
149930
+ // falls through
149557
149931
  case 306 /* EnumMember */:
149558
149932
  case 172 /* PropertyDeclaration */:
149559
149933
  case 171 /* PropertySignature */:
@@ -149588,6 +149962,7 @@ var SourceFileObject = class extends NodeObject {
149588
149962
  if (getAssignmentDeclarationKind(node) !== 0 /* None */) {
149589
149963
  addDeclaration(node);
149590
149964
  }
149965
+ // falls through
149591
149966
  default:
149592
149967
  forEachChild(node, visit);
149593
149968
  }
@@ -150475,6 +150850,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
150475
150850
  case 197 /* ThisType */:
150476
150851
  case 80 /* Identifier */:
150477
150852
  break;
150853
+ // Cant create the text span
150478
150854
  default:
150479
150855
  return void 0;
150480
150856
  }
@@ -151192,6 +151568,7 @@ function getContainingObjectLiteralElementWorker(node) {
151192
151568
  if (node.parent.kind === 167 /* ComputedPropertyName */) {
151193
151569
  return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : void 0;
151194
151570
  }
151571
+ // falls through
151195
151572
  case 80 /* Identifier */:
151196
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;
151197
151574
  }
@@ -151346,6 +151723,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151346
151723
  if (isFunctionBlock(node)) {
151347
151724
  return spanInFunctionBlock(node);
151348
151725
  }
151726
+ // falls through
151349
151727
  case 268 /* ModuleBlock */:
151350
151728
  return spanInBlock(node);
151351
151729
  case 299 /* CatchClause */:
@@ -151394,6 +151772,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151394
151772
  if (getModuleInstanceState(node) !== 1 /* Instantiated */) {
151395
151773
  return void 0;
151396
151774
  }
151775
+ // falls through
151397
151776
  case 263 /* ClassDeclaration */:
151398
151777
  case 266 /* EnumDeclaration */:
151399
151778
  case 306 /* EnumMember */:
@@ -151406,9 +151785,11 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151406
151785
  case 206 /* ObjectBindingPattern */:
151407
151786
  case 207 /* ArrayBindingPattern */:
151408
151787
  return spanInBindingPattern(node);
151788
+ // No breakpoint in interface, type alias
151409
151789
  case 264 /* InterfaceDeclaration */:
151410
151790
  case 265 /* TypeAliasDeclaration */:
151411
151791
  return void 0;
151792
+ // Tokens:
151412
151793
  case 27 /* SemicolonToken */:
151413
151794
  case 1 /* EndOfFileToken */:
151414
151795
  return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile));
@@ -151429,6 +151810,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151429
151810
  case 32 /* GreaterThanToken */:
151430
151811
  case 30 /* LessThanToken */:
151431
151812
  return spanInGreaterThanOrLessThanToken(node);
151813
+ // Keywords:
151432
151814
  case 117 /* WhileKeyword */:
151433
151815
  return spanInWhileKeyword(node);
151434
151816
  case 93 /* ElseKeyword */:
@@ -151579,10 +151961,13 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151579
151961
  if (getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {
151580
151962
  return void 0;
151581
151963
  }
151964
+ // Set on parent if on same line otherwise on first statement
151965
+ // falls through
151582
151966
  case 247 /* WhileStatement */:
151583
151967
  case 245 /* IfStatement */:
151584
151968
  case 249 /* ForInStatement */:
151585
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
151586
151971
  case 248 /* ForStatement */:
151587
151972
  case 250 /* ForOfStatement */:
151588
151973
  return spanInNodeIfStartsOnSameLine(findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
@@ -151648,6 +152033,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151648
152033
  if (getModuleInstanceState(node2.parent.parent) !== 1 /* Instantiated */) {
151649
152034
  return void 0;
151650
152035
  }
152036
+ // falls through
151651
152037
  case 266 /* EnumDeclaration */:
151652
152038
  case 263 /* ClassDeclaration */:
151653
152039
  return textSpan(node2);
@@ -151655,6 +152041,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151655
152041
  if (isFunctionBlock(node2.parent)) {
151656
152042
  return textSpan(node2);
151657
152043
  }
152044
+ // falls through
151658
152045
  case 299 /* CatchClause */:
151659
152046
  return spanInNode(lastOrUndefined(node2.parent.statements));
151660
152047
  case 269 /* CaseBlock */:
@@ -151667,6 +152054,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151667
152054
  case 206 /* ObjectBindingPattern */:
151668
152055
  const bindingPattern = node2.parent;
151669
152056
  return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern);
152057
+ // Default to parent node
151670
152058
  default:
151671
152059
  if (isArrayLiteralOrObjectLiteralDestructuringPattern(node2.parent)) {
151672
152060
  const objectLiteral = node2.parent;
@@ -151716,6 +152104,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151716
152104
  case 214 /* NewExpression */:
151717
152105
  case 217 /* ParenthesizedExpression */:
151718
152106
  return spanInPreviousNode(node2);
152107
+ // Default to parent node
151719
152108
  default:
151720
152109
  return spanInNode(node2.parent);
151721
152110
  }
@@ -154308,6 +154697,7 @@ function convertStatement(sourceFile, statement, checker, changes, identifiers,
154308
154697
  }
154309
154698
  }
154310
154699
  }
154700
+ // falls through
154311
154701
  default:
154312
154702
  return false;
154313
154703
  }
@@ -154407,6 +154797,8 @@ function tryChangeModuleExportsObject(object, useSitesToUnqualify) {
154407
154797
  switch (prop.kind) {
154408
154798
  case 177 /* GetAccessor */:
154409
154799
  case 178 /* SetAccessor */:
154800
+ // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`.
154801
+ // falls through
154410
154802
  case 304 /* ShorthandPropertyAssignment */:
154411
154803
  case 305 /* SpreadAssignment */:
154412
154804
  return void 0;
@@ -154488,6 +154880,7 @@ function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualif
154488
154880
  return exportConst();
154489
154881
  }
154490
154882
  }
154883
+ // falls through
154491
154884
  case 219 /* ArrowFunction */:
154492
154885
  return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify);
154493
154886
  case 231 /* ClassExpression */:
@@ -154536,6 +154929,7 @@ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target
154536
154929
  )]);
154537
154930
  }
154538
154931
  }
154932
+ // falls through -- object destructuring has an interesting pattern and must be a variable declaration
154539
154933
  case 207 /* ArrayBindingPattern */: {
154540
154934
  const tmp = makeUniqueName(moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers);
154541
154935
  return convertedImports([
@@ -159612,6 +160006,7 @@ function doChange27(changes, sourceFile, start, length2, errorCode) {
159612
160006
  }
159613
160007
  return;
159614
160008
  }
160009
+ // falls through
159615
160010
  case 247 /* WhileStatement */:
159616
160011
  case 248 /* ForStatement */:
159617
160012
  changes.delete(sourceFile, container);
@@ -160876,6 +161271,7 @@ function getDiagnostic(errorCode, token) {
160876
161271
  case Diagnostics.Parameter_0_implicitly_has_an_1_type.code:
160877
161272
  case Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code:
160878
161273
  return isSetAccessorDeclaration(getContainingFunction(token)) ? Diagnostics.Infer_type_of_0_from_usage : Diagnostics.Infer_parameter_types_from_usage;
161274
+ // TODO: GH#18217
160879
161275
  case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
160880
161276
  case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage.code:
160881
161277
  return Diagnostics.Infer_parameter_types_from_usage;
@@ -160914,6 +161310,7 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
160914
161310
  const importAdder = createImportAdder(sourceFile, program, preferences, host);
160915
161311
  errorCode = mapSuggestionDiagnostic(errorCode);
160916
161312
  switch (errorCode) {
161313
+ // Variable and Property declarations
160917
161314
  case Diagnostics.Member_0_implicitly_has_an_1_type.code:
160918
161315
  case Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code:
160919
161316
  if (isVariableDeclaration(parent2) && markSeen(parent2) || isPropertyDeclaration(parent2) || isPropertySignature(parent2)) {
@@ -160954,12 +161351,14 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
160954
161351
  }
160955
161352
  let declaration;
160956
161353
  switch (errorCode) {
161354
+ // Parameter declarations
160957
161355
  case Diagnostics.Parameter_0_implicitly_has_an_1_type.code:
160958
161356
  if (isSetAccessorDeclaration(containingFunction)) {
160959
161357
  annotateSetAccessor(changes, importAdder, sourceFile, containingFunction, program, host, cancellationToken);
160960
161358
  declaration = containingFunction;
160961
161359
  break;
160962
161360
  }
161361
+ // falls through
160963
161362
  case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
160964
161363
  if (markSeen(containingFunction)) {
160965
161364
  const param = cast(parent2, isParameter);
@@ -160967,6 +161366,7 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
160967
161366
  declaration = param;
160968
161367
  }
160969
161368
  break;
161369
+ // Get Accessor declarations
160970
161370
  case Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code:
160971
161371
  case Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code:
160972
161372
  if (isGetAccessorDeclaration(containingFunction) && isIdentifier(containingFunction.name)) {
@@ -160974,12 +161374,14 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
160974
161374
  declaration = containingFunction;
160975
161375
  }
160976
161376
  break;
161377
+ // Set Accessor declarations
160977
161378
  case Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code:
160978
161379
  if (isSetAccessorDeclaration(containingFunction)) {
160979
161380
  annotateSetAccessor(changes, importAdder, sourceFile, containingFunction, program, host, cancellationToken);
160980
161381
  declaration = containingFunction;
160981
161382
  }
160982
161383
  break;
161384
+ // Function 'this'
160983
161385
  case Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code:
160984
161386
  if (ts_textChanges_exports.isThisTypeAnnotatable(containingFunction) && markSeen(containingFunction)) {
160985
161387
  annotateThis(changes, sourceFile, containingFunction, program, host, cancellationToken);
@@ -161361,6 +161763,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161361
161763
  break;
161362
161764
  }
161363
161765
  }
161766
+ // falls through
161364
161767
  default:
161365
161768
  return inferTypeFromContextualType(node, usage);
161366
161769
  }
@@ -161388,16 +161791,25 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161388
161791
  }
161389
161792
  function inferTypeFromBinaryExpression(node, parent2, usage) {
161390
161793
  switch (parent2.operatorToken.kind) {
161794
+ // ExponentiationOperator
161391
161795
  case 43 /* AsteriskAsteriskToken */:
161796
+ // MultiplicativeOperator
161797
+ // falls through
161392
161798
  case 42 /* AsteriskToken */:
161393
161799
  case 44 /* SlashToken */:
161394
161800
  case 45 /* PercentToken */:
161801
+ // ShiftOperator
161802
+ // falls through
161395
161803
  case 48 /* LessThanLessThanToken */:
161396
161804
  case 49 /* GreaterThanGreaterThanToken */:
161397
161805
  case 50 /* GreaterThanGreaterThanGreaterThanToken */:
161806
+ // BitwiseOperator
161807
+ // falls through
161398
161808
  case 51 /* AmpersandToken */:
161399
161809
  case 52 /* BarToken */:
161400
161810
  case 53 /* CaretToken */:
161811
+ // CompoundAssignmentOperator
161812
+ // falls through
161401
161813
  case 66 /* MinusEqualsToken */:
161402
161814
  case 68 /* AsteriskAsteriskEqualsToken */:
161403
161815
  case 67 /* AsteriskEqualsToken */:
@@ -161409,7 +161821,11 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161409
161821
  case 71 /* LessThanLessThanEqualsToken */:
161410
161822
  case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
161411
161823
  case 72 /* GreaterThanGreaterThanEqualsToken */:
161824
+ // AdditiveOperator
161825
+ // falls through
161412
161826
  case 41 /* MinusToken */:
161827
+ // RelationalOperator
161828
+ // falls through
161413
161829
  case 30 /* LessThanToken */:
161414
161830
  case 33 /* LessThanEqualsToken */:
161415
161831
  case 32 /* GreaterThanToken */:
@@ -161435,6 +161851,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161435
161851
  usage.isNumberOrString = true;
161436
161852
  }
161437
161853
  break;
161854
+ // AssignmentOperators
161438
161855
  case 64 /* EqualsToken */:
161439
161856
  case 35 /* EqualsEqualsToken */:
161440
161857
  case 37 /* EqualsEqualsEqualsToken */:
@@ -161450,6 +161867,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161450
161867
  usage.isString = true;
161451
161868
  }
161452
161869
  break;
161870
+ // LogicalOperator Or NullishCoalescing
161453
161871
  case 57 /* BarBarToken */:
161454
161872
  case 61 /* QuestionQuestionToken */:
161455
161873
  if (node === parent2.left && (node.parent.parent.kind === 260 /* VariableDeclaration */ || isAssignmentExpression(
@@ -161954,11 +162372,10 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
161954
162372
  const optional = !!(symbol.flags & 16777216 /* Optional */);
161955
162373
  const ambient = !!(enclosingDeclaration.flags & 33554432 /* Ambient */) || isAmbient;
161956
162374
  const quotePreference = getQuotePreference(sourceFile, preferences);
162375
+ const flags = 1 /* NoTruncation */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
161957
162376
  switch (kind) {
161958
162377
  case 171 /* PropertySignature */:
161959
162378
  case 172 /* PropertyDeclaration */:
161960
- let flags = 1 /* NoTruncation */;
161961
- flags |= quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0;
161962
162379
  let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
161963
162380
  if (importAdder) {
161964
162381
  const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
@@ -161982,8 +162399,7 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
161982
162399
  let typeNode2 = checker.typeToTypeNode(
161983
162400
  type,
161984
162401
  enclosingDeclaration,
161985
- /*flags*/
161986
- void 0,
162402
+ flags,
161987
162403
  /*internalFlags*/
161988
162404
  void 0,
161989
162405
  getNoopSymbolTrackerWithResolver(context)
@@ -165703,6 +166119,7 @@ function getContextualType(previousToken, position, sourceFile, checker) {
165703
166119
  switch (parent2.kind) {
165704
166120
  case 260 /* VariableDeclaration */:
165705
166121
  return checker.getContextualType(parent2.initializer);
166122
+ // TODO: GH#18217
165706
166123
  case 226 /* BinaryExpression */:
165707
166124
  return checker.getTypeAtLocation(parent2.left);
165708
166125
  case 291 /* JsxAttribute */:
@@ -165889,6 +166306,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
165889
166306
  if (!binaryExpressionMayBeOpenTag(parent2)) {
165890
166307
  break;
165891
166308
  }
166309
+ // falls through
165892
166310
  case 285 /* JsxSelfClosingElement */:
165893
166311
  case 284 /* JsxElement */:
165894
166312
  case 286 /* JsxOpeningElement */:
@@ -166508,6 +166926,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166508
166926
  case 28 /* CommaToken */:
166509
166927
  switch (containingNodeKind) {
166510
166928
  case 213 /* CallExpression */:
166929
+ // func( a, |
166511
166930
  case 214 /* NewExpression */: {
166512
166931
  const expression = contextToken.parent.expression;
166513
166932
  if (getLineAndCharacterOfPosition(sourceFile, expression.end).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
@@ -166518,7 +166937,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166518
166937
  case 226 /* BinaryExpression */:
166519
166938
  return { defaultCommitCharacters: noCommaCommitCharacters, isNewIdentifierLocation: true };
166520
166939
  case 176 /* Constructor */:
166940
+ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
166521
166941
  case 184 /* FunctionType */:
166942
+ // var x: (s: string, list|
166522
166943
  case 210 /* ObjectLiteralExpression */:
166523
166944
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166524
166945
  case 209 /* ArrayLiteralExpression */:
@@ -166529,6 +166950,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166529
166950
  case 21 /* OpenParenToken */:
166530
166951
  switch (containingNodeKind) {
166531
166952
  case 213 /* CallExpression */:
166953
+ // func( |
166532
166954
  case 214 /* NewExpression */: {
166533
166955
  const expression = contextToken.parent.expression;
166534
166956
  if (getLineAndCharacterOfPosition(sourceFile, expression.end).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
@@ -166539,6 +166961,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166539
166961
  case 217 /* ParenthesizedExpression */:
166540
166962
  return { defaultCommitCharacters: noCommaCommitCharacters, isNewIdentifierLocation: true };
166541
166963
  case 176 /* Constructor */:
166964
+ // constructor( |
166542
166965
  case 196 /* ParenthesizedType */:
166543
166966
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166544
166967
  default:
@@ -166547,15 +166970,20 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166547
166970
  case 23 /* OpenBracketToken */:
166548
166971
  switch (containingNodeKind) {
166549
166972
  case 209 /* ArrayLiteralExpression */:
166973
+ // [ |
166550
166974
  case 181 /* IndexSignature */:
166975
+ // [ | : string ]
166551
166976
  case 189 /* TupleType */:
166977
+ // [ | : string ]
166552
166978
  case 167 /* ComputedPropertyName */:
166553
166979
  return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: true };
166554
166980
  default:
166555
166981
  return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: false };
166556
166982
  }
166557
166983
  case 144 /* ModuleKeyword */:
166984
+ // module |
166558
166985
  case 145 /* NamespaceKeyword */:
166986
+ // namespace |
166559
166987
  case 102 /* ImportKeyword */:
166560
166988
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166561
166989
  case 25 /* DotToken */:
@@ -166568,6 +166996,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166568
166996
  case 19 /* OpenBraceToken */:
166569
166997
  switch (containingNodeKind) {
166570
166998
  case 263 /* ClassDeclaration */:
166999
+ // class A { |
166571
167000
  case 210 /* ObjectLiteralExpression */:
166572
167001
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166573
167002
  default:
@@ -166576,6 +167005,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166576
167005
  case 64 /* EqualsToken */:
166577
167006
  switch (containingNodeKind) {
166578
167007
  case 260 /* VariableDeclaration */:
167008
+ // const x = a|
166579
167009
  case 226 /* BinaryExpression */:
166580
167010
  return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: true };
166581
167011
  default:
@@ -166830,6 +167260,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166830
167260
  const parent2 = contextToken2.parent;
166831
167261
  switch (contextToken2.kind) {
166832
167262
  case 32 /* GreaterThanToken */:
167263
+ // End of a type argument list
166833
167264
  case 31 /* LessThanSlashToken */:
166834
167265
  case 44 /* SlashToken */:
166835
167266
  case 80 /* Identifier */:
@@ -166852,6 +167283,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166852
167283
  return parent2.parent.parent;
166853
167284
  }
166854
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
166855
167289
  case 11 /* StringLiteral */:
166856
167290
  if (parent2 && (parent2.kind === 291 /* JsxAttribute */ || parent2.kind === 293 /* JsxSpreadAttribute */)) {
166857
167291
  return parent2.parent.parent;
@@ -166886,14 +167320,18 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166886
167320
  isClassLike(parent2) && !!parent2.typeParameters && parent2.typeParameters.end >= contextToken2.pos;
166887
167321
  case 25 /* DotToken */:
166888
167322
  return containingNodeKind === 207 /* ArrayBindingPattern */;
167323
+ // var [.|
166889
167324
  case 59 /* ColonToken */:
166890
167325
  return containingNodeKind === 208 /* BindingElement */;
167326
+ // var {x :html|
166891
167327
  case 23 /* OpenBracketToken */:
166892
167328
  return containingNodeKind === 207 /* ArrayBindingPattern */;
167329
+ // var [x|
166893
167330
  case 21 /* OpenParenToken */:
166894
167331
  return containingNodeKind === 299 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind);
166895
167332
  case 19 /* OpenBraceToken */:
166896
167333
  return containingNodeKind === 266 /* EnumDeclaration */;
167334
+ // enum a { |
166897
167335
  case 30 /* LessThanToken */:
166898
167336
  return containingNodeKind === 263 /* ClassDeclaration */ || // class A< |
166899
167337
  containingNodeKind === 231 /* ClassExpression */ || // var C = class D< |
@@ -166904,6 +167342,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166904
167342
  return containingNodeKind === 172 /* PropertyDeclaration */ && !isClassLike(parent2.parent);
166905
167343
  case 26 /* DotDotDotToken */:
166906
167344
  return containingNodeKind === 169 /* Parameter */ || !!parent2.parent && parent2.parent.kind === 207 /* ArrayBindingPattern */;
167345
+ // var [...z|
166907
167346
  case 125 /* PublicKeyword */:
166908
167347
  case 123 /* PrivateKeyword */:
166909
167348
  case 124 /* ProtectedKeyword */:
@@ -167130,6 +167569,7 @@ function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile)
167130
167569
  const { parent: parent2 } = contextToken;
167131
167570
  switch (contextToken.kind) {
167132
167571
  case 19 /* OpenBraceToken */:
167572
+ // const x = { |
167133
167573
  case 28 /* CommaToken */:
167134
167574
  if (isObjectLiteralExpression(parent2) || isObjectBindingPattern(parent2)) {
167135
167575
  return parent2;
@@ -167407,9 +167847,11 @@ function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken
167407
167847
  case 64 /* EqualsToken */:
167408
167848
  return void 0;
167409
167849
  case 27 /* SemicolonToken */:
167850
+ // class c {getValue(): number; | }
167410
167851
  case 20 /* CloseBraceToken */:
167411
167852
  return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : tryCast(location, isObjectTypeDeclaration);
167412
167853
  case 19 /* OpenBraceToken */:
167854
+ // class c { |
167413
167855
  case 28 /* CommaToken */:
167414
167856
  return tryCast(contextToken.parent, isObjectTypeDeclaration);
167415
167857
  default:
@@ -167915,6 +168357,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
167915
168357
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 291 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile, typeChecker);
167916
168358
  return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
167917
168359
  }
168360
+ // falls through (is `require("")` or `require(""` or `import("")`)
167918
168361
  case 272 /* ImportDeclaration */:
167919
168362
  case 278 /* ExportDeclaration */:
167920
168363
  case 283 /* ExternalModuleReference */:
@@ -168721,6 +169164,7 @@ function getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, {
168721
169164
  break;
168722
169165
  case 80 /* Identifier */:
168723
169166
  break;
169167
+ // TODO: GH#23879
168724
169168
  case 271 /* ImportEqualsDeclaration */:
168725
169169
  handleNamespaceImport(
168726
169170
  direct,
@@ -169615,6 +170059,7 @@ function declarationIsWriteAccess(decl) {
169615
170059
  case 306 /* EnumMember */:
169616
170060
  case 281 /* ExportSpecifier */:
169617
170061
  case 273 /* ImportClause */:
170062
+ // default import
169618
170063
  case 271 /* ImportEqualsDeclaration */:
169619
170064
  case 276 /* ImportSpecifier */:
169620
170065
  case 264 /* InterfaceDeclaration */:
@@ -170001,6 +170446,7 @@ var Core;
170001
170446
  Debug.assert(node.parent.name === node);
170002
170447
  return 2 /* Class */;
170003
170448
  }
170449
+ // falls through
170004
170450
  default:
170005
170451
  return 0 /* None */;
170006
170452
  }
@@ -170332,6 +170778,7 @@ var Core;
170332
170778
  if (isJSDocMemberName(node.parent)) {
170333
170779
  return true;
170334
170780
  }
170781
+ // falls through I guess
170335
170782
  case 80 /* Identifier */:
170336
170783
  return node.text.length === searchSymbolName.length;
170337
170784
  case 15 /* NoSubstitutionTemplateLiteral */:
@@ -170757,6 +171204,7 @@ var Core;
170757
171204
  searchSpaceNode = searchSpaceNode.parent;
170758
171205
  break;
170759
171206
  }
171207
+ // falls through
170760
171208
  case 172 /* PropertyDeclaration */:
170761
171209
  case 171 /* PropertySignature */:
170762
171210
  case 176 /* Constructor */:
@@ -170769,9 +171217,12 @@ var Core;
170769
171217
  if (isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) {
170770
171218
  return void 0;
170771
171219
  }
171220
+ // falls through
170772
171221
  case 262 /* FunctionDeclaration */:
170773
171222
  case 218 /* FunctionExpression */:
170774
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.
170775
171226
  default:
170776
171227
  return void 0;
170777
171228
  }
@@ -171111,6 +171562,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
171111
171562
  if (!isDefaultClause(node.parent)) {
171112
171563
  break;
171113
171564
  }
171565
+ // falls through
171114
171566
  case 84 /* CaseKeyword */:
171115
171567
  const switchStatement = findAncestor(node.parent, isSwitchStatement);
171116
171568
  if (switchStatement) {
@@ -171555,6 +172007,8 @@ function isDefinitionVisible(checker, declaration) {
171555
172007
  case 178 /* SetAccessor */:
171556
172008
  case 174 /* MethodDeclaration */:
171557
172009
  if (hasEffectiveModifier(declaration, 2 /* Private */)) return false;
172010
+ // Public properties/methods are visible if its parents are visible, so:
172011
+ // falls through
171558
172012
  case 176 /* Constructor */:
171559
172013
  case 303 /* PropertyAssignment */:
171560
172014
  case 304 /* ShorthandPropertyAssignment */:
@@ -172531,6 +172985,7 @@ function getCommentHavingNodes(declaration) {
172531
172985
  if (isJSDocOverloadTag(declaration.parent)) {
172532
172986
  return [declaration.parent.parent];
172533
172987
  }
172988
+ // falls through
172534
172989
  default:
172535
172990
  return getJSDocCommentsAndTags(declaration);
172536
172991
  }
@@ -173868,6 +174323,7 @@ function getOutliningSpanForNode(n, sourceFile) {
173868
174323
  const node = findChildOfKind(tryStatement, 98 /* FinallyKeyword */, sourceFile);
173869
174324
  if (node) return spanForNode(node);
173870
174325
  }
174326
+ // falls through
173871
174327
  default:
173872
174328
  return createOutliningSpan(createTextSpanFromNode(n, sourceFile), "code" /* Code */);
173873
174329
  }
@@ -177693,19 +178149,34 @@ function isBinaryOpContext(context) {
177693
178149
  case 193 /* IntersectionType */:
177694
178150
  case 238 /* SatisfiesExpression */:
177695
178151
  return true;
178152
+ // equals in binding elements: function foo([[x, y] = [1, 2]])
177696
178153
  case 208 /* BindingElement */:
178154
+ // equals in type X = ...
178155
+ // falls through
177697
178156
  case 265 /* TypeAliasDeclaration */:
178157
+ // equal in import a = module('a');
178158
+ // falls through
177698
178159
  case 271 /* ImportEqualsDeclaration */:
178160
+ // equal in export = 1
178161
+ // falls through
177699
178162
  case 277 /* ExportAssignment */:
178163
+ // equal in let a = 0
178164
+ // falls through
177700
178165
  case 260 /* VariableDeclaration */:
178166
+ // equal in p = 0
178167
+ // falls through
177701
178168
  case 169 /* Parameter */:
177702
178169
  case 306 /* EnumMember */:
177703
178170
  case 172 /* PropertyDeclaration */:
177704
178171
  case 171 /* PropertySignature */:
177705
178172
  return context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */;
178173
+ // "in" keyword in for (let x in []) { }
177706
178174
  case 249 /* ForInStatement */:
178175
+ // "in" keyword in [P in keyof T]: T[P]
178176
+ // falls through
177707
178177
  case 168 /* TypeParameter */:
177708
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"
177709
178180
  case 250 /* ForOfStatement */:
177710
178181
  return context.currentTokenSpan.kind === 165 /* OfKeyword */ || context.nextTokenSpan.kind === 165 /* OfKeyword */;
177711
178182
  }
@@ -177769,12 +178240,20 @@ function isFunctionDeclContext(context) {
177769
178240
  case 262 /* FunctionDeclaration */:
177770
178241
  case 174 /* MethodDeclaration */:
177771
178242
  case 173 /* MethodSignature */:
178243
+ // case SyntaxKind.MemberFunctionDeclaration:
178244
+ // falls through
177772
178245
  case 177 /* GetAccessor */:
177773
178246
  case 178 /* SetAccessor */:
178247
+ // case SyntaxKind.MethodSignature:
178248
+ // falls through
177774
178249
  case 179 /* CallSignature */:
177775
178250
  case 218 /* FunctionExpression */:
177776
178251
  case 176 /* Constructor */:
177777
178252
  case 219 /* ArrowFunction */:
178253
+ // case SyntaxKind.ConstructorDeclaration:
178254
+ // case SyntaxKind.SimpleArrowFunctionExpression:
178255
+ // case SyntaxKind.ParenthesizedArrowFunctionExpression:
178256
+ // falls through
177778
178257
  case 264 /* InterfaceDeclaration */:
177779
178258
  return true;
177780
178259
  }
@@ -177834,6 +178313,9 @@ function isControlDeclContext(context) {
177834
178313
  case 258 /* TryStatement */:
177835
178314
  case 246 /* DoStatement */:
177836
178315
  case 254 /* WithStatement */:
178316
+ // TODO
178317
+ // case SyntaxKind.ElseClause:
178318
+ // falls through
177837
178319
  case 299 /* CatchClause */:
177838
178320
  return true;
177839
178321
  default:
@@ -178462,6 +178944,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178462
178944
  if (node.asteriskToken) {
178463
178945
  return 42 /* AsteriskToken */;
178464
178946
  }
178947
+ // falls through
178465
178948
  case 172 /* PropertyDeclaration */:
178466
178949
  case 169 /* Parameter */:
178467
178950
  const name = getNameOfDeclaration(node);
@@ -178474,6 +178957,10 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178474
178957
  return {
178475
178958
  getIndentationForComment: (kind, tokenIndentation, container) => {
178476
178959
  switch (kind) {
178960
+ // preceding comment to the token that closes the indentation scope inherits the indentation from the scope
178961
+ // .. {
178962
+ // // comment
178963
+ // }
178477
178964
  case 20 /* CloseBraceToken */:
178478
178965
  case 24 /* CloseBracketToken */:
178479
178966
  case 22 /* CloseParenToken */:
@@ -178503,6 +178990,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178503
178990
  };
178504
178991
  function shouldAddDelta(line, kind, container) {
178505
178992
  switch (kind) {
178993
+ // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent
178506
178994
  case 19 /* OpenBraceToken */:
178507
178995
  case 20 /* CloseBraceToken */:
178508
178996
  case 22 /* CloseParenToken */:
@@ -178703,7 +179191,6 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178703
179191
  Debug.assert(rangeContainsRange(parent2, currentTokenInfo.token));
178704
179192
  const lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine();
178705
179193
  let indentToken = false;
178706
- let isNewlineSemicolon = false;
178707
179194
  if (currentTokenInfo.leadingTrivia) {
178708
179195
  processTrivia(currentTokenInfo.leadingTrivia, parent2, childContextNode, dynamicIndentation);
178709
179196
  }
@@ -178718,7 +179205,6 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178718
179205
  if (lineAction === 0 /* None */) {
178719
179206
  const prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;
178720
179207
  indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;
178721
- isNewlineSemicolon = currentTokenInfo.token.kind === 27 /* SemicolonToken */;
178722
179208
  } else {
178723
179209
  indentToken = lineAction === 1 /* LineAdded */;
178724
179210
  }
@@ -178729,7 +179215,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178729
179215
  processTrivia(currentTokenInfo.trailingTrivia, parent2, childContextNode, dynamicIndentation);
178730
179216
  }
178731
179217
  if (indentToken) {
178732
- const tokenIndentation = isTokenInRange && !rangeContainsError(currentTokenInfo.token) ? dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken || isNewlineSemicolon) : -1 /* Unknown */;
179218
+ const tokenIndentation = isTokenInRange && !rangeContainsError(currentTokenInfo.token) ? dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken) : -1 /* Unknown */;
178733
179219
  let indentNextTokenOrTrivia = true;
178734
179220
  if (currentTokenInfo.leadingTrivia) {
178735
179221
  const commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container);
@@ -181847,6 +182333,7 @@ __export(ts_exports2, {
181847
182333
  tagNamesAreEquivalent: () => tagNamesAreEquivalent,
181848
182334
  takeWhile: () => takeWhile,
181849
182335
  targetOptionDeclaration: () => targetOptionDeclaration,
182336
+ targetToLibMap: () => targetToLibMap,
181850
182337
  testFormatSettings: () => testFormatSettings,
181851
182338
  textChangeRangeIsUnchanged: () => textChangeRangeIsUnchanged,
181852
182339
  textChangeRangeNewSpan: () => textChangeRangeNewSpan,
@@ -183633,6 +184120,7 @@ var Project2 = class _Project {
183633
184120
  this.globalCacheResolutionModuleName = ts_JsTyping_exports.nonRelativeModuleNameForTypingCache;
183634
184121
  /** @internal */
183635
184122
  this.updateFromProjectInProgress = false;
184123
+ projectService.logger.info(`Creating ${ProjectKind[projectKind]}Project: ${projectName}, currentDirectory: ${currentDirectory}`);
183636
184124
  this.projectName = projectName;
183637
184125
  this.directoryStructureHost = directoryStructureHost;
183638
184126
  this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
@@ -184557,7 +185045,7 @@ var Project2 = class _Project {
184557
185045
  }
184558
185046
  removeExistingTypings(include) {
184559
185047
  if (!include.length) return include;
184560
- const existing = getAutomaticTypeDirectiveNames(this.getCompilerOptions(), this.directoryStructureHost);
185048
+ const existing = getAutomaticTypeDirectiveNames(this.getCompilerOptions(), this);
184561
185049
  return filter(include, (i) => !existing.includes(i));
184562
185050
  }
184563
185051
  updateGraphWorker() {
@@ -186432,6 +186920,9 @@ var _ProjectService = class _ProjectService {
186432
186920
  this.toCanonicalFileName = createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
186433
186921
  this.globalCacheLocationDirectoryPath = this.typingsInstaller.globalTypingsCacheLocation ? ensureTrailingDirectorySeparator(this.toPath(this.typingsInstaller.globalTypingsCacheLocation)) : void 0;
186434
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}`);
186435
186926
  if (this.typesMapLocation) {
186436
186927
  this.loadTypesMap();
186437
186928
  } else {
@@ -187499,7 +187990,6 @@ var _ProjectService = class _ProjectService {
187499
187990
  createConfiguredProject(configFileName, reason) {
187500
187991
  var _a;
187501
187992
  (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.Session, "createConfiguredProject", { configFilePath: configFileName });
187502
- this.logger.info(`Creating configuration project ${configFileName}`);
187503
187993
  const canonicalConfigFilePath = asNormalizedPath(this.toCanonicalFileName(configFileName));
187504
187994
  let configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
187505
187995
  if (!configFileExistenceInfo) {
@@ -189418,9 +189908,11 @@ Dynamic files must always be opened with service's current directory or service
189418
189908
  const result = [];
189419
189909
  const processDirectory = (directory) => {
189420
189910
  switch (packageJsonCache.directoryHasPackageJson(directory)) {
189911
+ // Sync and check same directory again
189421
189912
  case 3 /* Maybe */:
189422
189913
  packageJsonCache.searchDirectoryAndAncestors(directory);
189423
189914
  return processDirectory(directory);
189915
+ // Check package.json
189424
189916
  case -1 /* True */:
189425
189917
  const packageJsonFileName = combinePaths(directory, "package.json");
189426
189918
  this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project);
@@ -196205,6 +196697,7 @@ if (typeof console !== "undefined") {
196205
196697
  tagNamesAreEquivalent,
196206
196698
  takeWhile,
196207
196699
  targetOptionDeclaration,
196700
+ targetToLibMap,
196208
196701
  testFormatSettings,
196209
196702
  textChangeRangeIsUnchanged,
196210
196703
  textChangeRangeNewSpan,