typescript 5.7.0-dev.20240829 → 5.7.0-dev.20240831

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
@@ -2265,7 +2265,7 @@ module.exports = __toCommonJS(typescript_exports);
2265
2265
 
2266
2266
  // src/compiler/corePublic.ts
2267
2267
  var versionMajorMinor = "5.7";
2268
- var version = `${versionMajorMinor}.0-dev.20240829`;
2268
+ var version = `${versionMajorMinor}.0-dev.20240831`;
2269
2269
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2270
2270
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2271
2271
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -2733,7 +2733,10 @@ function deduplicateSorted(array, comparer) {
2733
2733
  for (let i = 1; i < array.length; i++) {
2734
2734
  const next = array[i];
2735
2735
  switch (comparer(next, last2)) {
2736
+ // equality comparison
2736
2737
  case true:
2738
+ // relational comparison
2739
+ // falls through
2737
2740
  case 0 /* EqualTo */:
2738
2741
  continue;
2739
2742
  case -1 /* LessThan */:
@@ -3618,7 +3621,7 @@ function findBestPatternMatch(values, getPattern, candidate) {
3618
3621
  for (let i = 0; i < values.length; i++) {
3619
3622
  const v = values[i];
3620
3623
  const pattern = getPattern(v);
3621
- if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
3624
+ if (pattern.prefix.length > longestMatchPrefixLength && isPatternMatch(pattern, candidate)) {
3622
3625
  longestMatchPrefixLength = pattern.prefix.length;
3623
3626
  matchedValue = v;
3624
3627
  }
@@ -5854,10 +5857,11 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind5) => {
5854
5857
  SyntaxKind5[SyntaxKind5["JSDocImportTag"] = 351] = "JSDocImportTag";
5855
5858
  SyntaxKind5[SyntaxKind5["SyntaxList"] = 352] = "SyntaxList";
5856
5859
  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";
5860
+ SyntaxKind5[SyntaxKind5["NotEmittedTypeElement"] = 354] = "NotEmittedTypeElement";
5861
+ SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 355] = "PartiallyEmittedExpression";
5862
+ SyntaxKind5[SyntaxKind5["CommaListExpression"] = 356] = "CommaListExpression";
5863
+ SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression";
5864
+ SyntaxKind5[SyntaxKind5["Count"] = 358] = "Count";
5861
5865
  SyntaxKind5[SyntaxKind5["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
5862
5866
  SyntaxKind5[SyntaxKind5["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
5863
5867
  SyntaxKind5[SyntaxKind5["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
@@ -7997,6 +8001,7 @@ function createSystemWatchFunctions({
7997
8001
  return generateWatchFileOptions(4 /* UseFsEvents */, 2 /* DynamicPriority */, options);
7998
8002
  case "UseFsEventsOnParentDirectory":
7999
8003
  useNonPollingWatchers2 = true;
8004
+ // fall through
8000
8005
  default:
8001
8006
  return useNonPollingWatchers2 ? (
8002
8007
  // Use notifications from FS to watch with falling back to fs.watchFile
@@ -11538,6 +11543,7 @@ function computeLineStarts(text) {
11538
11543
  if (text.charCodeAt(pos) === 10 /* lineFeed */) {
11539
11544
  pos++;
11540
11545
  }
11546
+ // falls through
11541
11547
  case 10 /* lineFeed */:
11542
11548
  result.push(lineStart);
11543
11549
  lineStart = pos;
@@ -11640,6 +11646,8 @@ function couldStartTrivia(text, pos) {
11640
11646
  case 12 /* formFeed */:
11641
11647
  case 32 /* space */:
11642
11648
  case 47 /* slash */:
11649
+ // starts of normal trivia
11650
+ // falls through
11643
11651
  case 60 /* lessThan */:
11644
11652
  case 124 /* bar */:
11645
11653
  case 61 /* equals */:
@@ -11663,6 +11671,7 @@ function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments, inJSDoc) {
11663
11671
  if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
11664
11672
  pos++;
11665
11673
  }
11674
+ // falls through
11666
11675
  case 10 /* lineFeed */:
11667
11676
  pos++;
11668
11677
  if (stopAfterLineBreak) {
@@ -11809,6 +11818,7 @@ function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
11809
11818
  if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
11810
11819
  pos++;
11811
11820
  }
11821
+ // falls through
11812
11822
  case 10 /* lineFeed */:
11813
11823
  pos++;
11814
11824
  if (trailing) {
@@ -12374,12 +12384,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12374
12384
  if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
12375
12385
  return "\0";
12376
12386
  }
12387
+ // '\01', '\011'
12388
+ // falls through
12377
12389
  case 49 /* _1 */:
12378
12390
  case 50 /* _2 */:
12379
12391
  case 51 /* _3 */:
12380
12392
  if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
12381
12393
  pos++;
12382
12394
  }
12395
+ // '\17', '\177'
12396
+ // falls through
12383
12397
  case 52 /* _4 */:
12384
12398
  case 53 /* _5 */:
12385
12399
  case 54 /* _6 */:
@@ -12477,10 +12491,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12477
12491
  }
12478
12492
  tokenFlags |= 4096 /* HexEscape */;
12479
12493
  return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
12494
+ // when encountering a LineContinuation (i.e. a backslash and a line terminator sequence),
12495
+ // the line terminator is interpreted to be "the empty code unit sequence".
12480
12496
  case 13 /* carriageReturn */:
12481
12497
  if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
12482
12498
  pos++;
12483
12499
  }
12500
+ // falls through
12484
12501
  case 10 /* lineFeed */:
12485
12502
  case 8232 /* lineSeparator */:
12486
12503
  case 8233 /* paragraphSeparator */:
@@ -12911,6 +12928,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12911
12928
  tokenFlags |= 256 /* OctalSpecifier */;
12912
12929
  return token = checkBigIntSuffix();
12913
12930
  }
12931
+ // falls through
12914
12932
  case 49 /* _1 */:
12915
12933
  case 50 /* _2 */:
12916
12934
  case 51 /* _3 */:
@@ -13430,6 +13448,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13430
13448
  break;
13431
13449
  }
13432
13450
  }
13451
+ // falls through
13433
13452
  case 42 /* asterisk */:
13434
13453
  case 43 /* plus */:
13435
13454
  case 63 /* question */:
@@ -13460,6 +13479,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13460
13479
  if (isInGroup) {
13461
13480
  return;
13462
13481
  }
13482
+ // falls through
13463
13483
  case 93 /* closeBracket */:
13464
13484
  case 125 /* closeBrace */:
13465
13485
  if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
@@ -13522,6 +13542,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13522
13542
  error2(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
13523
13543
  break;
13524
13544
  }
13545
+ // falls through
13525
13546
  default:
13526
13547
  Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
13527
13548
  /*atomEscape*/
@@ -13659,6 +13680,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13659
13680
  let start2 = pos;
13660
13681
  let operand;
13661
13682
  switch (text.slice(pos, pos + 2)) {
13683
+ // TODO: don't use slice
13662
13684
  case "--":
13663
13685
  case "&&":
13664
13686
  error2(Diagnostics.Expected_a_class_set_operand);
@@ -13764,6 +13786,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13764
13786
  }
13765
13787
  start2 = pos;
13766
13788
  switch (text.slice(pos, pos + 2)) {
13789
+ // TODO: don't use slice
13767
13790
  case "--":
13768
13791
  case "&&":
13769
13792
  error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
@@ -13861,6 +13884,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13861
13884
  }
13862
13885
  }
13863
13886
  pos--;
13887
+ // falls through
13864
13888
  default:
13865
13889
  return scanClassSetCharacter();
13866
13890
  }
@@ -14007,6 +14031,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14007
14031
  return true;
14008
14032
  case 80 /* P */:
14009
14033
  isCharacterComplement = true;
14034
+ // falls through
14010
14035
  case 112 /* p */:
14011
14036
  pos++;
14012
14037
  if (charCodeChecked(pos) === 123 /* openBrace */) {
@@ -14314,6 +14339,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14314
14339
  if (charCodeUnchecked(pos) === 10 /* lineFeed */) {
14315
14340
  pos++;
14316
14341
  }
14342
+ // falls through
14317
14343
  case 10 /* lineFeed */:
14318
14344
  tokenFlags |= 1 /* PrecedingLineBreak */;
14319
14345
  return token = 4 /* NewLineTrivia */;
@@ -14540,6 +14566,7 @@ function getDefaultLibFileName(options) {
14540
14566
  return "lib.es2016.full.d.ts";
14541
14567
  case 2 /* ES2015 */:
14542
14568
  return "lib.es6.d.ts";
14569
+ // We don't use lib.es2015.full.d.ts due to breaking change.
14543
14570
  default:
14544
14571
  return "lib.d.ts";
14545
14572
  }
@@ -15480,7 +15507,7 @@ function isModifierLike(node) {
15480
15507
  }
15481
15508
  function isTypeElement(node) {
15482
15509
  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 */;
15510
+ 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
15511
  }
15485
15512
  function isClassOrTypeElement(node) {
15486
15513
  return isTypeElement(node) || isClassElement(node);
@@ -15542,7 +15569,9 @@ function isObjectBindingOrAssignmentElement(node) {
15542
15569
  switch (node.kind) {
15543
15570
  case 208 /* BindingElement */:
15544
15571
  case 303 /* PropertyAssignment */:
15572
+ // AssignmentProperty
15545
15573
  case 304 /* ShorthandPropertyAssignment */:
15574
+ // AssignmentProperty
15546
15575
  case 305 /* SpreadAssignment */:
15547
15576
  return true;
15548
15577
  }
@@ -15560,11 +15589,17 @@ function isArrayBindingOrAssignmentElement(node) {
15560
15589
  switch (node.kind) {
15561
15590
  case 208 /* BindingElement */:
15562
15591
  case 232 /* OmittedExpression */:
15592
+ // Elision
15563
15593
  case 230 /* SpreadElement */:
15594
+ // AssignmentRestElement
15564
15595
  case 209 /* ArrayLiteralExpression */:
15596
+ // ArrayAssignmentPattern
15565
15597
  case 210 /* ObjectLiteralExpression */:
15598
+ // ObjectAssignmentPattern
15566
15599
  case 80 /* Identifier */:
15600
+ // DestructuringAssignmentTarget
15567
15601
  case 211 /* PropertyAccessExpression */:
15602
+ // DestructuringAssignmentTarget
15568
15603
  case 212 /* ElementAccessExpression */:
15569
15604
  return true;
15570
15605
  }
@@ -15625,6 +15660,7 @@ function isLeftHandSideExpressionKind(kind) {
15625
15660
  case 218 /* FunctionExpression */:
15626
15661
  case 80 /* Identifier */:
15627
15662
  case 81 /* PrivateIdentifier */:
15663
+ // technically this is only an Expression if it's in a `#field in expr` BinaryExpression
15628
15664
  case 14 /* RegularExpressionLiteral */:
15629
15665
  case 9 /* NumericLiteral */:
15630
15666
  case 10 /* BigIntLiteral */:
@@ -15640,6 +15676,7 @@ function isLeftHandSideExpressionKind(kind) {
15640
15676
  case 233 /* ExpressionWithTypeArguments */:
15641
15677
  case 236 /* MetaProperty */:
15642
15678
  case 102 /* ImportKeyword */:
15679
+ // technically this is only an Expression if it's in a CallExpression
15643
15680
  case 282 /* MissingDeclaration */:
15644
15681
  return true;
15645
15682
  default:
@@ -15696,8 +15733,8 @@ function isExpressionKind(kind) {
15696
15733
  case 230 /* SpreadElement */:
15697
15734
  case 234 /* AsExpression */:
15698
15735
  case 232 /* OmittedExpression */:
15699
- case 355 /* CommaListExpression */:
15700
- case 354 /* PartiallyEmittedExpression */:
15736
+ case 356 /* CommaListExpression */:
15737
+ case 355 /* PartiallyEmittedExpression */:
15701
15738
  case 238 /* SatisfiesExpression */:
15702
15739
  return true;
15703
15740
  default:
@@ -17436,6 +17473,8 @@ function getErrorSpanForNode(sourceFile, node) {
17436
17473
  }
17437
17474
  return getSpanOfTokenAtPosition(sourceFile, pos2);
17438
17475
  }
17476
+ // This list is a work in progress. Add missing node kinds to improve their error
17477
+ // spans.
17439
17478
  case 260 /* VariableDeclaration */:
17440
17479
  case 208 /* BindingElement */:
17441
17480
  case 263 /* ClassDeclaration */:
@@ -17607,6 +17646,8 @@ function isPartOfTypeNode(node) {
17607
17646
  return isPartOfTypeExpressionWithTypeArguments(node);
17608
17647
  case 168 /* TypeParameter */:
17609
17648
  return node.parent.kind === 200 /* MappedType */ || node.parent.kind === 195 /* InferType */;
17649
+ // Identifiers and qualified names may be type nodes, depending on their context. Climb
17650
+ // above them to find the lowest container
17610
17651
  case 80 /* Identifier */:
17611
17652
  if (node.parent.kind === 166 /* QualifiedName */ && node.parent.right === node) {
17612
17653
  node = node.parent;
@@ -17614,6 +17655,7 @@ function isPartOfTypeNode(node) {
17614
17655
  node = node.parent;
17615
17656
  }
17616
17657
  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'.");
17658
+ // falls through
17617
17659
  case 166 /* QualifiedName */:
17618
17660
  case 211 /* PropertyAccessExpression */:
17619
17661
  case 110 /* ThisKeyword */: {
@@ -17882,6 +17924,7 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
17882
17924
  if (!includeArrowFunctions) {
17883
17925
  continue;
17884
17926
  }
17927
+ // falls through
17885
17928
  case 262 /* FunctionDeclaration */:
17886
17929
  case 218 /* FunctionExpression */:
17887
17930
  case 267 /* ModuleDeclaration */:
@@ -17904,6 +17947,8 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
17904
17947
  }
17905
17948
  function isThisContainerOrFunctionBlock(node) {
17906
17949
  switch (node.kind) {
17950
+ // Arrow functions use the same scope, but may do so in a "delayed" manner
17951
+ // For example, `const getThis = () => this` may be before a super() call in a derived constructor
17907
17952
  case 219 /* ArrowFunction */:
17908
17953
  case 262 /* FunctionDeclaration */:
17909
17954
  case 218 /* FunctionExpression */:
@@ -17970,6 +18015,7 @@ function getSuperContainer(node, stopOnFunctions) {
17970
18015
  if (!stopOnFunctions) {
17971
18016
  continue;
17972
18017
  }
18018
+ // falls through
17973
18019
  case 172 /* PropertyDeclaration */:
17974
18020
  case 171 /* PropertySignature */:
17975
18021
  case 174 /* MethodDeclaration */:
@@ -18023,6 +18069,7 @@ function getEntityNameFromTypeNode(node) {
18023
18069
  return node.typeName;
18024
18070
  case 233 /* ExpressionWithTypeArguments */:
18025
18071
  return isEntityNameExpression(node.expression) ? node.expression : void 0;
18072
+ // 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
18073
  case 80 /* Identifier */:
18027
18074
  case 166 /* QualifiedName */:
18028
18075
  return node;
@@ -18187,6 +18234,7 @@ function isExpressionNode(node) {
18187
18234
  if (node.parent.kind === 186 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) {
18188
18235
  return true;
18189
18236
  }
18237
+ // falls through
18190
18238
  case 9 /* NumericLiteral */:
18191
18239
  case 10 /* BigIntLiteral */:
18192
18240
  case 11 /* StringLiteral */:
@@ -19101,6 +19149,7 @@ function getDeclarationFromName(name) {
19101
19149
  case 15 /* NoSubstitutionTemplateLiteral */:
19102
19150
  case 9 /* NumericLiteral */:
19103
19151
  if (isComputedPropertyName(parent2)) return parent2.parent;
19152
+ // falls through
19104
19153
  case 80 /* Identifier */:
19105
19154
  if (isDeclaration(parent2)) {
19106
19155
  return parent2.name === name ? parent2 : void 0;
@@ -19271,6 +19320,7 @@ function getFunctionFlags(node) {
19271
19320
  if (node.asteriskToken) {
19272
19321
  flags |= 1 /* Generator */;
19273
19322
  }
19323
+ // falls through
19274
19324
  case 219 /* ArrowFunction */:
19275
19325
  if (hasSyntacticModifier(node, 1024 /* Async */)) {
19276
19326
  flags |= 2 /* Async */;
@@ -19541,7 +19591,7 @@ var OperatorPrecedence = /* @__PURE__ */ ((OperatorPrecedence2) => {
19541
19591
  })(OperatorPrecedence || {});
19542
19592
  function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
19543
19593
  switch (nodeKind) {
19544
- case 355 /* CommaListExpression */:
19594
+ case 356 /* CommaListExpression */:
19545
19595
  return 0 /* Comma */;
19546
19596
  case 230 /* SpreadElement */:
19547
19597
  return 1 /* Spread */;
@@ -19573,6 +19623,7 @@ function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
19573
19623
  default:
19574
19624
  return getBinaryOperatorPrecedence(operatorKind);
19575
19625
  }
19626
+ // TODO: Should prefix `++` and `--` be moved to the `Update` precedence?
19576
19627
  case 216 /* TypeAssertionExpression */:
19577
19628
  case 235 /* NonNullExpression */:
19578
19629
  case 224 /* PrefixUnaryExpression */:
@@ -21207,11 +21258,12 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
21207
21258
  if (stopAtCallExpressions) {
21208
21259
  return node;
21209
21260
  }
21261
+ // falls through
21210
21262
  case 234 /* AsExpression */:
21211
21263
  case 212 /* ElementAccessExpression */:
21212
21264
  case 211 /* PropertyAccessExpression */:
21213
21265
  case 235 /* NonNullExpression */:
21214
- case 354 /* PartiallyEmittedExpression */:
21266
+ case 355 /* PartiallyEmittedExpression */:
21215
21267
  case 238 /* SatisfiesExpression */:
21216
21268
  node = node.expression;
21217
21269
  continue;
@@ -22385,8 +22437,33 @@ function tryParsePattern(pattern) {
22385
22437
  suffix: pattern.substr(indexOfStar + 1)
22386
22438
  };
22387
22439
  }
22440
+ var parsedPatternsCache = /* @__PURE__ */ new WeakMap();
22388
22441
  function tryParsePatterns(paths) {
22389
- return mapDefined(getOwnKeys(paths), (path) => tryParsePattern(path));
22442
+ let result = parsedPatternsCache.get(paths);
22443
+ if (result !== void 0) {
22444
+ return result;
22445
+ }
22446
+ let matchableStringSet;
22447
+ let patterns;
22448
+ const pathList = getOwnKeys(paths);
22449
+ for (const path of pathList) {
22450
+ const patternOrStr = tryParsePattern(path);
22451
+ if (patternOrStr === void 0) {
22452
+ continue;
22453
+ } else if (typeof patternOrStr === "string") {
22454
+ (matchableStringSet ?? (matchableStringSet = /* @__PURE__ */ new Set())).add(patternOrStr);
22455
+ } else {
22456
+ (patterns ?? (patterns = [])).push(patternOrStr);
22457
+ }
22458
+ }
22459
+ parsedPatternsCache.set(
22460
+ paths,
22461
+ result = {
22462
+ matchableStringSet,
22463
+ patterns
22464
+ }
22465
+ );
22466
+ return result;
22390
22467
  }
22391
22468
  function positionIsSynthesized(pos) {
22392
22469
  return !(pos >= 0);
@@ -22414,15 +22491,13 @@ var emptyFileSystemEntries = {
22414
22491
  files: emptyArray,
22415
22492
  directories: emptyArray
22416
22493
  };
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
- }
22494
+ function matchPatternOrExact(parsedPatterns, candidate) {
22495
+ const { matchableStringSet, patterns } = parsedPatterns;
22496
+ if (matchableStringSet == null ? void 0 : matchableStringSet.has(candidate)) {
22497
+ return candidate;
22498
+ }
22499
+ if (patterns === void 0 || patterns.length === 0) {
22500
+ return void 0;
22426
22501
  }
22427
22502
  return findBestPatternMatch(patterns, (_) => _, candidate);
22428
22503
  }
@@ -22499,6 +22574,7 @@ function isJsonEqual(a, b) {
22499
22574
  function parsePseudoBigInt(stringValue) {
22500
22575
  let log2Base;
22501
22576
  switch (stringValue.charCodeAt(1)) {
22577
+ // "x" in "0x123"
22502
22578
  case 98 /* b */:
22503
22579
  case 66 /* B */:
22504
22580
  log2Base = 1;
@@ -22746,7 +22822,7 @@ function getContainingNodeArray(node) {
22746
22822
  return parent2.types;
22747
22823
  case 189 /* TupleType */:
22748
22824
  case 209 /* ArrayLiteralExpression */:
22749
- case 355 /* CommaListExpression */:
22825
+ case 356 /* CommaListExpression */:
22750
22826
  case 275 /* NamedImports */:
22751
22827
  case 279 /* NamedExports */:
22752
22828
  return parent2.elements;
@@ -23285,6 +23361,7 @@ function createNameResolver({
23285
23361
  switch (location.kind) {
23286
23362
  case 307 /* SourceFile */:
23287
23363
  if (!isExternalOrCommonJsModule(location)) break;
23364
+ // falls through
23288
23365
  case 267 /* ModuleDeclaration */:
23289
23366
  const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
23290
23367
  if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
@@ -23368,6 +23445,14 @@ function createNameResolver({
23368
23445
  }
23369
23446
  }
23370
23447
  break;
23448
+ // It is not legal to reference a class's own type parameters from a computed property name that
23449
+ // belongs to the class. For example:
23450
+ //
23451
+ // function foo<T>() { return '' }
23452
+ // class C<T> { // <-- Class's own type parameter T
23453
+ // [foo<T>()]() { } // <-- Reference to T from class's own computed property
23454
+ // }
23455
+ //
23371
23456
  case 167 /* ComputedPropertyName */:
23372
23457
  grandparent = location.parent.parent;
23373
23458
  if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
@@ -23383,6 +23468,7 @@ function createNameResolver({
23383
23468
  if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
23384
23469
  break;
23385
23470
  }
23471
+ // falls through
23386
23472
  case 174 /* MethodDeclaration */:
23387
23473
  case 176 /* Constructor */:
23388
23474
  case 177 /* GetAccessor */:
@@ -24027,6 +24113,7 @@ function createParenthesizerRules(factory2) {
24027
24113
  function parenthesizeConstituentTypeOfUnionType(type) {
24028
24114
  switch (type.kind) {
24029
24115
  case 192 /* UnionType */:
24116
+ // Not strictly necessary, but a union containing a union should have been flattened
24030
24117
  case 193 /* IntersectionType */:
24031
24118
  return factory2.createParenthesizedType(type);
24032
24119
  }
@@ -24808,6 +24895,7 @@ function createNodeFactory(flags, baseFactory2) {
24808
24895
  createSyntheticExpression,
24809
24896
  createSyntaxList: createSyntaxList3,
24810
24897
  createNotEmittedStatement,
24898
+ createNotEmittedTypeElement,
24811
24899
  createPartiallyEmittedExpression,
24812
24900
  updatePartiallyEmittedExpression,
24813
24901
  createCommaListExpression,
@@ -27834,7 +27922,7 @@ function createNodeFactory(flags, baseFactory2) {
27834
27922
  return node;
27835
27923
  }
27836
27924
  function createPartiallyEmittedExpression(expression, original) {
27837
- const node = createBaseNode(354 /* PartiallyEmittedExpression */);
27925
+ const node = createBaseNode(355 /* PartiallyEmittedExpression */);
27838
27926
  node.expression = expression;
27839
27927
  node.original = original;
27840
27928
  node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
@@ -27844,6 +27932,9 @@ function createNodeFactory(flags, baseFactory2) {
27844
27932
  function updatePartiallyEmittedExpression(node, expression) {
27845
27933
  return node.expression !== expression ? update(createPartiallyEmittedExpression(expression, node.original), node) : node;
27846
27934
  }
27935
+ function createNotEmittedTypeElement() {
27936
+ return createBaseNode(354 /* NotEmittedTypeElement */);
27937
+ }
27847
27938
  function flattenCommaElements(node) {
27848
27939
  if (nodeIsSynthesized(node) && !isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
27849
27940
  if (isCommaListExpression(node)) {
@@ -27856,7 +27947,7 @@ function createNodeFactory(flags, baseFactory2) {
27856
27947
  return node;
27857
27948
  }
27858
27949
  function createCommaListExpression(elements) {
27859
- const node = createBaseNode(355 /* CommaListExpression */);
27950
+ const node = createBaseNode(356 /* CommaListExpression */);
27860
27951
  node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
27861
27952
  node.transformFlags |= propagateChildrenFlags(node.elements);
27862
27953
  return node;
@@ -27865,7 +27956,7 @@ function createNodeFactory(flags, baseFactory2) {
27865
27956
  return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
27866
27957
  }
27867
27958
  function createSyntheticReferenceExpression(expression, thisArg) {
27868
- const node = createBaseNode(356 /* SyntheticReferenceExpression */);
27959
+ const node = createBaseNode(357 /* SyntheticReferenceExpression */);
27869
27960
  node.expression = expression;
27870
27961
  node.thisArg = thisArg;
27871
27962
  node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
@@ -28112,7 +28203,7 @@ function createNodeFactory(flags, baseFactory2) {
28112
28203
  return updateNonNullExpression(outerExpression, expression);
28113
28204
  case 233 /* ExpressionWithTypeArguments */:
28114
28205
  return updateExpressionWithTypeArguments(outerExpression, expression, outerExpression.typeArguments);
28115
- case 354 /* PartiallyEmittedExpression */:
28206
+ case 355 /* PartiallyEmittedExpression */:
28116
28207
  return updatePartiallyEmittedExpression(outerExpression, expression);
28117
28208
  }
28118
28209
  }
@@ -28657,7 +28748,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
28657
28748
  case 216 /* TypeAssertionExpression */:
28658
28749
  case 238 /* SatisfiesExpression */:
28659
28750
  case 234 /* AsExpression */:
28660
- case 354 /* PartiallyEmittedExpression */:
28751
+ case 355 /* PartiallyEmittedExpression */:
28661
28752
  case 217 /* ParenthesizedExpression */:
28662
28753
  case 108 /* SuperKeyword */:
28663
28754
  return -2147483648 /* OuterExpressionExcludes */;
@@ -30366,10 +30457,10 @@ function isSyntheticExpression(node) {
30366
30457
  return node.kind === 237 /* SyntheticExpression */;
30367
30458
  }
30368
30459
  function isPartiallyEmittedExpression(node) {
30369
- return node.kind === 354 /* PartiallyEmittedExpression */;
30460
+ return node.kind === 355 /* PartiallyEmittedExpression */;
30370
30461
  }
30371
30462
  function isCommaListExpression(node) {
30372
- return node.kind === 355 /* CommaListExpression */;
30463
+ return node.kind === 356 /* CommaListExpression */;
30373
30464
  }
30374
30465
  function isTemplateSpan(node) {
30375
30466
  return node.kind === 239 /* TemplateSpan */;
@@ -30525,7 +30616,7 @@ function isNotEmittedStatement(node) {
30525
30616
  return node.kind === 353 /* NotEmittedStatement */;
30526
30617
  }
30527
30618
  function isSyntheticReference(node) {
30528
- return node.kind === 356 /* SyntheticReferenceExpression */;
30619
+ return node.kind === 357 /* SyntheticReferenceExpression */;
30529
30620
  }
30530
30621
  function isExternalModuleReference(node) {
30531
30622
  return node.kind === 283 /* ExternalModuleReference */;
@@ -31148,7 +31239,7 @@ function isOuterExpression(node, kinds = 31 /* All */) {
31148
31239
  return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
31149
31240
  case 235 /* NonNullExpression */:
31150
31241
  return (kinds & 4 /* NonNullAssertions */) !== 0;
31151
- case 354 /* PartiallyEmittedExpression */:
31242
+ case 355 /* PartiallyEmittedExpression */:
31152
31243
  return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
31153
31244
  }
31154
31245
  return false;
@@ -31592,10 +31683,13 @@ var BinaryExpressionState;
31592
31683
  switch (currentState) {
31593
31684
  case enter:
31594
31685
  if (machine.onLeft) return left;
31686
+ // falls through
31595
31687
  case left:
31596
31688
  if (machine.onOperator) return operator;
31689
+ // falls through
31597
31690
  case operator:
31598
31691
  if (machine.onRight) return right;
31692
+ // falls through
31599
31693
  case right:
31600
31694
  return exit;
31601
31695
  case exit:
@@ -32223,7 +32317,7 @@ var forEachChildTable = {
32223
32317
  [282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
32224
32318
  return visitNodes(cbNode, cbNodes, node.modifiers);
32225
32319
  },
32226
- [355 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
32320
+ [356 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
32227
32321
  return visitNodes(cbNode, cbNodes, node.elements);
32228
32322
  },
32229
32323
  [284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
@@ -32319,7 +32413,7 @@ var forEachChildTable = {
32319
32413
  [331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
32320
32414
  [337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
32321
32415
  [351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
32322
- [354 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
32416
+ [355 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
32323
32417
  };
32324
32418
  function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
32325
32419
  return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
@@ -32689,6 +32783,7 @@ var Parser;
32689
32783
  expression2 = parseLiteralNode();
32690
32784
  break;
32691
32785
  }
32786
+ // falls through
32692
32787
  default:
32693
32788
  expression2 = parseObjectLiteralExpression();
32694
32789
  break;
@@ -33610,6 +33705,7 @@ var Parser;
33610
33705
  case 25 /* DotToken */:
33611
33706
  return true;
33612
33707
  }
33708
+ // falls through
33613
33709
  case 11 /* ArgumentExpressions */:
33614
33710
  return token() === 26 /* DotDotDotToken */ || isStartOfExpression();
33615
33711
  case 16 /* Parameters */:
@@ -33643,6 +33739,7 @@ var Parser;
33643
33739
  return true;
33644
33740
  case 26 /* Count */:
33645
33741
  return Debug.fail("ParsingContext.Count used as a context");
33742
+ // Not a real context, only a marker.
33646
33743
  default:
33647
33744
  Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
33648
33745
  }
@@ -33959,6 +34056,7 @@ var Parser;
33959
34056
  case 3 /* SwitchClauseStatements */:
33960
34057
  return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
33961
34058
  case 18 /* RestProperties */:
34059
+ // fallthrough
33962
34060
  case 4 /* TypeMembers */:
33963
34061
  return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
33964
34062
  case 5 /* ClassMembers */:
@@ -34006,6 +34104,7 @@ var Parser;
34006
34104
  return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
34007
34105
  case 26 /* Count */:
34008
34106
  return Debug.fail("ParsingContext.Count used as a context");
34107
+ // Not a real context, only a marker.
34009
34108
  default:
34010
34109
  Debug.assertNever(context);
34011
34110
  }
@@ -34930,10 +35029,12 @@ var Parser;
34930
35029
  return tryParse(parseKeywordAndNoDot) || parseTypeReference();
34931
35030
  case 67 /* AsteriskEqualsToken */:
34932
35031
  scanner2.reScanAsteriskEqualsToken();
35032
+ // falls through
34933
35033
  case 42 /* AsteriskToken */:
34934
35034
  return parseJSDocAllType();
34935
35035
  case 61 /* QuestionQuestionToken */:
34936
35036
  scanner2.reScanQuestionToken();
35037
+ // falls through
34937
35038
  case 58 /* QuestionToken */:
34938
35039
  return parseJSDocUnknownOrNullableType();
34939
35040
  case 100 /* FunctionKeyword */:
@@ -35811,6 +35912,7 @@ var Parser;
35811
35912
  if (isAwaitExpression2()) {
35812
35913
  return parseAwaitExpression();
35813
35914
  }
35915
+ // falls through
35814
35916
  default:
35815
35917
  return parseUpdateExpression();
35816
35918
  }
@@ -35830,6 +35932,8 @@ var Parser;
35830
35932
  if (languageVariant !== 1 /* JSX */) {
35831
35933
  return false;
35832
35934
  }
35935
+ // We are in JSX context and the token is part of JSXElement.
35936
+ // falls through
35833
35937
  default:
35834
35938
  return true;
35835
35939
  }
@@ -36403,10 +36507,16 @@ var Parser;
36403
36507
  }
36404
36508
  function canFollowTypeArgumentsInExpression() {
36405
36509
  switch (token()) {
36510
+ // These tokens can follow a type argument list in a call expression.
36406
36511
  case 21 /* OpenParenToken */:
36512
+ // foo<x>(
36407
36513
  case 15 /* NoSubstitutionTemplateLiteral */:
36514
+ // foo<T> `...`
36408
36515
  case 16 /* TemplateHead */:
36409
36516
  return true;
36517
+ // A type argument list followed by `<` never makes sense, and a type argument list followed
36518
+ // by `>` is ambiguous with a (re-scanned) `>>` operator, so we disqualify both. Also, in
36519
+ // this context, `+` and `-` are unary operators, not binary operators.
36410
36520
  case 30 /* LessThanToken */:
36411
36521
  case 32 /* GreaterThanToken */:
36412
36522
  case 40 /* PlusToken */:
@@ -36424,6 +36534,7 @@ var Parser;
36424
36534
  false
36425
36535
  );
36426
36536
  }
36537
+ // falls through
36427
36538
  case 9 /* NumericLiteral */:
36428
36539
  case 10 /* BigIntLiteral */:
36429
36540
  case 11 /* StringLiteral */:
@@ -36927,6 +37038,27 @@ var Parser;
36927
37038
  return isUsingDeclaration();
36928
37039
  case 135 /* AwaitKeyword */:
36929
37040
  return isAwaitUsingDeclaration();
37041
+ // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
37042
+ // however, an identifier cannot be followed by another identifier on the same line. This is what we
37043
+ // count on to parse out the respective declarations. For instance, we exploit this to say that
37044
+ //
37045
+ // namespace n
37046
+ //
37047
+ // can be none other than the beginning of a namespace declaration, but need to respect that JavaScript sees
37048
+ //
37049
+ // namespace
37050
+ // n
37051
+ //
37052
+ // as the identifier 'namespace' on one line followed by the identifier 'n' on another.
37053
+ // We need to look one token ahead to see if it permissible to try parsing a declaration.
37054
+ //
37055
+ // *Note*: 'interface' is actually a strict mode reserved word. So while
37056
+ //
37057
+ // "use strict"
37058
+ // interface
37059
+ // I {}
37060
+ //
37061
+ // could be legal, it would add complexity for very little gain.
36930
37062
  case 120 /* InterfaceKeyword */:
36931
37063
  case 156 /* TypeKeyword */:
36932
37064
  return nextTokenIsIdentifierOnSameLine();
@@ -36999,6 +37131,9 @@ var Parser;
36999
37131
  case 111 /* ThrowKeyword */:
37000
37132
  case 113 /* TryKeyword */:
37001
37133
  case 89 /* DebuggerKeyword */:
37134
+ // 'catch' and 'finally' do not actually indicate that the code is part of a statement,
37135
+ // however, we say they are here so that we may gracefully parse them and error later.
37136
+ // falls through
37002
37137
  case 85 /* CatchKeyword */:
37003
37138
  case 98 /* FinallyKeyword */:
37004
37139
  return true;
@@ -37137,6 +37272,8 @@ var Parser;
37137
37272
  case 111 /* ThrowKeyword */:
37138
37273
  return parseThrowStatement();
37139
37274
  case 113 /* TryKeyword */:
37275
+ // Include 'catch' and 'finally' for error recovery.
37276
+ // falls through
37140
37277
  case 85 /* CatchKeyword */:
37141
37278
  case 98 /* FinallyKeyword */:
37142
37279
  return parseTryStatement();
@@ -37555,10 +37692,15 @@ var Parser;
37555
37692
  }
37556
37693
  switch (token()) {
37557
37694
  case 21 /* OpenParenToken */:
37695
+ // Method declaration
37558
37696
  case 30 /* LessThanToken */:
37697
+ // Generic Method declaration
37559
37698
  case 54 /* ExclamationToken */:
37699
+ // Non-null assertion on property name
37560
37700
  case 59 /* ColonToken */:
37701
+ // Type Annotation for declaration
37561
37702
  case 64 /* EqualsToken */:
37703
+ // Initializer for declaration
37562
37704
  case 58 /* QuestionToken */:
37563
37705
  return true;
37564
37706
  default:
@@ -38465,6 +38607,7 @@ var Parser;
38465
38607
  linkEnd = scanner2.getTokenEnd();
38466
38608
  break;
38467
38609
  }
38610
+ // fallthrough if it's not a {@link sequence
38468
38611
  default:
38469
38612
  state = 2 /* SavingComments */;
38470
38613
  pushComment(scanner2.getTokenText());
@@ -38723,6 +38866,8 @@ var Parser;
38723
38866
  indent3 += 1;
38724
38867
  break;
38725
38868
  }
38869
+ // record the * as a comment
38870
+ // falls through
38726
38871
  default:
38727
38872
  if (state !== 3 /* SavingBackticks */) {
38728
38873
  state = 2 /* SavingComments */;
@@ -39803,6 +39948,7 @@ function processPragmasIntoFields(context, reportDiagnostic) {
39803
39948
  case "jsximportsource":
39804
39949
  case "jsxruntime":
39805
39950
  return;
39951
+ // Accessed directly
39806
39952
  default:
39807
39953
  Debug.fail("Unhandled pragma kind");
39808
39954
  }
@@ -41659,6 +41805,7 @@ function parseOptionValue(args, i, diagnostics, opt, options, errors) {
41659
41805
  case "listOrElement":
41660
41806
  Debug.fail("listOrElement not supported here");
41661
41807
  break;
41808
+ // If not a primitive, the possible types are specified in what is effectively a map of options.
41662
41809
  default:
41663
41810
  options[opt.name] = parseCustomTypeOption(opt, args[i], errors);
41664
41811
  i++;
@@ -41999,6 +42146,7 @@ function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConv
41999
42146
  return false;
42000
42147
  case 106 /* NullKeyword */:
42001
42148
  return null;
42149
+ // eslint-disable-line no-restricted-syntax
42002
42150
  case 11 /* StringLiteral */:
42003
42151
  if (!isDoubleQuotedString(valueExpression)) {
42004
42152
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
@@ -42478,8 +42626,6 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
42478
42626
  validatedFilesSpecBeforeSubstitution,
42479
42627
  validatedIncludeSpecsBeforeSubstitution,
42480
42628
  validatedExcludeSpecsBeforeSubstitution,
42481
- pathPatterns: void 0,
42482
- // Initialized on first use
42483
42629
  isDefaultIncludeSpec
42484
42630
  };
42485
42631
  }
@@ -43207,6 +43353,7 @@ function getOptionValueWithEmptyStrings(value, option) {
43207
43353
  return typeof value === "boolean" ? value : "";
43208
43354
  case "listOrElement":
43209
43355
  if (!isArray(value)) return getOptionValueWithEmptyStrings(value, option.element);
43356
+ // fall through to list
43210
43357
  case "list":
43211
43358
  const elementType = option.element;
43212
43359
  return isArray(value) ? mapDefined(value, (v) => getOptionValueWithEmptyStrings(v, elementType)) : "";
@@ -44183,8 +44330,7 @@ function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, co
44183
44330
  }
44184
44331
  }
44185
44332
  function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state) {
44186
- var _a;
44187
- const { baseUrl, paths, configFile } = state.compilerOptions;
44333
+ const { baseUrl, paths } = state.compilerOptions;
44188
44334
  if (paths && !pathIsRelative(moduleName)) {
44189
44335
  if (state.traceEnabled) {
44190
44336
  if (baseUrl) {
@@ -44193,7 +44339,7 @@ function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state
44193
44339
  trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
44194
44340
  }
44195
44341
  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;
44342
+ const pathPatterns = tryParsePatterns(paths);
44197
44343
  return tryLoadModuleUsingPaths(
44198
44344
  extensions,
44199
44345
  moduleName,
@@ -44992,17 +45138,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
44992
45138
  if (state.traceEnabled) {
44993
45139
  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
45140
  }
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
- );
45141
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
45142
+ const result = tryLoadModuleUsingPaths(extensions, moduleName, candidate, versionPaths.paths, pathPatterns, loader, onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex, state);
45006
45143
  if (result) {
45007
45144
  return removeIgnoredPackageId(result.value);
45008
45145
  }
@@ -45594,17 +45731,8 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
45594
45731
  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
45732
  }
45596
45733
  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
- );
45734
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
45735
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, pathPatterns, loader, !packageDirectoryExists, state);
45608
45736
  if (fromPaths) {
45609
45737
  return fromPaths.value;
45610
45738
  }
@@ -45612,7 +45740,6 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
45612
45740
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
45613
45741
  }
45614
45742
  function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
45615
- pathPatterns || (pathPatterns = tryParsePatterns(paths));
45616
45743
  const matchedPattern = matchPatternOrExact(pathPatterns, moduleName);
45617
45744
  if (matchedPattern) {
45618
45745
  const matchedStar = isString(matchedPattern) ? void 0 : matchedText(matchedPattern, moduleName);
@@ -45879,20 +46006,24 @@ function getModuleInstanceStateCached(node, visited = /* @__PURE__ */ new Map())
45879
46006
  }
45880
46007
  function getModuleInstanceStateWorker(node, visited) {
45881
46008
  switch (node.kind) {
46009
+ // 1. interface declarations, type alias declarations
45882
46010
  case 264 /* InterfaceDeclaration */:
45883
46011
  case 265 /* TypeAliasDeclaration */:
45884
46012
  return 0 /* NonInstantiated */;
46013
+ // 2. const enum declarations
45885
46014
  case 266 /* EnumDeclaration */:
45886
46015
  if (isEnumConst(node)) {
45887
46016
  return 2 /* ConstEnumOnly */;
45888
46017
  }
45889
46018
  break;
46019
+ // 3. non-exported import declarations
45890
46020
  case 272 /* ImportDeclaration */:
45891
46021
  case 271 /* ImportEqualsDeclaration */:
45892
46022
  if (!hasSyntacticModifier(node, 32 /* Export */)) {
45893
46023
  return 0 /* NonInstantiated */;
45894
46024
  }
45895
46025
  break;
46026
+ // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain
45896
46027
  case 278 /* ExportDeclaration */:
45897
46028
  const exportDeclaration = node;
45898
46029
  if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 279 /* NamedExports */) {
@@ -45909,6 +46040,7 @@ function getModuleInstanceStateWorker(node, visited) {
45909
46040
  return state;
45910
46041
  }
45911
46042
  break;
46043
+ // 5. other uninstantiated module declarations.
45912
46044
  case 268 /* ModuleBlock */: {
45913
46045
  let state = 0 /* NonInstantiated */;
45914
46046
  forEachChild(node, (n) => {
@@ -46519,6 +46651,7 @@ function createBinder() {
46519
46651
  case 351 /* JSDocImportTag */:
46520
46652
  bindJSDocImportTag(node);
46521
46653
  break;
46654
+ // In source files and blocks, bind functions first to match hoisting that occurs at runtime
46522
46655
  case 307 /* SourceFile */: {
46523
46656
  bindEachFunctionsFirst(node.statements);
46524
46657
  bind(node.endOfFileToken);
@@ -46539,6 +46672,7 @@ function createBinder() {
46539
46672
  case 303 /* PropertyAssignment */:
46540
46673
  case 230 /* SpreadElement */:
46541
46674
  inAssignmentPattern = saveInAssignmentPattern;
46675
+ // falls through
46542
46676
  default:
46543
46677
  bindEachChild(node);
46544
46678
  break;
@@ -46560,6 +46694,7 @@ function createBinder() {
46560
46694
  if (isJSDocTypeAssertion(expr)) {
46561
46695
  return false;
46562
46696
  }
46697
+ // fallthrough
46563
46698
  case 235 /* NonNullExpression */:
46564
46699
  return isNarrowingExpression(expr.expression);
46565
46700
  case 226 /* BinaryExpression */:
@@ -47391,6 +47526,10 @@ function createBinder() {
47391
47526
  }
47392
47527
  function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
47393
47528
  switch (container.kind) {
47529
+ // Modules, source files, and classes need specialized handling for how their
47530
+ // members are declared (for example, a member of a class will go into a specific
47531
+ // symbol table depending on if it is static or not). We defer to specialized
47532
+ // handlers to take care of declaring these child members.
47394
47533
  case 267 /* ModuleDeclaration */:
47395
47534
  return declareModuleMember(node, symbolFlags, symbolExcludes);
47396
47535
  case 307 /* SourceFile */:
@@ -47532,6 +47671,7 @@ function createBinder() {
47532
47671
  declareModuleMember(node, symbolFlags, symbolExcludes);
47533
47672
  break;
47534
47673
  }
47674
+ // falls through
47535
47675
  default:
47536
47676
  Debug.assertNode(blockScopeContainer, canHaveLocals);
47537
47677
  if (!blockScopeContainer.locals) {
@@ -47852,6 +47992,7 @@ function createBinder() {
47852
47992
  }
47853
47993
  function bindWorker(node) {
47854
47994
  switch (node.kind) {
47995
+ /* Strict mode checks */
47855
47996
  case 80 /* Identifier */:
47856
47997
  if (node.flags & 4096 /* IdentifierIsInJSDocNamespace */) {
47857
47998
  let parentNode = node.parent;
@@ -47861,6 +48002,7 @@ function createBinder() {
47861
48002
  bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
47862
48003
  break;
47863
48004
  }
48005
+ // falls through
47864
48006
  case 110 /* ThisKeyword */:
47865
48007
  if (currentFlow && (isExpression(node) || parent2.kind === 304 /* ShorthandPropertyAssignment */)) {
47866
48008
  node.flowNode = currentFlow;
@@ -47949,6 +48091,7 @@ function createBinder() {
47949
48091
  return;
47950
48092
  case 182 /* TypePredicate */:
47951
48093
  break;
48094
+ // Binding the children will handle everything
47952
48095
  case 168 /* TypeParameter */:
47953
48096
  return bindTypeParameter(node);
47954
48097
  case 169 /* Parameter */:
@@ -48013,6 +48156,7 @@ function createBinder() {
48013
48156
  return bindObjectDefinePrototypeProperty(node);
48014
48157
  case 0 /* None */:
48015
48158
  break;
48159
+ // Nothing to do
48016
48160
  default:
48017
48161
  return Debug.fail("Unknown call expression assignment declaration kind");
48018
48162
  }
@@ -48020,6 +48164,7 @@ function createBinder() {
48020
48164
  bindCallExpression(node);
48021
48165
  }
48022
48166
  break;
48167
+ // Members of classes, interfaces, and modules
48023
48168
  case 231 /* ClassExpression */:
48024
48169
  case 263 /* ClassDeclaration */:
48025
48170
  inStrictMode = true;
@@ -48032,10 +48177,12 @@ function createBinder() {
48032
48177
  return bindEnumDeclaration(node);
48033
48178
  case 267 /* ModuleDeclaration */:
48034
48179
  return bindModuleDeclaration(node);
48180
+ // Jsx-attributes
48035
48181
  case 292 /* JsxAttributes */:
48036
48182
  return bindJsxAttributes(node);
48037
48183
  case 291 /* JsxAttribute */:
48038
48184
  return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
48185
+ // Imports and exports
48039
48186
  case 271 /* ImportEqualsDeclaration */:
48040
48187
  case 274 /* NamespaceImport */:
48041
48188
  case 276 /* ImportSpecifier */:
@@ -48056,6 +48203,7 @@ function createBinder() {
48056
48203
  if (!isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) {
48057
48204
  return;
48058
48205
  }
48206
+ // falls through
48059
48207
  case 268 /* ModuleBlock */:
48060
48208
  return updateStrictModeStatementList(node.statements);
48061
48209
  case 341 /* JSDocParameterTag */:
@@ -48065,6 +48213,7 @@ function createBinder() {
48065
48213
  if (node.parent.kind !== 322 /* JSDocTypeLiteral */) {
48066
48214
  break;
48067
48215
  }
48216
+ // falls through
48068
48217
  case 348 /* JSDocPropertyTag */:
48069
48218
  const propTag = node;
48070
48219
  const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */;
@@ -48277,6 +48426,7 @@ function createBinder() {
48277
48426
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
48278
48427
  }
48279
48428
  break;
48429
+ // Namespaces are not allowed in javascript files, so do nothing here
48280
48430
  case 267 /* ModuleDeclaration */:
48281
48431
  break;
48282
48432
  default:
@@ -48773,6 +48923,7 @@ function getContainerFlags(node) {
48773
48923
  if (isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
48774
48924
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */;
48775
48925
  }
48926
+ // falls through
48776
48927
  case 176 /* Constructor */:
48777
48928
  case 262 /* FunctionDeclaration */:
48778
48929
  case 173 /* MethodSignature */:
@@ -51926,6 +52077,7 @@ function createTypeChecker(host) {
51926
52077
  if (isEntityNameExpression(node.expression)) {
51927
52078
  return node.expression;
51928
52079
  }
52080
+ // falls through
51929
52081
  default:
51930
52082
  return void 0;
51931
52083
  }
@@ -53781,6 +53933,7 @@ function createTypeChecker(host) {
53781
53933
  if (!isExternalOrCommonJsModule(location)) {
53782
53934
  break;
53783
53935
  }
53936
+ // falls through
53784
53937
  case 267 /* ModuleDeclaration */:
53785
53938
  const sym = getSymbolOfDeclaration(location);
53786
53939
  if (result = callback(
@@ -55203,6 +55356,9 @@ function createTypeChecker(host) {
55203
55356
  }
55204
55357
  function createTypeNodesFromResolvedType(resolvedType) {
55205
55358
  if (checkTruncationLength(context)) {
55359
+ if (context.flags & 1 /* NoTruncation */) {
55360
+ return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, "elided")];
55361
+ }
55206
55362
  return [factory.createPropertySignature(
55207
55363
  /*modifiers*/
55208
55364
  void 0,
@@ -55240,15 +55396,20 @@ function createTypeChecker(host) {
55240
55396
  }
55241
55397
  }
55242
55398
  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
- ));
55399
+ if (context.flags & 1 /* NoTruncation */) {
55400
+ const typeElement = typeElements.pop();
55401
+ typeElements.push(addSyntheticTrailingComment(typeElement, 3 /* MultiLineCommentTrivia */, `... ${properties.length - i} more elided ...`));
55402
+ } else {
55403
+ typeElements.push(factory.createPropertySignature(
55404
+ /*modifiers*/
55405
+ void 0,
55406
+ `... ${properties.length - i} more ...`,
55407
+ /*questionToken*/
55408
+ void 0,
55409
+ /*type*/
55410
+ void 0
55411
+ ));
55412
+ }
55252
55413
  addPropertyToElementList(properties[properties.length - 1], context, typeElements);
55253
55414
  break;
55254
55415
  }
@@ -55266,7 +55427,7 @@ function createTypeChecker(host) {
55266
55427
  void 0
55267
55428
  );
55268
55429
  }
55269
- return factory.createKeywordTypeNode(133 /* AnyKeyword */);
55430
+ return addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided");
55270
55431
  }
55271
55432
  function shouldUsePlaceholderForProperty(propertySymbol, context) {
55272
55433
  var _a;
@@ -55402,15 +55563,17 @@ function createTypeChecker(host) {
55402
55563
  if (some(types)) {
55403
55564
  if (checkTruncationLength(context)) {
55404
55565
  if (!isBareList) {
55405
- return [factory.createTypeReferenceNode(
55406
- "...",
55407
- /*typeArguments*/
55408
- void 0
55409
- )];
55566
+ return [
55567
+ context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided") : factory.createTypeReferenceNode(
55568
+ "...",
55569
+ /*typeArguments*/
55570
+ void 0
55571
+ )
55572
+ ];
55410
55573
  } else if (types.length > 2) {
55411
55574
  return [
55412
55575
  typeToTypeNodeHelper(types[0], context),
55413
- factory.createTypeReferenceNode(
55576
+ context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - 2} more elided ...`) : factory.createTypeReferenceNode(
55414
55577
  `... ${types.length - 2} more ...`,
55415
55578
  /*typeArguments*/
55416
55579
  void 0
@@ -55426,11 +55589,13 @@ function createTypeChecker(host) {
55426
55589
  for (const type of types) {
55427
55590
  i++;
55428
55591
  if (checkTruncationLength(context) && i + 2 < types.length - 1) {
55429
- result.push(factory.createTypeReferenceNode(
55430
- `... ${types.length - i} more ...`,
55431
- /*typeArguments*/
55432
- void 0
55433
- ));
55592
+ result.push(
55593
+ context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - i} more elided ...`) : factory.createTypeReferenceNode(
55594
+ `... ${types.length - i} more ...`,
55595
+ /*typeArguments*/
55596
+ void 0
55597
+ )
55598
+ );
55434
55599
  const typeNode2 = typeToTypeNodeHelper(types[types.length - 1], context);
55435
55600
  if (typeNode2) {
55436
55601
  result.push(typeNode2);
@@ -58025,6 +58190,7 @@ function createTypeChecker(host) {
58025
58190
  );
58026
58191
  break;
58027
58192
  }
58193
+ // else fall through and treat commonjs require just like import=
58028
58194
  case 271 /* ImportEqualsDeclaration */:
58029
58195
  if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, (d) => isSourceFile(d) && isJsonSourceFile(d))) {
58030
58196
  serializeMaybeAliasAssignment(symbol);
@@ -58797,6 +58963,7 @@ function createTypeChecker(host) {
58797
58963
  if (isBindingPattern(node.name) && !node.name.elements.length) {
58798
58964
  return false;
58799
58965
  }
58966
+ // falls through
58800
58967
  case 267 /* ModuleDeclaration */:
58801
58968
  case 263 /* ClassDeclaration */:
58802
58969
  case 264 /* InterfaceDeclaration */:
@@ -58821,6 +58988,8 @@ function createTypeChecker(host) {
58821
58988
  if (hasEffectiveModifier(node, 2 /* Private */ | 4 /* Protected */)) {
58822
58989
  return false;
58823
58990
  }
58991
+ // Public properties/methods are visible if its parents are visible, so:
58992
+ // falls through
58824
58993
  case 176 /* Constructor */:
58825
58994
  case 180 /* ConstructSignature */:
58826
58995
  case 179 /* CallSignature */:
@@ -58838,14 +59007,20 @@ function createTypeChecker(host) {
58838
59007
  case 196 /* ParenthesizedType */:
58839
59008
  case 202 /* NamedTupleMember */:
58840
59009
  return isDeclarationVisible(node.parent);
59010
+ // Default binding, import specifier and namespace import is visible
59011
+ // only on demand so by default it is not visible
58841
59012
  case 273 /* ImportClause */:
58842
59013
  case 274 /* NamespaceImport */:
58843
59014
  case 276 /* ImportSpecifier */:
58844
59015
  return false;
59016
+ // Type parameters are always visible
58845
59017
  case 168 /* TypeParameter */:
59018
+ // Source file and namespace export are always visible
59019
+ // falls through
58846
59020
  case 307 /* SourceFile */:
58847
59021
  case 270 /* NamespaceExportDeclaration */:
58848
59022
  return true;
59023
+ // Export assignments do not create name bindings outside the module
58849
59024
  case 277 /* ExportAssignment */:
58850
59025
  return false;
58851
59026
  default:
@@ -66395,6 +66570,9 @@ function createTypeChecker(host) {
66395
66570
  return getTypeFromTemplateTypeNode(node);
66396
66571
  case 205 /* ImportType */:
66397
66572
  return getTypeFromImportTypeNode(node);
66573
+ // This function assumes that an identifier, qualified name, or property access expression is a type expression
66574
+ // Callers should first ensure this by calling `isPartOfTypeNode`
66575
+ // 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
66576
  case 80 /* Identifier */:
66399
66577
  case 166 /* QualifiedName */:
66400
66578
  case 211 /* PropertyAccessExpression */:
@@ -66642,6 +66820,7 @@ function createTypeChecker(host) {
66642
66820
  return !!tp.isThisType;
66643
66821
  case 80 /* Identifier */:
66644
66822
  return !tp.isThisType && isPartOfTypeNode(node2) && maybeTypeParameterReference(node2) && getTypeFromTypeNodeWorker(node2) === tp;
66823
+ // use worker because we're looking for === equality
66645
66824
  case 186 /* TypeQuery */:
66646
66825
  const entityName = node2.exprName;
66647
66826
  const firstIdentifier = getFirstIdentifier(entityName);
@@ -67061,6 +67240,7 @@ function createTypeChecker(host) {
67061
67240
  if (!isConstAssertion(node)) {
67062
67241
  break;
67063
67242
  }
67243
+ // fallthrough
67064
67244
  case 294 /* JsxExpression */:
67065
67245
  case 217 /* ParenthesizedExpression */:
67066
67246
  return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
@@ -68156,7 +68336,7 @@ function createTypeChecker(host) {
68156
68336
  const [sourceType, targetType] = getTypeNamesForErrorDisplay(source2, target2);
68157
68337
  let generalizedSource = source2;
68158
68338
  let generalizedSourceType = sourceType;
68159
- if (isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) {
68339
+ if (!(target2.flags & 131072 /* Never */) && isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) {
68160
68340
  generalizedSource = getBaseTypeOfLiteralType(source2);
68161
68341
  Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
68162
68342
  generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
@@ -72380,6 +72560,7 @@ function createTypeChecker(host) {
72380
72560
  if (isCallExpression(node.parent)) {
72381
72561
  return Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function;
72382
72562
  }
72563
+ // falls through
72383
72564
  default:
72384
72565
  if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) {
72385
72566
  return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
@@ -72413,6 +72594,7 @@ function createTypeChecker(host) {
72413
72594
  const symbol = getResolvedSymbol(node);
72414
72595
  return symbol !== unknownSymbol ? `${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}|${getSymbolId(symbol)}` : void 0;
72415
72596
  }
72597
+ // falls through
72416
72598
  case 110 /* ThisKeyword */:
72417
72599
  return `0|${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}`;
72418
72600
  case 235 /* NonNullExpression */:
@@ -73966,6 +74148,9 @@ function createTypeChecker(host) {
73966
74148
  break;
73967
74149
  case 28 /* CommaToken */:
73968
74150
  return narrowType(type, expr.right, assumeTrue);
74151
+ // Ordinarily we won't see && and || expressions in control flow analysis because the Binder breaks those
74152
+ // expressions down to individual conditional control flows. However, we may encounter them when analyzing
74153
+ // aliased conditional expressions.
73969
74154
  case 56 /* AmpersandAmpersandToken */:
73970
74155
  return assumeTrue ? narrowType(
73971
74156
  narrowType(
@@ -74409,6 +74594,7 @@ function createTypeChecker(host) {
74409
74594
  }
74410
74595
  }
74411
74596
  }
74597
+ // falls through
74412
74598
  case 110 /* ThisKeyword */:
74413
74599
  case 108 /* SuperKeyword */:
74414
74600
  case 211 /* PropertyAccessExpression */:
@@ -82227,6 +82413,7 @@ function createTypeChecker(host) {
82227
82413
  hasError = true;
82228
82414
  break;
82229
82415
  }
82416
+ // fallthrough
82230
82417
  case 7 /* ES2022 */:
82231
82418
  case 99 /* ESNext */:
82232
82419
  case 200 /* Preserve */:
@@ -82234,6 +82421,7 @@ function createTypeChecker(host) {
82234
82421
  if (languageVersion >= 4 /* ES2017 */) {
82235
82422
  break;
82236
82423
  }
82424
+ // fallthrough
82237
82425
  default:
82238
82426
  span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
82239
82427
  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 +82839,13 @@ function createTypeChecker(host) {
82651
82839
  return true;
82652
82840
  }
82653
82841
  return false;
82842
+ // Some forms listed here for clarity
82654
82843
  case 222 /* VoidExpression */:
82844
+ // Explicit opt-out
82655
82845
  case 216 /* TypeAssertionExpression */:
82846
+ // Not SEF, but can produce useful type warnings
82656
82847
  case 234 /* AsExpression */:
82848
+ // Not SEF, but can produce useful type warnings
82657
82849
  default:
82658
82850
  return false;
82659
82851
  }
@@ -83899,6 +84091,7 @@ function createTypeChecker(host) {
83899
84091
  if (node.expression.kind === 102 /* ImportKeyword */) {
83900
84092
  return checkImportCallExpression(node);
83901
84093
  }
84094
+ // falls through
83902
84095
  case 214 /* NewExpression */:
83903
84096
  return checkCallExpression(node, checkMode);
83904
84097
  case 215 /* TaggedTemplateExpression */:
@@ -84268,6 +84461,7 @@ function createTypeChecker(host) {
84268
84461
  if (useDefineForClassFields) {
84269
84462
  break;
84270
84463
  }
84464
+ // fall through
84271
84465
  case "prototype":
84272
84466
  const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
84273
84467
  const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
@@ -85011,6 +85205,8 @@ function createTypeChecker(host) {
85011
85205
  switch (d.kind) {
85012
85206
  case 264 /* InterfaceDeclaration */:
85013
85207
  case 265 /* TypeAliasDeclaration */:
85208
+ // A jsdoc typedef and callback are, by definition, type aliases.
85209
+ // falls through
85014
85210
  case 346 /* JSDocTypedefTag */:
85015
85211
  case 338 /* JSDocCallbackTag */:
85016
85212
  case 340 /* JSDocEnumTag */:
@@ -85031,6 +85227,8 @@ function createTypeChecker(host) {
85031
85227
  return 1 /* ExportValue */;
85032
85228
  }
85033
85229
  d = expression;
85230
+ // The below options all declare an Alias, which is allowed to merge with other values within the importing module.
85231
+ // falls through
85034
85232
  case 271 /* ImportEqualsDeclaration */:
85035
85233
  case 274 /* NamespaceImport */:
85036
85234
  case 273 /* ImportClause */:
@@ -85044,6 +85242,7 @@ function createTypeChecker(host) {
85044
85242
  case 208 /* BindingElement */:
85045
85243
  case 262 /* FunctionDeclaration */:
85046
85244
  case 276 /* ImportSpecifier */:
85245
+ // https://github.com/Microsoft/TypeScript/pull/7591
85047
85246
  case 80 /* Identifier */:
85048
85247
  return 1 /* ExportValue */;
85049
85248
  case 173 /* MethodSignature */:
@@ -85392,6 +85591,7 @@ function createTypeChecker(host) {
85392
85591
  headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
85393
85592
  break;
85394
85593
  }
85594
+ // falls through
85395
85595
  case 169 /* Parameter */:
85396
85596
  headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
85397
85597
  break;
@@ -88613,6 +88813,7 @@ function createTypeChecker(host) {
88613
88813
  break;
88614
88814
  case 271 /* ImportEqualsDeclaration */:
88615
88815
  if (isInternalModuleImportEqualsDeclaration(node)) break;
88816
+ // falls through
88616
88817
  case 272 /* ImportDeclaration */:
88617
88818
  grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
88618
88819
  break;
@@ -88625,6 +88826,7 @@ function createTypeChecker(host) {
88625
88826
  }
88626
88827
  break;
88627
88828
  }
88829
+ // falls through
88628
88830
  case 263 /* ClassDeclaration */:
88629
88831
  case 266 /* EnumDeclaration */:
88630
88832
  case 262 /* FunctionDeclaration */:
@@ -89301,6 +89503,7 @@ function createTypeChecker(host) {
89301
89503
  return checkJSDocPropertyTag(node);
89302
89504
  case 317 /* JSDocFunctionType */:
89303
89505
  checkJSDocFunctionType(node);
89506
+ // falls through
89304
89507
  case 315 /* JSDocNonNullableType */:
89305
89508
  case 314 /* JSDocNullableType */:
89306
89509
  case 312 /* JSDocAllType */:
@@ -89724,6 +89927,7 @@ function createTypeChecker(host) {
89724
89927
  switch (location.kind) {
89725
89928
  case 307 /* SourceFile */:
89726
89929
  if (!isExternalModule(location)) break;
89930
+ // falls through
89727
89931
  case 267 /* ModuleDeclaration */:
89728
89932
  copyLocallyVisibleExportSymbols(getSymbolOfDeclaration(location).exports, meaning & 2623475 /* ModuleMember */);
89729
89933
  break;
@@ -89735,6 +89939,9 @@ function createTypeChecker(host) {
89735
89939
  if (className) {
89736
89940
  copySymbol(location.symbol, meaning);
89737
89941
  }
89942
+ // this fall-through is necessary because we would like to handle
89943
+ // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration.
89944
+ // falls through
89738
89945
  case 263 /* ClassDeclaration */:
89739
89946
  case 264 /* InterfaceDeclaration */:
89740
89947
  if (!isStaticSymbol) {
@@ -89843,6 +90050,7 @@ function createTypeChecker(host) {
89843
90050
  if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
89844
90051
  return void 0;
89845
90052
  }
90053
+ // falls through
89846
90054
  case 4 /* ThisProperty */:
89847
90055
  case 2 /* ModuleExports */:
89848
90056
  return getSymbolOfDeclaration(entityName.parent.parent);
@@ -90136,6 +90344,7 @@ function createTypeChecker(host) {
90136
90344
  if (!isThisInTypeQuery(node)) {
90137
90345
  return getSymbolOfNameOrPropertyAccessExpression(node);
90138
90346
  }
90347
+ // falls through
90139
90348
  case 110 /* ThisKeyword */:
90140
90349
  const container = getThisContainer(
90141
90350
  node,
@@ -90153,6 +90362,7 @@ function createTypeChecker(host) {
90153
90362
  if (isInExpressionContext(node)) {
90154
90363
  return checkExpression(node).symbol;
90155
90364
  }
90365
+ // falls through
90156
90366
  case 197 /* ThisType */:
90157
90367
  return getTypeFromThisTypeNode(node).symbol;
90158
90368
  case 108 /* SuperKeyword */:
@@ -90175,6 +90385,7 @@ function createTypeChecker(host) {
90175
90385
  if (isCallExpression(parent2) && isBindableObjectDefinePropertyCall(parent2) && parent2.arguments[1] === node) {
90176
90386
  return getSymbolOfDeclaration(parent2);
90177
90387
  }
90388
+ // falls through
90178
90389
  case 9 /* NumericLiteral */:
90179
90390
  const objectType = isElementAccessExpression(parent2) ? parent2.argumentExpression === node ? getTypeOfExpression(parent2.expression) : void 0 : isLiteralTypeNode(parent2) && isIndexedAccessTypeNode(grandParent) ? getTypeFromTypeNode(grandParent.objectType) : void 0;
90180
90391
  return objectType && getPropertyOfType(objectType, escapeLeadingUnderscores(node.text));
@@ -90204,6 +90415,7 @@ function createTypeChecker(host) {
90204
90415
  const symbol = getIntrinsicTagSymbol(node.parent);
90205
90416
  return symbol === unknownSymbol ? void 0 : symbol;
90206
90417
  }
90418
+ // falls through
90207
90419
  default:
90208
90420
  return void 0;
90209
90421
  }
@@ -92298,6 +92510,7 @@ function createTypeChecker(host) {
92298
92510
  );
92299
92511
  break;
92300
92512
  }
92513
+ // fallthrough
92301
92514
  case 7 /* ES2022 */:
92302
92515
  case 99 /* ESNext */:
92303
92516
  case 200 /* Preserve */:
@@ -92305,6 +92518,7 @@ function createTypeChecker(host) {
92305
92518
  if (languageVersion >= 4 /* ES2017 */) {
92306
92519
  break;
92307
92520
  }
92521
+ // fallthrough
92308
92522
  default:
92309
92523
  diagnostics.add(
92310
92524
  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 +94695,13 @@ var visitEachChildTable = {
94481
94695
  );
94482
94696
  },
94483
94697
  // Transformation nodes
94484
- [354 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
94698
+ [355 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
94485
94699
  return context.factory.updatePartiallyEmittedExpression(
94486
94700
  node,
94487
94701
  Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
94488
94702
  );
94489
94703
  },
94490
- [355 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
94704
+ [356 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
94491
94705
  return context.factory.updateCommaListExpression(
94492
94706
  node,
94493
94707
  nodesVisitor(node.elements, visitor, isExpression)
@@ -96593,6 +96807,8 @@ function transformTypeScript(context) {
96593
96807
  case 148 /* ReadonlyKeyword */:
96594
96808
  case 103 /* InKeyword */:
96595
96809
  case 147 /* OutKeyword */:
96810
+ // TypeScript accessibility and readonly modifiers are elided
96811
+ // falls through
96596
96812
  case 188 /* ArrayType */:
96597
96813
  case 189 /* TupleType */:
96598
96814
  case 190 /* OptionalType */:
@@ -96621,6 +96837,8 @@ function transformTypeScript(context) {
96621
96837
  case 199 /* IndexedAccessType */:
96622
96838
  case 200 /* MappedType */:
96623
96839
  case 201 /* LiteralType */:
96840
+ // TypeScript type nodes are elided.
96841
+ // falls through
96624
96842
  case 181 /* IndexSignature */:
96625
96843
  return void 0;
96626
96844
  case 265 /* TypeAliasDeclaration */:
@@ -98303,7 +98521,7 @@ function transformClassFields(context) {
98303
98521
  /*discarded*/
98304
98522
  true
98305
98523
  );
98306
- case 355 /* CommaListExpression */:
98524
+ case 356 /* CommaListExpression */:
98307
98525
  return visitCommaListExpression(
98308
98526
  node,
98309
98527
  /*discarded*/
@@ -100243,6 +100461,7 @@ function transformClassFields(context) {
100243
100461
  if (isArrowFunction(original) || getEmitFlags(node) & 524288 /* AsyncFunctionBody */) {
100244
100462
  break;
100245
100463
  }
100464
+ // falls through
100246
100465
  case 262 /* FunctionDeclaration */:
100247
100466
  case 176 /* Constructor */:
100248
100467
  case 177 /* GetAccessor */:
@@ -100518,6 +100737,7 @@ function createRuntimeTypeSerializer(context) {
100518
100737
  case 197 /* ThisType */:
100519
100738
  case 205 /* ImportType */:
100520
100739
  break;
100740
+ // handle JSDoc types from an invalid parse
100521
100741
  case 312 /* JSDocAllType */:
100522
100742
  case 313 /* JSDocUnknownType */:
100523
100743
  case 317 /* JSDocFunctionType */:
@@ -101363,6 +101583,7 @@ function transformESDecorators(context) {
101363
101583
  return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead.");
101364
101584
  case 169 /* Parameter */:
101365
101585
  return visitParameterDeclaration(node);
101586
+ // Support NamedEvaluation to ensure the correct class name for class expressions.
101366
101587
  case 226 /* BinaryExpression */:
101367
101588
  return visitBinaryExpression(
101368
101589
  node,
@@ -101383,7 +101604,7 @@ function transformESDecorators(context) {
101383
101604
  return visitForStatement(node);
101384
101605
  case 244 /* ExpressionStatement */:
101385
101606
  return visitExpressionStatement(node);
101386
- case 355 /* CommaListExpression */:
101607
+ case 356 /* CommaListExpression */:
101387
101608
  return visitCommaListExpression(
101388
101609
  node,
101389
101610
  /*discarded*/
@@ -101395,7 +101616,7 @@ function transformESDecorators(context) {
101395
101616
  /*discarded*/
101396
101617
  false
101397
101618
  );
101398
- case 354 /* PartiallyEmittedExpression */:
101619
+ case 355 /* PartiallyEmittedExpression */:
101399
101620
  return visitPartiallyEmittedExpression(
101400
101621
  node,
101401
101622
  /*discarded*/
@@ -101419,6 +101640,7 @@ function transformESDecorators(context) {
101419
101640
  case 167 /* ComputedPropertyName */:
101420
101641
  return visitComputedPropertyName(node);
101421
101642
  case 174 /* MethodDeclaration */:
101643
+ // object literal methods and accessors
101422
101644
  case 178 /* SetAccessor */:
101423
101645
  case 177 /* GetAccessor */:
101424
101646
  case 218 /* FunctionExpression */:
@@ -101481,7 +101703,7 @@ function transformESDecorators(context) {
101481
101703
  /*discarded*/
101482
101704
  true
101483
101705
  );
101484
- case 355 /* CommaListExpression */:
101706
+ case 356 /* CommaListExpression */:
101485
101707
  return visitCommaListExpression(
101486
101708
  node,
101487
101709
  /*discarded*/
@@ -104063,7 +104285,7 @@ function transformES2018(context) {
104063
104285
  return visitObjectLiteralExpression(node);
104064
104286
  case 226 /* BinaryExpression */:
104065
104287
  return visitBinaryExpression(node, expressionResultIsUnused2);
104066
- case 355 /* CommaListExpression */:
104288
+ case 356 /* CommaListExpression */:
104067
104289
  return visitCommaListExpression(node, expressionResultIsUnused2);
104068
104290
  case 299 /* CatchClause */:
104069
104291
  return visitCatchClause(node);
@@ -107203,6 +107425,7 @@ function transformES2015(context) {
107203
107425
  switch (node.kind) {
107204
107426
  case 126 /* StaticKeyword */:
107205
107427
  return void 0;
107428
+ // elide static keyword
107206
107429
  case 263 /* ClassDeclaration */:
107207
107430
  return visitClassDeclaration(node);
107208
107431
  case 231 /* ClassExpression */:
@@ -107281,7 +107504,7 @@ function transformES2015(context) {
107281
107504
  return visitParenthesizedExpression(node, expressionResultIsUnused2);
107282
107505
  case 226 /* BinaryExpression */:
107283
107506
  return visitBinaryExpression(node, expressionResultIsUnused2);
107284
- case 355 /* CommaListExpression */:
107507
+ case 356 /* CommaListExpression */:
107285
107508
  return visitCommaListExpression(node, expressionResultIsUnused2);
107286
107509
  case 15 /* NoSubstitutionTemplateLiteral */:
107287
107510
  case 16 /* TemplateHead */:
@@ -107665,12 +107888,14 @@ function transformES2015(context) {
107665
107888
  return false;
107666
107889
  }
107667
107890
  switch (node.kind) {
107891
+ // stop at function boundaries
107668
107892
  case 219 /* ArrowFunction */:
107669
107893
  case 218 /* FunctionExpression */:
107670
107894
  case 262 /* FunctionDeclaration */:
107671
107895
  case 176 /* Constructor */:
107672
107896
  case 175 /* ClassStaticBlockDeclaration */:
107673
107897
  return false;
107898
+ // only step into computed property names for class and object literal elements
107674
107899
  case 177 /* GetAccessor */:
107675
107900
  case 178 /* SetAccessor */:
107676
107901
  case 174 /* MethodDeclaration */:
@@ -107879,12 +108104,14 @@ function transformES2015(context) {
107879
108104
  return factory2.createPartiallyEmittedExpression(node.right, node);
107880
108105
  }
107881
108106
  switch (node.kind) {
108107
+ // stop at function boundaries
107882
108108
  case 219 /* ArrowFunction */:
107883
108109
  case 218 /* FunctionExpression */:
107884
108110
  case 262 /* FunctionDeclaration */:
107885
108111
  case 176 /* Constructor */:
107886
108112
  case 175 /* ClassStaticBlockDeclaration */:
107887
108113
  return node;
108114
+ // only step into computed property names for class and object literal elements
107888
108115
  case 177 /* GetAccessor */:
107889
108116
  case 178 /* SetAccessor */:
107890
108117
  case 174 /* MethodDeclaration */:
@@ -107930,12 +108157,14 @@ function transformES2015(context) {
107930
108157
  );
107931
108158
  }
107932
108159
  switch (node.kind) {
108160
+ // stop at function boundaries
107933
108161
  case 219 /* ArrowFunction */:
107934
108162
  case 218 /* FunctionExpression */:
107935
108163
  case 262 /* FunctionDeclaration */:
107936
108164
  case 176 /* Constructor */:
107937
108165
  case 175 /* ClassStaticBlockDeclaration */:
107938
108166
  return node;
108167
+ // only step into computed property names for class and object literal elements
107939
108168
  case 177 /* GetAccessor */:
107940
108169
  case 178 /* SetAccessor */:
107941
108170
  case 174 /* MethodDeclaration */:
@@ -110567,7 +110796,7 @@ function transformGenerators(context) {
110567
110796
  switch (node.kind) {
110568
110797
  case 226 /* BinaryExpression */:
110569
110798
  return visitBinaryExpression(node);
110570
- case 355 /* CommaListExpression */:
110799
+ case 356 /* CommaListExpression */:
110571
110800
  return visitCommaListExpression(node);
110572
110801
  case 227 /* ConditionalExpression */:
110573
110802
  return visitConditionalExpression(node);
@@ -112958,7 +113187,7 @@ function transformModule(context) {
112958
113187
  return visitExpressionStatement(node);
112959
113188
  case 217 /* ParenthesizedExpression */:
112960
113189
  return visitParenthesizedExpression(node, valueIsDiscarded);
112961
- case 354 /* PartiallyEmittedExpression */:
113190
+ case 355 /* PartiallyEmittedExpression */:
112962
113191
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
112963
113192
  case 213 /* CallExpression */:
112964
113193
  if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
@@ -114718,6 +114947,7 @@ function transformSystemModule(context) {
114718
114947
  if (!entry.importClause) {
114719
114948
  break;
114720
114949
  }
114950
+ // falls through
114721
114951
  case 271 /* ImportEqualsDeclaration */:
114722
114952
  Debug.assert(importVariableName !== void 0);
114723
114953
  statements.push(
@@ -115352,7 +115582,7 @@ function transformSystemModule(context) {
115352
115582
  return visitExpressionStatement(node);
115353
115583
  case 217 /* ParenthesizedExpression */:
115354
115584
  return visitParenthesizedExpression(node, valueIsDiscarded);
115355
- case 354 /* PartiallyEmittedExpression */:
115585
+ case 355 /* PartiallyEmittedExpression */:
115356
115586
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
115357
115587
  case 226 /* BinaryExpression */:
115358
115588
  if (isDestructuringAssignment(node)) {
@@ -116951,6 +117181,7 @@ function transformDeclarations(context) {
116951
117181
  case 265 /* TypeAliasDeclaration */:
116952
117182
  case 266 /* EnumDeclaration */:
116953
117183
  return !resolver.isDeclarationVisible(node);
117184
+ // The following should be doing their own visibility checks based on filtering their members
116954
117185
  case 260 /* VariableDeclaration */:
116955
117186
  return !getBindingNameVisible(node);
116956
117187
  case 271 /* ImportEqualsDeclaration */:
@@ -118232,7 +118463,7 @@ function noEmitNotification(hint, node, callback) {
118232
118463
  }
118233
118464
  function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
118234
118465
  var _a, _b;
118235
- const enabledSyntaxKindFeatures = new Array(357 /* Count */);
118466
+ const enabledSyntaxKindFeatures = new Array(358 /* Count */);
118236
118467
  let lexicalEnvironmentVariableDeclarations;
118237
118468
  let lexicalEnvironmentFunctionDeclarations;
118238
118469
  let lexicalEnvironmentStatements;
@@ -119446,6 +119677,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119446
119677
  if (onEmitNode !== noEmitNotification && (!isEmitNotificationEnabled || isEmitNotificationEnabled(node))) {
119447
119678
  return pipelineEmitWithNotification;
119448
119679
  }
119680
+ // falls through
119449
119681
  case 1 /* Substitution */:
119450
119682
  if (substituteNode !== noEmitSubstitution && (lastSubstitution = substituteNode(emitHint, node) || node) !== node) {
119451
119683
  if (currentParenthesizerRule) {
@@ -119453,14 +119685,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119453
119685
  }
119454
119686
  return pipelineEmitWithSubstitution;
119455
119687
  }
119688
+ // falls through
119456
119689
  case 2 /* Comments */:
119457
119690
  if (shouldEmitComments(node)) {
119458
119691
  return pipelineEmitWithComments;
119459
119692
  }
119693
+ // falls through
119460
119694
  case 3 /* SourceMaps */:
119461
119695
  if (shouldEmitSourceMaps(node)) {
119462
119696
  return pipelineEmitWithSourceMaps;
119463
119697
  }
119698
+ // falls through
119464
119699
  case 4 /* Emit */:
119465
119700
  return pipelineEmitWithHint;
119466
119701
  default:
@@ -119512,6 +119747,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119512
119747
  }
119513
119748
  if (hint === 4 /* Unspecified */) {
119514
119749
  switch (node.kind) {
119750
+ // Pseudo-literals
119515
119751
  case 16 /* TemplateHead */:
119516
119752
  case 17 /* TemplateMiddle */:
119517
119753
  case 18 /* TemplateTail */:
@@ -119520,20 +119756,26 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119520
119756
  /*jsxAttributeEscape*/
119521
119757
  false
119522
119758
  );
119759
+ // Identifiers
119523
119760
  case 80 /* Identifier */:
119524
119761
  return emitIdentifier(node);
119762
+ // PrivateIdentifiers
119525
119763
  case 81 /* PrivateIdentifier */:
119526
119764
  return emitPrivateIdentifier(node);
119765
+ // Parse tree nodes
119766
+ // Names
119527
119767
  case 166 /* QualifiedName */:
119528
119768
  return emitQualifiedName(node);
119529
119769
  case 167 /* ComputedPropertyName */:
119530
119770
  return emitComputedPropertyName(node);
119771
+ // Signature elements
119531
119772
  case 168 /* TypeParameter */:
119532
119773
  return emitTypeParameter(node);
119533
119774
  case 169 /* Parameter */:
119534
119775
  return emitParameter(node);
119535
119776
  case 170 /* Decorator */:
119536
119777
  return emitDecorator(node);
119778
+ // Type members
119537
119779
  case 171 /* PropertySignature */:
119538
119780
  return emitPropertySignature(node);
119539
119781
  case 172 /* PropertyDeclaration */:
@@ -119555,6 +119797,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119555
119797
  return emitConstructSignature(node);
119556
119798
  case 181 /* IndexSignature */:
119557
119799
  return emitIndexSignature(node);
119800
+ // Types
119558
119801
  case 182 /* TypePredicate */:
119559
119802
  return emitTypePredicate(node);
119560
119803
  case 183 /* TypeReference */:
@@ -119573,6 +119816,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119573
119816
  return emitTupleType(node);
119574
119817
  case 190 /* OptionalType */:
119575
119818
  return emitOptionalType(node);
119819
+ // SyntaxKind.RestType is handled below
119576
119820
  case 192 /* UnionType */:
119577
119821
  return emitUnionType(node);
119578
119822
  case 193 /* IntersectionType */:
@@ -119603,16 +119847,19 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119603
119847
  return emitTemplateTypeSpan(node);
119604
119848
  case 205 /* ImportType */:
119605
119849
  return emitImportTypeNode(node);
119850
+ // Binding patterns
119606
119851
  case 206 /* ObjectBindingPattern */:
119607
119852
  return emitObjectBindingPattern(node);
119608
119853
  case 207 /* ArrayBindingPattern */:
119609
119854
  return emitArrayBindingPattern(node);
119610
119855
  case 208 /* BindingElement */:
119611
119856
  return emitBindingElement(node);
119857
+ // Misc
119612
119858
  case 239 /* TemplateSpan */:
119613
119859
  return emitTemplateSpan(node);
119614
119860
  case 240 /* SemicolonClassElement */:
119615
119861
  return emitSemicolonClassElement();
119862
+ // Statements
119616
119863
  case 241 /* Block */:
119617
119864
  return emitBlock(node);
119618
119865
  case 243 /* VariableStatement */:
@@ -119654,6 +119901,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119654
119901
  return emitTryStatement(node);
119655
119902
  case 259 /* DebuggerStatement */:
119656
119903
  return emitDebuggerStatement(node);
119904
+ // Declarations
119657
119905
  case 260 /* VariableDeclaration */:
119658
119906
  return emitVariableDeclaration(node);
119659
119907
  case 261 /* VariableDeclarationList */:
@@ -119704,8 +119952,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119704
119952
  return emitImportAttribute(node);
119705
119953
  case 282 /* MissingDeclaration */:
119706
119954
  return;
119955
+ // Module references
119707
119956
  case 283 /* ExternalModuleReference */:
119708
119957
  return emitExternalModuleReference(node);
119958
+ // JSX (non-expression)
119709
119959
  case 12 /* JsxText */:
119710
119960
  return emitJsxText(node);
119711
119961
  case 286 /* JsxOpeningElement */:
@@ -119724,6 +119974,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119724
119974
  return emitJsxExpression(node);
119725
119975
  case 295 /* JsxNamespacedName */:
119726
119976
  return emitJsxNamespacedName(node);
119977
+ // Clauses
119727
119978
  case 296 /* CaseClause */:
119728
119979
  return emitCaseClause(node);
119729
119980
  case 297 /* DefaultClause */:
@@ -119732,18 +119983,22 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119732
119983
  return emitHeritageClause(node);
119733
119984
  case 299 /* CatchClause */:
119734
119985
  return emitCatchClause(node);
119986
+ // Property assignments
119735
119987
  case 303 /* PropertyAssignment */:
119736
119988
  return emitPropertyAssignment(node);
119737
119989
  case 304 /* ShorthandPropertyAssignment */:
119738
119990
  return emitShorthandPropertyAssignment(node);
119739
119991
  case 305 /* SpreadAssignment */:
119740
119992
  return emitSpreadAssignment(node);
119993
+ // Enum
119741
119994
  case 306 /* EnumMember */:
119742
119995
  return emitEnumMember(node);
119996
+ // Top-level nodes
119743
119997
  case 307 /* SourceFile */:
119744
119998
  return emitSourceFile(node);
119745
119999
  case 308 /* Bundle */:
119746
120000
  return Debug.fail("Bundles should be printed using printBundle");
120001
+ // JSDoc nodes (only used in codefixes currently)
119747
120002
  case 309 /* JSDocTypeExpression */:
119748
120003
  return emitJSDocTypeExpression(node);
119749
120004
  case 310 /* JSDocNameReference */:
@@ -119781,6 +120036,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119781
120036
  case 330 /* JSDocAuthorTag */:
119782
120037
  case 331 /* JSDocDeprecatedTag */:
119783
120038
  return;
120039
+ // SyntaxKind.JSDocClassTag (see JSDocTag, above)
119784
120040
  case 333 /* JSDocPublicTag */:
119785
120041
  case 334 /* JSDocPrivateTag */:
119786
120042
  case 335 /* JSDocProtectedTag */:
@@ -119790,6 +120046,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119790
120046
  return emitJSDocCallbackTag(node);
119791
120047
  case 339 /* JSDocOverloadTag */:
119792
120048
  return emitJSDocOverloadTag(node);
120049
+ // SyntaxKind.JSDocEnumTag (see below)
119793
120050
  case 341 /* JSDocParameterTag */:
119794
120051
  case 348 /* JSDocPropertyTag */:
119795
120052
  return emitJSDocPropertyLikeTag(node);
@@ -119808,7 +120065,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119808
120065
  return emitJSDocSeeTag(node);
119809
120066
  case 351 /* JSDocImportTag */:
119810
120067
  return emitJSDocImportTag(node);
120068
+ // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above)
120069
+ // Transformation nodes
119811
120070
  case 353 /* NotEmittedStatement */:
120071
+ case 354 /* NotEmittedTypeElement */:
119812
120072
  return;
119813
120073
  }
119814
120074
  if (isExpression(node)) {
@@ -119826,6 +120086,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119826
120086
  }
119827
120087
  if (hint === 1 /* Expression */) {
119828
120088
  switch (node.kind) {
120089
+ // Literals
119829
120090
  case 9 /* NumericLiteral */:
119830
120091
  case 10 /* BigIntLiteral */:
119831
120092
  return emitNumericOrBigIntLiteral(node);
@@ -119837,10 +120098,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119837
120098
  /*jsxAttributeEscape*/
119838
120099
  false
119839
120100
  );
120101
+ // Identifiers
119840
120102
  case 80 /* Identifier */:
119841
120103
  return emitIdentifier(node);
119842
120104
  case 81 /* PrivateIdentifier */:
119843
120105
  return emitPrivateIdentifier(node);
120106
+ // Expressions
119844
120107
  case 209 /* ArrayLiteralExpression */:
119845
120108
  return emitArrayLiteralExpression(node);
119846
120109
  case 210 /* ObjectLiteralExpression */:
@@ -119903,21 +120166,24 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119903
120166
  return Debug.fail("SyntheticExpression should never be printed.");
119904
120167
  case 282 /* MissingDeclaration */:
119905
120168
  return;
120169
+ // JSX
119906
120170
  case 284 /* JsxElement */:
119907
120171
  return emitJsxElement(node);
119908
120172
  case 285 /* JsxSelfClosingElement */:
119909
120173
  return emitJsxSelfClosingElement(node);
119910
120174
  case 288 /* JsxFragment */:
119911
120175
  return emitJsxFragment(node);
120176
+ // Synthesized list
119912
120177
  case 352 /* SyntaxList */:
119913
120178
  return Debug.fail("SyntaxList should not be printed");
120179
+ // Transformation nodes
119914
120180
  case 353 /* NotEmittedStatement */:
119915
120181
  return;
119916
- case 354 /* PartiallyEmittedExpression */:
120182
+ case 355 /* PartiallyEmittedExpression */:
119917
120183
  return emitPartiallyEmittedExpression(node);
119918
- case 355 /* CommaListExpression */:
120184
+ case 356 /* CommaListExpression */:
119919
120185
  return emitCommaList(node);
119920
- case 356 /* SyntheticReferenceExpression */:
120186
+ case 357 /* SyntheticReferenceExpression */:
119921
120187
  return Debug.fail("SyntheticReferenceExpression should not be printed");
119922
120188
  }
119923
120189
  }
@@ -126100,6 +126366,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126100
126366
  diagnostics.push(createDiagnosticForNode2(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
126101
126367
  return "skip";
126102
126368
  }
126369
+ // falls through
126103
126370
  case 173 /* MethodSignature */:
126104
126371
  case 176 /* Constructor */:
126105
126372
  case 177 /* GetAccessor */:
@@ -126231,6 +126498,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126231
126498
  diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
126232
126499
  return "skip";
126233
126500
  }
126501
+ // falls through
126234
126502
  case 243 /* VariableStatement */:
126235
126503
  if (nodes === parent2.modifiers) {
126236
126504
  checkModifiers(parent2.modifiers, parent2.kind === 243 /* VariableStatement */);
@@ -126273,6 +126541,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126273
126541
  if (isConstValid) {
126274
126542
  continue;
126275
126543
  }
126544
+ // to report error,
126545
+ // falls through
126276
126546
  case 125 /* PublicKeyword */:
126277
126547
  case 123 /* PrivateKeyword */:
126278
126548
  case 124 /* ProtectedKeyword */:
@@ -126284,6 +126554,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126284
126554
  case 147 /* OutKeyword */:
126285
126555
  diagnostics.push(createDiagnosticForNode2(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
126286
126556
  break;
126557
+ // These are all legal modifiers.
126287
126558
  case 126 /* StaticKeyword */:
126288
126559
  case 95 /* ExportKeyword */:
126289
126560
  case 90 /* DefaultKeyword */:
@@ -131750,6 +132021,7 @@ function getSourceFileVersionAsHashFromText(host, text) {
131750
132021
  if (pos && text.charCodeAt(pos - 1) === 13 /* carriageReturn */) {
131751
132022
  pos--;
131752
132023
  }
132024
+ // falls through
131753
132025
  case 13 /* carriageReturn */:
131754
132026
  break;
131755
132027
  default:
@@ -133287,6 +133559,7 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
133287
133559
  queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
133288
133560
  step++;
133289
133561
  break;
133562
+ // Should never be done
133290
133563
  case 3 /* Done */:
133291
133564
  default:
133292
133565
  assertType(step);
@@ -133827,6 +134100,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
133827
134100
  status.type = 2 /* UpToDateWithUpstreamTypes */;
133828
134101
  break;
133829
134102
  }
134103
+ // falls through
133830
134104
  case 15 /* UpToDateWithInputFileText */:
133831
134105
  case 2 /* UpToDateWithUpstreamTypes */:
133832
134106
  if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
@@ -134344,6 +134618,8 @@ function reportUpToDateStatus(state, configFileName, status) {
134344
134618
  relName(state, configFileName)
134345
134619
  );
134346
134620
  case 16 /* ContainerOnly */:
134621
+ // Don't report status on "solution" projects
134622
+ // falls through
134347
134623
  case 13 /* ComputingUpstream */:
134348
134624
  break;
134349
134625
  default:
@@ -136176,6 +136452,7 @@ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeN
136176
136452
  return `'${typing}':: ${kind} name '${name}' contains non URI safe characters`;
136177
136453
  case 0 /* Ok */:
136178
136454
  return Debug.fail();
136455
+ // Shouldn't have called this.
136179
136456
  default:
136180
136457
  Debug.assertNever(result);
136181
136458
  }
@@ -136552,6 +136829,7 @@ function getMeaningFromDeclaration(node) {
136552
136829
  case 277 /* ExportAssignment */:
136553
136830
  case 278 /* ExportDeclaration */:
136554
136831
  return 7 /* All */;
136832
+ // An external module can be a Value
136555
136833
  case 307 /* SourceFile */:
136556
136834
  return 4 /* Namespace */ | 1 /* Value */;
136557
136835
  }
@@ -136860,6 +137138,7 @@ function getNodeKind(node) {
136860
137138
  return isFunctionExpression(right) ? "method" /* memberFunctionElement */ : "property" /* memberVariableElement */;
136861
137139
  case 4 /* ThisProperty */:
136862
137140
  return "property" /* memberVariableElement */;
137141
+ // property
136863
137142
  case 5 /* Property */:
136864
137143
  return isFunctionExpression(right) ? "method" /* memberFunctionElement */ : "property" /* memberVariableElement */;
136865
137144
  case 6 /* Prototype */:
@@ -136953,6 +137232,7 @@ function isCompletedNode(n, sourceFile) {
136953
137232
  if (!n.arguments) {
136954
137233
  return true;
136955
137234
  }
137235
+ // falls through
136956
137236
  case 213 /* CallExpression */:
136957
137237
  case 217 /* ParenthesizedExpression */:
136958
137238
  case 196 /* ParenthesizedType */:
@@ -137681,16 +137961,19 @@ function getPossibleTypeArgumentsInfo(tokenIn, sourceFile) {
137681
137961
  token = findPrecedingMatchingToken(token, 23 /* OpenBracketToken */, sourceFile);
137682
137962
  if (!token) return void 0;
137683
137963
  break;
137964
+ // Valid tokens in a type name. Skip.
137684
137965
  case 28 /* CommaToken */:
137685
137966
  nTypeArguments++;
137686
137967
  break;
137687
137968
  case 39 /* EqualsGreaterThanToken */:
137969
+ // falls through
137688
137970
  case 80 /* Identifier */:
137689
137971
  case 11 /* StringLiteral */:
137690
137972
  case 9 /* NumericLiteral */:
137691
137973
  case 10 /* BigIntLiteral */:
137692
137974
  case 112 /* TrueKeyword */:
137693
137975
  case 97 /* FalseKeyword */:
137976
+ // falls through
137694
137977
  case 114 /* TypeOfKeyword */:
137695
137978
  case 96 /* ExtendsKeyword */:
137696
137979
  case 143 /* KeyOfKeyword */:
@@ -139964,6 +140247,7 @@ function canFollow(keyword1, keyword2) {
139964
140247
  case 126 /* StaticKeyword */:
139965
140248
  case 129 /* AccessorKeyword */:
139966
140249
  return true;
140250
+ // Allow things like "public get", "public constructor" and "public static".
139967
140251
  default:
139968
140252
  return false;
139969
140253
  }
@@ -140774,6 +141058,7 @@ var DocumentHighlights;
140774
141058
  if (statement.kind === 251 /* ContinueStatement */) {
140775
141059
  return false;
140776
141060
  }
141061
+ // falls through
140777
141062
  case 248 /* ForStatement */:
140778
141063
  case 249 /* ForInStatement */:
140779
141064
  case 250 /* ForOfStatement */:
@@ -140819,6 +141104,7 @@ var DocumentHighlights;
140819
141104
  return [...nodes, container];
140820
141105
  }
140821
141106
  return nodes;
141107
+ // Syntactically invalid positions that the parser might produce anyway
140822
141108
  default:
140823
141109
  return void 0;
140824
141110
  }
@@ -142398,8 +142684,10 @@ function isFixablePromiseArgument(arg, checker) {
142398
142684
  if (functionFlags & 1 /* Generator */) {
142399
142685
  return false;
142400
142686
  }
142687
+ // falls through
142401
142688
  case 219 /* ArrowFunction */:
142402
142689
  visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true);
142690
+ // falls through
142403
142691
  case 106 /* NullKeyword */:
142404
142692
  return true;
142405
142693
  case 80 /* Identifier */:
@@ -143072,6 +143360,7 @@ function addChildrenRecursively(node) {
143072
143360
  Debug.assertNever(special);
143073
143361
  }
143074
143362
  }
143363
+ // falls through
143075
143364
  default:
143076
143365
  if (hasJSDocNodes(node)) {
143077
143366
  forEach(node.jsDoc, (jsDoc) => {
@@ -143664,6 +143953,7 @@ function changeExport(exportingSourceFile, { wasDefault, exportNode, exportName
143664
143953
  changes.replaceNode(exportingSourceFile, exportNode, factory.createExportDefault(Debug.checkDefined(decl.initializer, "Initializer was previously known to be present")));
143665
143954
  break;
143666
143955
  }
143956
+ // falls through
143667
143957
  case 266 /* EnumDeclaration */:
143668
143958
  case 265 /* TypeAliasDeclaration */:
143669
143959
  case 267 /* ModuleDeclaration */:
@@ -144770,6 +145060,7 @@ function getNamesToExportInCommonJS(decl) {
144770
145060
  case 262 /* FunctionDeclaration */:
144771
145061
  case 263 /* ClassDeclaration */:
144772
145062
  return [decl.name.text];
145063
+ // TODO: GH#18217
144773
145064
  case 243 /* VariableStatement */:
144774
145065
  return mapDefined(decl.declarationList.declarations, (d) => isIdentifier(d.name) ? d.name.text : void 0);
144775
145066
  case 267 /* ModuleDeclaration */:
@@ -146232,6 +146523,7 @@ function entryToFunctionCall(entry) {
146232
146523
  const functionReference = entry.node;
146233
146524
  const parent2 = functionReference.parent;
146234
146525
  switch (parent2.kind) {
146526
+ // foo(...) or super(...) or new Foo(...)
146235
146527
  case 213 /* CallExpression */:
146236
146528
  case 214 /* NewExpression */:
146237
146529
  const callOrNewExpression = tryCast(parent2, isCallOrNewExpression);
@@ -146239,6 +146531,7 @@ function entryToFunctionCall(entry) {
146239
146531
  return callOrNewExpression;
146240
146532
  }
146241
146533
  break;
146534
+ // x.foo(...)
146242
146535
  case 211 /* PropertyAccessExpression */:
146243
146536
  const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression);
146244
146537
  if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) {
@@ -146248,6 +146541,7 @@ function entryToFunctionCall(entry) {
146248
146541
  }
146249
146542
  }
146250
146543
  break;
146544
+ // x["foo"](...)
146251
146545
  case 212 /* ElementAccessExpression */:
146252
146546
  const elementAccessExpression = tryCast(parent2, isElementAccessExpression);
146253
146547
  if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) {
@@ -146266,12 +146560,14 @@ function entryToAccessExpression(entry) {
146266
146560
  const reference = entry.node;
146267
146561
  const parent2 = reference.parent;
146268
146562
  switch (parent2.kind) {
146563
+ // `C.foo`
146269
146564
  case 211 /* PropertyAccessExpression */:
146270
146565
  const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression);
146271
146566
  if (propertyAccessExpression && propertyAccessExpression.expression === reference) {
146272
146567
  return propertyAccessExpression;
146273
146568
  }
146274
146569
  break;
146570
+ // `C["foo"]`
146275
146571
  case 212 /* ElementAccessExpression */:
146276
146572
  const elementAccessExpression = tryCast(parent2, isElementAccessExpression);
146277
146573
  if (elementAccessExpression && elementAccessExpression.expression === reference) {
@@ -147364,11 +147660,13 @@ function getRangeToExtract2(sourceFile, span, invoked = true) {
147364
147660
  forEachChild(n, check);
147365
147661
  }
147366
147662
  });
147663
+ // falls through
147367
147664
  case 263 /* ClassDeclaration */:
147368
147665
  case 262 /* FunctionDeclaration */:
147369
147666
  if (isSourceFile(node2.parent) && node2.parent.externalModuleIndicator === void 0) {
147370
147667
  (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.functionWillNotBeVisibleInTheNewScope));
147371
147668
  }
147669
+ // falls through
147372
147670
  case 231 /* ClassExpression */:
147373
147671
  case 218 /* FunctionExpression */:
147374
147672
  case 174 /* MethodDeclaration */:
@@ -149543,6 +149841,7 @@ var SourceFileObject = class extends NodeObject {
149543
149841
  if (!hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
149544
149842
  break;
149545
149843
  }
149844
+ // falls through
149546
149845
  case 260 /* VariableDeclaration */:
149547
149846
  case 208 /* BindingElement */: {
149548
149847
  const decl = node;
@@ -149554,6 +149853,7 @@ var SourceFileObject = class extends NodeObject {
149554
149853
  visit(decl.initializer);
149555
149854
  }
149556
149855
  }
149856
+ // falls through
149557
149857
  case 306 /* EnumMember */:
149558
149858
  case 172 /* PropertyDeclaration */:
149559
149859
  case 171 /* PropertySignature */:
@@ -149588,6 +149888,7 @@ var SourceFileObject = class extends NodeObject {
149588
149888
  if (getAssignmentDeclarationKind(node) !== 0 /* None */) {
149589
149889
  addDeclaration(node);
149590
149890
  }
149891
+ // falls through
149591
149892
  default:
149592
149893
  forEachChild(node, visit);
149593
149894
  }
@@ -150475,6 +150776,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
150475
150776
  case 197 /* ThisType */:
150476
150777
  case 80 /* Identifier */:
150477
150778
  break;
150779
+ // Cant create the text span
150478
150780
  default:
150479
150781
  return void 0;
150480
150782
  }
@@ -151192,6 +151494,7 @@ function getContainingObjectLiteralElementWorker(node) {
151192
151494
  if (node.parent.kind === 167 /* ComputedPropertyName */) {
151193
151495
  return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : void 0;
151194
151496
  }
151497
+ // falls through
151195
151498
  case 80 /* Identifier */:
151196
151499
  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
151500
  }
@@ -151346,6 +151649,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151346
151649
  if (isFunctionBlock(node)) {
151347
151650
  return spanInFunctionBlock(node);
151348
151651
  }
151652
+ // falls through
151349
151653
  case 268 /* ModuleBlock */:
151350
151654
  return spanInBlock(node);
151351
151655
  case 299 /* CatchClause */:
@@ -151394,6 +151698,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151394
151698
  if (getModuleInstanceState(node) !== 1 /* Instantiated */) {
151395
151699
  return void 0;
151396
151700
  }
151701
+ // falls through
151397
151702
  case 263 /* ClassDeclaration */:
151398
151703
  case 266 /* EnumDeclaration */:
151399
151704
  case 306 /* EnumMember */:
@@ -151406,9 +151711,11 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151406
151711
  case 206 /* ObjectBindingPattern */:
151407
151712
  case 207 /* ArrayBindingPattern */:
151408
151713
  return spanInBindingPattern(node);
151714
+ // No breakpoint in interface, type alias
151409
151715
  case 264 /* InterfaceDeclaration */:
151410
151716
  case 265 /* TypeAliasDeclaration */:
151411
151717
  return void 0;
151718
+ // Tokens:
151412
151719
  case 27 /* SemicolonToken */:
151413
151720
  case 1 /* EndOfFileToken */:
151414
151721
  return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile));
@@ -151429,6 +151736,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151429
151736
  case 32 /* GreaterThanToken */:
151430
151737
  case 30 /* LessThanToken */:
151431
151738
  return spanInGreaterThanOrLessThanToken(node);
151739
+ // Keywords:
151432
151740
  case 117 /* WhileKeyword */:
151433
151741
  return spanInWhileKeyword(node);
151434
151742
  case 93 /* ElseKeyword */:
@@ -151579,10 +151887,13 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151579
151887
  if (getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {
151580
151888
  return void 0;
151581
151889
  }
151890
+ // Set on parent if on same line otherwise on first statement
151891
+ // falls through
151582
151892
  case 247 /* WhileStatement */:
151583
151893
  case 245 /* IfStatement */:
151584
151894
  case 249 /* ForInStatement */:
151585
151895
  return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
151896
+ // Set span on previous token if it starts on same line otherwise on the first statement of the block
151586
151897
  case 248 /* ForStatement */:
151587
151898
  case 250 /* ForOfStatement */:
151588
151899
  return spanInNodeIfStartsOnSameLine(findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
@@ -151648,6 +151959,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151648
151959
  if (getModuleInstanceState(node2.parent.parent) !== 1 /* Instantiated */) {
151649
151960
  return void 0;
151650
151961
  }
151962
+ // falls through
151651
151963
  case 266 /* EnumDeclaration */:
151652
151964
  case 263 /* ClassDeclaration */:
151653
151965
  return textSpan(node2);
@@ -151655,6 +151967,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151655
151967
  if (isFunctionBlock(node2.parent)) {
151656
151968
  return textSpan(node2);
151657
151969
  }
151970
+ // falls through
151658
151971
  case 299 /* CatchClause */:
151659
151972
  return spanInNode(lastOrUndefined(node2.parent.statements));
151660
151973
  case 269 /* CaseBlock */:
@@ -151667,6 +151980,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151667
151980
  case 206 /* ObjectBindingPattern */:
151668
151981
  const bindingPattern = node2.parent;
151669
151982
  return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern);
151983
+ // Default to parent node
151670
151984
  default:
151671
151985
  if (isArrayLiteralOrObjectLiteralDestructuringPattern(node2.parent)) {
151672
151986
  const objectLiteral = node2.parent;
@@ -151716,6 +152030,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
151716
152030
  case 214 /* NewExpression */:
151717
152031
  case 217 /* ParenthesizedExpression */:
151718
152032
  return spanInPreviousNode(node2);
152033
+ // Default to parent node
151719
152034
  default:
151720
152035
  return spanInNode(node2.parent);
151721
152036
  }
@@ -154308,6 +154623,7 @@ function convertStatement(sourceFile, statement, checker, changes, identifiers,
154308
154623
  }
154309
154624
  }
154310
154625
  }
154626
+ // falls through
154311
154627
  default:
154312
154628
  return false;
154313
154629
  }
@@ -154407,6 +154723,8 @@ function tryChangeModuleExportsObject(object, useSitesToUnqualify) {
154407
154723
  switch (prop.kind) {
154408
154724
  case 177 /* GetAccessor */:
154409
154725
  case 178 /* SetAccessor */:
154726
+ // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`.
154727
+ // falls through
154410
154728
  case 304 /* ShorthandPropertyAssignment */:
154411
154729
  case 305 /* SpreadAssignment */:
154412
154730
  return void 0;
@@ -154488,6 +154806,7 @@ function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualif
154488
154806
  return exportConst();
154489
154807
  }
154490
154808
  }
154809
+ // falls through
154491
154810
  case 219 /* ArrowFunction */:
154492
154811
  return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify);
154493
154812
  case 231 /* ClassExpression */:
@@ -154536,6 +154855,7 @@ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target
154536
154855
  )]);
154537
154856
  }
154538
154857
  }
154858
+ // falls through -- object destructuring has an interesting pattern and must be a variable declaration
154539
154859
  case 207 /* ArrayBindingPattern */: {
154540
154860
  const tmp = makeUniqueName(moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers);
154541
154861
  return convertedImports([
@@ -159612,6 +159932,7 @@ function doChange27(changes, sourceFile, start, length2, errorCode) {
159612
159932
  }
159613
159933
  return;
159614
159934
  }
159935
+ // falls through
159615
159936
  case 247 /* WhileStatement */:
159616
159937
  case 248 /* ForStatement */:
159617
159938
  changes.delete(sourceFile, container);
@@ -160876,6 +161197,7 @@ function getDiagnostic(errorCode, token) {
160876
161197
  case Diagnostics.Parameter_0_implicitly_has_an_1_type.code:
160877
161198
  case Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code:
160878
161199
  return isSetAccessorDeclaration(getContainingFunction(token)) ? Diagnostics.Infer_type_of_0_from_usage : Diagnostics.Infer_parameter_types_from_usage;
161200
+ // TODO: GH#18217
160879
161201
  case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
160880
161202
  case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage.code:
160881
161203
  return Diagnostics.Infer_parameter_types_from_usage;
@@ -160914,6 +161236,7 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
160914
161236
  const importAdder = createImportAdder(sourceFile, program, preferences, host);
160915
161237
  errorCode = mapSuggestionDiagnostic(errorCode);
160916
161238
  switch (errorCode) {
161239
+ // Variable and Property declarations
160917
161240
  case Diagnostics.Member_0_implicitly_has_an_1_type.code:
160918
161241
  case Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code:
160919
161242
  if (isVariableDeclaration(parent2) && markSeen(parent2) || isPropertyDeclaration(parent2) || isPropertySignature(parent2)) {
@@ -160954,12 +161277,14 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
160954
161277
  }
160955
161278
  let declaration;
160956
161279
  switch (errorCode) {
161280
+ // Parameter declarations
160957
161281
  case Diagnostics.Parameter_0_implicitly_has_an_1_type.code:
160958
161282
  if (isSetAccessorDeclaration(containingFunction)) {
160959
161283
  annotateSetAccessor(changes, importAdder, sourceFile, containingFunction, program, host, cancellationToken);
160960
161284
  declaration = containingFunction;
160961
161285
  break;
160962
161286
  }
161287
+ // falls through
160963
161288
  case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
160964
161289
  if (markSeen(containingFunction)) {
160965
161290
  const param = cast(parent2, isParameter);
@@ -160967,6 +161292,7 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
160967
161292
  declaration = param;
160968
161293
  }
160969
161294
  break;
161295
+ // Get Accessor declarations
160970
161296
  case Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code:
160971
161297
  case Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code:
160972
161298
  if (isGetAccessorDeclaration(containingFunction) && isIdentifier(containingFunction.name)) {
@@ -160974,12 +161300,14 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
160974
161300
  declaration = containingFunction;
160975
161301
  }
160976
161302
  break;
161303
+ // Set Accessor declarations
160977
161304
  case Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code:
160978
161305
  if (isSetAccessorDeclaration(containingFunction)) {
160979
161306
  annotateSetAccessor(changes, importAdder, sourceFile, containingFunction, program, host, cancellationToken);
160980
161307
  declaration = containingFunction;
160981
161308
  }
160982
161309
  break;
161310
+ // Function 'this'
160983
161311
  case Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code:
160984
161312
  if (ts_textChanges_exports.isThisTypeAnnotatable(containingFunction) && markSeen(containingFunction)) {
160985
161313
  annotateThis(changes, sourceFile, containingFunction, program, host, cancellationToken);
@@ -161361,6 +161689,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161361
161689
  break;
161362
161690
  }
161363
161691
  }
161692
+ // falls through
161364
161693
  default:
161365
161694
  return inferTypeFromContextualType(node, usage);
161366
161695
  }
@@ -161388,16 +161717,25 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161388
161717
  }
161389
161718
  function inferTypeFromBinaryExpression(node, parent2, usage) {
161390
161719
  switch (parent2.operatorToken.kind) {
161720
+ // ExponentiationOperator
161391
161721
  case 43 /* AsteriskAsteriskToken */:
161722
+ // MultiplicativeOperator
161723
+ // falls through
161392
161724
  case 42 /* AsteriskToken */:
161393
161725
  case 44 /* SlashToken */:
161394
161726
  case 45 /* PercentToken */:
161727
+ // ShiftOperator
161728
+ // falls through
161395
161729
  case 48 /* LessThanLessThanToken */:
161396
161730
  case 49 /* GreaterThanGreaterThanToken */:
161397
161731
  case 50 /* GreaterThanGreaterThanGreaterThanToken */:
161732
+ // BitwiseOperator
161733
+ // falls through
161398
161734
  case 51 /* AmpersandToken */:
161399
161735
  case 52 /* BarToken */:
161400
161736
  case 53 /* CaretToken */:
161737
+ // CompoundAssignmentOperator
161738
+ // falls through
161401
161739
  case 66 /* MinusEqualsToken */:
161402
161740
  case 68 /* AsteriskAsteriskEqualsToken */:
161403
161741
  case 67 /* AsteriskEqualsToken */:
@@ -161409,7 +161747,11 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161409
161747
  case 71 /* LessThanLessThanEqualsToken */:
161410
161748
  case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
161411
161749
  case 72 /* GreaterThanGreaterThanEqualsToken */:
161750
+ // AdditiveOperator
161751
+ // falls through
161412
161752
  case 41 /* MinusToken */:
161753
+ // RelationalOperator
161754
+ // falls through
161413
161755
  case 30 /* LessThanToken */:
161414
161756
  case 33 /* LessThanEqualsToken */:
161415
161757
  case 32 /* GreaterThanToken */:
@@ -161435,6 +161777,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161435
161777
  usage.isNumberOrString = true;
161436
161778
  }
161437
161779
  break;
161780
+ // AssignmentOperators
161438
161781
  case 64 /* EqualsToken */:
161439
161782
  case 35 /* EqualsEqualsToken */:
161440
161783
  case 37 /* EqualsEqualsEqualsToken */:
@@ -161450,6 +161793,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
161450
161793
  usage.isString = true;
161451
161794
  }
161452
161795
  break;
161796
+ // LogicalOperator Or NullishCoalescing
161453
161797
  case 57 /* BarBarToken */:
161454
161798
  case 61 /* QuestionQuestionToken */:
161455
161799
  if (node === parent2.left && (node.parent.parent.kind === 260 /* VariableDeclaration */ || isAssignmentExpression(
@@ -161954,11 +162298,10 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
161954
162298
  const optional = !!(symbol.flags & 16777216 /* Optional */);
161955
162299
  const ambient = !!(enclosingDeclaration.flags & 33554432 /* Ambient */) || isAmbient;
161956
162300
  const quotePreference = getQuotePreference(sourceFile, preferences);
162301
+ const flags = 1 /* NoTruncation */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
161957
162302
  switch (kind) {
161958
162303
  case 171 /* PropertySignature */:
161959
162304
  case 172 /* PropertyDeclaration */:
161960
- let flags = 1 /* NoTruncation */;
161961
- flags |= quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0;
161962
162305
  let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
161963
162306
  if (importAdder) {
161964
162307
  const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
@@ -161982,8 +162325,7 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
161982
162325
  let typeNode2 = checker.typeToTypeNode(
161983
162326
  type,
161984
162327
  enclosingDeclaration,
161985
- /*flags*/
161986
- void 0,
162328
+ flags,
161987
162329
  /*internalFlags*/
161988
162330
  void 0,
161989
162331
  getNoopSymbolTrackerWithResolver(context)
@@ -165703,6 +166045,7 @@ function getContextualType(previousToken, position, sourceFile, checker) {
165703
166045
  switch (parent2.kind) {
165704
166046
  case 260 /* VariableDeclaration */:
165705
166047
  return checker.getContextualType(parent2.initializer);
166048
+ // TODO: GH#18217
165706
166049
  case 226 /* BinaryExpression */:
165707
166050
  return checker.getTypeAtLocation(parent2.left);
165708
166051
  case 291 /* JsxAttribute */:
@@ -165889,6 +166232,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
165889
166232
  if (!binaryExpressionMayBeOpenTag(parent2)) {
165890
166233
  break;
165891
166234
  }
166235
+ // falls through
165892
166236
  case 285 /* JsxSelfClosingElement */:
165893
166237
  case 284 /* JsxElement */:
165894
166238
  case 286 /* JsxOpeningElement */:
@@ -166508,6 +166852,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166508
166852
  case 28 /* CommaToken */:
166509
166853
  switch (containingNodeKind) {
166510
166854
  case 213 /* CallExpression */:
166855
+ // func( a, |
166511
166856
  case 214 /* NewExpression */: {
166512
166857
  const expression = contextToken.parent.expression;
166513
166858
  if (getLineAndCharacterOfPosition(sourceFile, expression.end).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
@@ -166518,7 +166863,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166518
166863
  case 226 /* BinaryExpression */:
166519
166864
  return { defaultCommitCharacters: noCommaCommitCharacters, isNewIdentifierLocation: true };
166520
166865
  case 176 /* Constructor */:
166866
+ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
166521
166867
  case 184 /* FunctionType */:
166868
+ // var x: (s: string, list|
166522
166869
  case 210 /* ObjectLiteralExpression */:
166523
166870
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166524
166871
  case 209 /* ArrayLiteralExpression */:
@@ -166529,6 +166876,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166529
166876
  case 21 /* OpenParenToken */:
166530
166877
  switch (containingNodeKind) {
166531
166878
  case 213 /* CallExpression */:
166879
+ // func( |
166532
166880
  case 214 /* NewExpression */: {
166533
166881
  const expression = contextToken.parent.expression;
166534
166882
  if (getLineAndCharacterOfPosition(sourceFile, expression.end).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
@@ -166539,6 +166887,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166539
166887
  case 217 /* ParenthesizedExpression */:
166540
166888
  return { defaultCommitCharacters: noCommaCommitCharacters, isNewIdentifierLocation: true };
166541
166889
  case 176 /* Constructor */:
166890
+ // constructor( |
166542
166891
  case 196 /* ParenthesizedType */:
166543
166892
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166544
166893
  default:
@@ -166547,15 +166896,20 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166547
166896
  case 23 /* OpenBracketToken */:
166548
166897
  switch (containingNodeKind) {
166549
166898
  case 209 /* ArrayLiteralExpression */:
166899
+ // [ |
166550
166900
  case 181 /* IndexSignature */:
166901
+ // [ | : string ]
166551
166902
  case 189 /* TupleType */:
166903
+ // [ | : string ]
166552
166904
  case 167 /* ComputedPropertyName */:
166553
166905
  return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: true };
166554
166906
  default:
166555
166907
  return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: false };
166556
166908
  }
166557
166909
  case 144 /* ModuleKeyword */:
166910
+ // module |
166558
166911
  case 145 /* NamespaceKeyword */:
166912
+ // namespace |
166559
166913
  case 102 /* ImportKeyword */:
166560
166914
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166561
166915
  case 25 /* DotToken */:
@@ -166568,6 +166922,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166568
166922
  case 19 /* OpenBraceToken */:
166569
166923
  switch (containingNodeKind) {
166570
166924
  case 263 /* ClassDeclaration */:
166925
+ // class A { |
166571
166926
  case 210 /* ObjectLiteralExpression */:
166572
166927
  return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
166573
166928
  default:
@@ -166576,6 +166931,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166576
166931
  case 64 /* EqualsToken */:
166577
166932
  switch (containingNodeKind) {
166578
166933
  case 260 /* VariableDeclaration */:
166934
+ // const x = a|
166579
166935
  case 226 /* BinaryExpression */:
166580
166936
  return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: true };
166581
166937
  default:
@@ -166830,6 +167186,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166830
167186
  const parent2 = contextToken2.parent;
166831
167187
  switch (contextToken2.kind) {
166832
167188
  case 32 /* GreaterThanToken */:
167189
+ // End of a type argument list
166833
167190
  case 31 /* LessThanSlashToken */:
166834
167191
  case 44 /* SlashToken */:
166835
167192
  case 80 /* Identifier */:
@@ -166852,6 +167209,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166852
167209
  return parent2.parent.parent;
166853
167210
  }
166854
167211
  break;
167212
+ // The context token is the closing } or " of an attribute, which means
167213
+ // its parent is a JsxExpression, whose parent is a JsxAttribute,
167214
+ // whose parent is a JsxOpeningLikeElement
166855
167215
  case 11 /* StringLiteral */:
166856
167216
  if (parent2 && (parent2.kind === 291 /* JsxAttribute */ || parent2.kind === 293 /* JsxSpreadAttribute */)) {
166857
167217
  return parent2.parent.parent;
@@ -166886,14 +167246,18 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166886
167246
  isClassLike(parent2) && !!parent2.typeParameters && parent2.typeParameters.end >= contextToken2.pos;
166887
167247
  case 25 /* DotToken */:
166888
167248
  return containingNodeKind === 207 /* ArrayBindingPattern */;
167249
+ // var [.|
166889
167250
  case 59 /* ColonToken */:
166890
167251
  return containingNodeKind === 208 /* BindingElement */;
167252
+ // var {x :html|
166891
167253
  case 23 /* OpenBracketToken */:
166892
167254
  return containingNodeKind === 207 /* ArrayBindingPattern */;
167255
+ // var [x|
166893
167256
  case 21 /* OpenParenToken */:
166894
167257
  return containingNodeKind === 299 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind);
166895
167258
  case 19 /* OpenBraceToken */:
166896
167259
  return containingNodeKind === 266 /* EnumDeclaration */;
167260
+ // enum a { |
166897
167261
  case 30 /* LessThanToken */:
166898
167262
  return containingNodeKind === 263 /* ClassDeclaration */ || // class A< |
166899
167263
  containingNodeKind === 231 /* ClassExpression */ || // var C = class D< |
@@ -166904,6 +167268,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166904
167268
  return containingNodeKind === 172 /* PropertyDeclaration */ && !isClassLike(parent2.parent);
166905
167269
  case 26 /* DotDotDotToken */:
166906
167270
  return containingNodeKind === 169 /* Parameter */ || !!parent2.parent && parent2.parent.kind === 207 /* ArrayBindingPattern */;
167271
+ // var [...z|
166907
167272
  case 125 /* PublicKeyword */:
166908
167273
  case 123 /* PrivateKeyword */:
166909
167274
  case 124 /* ProtectedKeyword */:
@@ -167130,6 +167495,7 @@ function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile)
167130
167495
  const { parent: parent2 } = contextToken;
167131
167496
  switch (contextToken.kind) {
167132
167497
  case 19 /* OpenBraceToken */:
167498
+ // const x = { |
167133
167499
  case 28 /* CommaToken */:
167134
167500
  if (isObjectLiteralExpression(parent2) || isObjectBindingPattern(parent2)) {
167135
167501
  return parent2;
@@ -167407,9 +167773,11 @@ function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken
167407
167773
  case 64 /* EqualsToken */:
167408
167774
  return void 0;
167409
167775
  case 27 /* SemicolonToken */:
167776
+ // class c {getValue(): number; | }
167410
167777
  case 20 /* CloseBraceToken */:
167411
167778
  return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : tryCast(location, isObjectTypeDeclaration);
167412
167779
  case 19 /* OpenBraceToken */:
167780
+ // class c { |
167413
167781
  case 28 /* CommaToken */:
167414
167782
  return tryCast(contextToken.parent, isObjectTypeDeclaration);
167415
167783
  default:
@@ -167915,6 +168283,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
167915
168283
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 291 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile, typeChecker);
167916
168284
  return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
167917
168285
  }
168286
+ // falls through (is `require("")` or `require(""` or `import("")`)
167918
168287
  case 272 /* ImportDeclaration */:
167919
168288
  case 278 /* ExportDeclaration */:
167920
168289
  case 283 /* ExternalModuleReference */:
@@ -168721,6 +169090,7 @@ function getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, {
168721
169090
  break;
168722
169091
  case 80 /* Identifier */:
168723
169092
  break;
169093
+ // TODO: GH#23879
168724
169094
  case 271 /* ImportEqualsDeclaration */:
168725
169095
  handleNamespaceImport(
168726
169096
  direct,
@@ -169615,6 +169985,7 @@ function declarationIsWriteAccess(decl) {
169615
169985
  case 306 /* EnumMember */:
169616
169986
  case 281 /* ExportSpecifier */:
169617
169987
  case 273 /* ImportClause */:
169988
+ // default import
169618
169989
  case 271 /* ImportEqualsDeclaration */:
169619
169990
  case 276 /* ImportSpecifier */:
169620
169991
  case 264 /* InterfaceDeclaration */:
@@ -170001,6 +170372,7 @@ var Core;
170001
170372
  Debug.assert(node.parent.name === node);
170002
170373
  return 2 /* Class */;
170003
170374
  }
170375
+ // falls through
170004
170376
  default:
170005
170377
  return 0 /* None */;
170006
170378
  }
@@ -170332,6 +170704,7 @@ var Core;
170332
170704
  if (isJSDocMemberName(node.parent)) {
170333
170705
  return true;
170334
170706
  }
170707
+ // falls through I guess
170335
170708
  case 80 /* Identifier */:
170336
170709
  return node.text.length === searchSymbolName.length;
170337
170710
  case 15 /* NoSubstitutionTemplateLiteral */:
@@ -170757,6 +171130,7 @@ var Core;
170757
171130
  searchSpaceNode = searchSpaceNode.parent;
170758
171131
  break;
170759
171132
  }
171133
+ // falls through
170760
171134
  case 172 /* PropertyDeclaration */:
170761
171135
  case 171 /* PropertySignature */:
170762
171136
  case 176 /* Constructor */:
@@ -170769,9 +171143,12 @@ var Core;
170769
171143
  if (isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) {
170770
171144
  return void 0;
170771
171145
  }
171146
+ // falls through
170772
171147
  case 262 /* FunctionDeclaration */:
170773
171148
  case 218 /* FunctionExpression */:
170774
171149
  break;
171150
+ // Computed properties in classes are not handled here because references to this are illegal,
171151
+ // so there is no point finding references to them.
170775
171152
  default:
170776
171153
  return void 0;
170777
171154
  }
@@ -171111,6 +171488,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
171111
171488
  if (!isDefaultClause(node.parent)) {
171112
171489
  break;
171113
171490
  }
171491
+ // falls through
171114
171492
  case 84 /* CaseKeyword */:
171115
171493
  const switchStatement = findAncestor(node.parent, isSwitchStatement);
171116
171494
  if (switchStatement) {
@@ -171555,6 +171933,8 @@ function isDefinitionVisible(checker, declaration) {
171555
171933
  case 178 /* SetAccessor */:
171556
171934
  case 174 /* MethodDeclaration */:
171557
171935
  if (hasEffectiveModifier(declaration, 2 /* Private */)) return false;
171936
+ // Public properties/methods are visible if its parents are visible, so:
171937
+ // falls through
171558
171938
  case 176 /* Constructor */:
171559
171939
  case 303 /* PropertyAssignment */:
171560
171940
  case 304 /* ShorthandPropertyAssignment */:
@@ -172531,6 +172911,7 @@ function getCommentHavingNodes(declaration) {
172531
172911
  if (isJSDocOverloadTag(declaration.parent)) {
172532
172912
  return [declaration.parent.parent];
172533
172913
  }
172914
+ // falls through
172534
172915
  default:
172535
172916
  return getJSDocCommentsAndTags(declaration);
172536
172917
  }
@@ -173868,6 +174249,7 @@ function getOutliningSpanForNode(n, sourceFile) {
173868
174249
  const node = findChildOfKind(tryStatement, 98 /* FinallyKeyword */, sourceFile);
173869
174250
  if (node) return spanForNode(node);
173870
174251
  }
174252
+ // falls through
173871
174253
  default:
173872
174254
  return createOutliningSpan(createTextSpanFromNode(n, sourceFile), "code" /* Code */);
173873
174255
  }
@@ -177693,19 +178075,34 @@ function isBinaryOpContext(context) {
177693
178075
  case 193 /* IntersectionType */:
177694
178076
  case 238 /* SatisfiesExpression */:
177695
178077
  return true;
178078
+ // equals in binding elements: function foo([[x, y] = [1, 2]])
177696
178079
  case 208 /* BindingElement */:
178080
+ // equals in type X = ...
178081
+ // falls through
177697
178082
  case 265 /* TypeAliasDeclaration */:
178083
+ // equal in import a = module('a');
178084
+ // falls through
177698
178085
  case 271 /* ImportEqualsDeclaration */:
178086
+ // equal in export = 1
178087
+ // falls through
177699
178088
  case 277 /* ExportAssignment */:
178089
+ // equal in let a = 0
178090
+ // falls through
177700
178091
  case 260 /* VariableDeclaration */:
178092
+ // equal in p = 0
178093
+ // falls through
177701
178094
  case 169 /* Parameter */:
177702
178095
  case 306 /* EnumMember */:
177703
178096
  case 172 /* PropertyDeclaration */:
177704
178097
  case 171 /* PropertySignature */:
177705
178098
  return context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */;
178099
+ // "in" keyword in for (let x in []) { }
177706
178100
  case 249 /* ForInStatement */:
178101
+ // "in" keyword in [P in keyof T]: T[P]
178102
+ // falls through
177707
178103
  case 168 /* TypeParameter */:
177708
178104
  return context.currentTokenSpan.kind === 103 /* InKeyword */ || context.nextTokenSpan.kind === 103 /* InKeyword */ || context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */;
178105
+ // Technically, "of" is not a binary operator, but format it the same way as "in"
177709
178106
  case 250 /* ForOfStatement */:
177710
178107
  return context.currentTokenSpan.kind === 165 /* OfKeyword */ || context.nextTokenSpan.kind === 165 /* OfKeyword */;
177711
178108
  }
@@ -177769,12 +178166,20 @@ function isFunctionDeclContext(context) {
177769
178166
  case 262 /* FunctionDeclaration */:
177770
178167
  case 174 /* MethodDeclaration */:
177771
178168
  case 173 /* MethodSignature */:
178169
+ // case SyntaxKind.MemberFunctionDeclaration:
178170
+ // falls through
177772
178171
  case 177 /* GetAccessor */:
177773
178172
  case 178 /* SetAccessor */:
178173
+ // case SyntaxKind.MethodSignature:
178174
+ // falls through
177774
178175
  case 179 /* CallSignature */:
177775
178176
  case 218 /* FunctionExpression */:
177776
178177
  case 176 /* Constructor */:
177777
178178
  case 219 /* ArrowFunction */:
178179
+ // case SyntaxKind.ConstructorDeclaration:
178180
+ // case SyntaxKind.SimpleArrowFunctionExpression:
178181
+ // case SyntaxKind.ParenthesizedArrowFunctionExpression:
178182
+ // falls through
177778
178183
  case 264 /* InterfaceDeclaration */:
177779
178184
  return true;
177780
178185
  }
@@ -177834,6 +178239,9 @@ function isControlDeclContext(context) {
177834
178239
  case 258 /* TryStatement */:
177835
178240
  case 246 /* DoStatement */:
177836
178241
  case 254 /* WithStatement */:
178242
+ // TODO
178243
+ // case SyntaxKind.ElseClause:
178244
+ // falls through
177837
178245
  case 299 /* CatchClause */:
177838
178246
  return true;
177839
178247
  default:
@@ -178462,6 +178870,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178462
178870
  if (node.asteriskToken) {
178463
178871
  return 42 /* AsteriskToken */;
178464
178872
  }
178873
+ // falls through
178465
178874
  case 172 /* PropertyDeclaration */:
178466
178875
  case 169 /* Parameter */:
178467
178876
  const name = getNameOfDeclaration(node);
@@ -178474,6 +178883,10 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178474
178883
  return {
178475
178884
  getIndentationForComment: (kind, tokenIndentation, container) => {
178476
178885
  switch (kind) {
178886
+ // preceding comment to the token that closes the indentation scope inherits the indentation from the scope
178887
+ // .. {
178888
+ // // comment
178889
+ // }
178477
178890
  case 20 /* CloseBraceToken */:
178478
178891
  case 24 /* CloseBracketToken */:
178479
178892
  case 22 /* CloseParenToken */:
@@ -178503,6 +178916,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
178503
178916
  };
178504
178917
  function shouldAddDelta(line, kind, container) {
178505
178918
  switch (kind) {
178919
+ // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent
178506
178920
  case 19 /* OpenBraceToken */:
178507
178921
  case 20 /* CloseBraceToken */:
178508
178922
  case 22 /* CloseParenToken */:
@@ -189416,9 +189830,11 @@ Dynamic files must always be opened with service's current directory or service
189416
189830
  const result = [];
189417
189831
  const processDirectory = (directory) => {
189418
189832
  switch (packageJsonCache.directoryHasPackageJson(directory)) {
189833
+ // Sync and check same directory again
189419
189834
  case 3 /* Maybe */:
189420
189835
  packageJsonCache.searchDirectoryAndAncestors(directory);
189421
189836
  return processDirectory(directory);
189837
+ // Check package.json
189422
189838
  case -1 /* True */:
189423
189839
  const packageJsonFileName = combinePaths(directory, "package.json");
189424
189840
  this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project);