@typescript-deploys/pr-build 5.7.0-pr-59736-2 → 5.7.0-pr-53017-15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.7";
21
- var version = `${versionMajorMinor}.0-insiders.20240827`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240916`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -426,7 +426,10 @@ function deduplicateSorted(array, comparer) {
426
426
  for (let i = 1; i < array.length; i++) {
427
427
  const next = array[i];
428
428
  switch (comparer(next, last2)) {
429
+ // equality comparison
429
430
  case true:
431
+ // relational comparison
432
+ // falls through
430
433
  case 0 /* EqualTo */:
431
434
  continue;
432
435
  case -1 /* LessThan */:
@@ -1079,7 +1082,7 @@ function findBestPatternMatch(values, getPattern, candidate) {
1079
1082
  for (let i = 0; i < values.length; i++) {
1080
1083
  const v = values[i];
1081
1084
  const pattern = getPattern(v);
1082
- if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
1085
+ if (pattern.prefix.length > longestMatchPrefixLength && isPatternMatch(pattern, candidate)) {
1083
1086
  longestMatchPrefixLength = pattern.prefix.length;
1084
1087
  matchedValue = v;
1085
1088
  }
@@ -3285,10 +3288,11 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind4) => {
3285
3288
  SyntaxKind4[SyntaxKind4["JSDocImportTag"] = 351] = "JSDocImportTag";
3286
3289
  SyntaxKind4[SyntaxKind4["SyntaxList"] = 352] = "SyntaxList";
3287
3290
  SyntaxKind4[SyntaxKind4["NotEmittedStatement"] = 353] = "NotEmittedStatement";
3288
- SyntaxKind4[SyntaxKind4["PartiallyEmittedExpression"] = 354] = "PartiallyEmittedExpression";
3289
- SyntaxKind4[SyntaxKind4["CommaListExpression"] = 355] = "CommaListExpression";
3290
- SyntaxKind4[SyntaxKind4["SyntheticReferenceExpression"] = 356] = "SyntheticReferenceExpression";
3291
- SyntaxKind4[SyntaxKind4["Count"] = 357] = "Count";
3291
+ SyntaxKind4[SyntaxKind4["NotEmittedTypeElement"] = 354] = "NotEmittedTypeElement";
3292
+ SyntaxKind4[SyntaxKind4["PartiallyEmittedExpression"] = 355] = "PartiallyEmittedExpression";
3293
+ SyntaxKind4[SyntaxKind4["CommaListExpression"] = 356] = "CommaListExpression";
3294
+ SyntaxKind4[SyntaxKind4["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression";
3295
+ SyntaxKind4[SyntaxKind4["Count"] = 358] = "Count";
3292
3296
  SyntaxKind4[SyntaxKind4["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
3293
3297
  SyntaxKind4[SyntaxKind4["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
3294
3298
  SyntaxKind4[SyntaxKind4["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
@@ -3850,6 +3854,42 @@ var EmitFlags = /* @__PURE__ */ ((EmitFlags3) => {
3850
3854
  EmitFlags3[EmitFlags3["NoAsciiEscaping"] = 16777216] = "NoAsciiEscaping";
3851
3855
  return EmitFlags3;
3852
3856
  })(EmitFlags || {});
3857
+ var LanguageFeatureMinimumTarget = {
3858
+ Classes: 2 /* ES2015 */,
3859
+ ForOf: 2 /* ES2015 */,
3860
+ Generators: 2 /* ES2015 */,
3861
+ Iteration: 2 /* ES2015 */,
3862
+ SpreadElements: 2 /* ES2015 */,
3863
+ RestElements: 2 /* ES2015 */,
3864
+ TaggedTemplates: 2 /* ES2015 */,
3865
+ DestructuringAssignment: 2 /* ES2015 */,
3866
+ BindingPatterns: 2 /* ES2015 */,
3867
+ ArrowFunctions: 2 /* ES2015 */,
3868
+ BlockScopedVariables: 2 /* ES2015 */,
3869
+ ObjectAssign: 2 /* ES2015 */,
3870
+ RegularExpressionFlagsUnicode: 2 /* ES2015 */,
3871
+ RegularExpressionFlagsSticky: 2 /* ES2015 */,
3872
+ Exponentiation: 3 /* ES2016 */,
3873
+ AsyncFunctions: 4 /* ES2017 */,
3874
+ ForAwaitOf: 5 /* ES2018 */,
3875
+ AsyncGenerators: 5 /* ES2018 */,
3876
+ AsyncIteration: 5 /* ES2018 */,
3877
+ ObjectSpreadRest: 5 /* ES2018 */,
3878
+ RegularExpressionFlagsDotAll: 5 /* ES2018 */,
3879
+ BindinglessCatch: 6 /* ES2019 */,
3880
+ BigInt: 7 /* ES2020 */,
3881
+ NullishCoalesce: 7 /* ES2020 */,
3882
+ OptionalChaining: 7 /* ES2020 */,
3883
+ LogicalAssignment: 8 /* ES2021 */,
3884
+ TopLevelAwait: 9 /* ES2022 */,
3885
+ ClassFields: 9 /* ES2022 */,
3886
+ PrivateNamesAndClassStaticBlocks: 9 /* ES2022 */,
3887
+ RegularExpressionFlagsHasIndices: 9 /* ES2022 */,
3888
+ ShebangComments: 99 /* ESNext */,
3889
+ UsingAndAwaitUsing: 99 /* ESNext */,
3890
+ ClassAndClassElementDecorators: 99 /* ESNext */,
3891
+ RegularExpressionFlagsUnicodeSets: 99 /* ESNext */
3892
+ };
3853
3893
  var commentPragmas = {
3854
3894
  "reference": {
3855
3895
  args: [
@@ -4609,6 +4649,7 @@ function createSystemWatchFunctions({
4609
4649
  return generateWatchFileOptions(4 /* UseFsEvents */, 2 /* DynamicPriority */, options);
4610
4650
  case "UseFsEventsOnParentDirectory":
4611
4651
  useNonPollingWatchers2 = true;
4652
+ // fall through
4612
4653
  default:
4613
4654
  return useNonPollingWatchers2 ? (
4614
4655
  // Use notifications from FS to watch with falling back to fs.watchFile
@@ -8065,11 +8106,11 @@ var charCodeToRegExpFlag = /* @__PURE__ */ new Map([
8065
8106
  [121 /* y */, 128 /* Sticky */]
8066
8107
  ]);
8067
8108
  var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
8068
- [1 /* HasIndices */, 9 /* RegularExpressionFlagsHasIndices */],
8069
- [16 /* DotAll */, 5 /* RegularExpressionFlagsDotAll */],
8070
- [32 /* Unicode */, 2 /* RegularExpressionFlagsUnicode */],
8071
- [64 /* UnicodeSets */, 99 /* RegularExpressionFlagsUnicodeSets */],
8072
- [128 /* Sticky */, 2 /* RegularExpressionFlagsSticky */]
8109
+ [1 /* HasIndices */, LanguageFeatureMinimumTarget.RegularExpressionFlagsHasIndices],
8110
+ [16 /* DotAll */, LanguageFeatureMinimumTarget.RegularExpressionFlagsDotAll],
8111
+ [32 /* Unicode */, LanguageFeatureMinimumTarget.RegularExpressionFlagsUnicode],
8112
+ [64 /* UnicodeSets */, LanguageFeatureMinimumTarget.RegularExpressionFlagsUnicodeSets],
8113
+ [128 /* Sticky */, LanguageFeatureMinimumTarget.RegularExpressionFlagsSticky]
8073
8114
  ]);
8074
8115
  var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6e3, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
8075
8116
  var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6e3, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
@@ -8135,6 +8176,7 @@ function computeLineStarts(text) {
8135
8176
  if (text.charCodeAt(pos) === 10 /* lineFeed */) {
8136
8177
  pos++;
8137
8178
  }
8179
+ // falls through
8138
8180
  case 10 /* lineFeed */:
8139
8181
  result.push(lineStart);
8140
8182
  lineStart = pos;
@@ -8239,6 +8281,7 @@ function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments, inJSDoc) {
8239
8281
  if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
8240
8282
  pos++;
8241
8283
  }
8284
+ // falls through
8242
8285
  case 10 /* lineFeed */:
8243
8286
  pos++;
8244
8287
  if (stopAfterLineBreak) {
@@ -8385,6 +8428,7 @@ function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
8385
8428
  if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
8386
8429
  pos++;
8387
8430
  }
8431
+ // falls through
8388
8432
  case 10 /* lineFeed */:
8389
8433
  pos++;
8390
8434
  if (trailing) {
@@ -8950,12 +8994,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8950
8994
  if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
8951
8995
  return "\0";
8952
8996
  }
8997
+ // '\01', '\011'
8998
+ // falls through
8953
8999
  case 49 /* _1 */:
8954
9000
  case 50 /* _2 */:
8955
9001
  case 51 /* _3 */:
8956
9002
  if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
8957
9003
  pos++;
8958
9004
  }
9005
+ // '\17', '\177'
9006
+ // falls through
8959
9007
  case 52 /* _4 */:
8960
9008
  case 53 /* _5 */:
8961
9009
  case 54 /* _6 */:
@@ -9053,10 +9101,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9053
9101
  }
9054
9102
  tokenFlags |= 4096 /* HexEscape */;
9055
9103
  return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
9104
+ // when encountering a LineContinuation (i.e. a backslash and a line terminator sequence),
9105
+ // the line terminator is interpreted to be "the empty code unit sequence".
9056
9106
  case 13 /* carriageReturn */:
9057
9107
  if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
9058
9108
  pos++;
9059
9109
  }
9110
+ // falls through
9060
9111
  case 10 /* lineFeed */:
9061
9112
  case 8232 /* lineSeparator */:
9062
9113
  case 8233 /* paragraphSeparator */:
@@ -9487,6 +9538,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9487
9538
  tokenFlags |= 256 /* OctalSpecifier */;
9488
9539
  return token = checkBigIntSuffix();
9489
9540
  }
9541
+ // falls through
9490
9542
  case 49 /* _1 */:
9491
9543
  case 50 /* _2 */:
9492
9544
  case 51 /* _3 */:
@@ -10006,6 +10058,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10006
10058
  break;
10007
10059
  }
10008
10060
  }
10061
+ // falls through
10009
10062
  case 42 /* asterisk */:
10010
10063
  case 43 /* plus */:
10011
10064
  case 63 /* question */:
@@ -10036,6 +10089,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10036
10089
  if (isInGroup) {
10037
10090
  return;
10038
10091
  }
10092
+ // falls through
10039
10093
  case 93 /* closeBracket */:
10040
10094
  case 125 /* closeBrace */:
10041
10095
  if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
@@ -10098,6 +10152,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10098
10152
  error(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
10099
10153
  break;
10100
10154
  }
10155
+ // falls through
10101
10156
  default:
10102
10157
  Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
10103
10158
  /*atomEscape*/
@@ -10235,6 +10290,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10235
10290
  let start2 = pos;
10236
10291
  let operand;
10237
10292
  switch (text.slice(pos, pos + 2)) {
10293
+ // TODO: don't use slice
10238
10294
  case "--":
10239
10295
  case "&&":
10240
10296
  error(Diagnostics.Expected_a_class_set_operand);
@@ -10340,6 +10396,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10340
10396
  }
10341
10397
  start2 = pos;
10342
10398
  switch (text.slice(pos, pos + 2)) {
10399
+ // TODO: don't use slice
10343
10400
  case "--":
10344
10401
  case "&&":
10345
10402
  error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
@@ -10437,6 +10494,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10437
10494
  }
10438
10495
  }
10439
10496
  pos--;
10497
+ // falls through
10440
10498
  default:
10441
10499
  return scanClassSetCharacter();
10442
10500
  }
@@ -10583,6 +10641,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10583
10641
  return true;
10584
10642
  case 80 /* P */:
10585
10643
  isCharacterComplement = true;
10644
+ // falls through
10586
10645
  case 112 /* p */:
10587
10646
  pos++;
10588
10647
  if (charCodeChecked(pos) === 123 /* openBrace */) {
@@ -10890,6 +10949,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10890
10949
  if (charCodeUnchecked(pos) === 10 /* lineFeed */) {
10891
10950
  pos++;
10892
10951
  }
10952
+ // falls through
10893
10953
  case 10 /* lineFeed */:
10894
10954
  tokenFlags |= 1 /* PrecedingLineBreak */;
10895
10955
  return token = 4 /* NewLineTrivia */;
@@ -11094,28 +11154,33 @@ function isExternalModuleNameRelative(moduleName) {
11094
11154
  function sortAndDeduplicateDiagnostics(diagnostics) {
11095
11155
  return sortAndDeduplicate(diagnostics, compareDiagnostics, diagnosticsEqualityComparer);
11096
11156
  }
11157
+ var targetToLibMap = /* @__PURE__ */ new Map([
11158
+ [99 /* ESNext */, "lib.esnext.full.d.ts"],
11159
+ [10 /* ES2023 */, "lib.es2023.full.d.ts"],
11160
+ [9 /* ES2022 */, "lib.es2022.full.d.ts"],
11161
+ [8 /* ES2021 */, "lib.es2021.full.d.ts"],
11162
+ [7 /* ES2020 */, "lib.es2020.full.d.ts"],
11163
+ [6 /* ES2019 */, "lib.es2019.full.d.ts"],
11164
+ [5 /* ES2018 */, "lib.es2018.full.d.ts"],
11165
+ [4 /* ES2017 */, "lib.es2017.full.d.ts"],
11166
+ [3 /* ES2016 */, "lib.es2016.full.d.ts"],
11167
+ [2 /* ES2015 */, "lib.es6.d.ts"]
11168
+ // We don't use lib.es2015.full.d.ts due to breaking change.
11169
+ ]);
11097
11170
  function getDefaultLibFileName(options) {
11098
- switch (getEmitScriptTarget(options)) {
11171
+ const target = getEmitScriptTarget(options);
11172
+ switch (target) {
11099
11173
  case 99 /* ESNext */:
11100
- return "lib.esnext.full.d.ts";
11101
11174
  case 10 /* ES2023 */:
11102
- return "lib.es2023.full.d.ts";
11103
11175
  case 9 /* ES2022 */:
11104
- return "lib.es2022.full.d.ts";
11105
11176
  case 8 /* ES2021 */:
11106
- return "lib.es2021.full.d.ts";
11107
11177
  case 7 /* ES2020 */:
11108
- return "lib.es2020.full.d.ts";
11109
11178
  case 6 /* ES2019 */:
11110
- return "lib.es2019.full.d.ts";
11111
11179
  case 5 /* ES2018 */:
11112
- return "lib.es2018.full.d.ts";
11113
11180
  case 4 /* ES2017 */:
11114
- return "lib.es2017.full.d.ts";
11115
11181
  case 3 /* ES2016 */:
11116
- return "lib.es2016.full.d.ts";
11117
11182
  case 2 /* ES2015 */:
11118
- return "lib.es6.d.ts";
11183
+ return targetToLibMap.get(target);
11119
11184
  default:
11120
11185
  return "lib.d.ts";
11121
11186
  }
@@ -11915,7 +11980,7 @@ function isModifierLike(node) {
11915
11980
  }
11916
11981
  function isTypeElement(node) {
11917
11982
  const kind = node.kind;
11918
- return kind === 180 /* ConstructSignature */ || kind === 179 /* CallSignature */ || kind === 171 /* PropertySignature */ || kind === 173 /* MethodSignature */ || kind === 181 /* IndexSignature */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */;
11983
+ 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 */;
11919
11984
  }
11920
11985
  function isObjectLiteralElementLike(node) {
11921
11986
  const kind = node.kind;
@@ -11974,7 +12039,9 @@ function isObjectBindingOrAssignmentElement(node) {
11974
12039
  switch (node.kind) {
11975
12040
  case 208 /* BindingElement */:
11976
12041
  case 303 /* PropertyAssignment */:
12042
+ // AssignmentProperty
11977
12043
  case 304 /* ShorthandPropertyAssignment */:
12044
+ // AssignmentProperty
11978
12045
  case 305 /* SpreadAssignment */:
11979
12046
  return true;
11980
12047
  }
@@ -11992,11 +12059,17 @@ function isArrayBindingOrAssignmentElement(node) {
11992
12059
  switch (node.kind) {
11993
12060
  case 208 /* BindingElement */:
11994
12061
  case 232 /* OmittedExpression */:
12062
+ // Elision
11995
12063
  case 230 /* SpreadElement */:
12064
+ // AssignmentRestElement
11996
12065
  case 209 /* ArrayLiteralExpression */:
12066
+ // ArrayAssignmentPattern
11997
12067
  case 210 /* ObjectLiteralExpression */:
12068
+ // ObjectAssignmentPattern
11998
12069
  case 80 /* Identifier */:
12070
+ // DestructuringAssignmentTarget
11999
12071
  case 211 /* PropertyAccessExpression */:
12072
+ // DestructuringAssignmentTarget
12000
12073
  case 212 /* ElementAccessExpression */:
12001
12074
  return true;
12002
12075
  }
@@ -12057,6 +12130,7 @@ function isLeftHandSideExpressionKind(kind) {
12057
12130
  case 218 /* FunctionExpression */:
12058
12131
  case 80 /* Identifier */:
12059
12132
  case 81 /* PrivateIdentifier */:
12133
+ // technically this is only an Expression if it's in a `#field in expr` BinaryExpression
12060
12134
  case 14 /* RegularExpressionLiteral */:
12061
12135
  case 9 /* NumericLiteral */:
12062
12136
  case 10 /* BigIntLiteral */:
@@ -12072,6 +12146,7 @@ function isLeftHandSideExpressionKind(kind) {
12072
12146
  case 233 /* ExpressionWithTypeArguments */:
12073
12147
  case 236 /* MetaProperty */:
12074
12148
  case 102 /* ImportKeyword */:
12149
+ // technically this is only an Expression if it's in a CallExpression
12075
12150
  case 282 /* MissingDeclaration */:
12076
12151
  return true;
12077
12152
  default:
@@ -12118,8 +12193,8 @@ function isExpressionKind(kind) {
12118
12193
  case 230 /* SpreadElement */:
12119
12194
  case 234 /* AsExpression */:
12120
12195
  case 232 /* OmittedExpression */:
12121
- case 355 /* CommaListExpression */:
12122
- case 354 /* PartiallyEmittedExpression */:
12196
+ case 356 /* CommaListExpression */:
12197
+ case 355 /* PartiallyEmittedExpression */:
12123
12198
  case 238 /* SatisfiesExpression */:
12124
12199
  return true;
12125
12200
  default:
@@ -13738,6 +13813,8 @@ function getErrorSpanForNode(sourceFile, node) {
13738
13813
  }
13739
13814
  return getSpanOfTokenAtPosition(sourceFile, pos2);
13740
13815
  }
13816
+ // This list is a work in progress. Add missing node kinds to improve their error
13817
+ // spans.
13741
13818
  case 260 /* VariableDeclaration */:
13742
13819
  case 208 /* BindingElement */:
13743
13820
  case 263 /* ClassDeclaration */:
@@ -13909,6 +13986,8 @@ function isPartOfTypeNode(node) {
13909
13986
  return isPartOfTypeExpressionWithTypeArguments(node);
13910
13987
  case 168 /* TypeParameter */:
13911
13988
  return node.parent.kind === 200 /* MappedType */ || node.parent.kind === 195 /* InferType */;
13989
+ // Identifiers and qualified names may be type nodes, depending on their context. Climb
13990
+ // above them to find the lowest container
13912
13991
  case 80 /* Identifier */:
13913
13992
  if (node.parent.kind === 166 /* QualifiedName */ && node.parent.right === node) {
13914
13993
  node = node.parent;
@@ -13916,6 +13995,7 @@ function isPartOfTypeNode(node) {
13916
13995
  node = node.parent;
13917
13996
  }
13918
13997
  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'.");
13998
+ // falls through
13919
13999
  case 166 /* QualifiedName */:
13920
14000
  case 211 /* PropertyAccessExpression */:
13921
14001
  case 110 /* ThisKeyword */: {
@@ -14181,6 +14261,7 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
14181
14261
  if (!includeArrowFunctions) {
14182
14262
  continue;
14183
14263
  }
14264
+ // falls through
14184
14265
  case 262 /* FunctionDeclaration */:
14185
14266
  case 218 /* FunctionExpression */:
14186
14267
  case 267 /* ModuleDeclaration */:
@@ -14203,6 +14284,8 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
14203
14284
  }
14204
14285
  function isThisContainerOrFunctionBlock(node) {
14205
14286
  switch (node.kind) {
14287
+ // Arrow functions use the same scope, but may do so in a "delayed" manner
14288
+ // For example, `const getThis = () => this` may be before a super() call in a derived constructor
14206
14289
  case 219 /* ArrowFunction */:
14207
14290
  case 262 /* FunctionDeclaration */:
14208
14291
  case 218 /* FunctionExpression */:
@@ -14269,6 +14352,7 @@ function getSuperContainer(node, stopOnFunctions) {
14269
14352
  if (!stopOnFunctions) {
14270
14353
  continue;
14271
14354
  }
14355
+ // falls through
14272
14356
  case 172 /* PropertyDeclaration */:
14273
14357
  case 171 /* PropertySignature */:
14274
14358
  case 174 /* MethodDeclaration */:
@@ -14322,6 +14406,7 @@ function getEntityNameFromTypeNode(node) {
14322
14406
  return node.typeName;
14323
14407
  case 233 /* ExpressionWithTypeArguments */:
14324
14408
  return isEntityNameExpression(node.expression) ? node.expression : void 0;
14409
+ // 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.
14325
14410
  case 80 /* Identifier */:
14326
14411
  case 166 /* QualifiedName */:
14327
14412
  return node;
@@ -14486,6 +14571,7 @@ function isExpressionNode(node) {
14486
14571
  if (node.parent.kind === 186 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) {
14487
14572
  return true;
14488
14573
  }
14574
+ // falls through
14489
14575
  case 9 /* NumericLiteral */:
14490
14576
  case 10 /* BigIntLiteral */:
14491
14577
  case 11 /* StringLiteral */:
@@ -14956,17 +15042,15 @@ function isDefaultImport(node) {
14956
15042
  return (node.kind === 272 /* ImportDeclaration */ || node.kind === 351 /* JSDocImportTag */) && !!node.importClause && !!node.importClause.name;
14957
15043
  }
14958
15044
  function hasQuestionToken(node) {
14959
- if (node) {
14960
- switch (node.kind) {
14961
- case 169 /* Parameter */:
14962
- case 174 /* MethodDeclaration */:
14963
- case 173 /* MethodSignature */:
14964
- case 304 /* ShorthandPropertyAssignment */:
14965
- case 303 /* PropertyAssignment */:
14966
- case 172 /* PropertyDeclaration */:
14967
- case 171 /* PropertySignature */:
14968
- return node.questionToken !== void 0;
14969
- }
15045
+ switch (node.kind) {
15046
+ case 169 /* Parameter */:
15047
+ case 174 /* MethodDeclaration */:
15048
+ case 173 /* MethodSignature */:
15049
+ case 304 /* ShorthandPropertyAssignment */:
15050
+ case 303 /* PropertyAssignment */:
15051
+ case 172 /* PropertyDeclaration */:
15052
+ case 171 /* PropertySignature */:
15053
+ return node.questionToken !== void 0;
14970
15054
  }
14971
15055
  return false;
14972
15056
  }
@@ -15490,6 +15574,7 @@ function getFunctionFlags(node) {
15490
15574
  if (node.asteriskToken) {
15491
15575
  flags |= 1 /* Generator */;
15492
15576
  }
15577
+ // falls through
15493
15578
  case 219 /* ArrowFunction */:
15494
15579
  if (hasSyntacticModifier(node, 1024 /* Async */)) {
15495
15580
  flags |= 2 /* Async */;
@@ -15724,7 +15809,7 @@ function getOperator(expression) {
15724
15809
  }
15725
15810
  function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
15726
15811
  switch (nodeKind) {
15727
- case 355 /* CommaListExpression */:
15812
+ case 356 /* CommaListExpression */:
15728
15813
  return 0 /* Comma */;
15729
15814
  case 230 /* SpreadElement */:
15730
15815
  return 1 /* Spread */;
@@ -15756,6 +15841,7 @@ function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
15756
15841
  default:
15757
15842
  return getBinaryOperatorPrecedence(operatorKind);
15758
15843
  }
15844
+ // TODO: Should prefix `++` and `--` be moved to the `Update` precedence?
15759
15845
  case 216 /* TypeAssertionExpression */:
15760
15846
  case 235 /* NonNullExpression */:
15761
15847
  case 224 /* PrefixUnaryExpression */:
@@ -17254,11 +17340,12 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
17254
17340
  if (stopAtCallExpressions) {
17255
17341
  return node;
17256
17342
  }
17343
+ // falls through
17257
17344
  case 234 /* AsExpression */:
17258
17345
  case 212 /* ElementAccessExpression */:
17259
17346
  case 211 /* PropertyAccessExpression */:
17260
17347
  case 235 /* NonNullExpression */:
17261
- case 354 /* PartiallyEmittedExpression */:
17348
+ case 355 /* PartiallyEmittedExpression */:
17262
17349
  case 238 /* SatisfiesExpression */:
17263
17350
  node = node.expression;
17264
17351
  continue;
@@ -17644,7 +17731,7 @@ function importSyntaxAffectsModuleResolution(options) {
17644
17731
  function createComputedCompilerOptions(options) {
17645
17732
  return options;
17646
17733
  }
17647
- var computedOptions = createComputedCompilerOptions({
17734
+ var _computedOptions = createComputedCompilerOptions({
17648
17735
  target: {
17649
17736
  dependencies: ["module"],
17650
17737
  computeValue: (compilerOptions) => {
@@ -17655,7 +17742,7 @@ var computedOptions = createComputedCompilerOptions({
17655
17742
  module: {
17656
17743
  dependencies: ["target"],
17657
17744
  computeValue: (compilerOptions) => {
17658
- return typeof compilerOptions.module === "number" ? compilerOptions.module : computedOptions.target.computeValue(compilerOptions) >= 2 /* ES2015 */ ? 5 /* ES2015 */ : 1 /* CommonJS */;
17745
+ return typeof compilerOptions.module === "number" ? compilerOptions.module : _computedOptions.target.computeValue(compilerOptions) >= 2 /* ES2015 */ ? 5 /* ES2015 */ : 1 /* CommonJS */;
17659
17746
  }
17660
17747
  },
17661
17748
  moduleResolution: {
@@ -17663,7 +17750,7 @@ var computedOptions = createComputedCompilerOptions({
17663
17750
  computeValue: (compilerOptions) => {
17664
17751
  let moduleResolution = compilerOptions.moduleResolution;
17665
17752
  if (moduleResolution === void 0) {
17666
- switch (computedOptions.module.computeValue(compilerOptions)) {
17753
+ switch (_computedOptions.module.computeValue(compilerOptions)) {
17667
17754
  case 1 /* CommonJS */:
17668
17755
  moduleResolution = 2 /* Node10 */;
17669
17756
  break;
@@ -17687,7 +17774,7 @@ var computedOptions = createComputedCompilerOptions({
17687
17774
  moduleDetection: {
17688
17775
  dependencies: ["module", "target"],
17689
17776
  computeValue: (compilerOptions) => {
17690
- return compilerOptions.moduleDetection || (computedOptions.module.computeValue(compilerOptions) === 100 /* Node16 */ || computedOptions.module.computeValue(compilerOptions) === 199 /* NodeNext */ ? 3 /* Force */ : 2 /* Auto */);
17777
+ return compilerOptions.moduleDetection || (_computedOptions.module.computeValue(compilerOptions) === 100 /* Node16 */ || _computedOptions.module.computeValue(compilerOptions) === 199 /* NodeNext */ ? 3 /* Force */ : 2 /* Auto */);
17691
17778
  }
17692
17779
  },
17693
17780
  isolatedModules: {
@@ -17702,7 +17789,7 @@ var computedOptions = createComputedCompilerOptions({
17702
17789
  if (compilerOptions.esModuleInterop !== void 0) {
17703
17790
  return compilerOptions.esModuleInterop;
17704
17791
  }
17705
- switch (computedOptions.module.computeValue(compilerOptions)) {
17792
+ switch (_computedOptions.module.computeValue(compilerOptions)) {
17706
17793
  case 100 /* Node16 */:
17707
17794
  case 199 /* NodeNext */:
17708
17795
  case 200 /* Preserve */:
@@ -17717,13 +17804,13 @@ var computedOptions = createComputedCompilerOptions({
17717
17804
  if (compilerOptions.allowSyntheticDefaultImports !== void 0) {
17718
17805
  return compilerOptions.allowSyntheticDefaultImports;
17719
17806
  }
17720
- return computedOptions.esModuleInterop.computeValue(compilerOptions) || computedOptions.module.computeValue(compilerOptions) === 4 /* System */ || computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
17807
+ return _computedOptions.esModuleInterop.computeValue(compilerOptions) || _computedOptions.module.computeValue(compilerOptions) === 4 /* System */ || _computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
17721
17808
  }
17722
17809
  },
17723
17810
  resolvePackageJsonExports: {
17724
17811
  dependencies: ["moduleResolution"],
17725
17812
  computeValue: (compilerOptions) => {
17726
- const moduleResolution = computedOptions.moduleResolution.computeValue(compilerOptions);
17813
+ const moduleResolution = _computedOptions.moduleResolution.computeValue(compilerOptions);
17727
17814
  if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
17728
17815
  return false;
17729
17816
  }
@@ -17742,7 +17829,7 @@ var computedOptions = createComputedCompilerOptions({
17742
17829
  resolvePackageJsonImports: {
17743
17830
  dependencies: ["moduleResolution", "resolvePackageJsonExports"],
17744
17831
  computeValue: (compilerOptions) => {
17745
- const moduleResolution = computedOptions.moduleResolution.computeValue(compilerOptions);
17832
+ const moduleResolution = _computedOptions.moduleResolution.computeValue(compilerOptions);
17746
17833
  if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
17747
17834
  return false;
17748
17835
  }
@@ -17764,7 +17851,7 @@ var computedOptions = createComputedCompilerOptions({
17764
17851
  if (compilerOptions.resolveJsonModule !== void 0) {
17765
17852
  return compilerOptions.resolveJsonModule;
17766
17853
  }
17767
- return computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
17854
+ return _computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
17768
17855
  }
17769
17856
  },
17770
17857
  declaration: {
@@ -17776,7 +17863,7 @@ var computedOptions = createComputedCompilerOptions({
17776
17863
  preserveConstEnums: {
17777
17864
  dependencies: ["isolatedModules", "verbatimModuleSyntax"],
17778
17865
  computeValue: (compilerOptions) => {
17779
- return !!(compilerOptions.preserveConstEnums || computedOptions.isolatedModules.computeValue(compilerOptions));
17866
+ return !!(compilerOptions.preserveConstEnums || _computedOptions.isolatedModules.computeValue(compilerOptions));
17780
17867
  }
17781
17868
  },
17782
17869
  incremental: {
@@ -17788,7 +17875,7 @@ var computedOptions = createComputedCompilerOptions({
17788
17875
  declarationMap: {
17789
17876
  dependencies: ["declaration", "composite"],
17790
17877
  computeValue: (compilerOptions) => {
17791
- return !!(compilerOptions.declarationMap && computedOptions.declaration.computeValue(compilerOptions));
17878
+ return !!(compilerOptions.declarationMap && _computedOptions.declaration.computeValue(compilerOptions));
17792
17879
  }
17793
17880
  },
17794
17881
  allowJs: {
@@ -17800,7 +17887,7 @@ var computedOptions = createComputedCompilerOptions({
17800
17887
  useDefineForClassFields: {
17801
17888
  dependencies: ["target", "module"],
17802
17889
  computeValue: (compilerOptions) => {
17803
- return compilerOptions.useDefineForClassFields === void 0 ? computedOptions.target.computeValue(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields;
17890
+ return compilerOptions.useDefineForClassFields === void 0 ? _computedOptions.target.computeValue(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields;
17804
17891
  }
17805
17892
  },
17806
17893
  noImplicitAny: {
@@ -17858,22 +17945,23 @@ var computedOptions = createComputedCompilerOptions({
17858
17945
  }
17859
17946
  }
17860
17947
  });
17861
- var getEmitScriptTarget = computedOptions.target.computeValue;
17862
- var getEmitModuleKind = computedOptions.module.computeValue;
17863
- var getEmitModuleResolutionKind = computedOptions.moduleResolution.computeValue;
17864
- var getEmitModuleDetectionKind = computedOptions.moduleDetection.computeValue;
17865
- var getIsolatedModules = computedOptions.isolatedModules.computeValue;
17866
- var getESModuleInterop = computedOptions.esModuleInterop.computeValue;
17867
- var getAllowSyntheticDefaultImports = computedOptions.allowSyntheticDefaultImports.computeValue;
17868
- var getResolvePackageJsonExports = computedOptions.resolvePackageJsonExports.computeValue;
17869
- var getResolvePackageJsonImports = computedOptions.resolvePackageJsonImports.computeValue;
17870
- var getResolveJsonModule = computedOptions.resolveJsonModule.computeValue;
17871
- var getEmitDeclarations = computedOptions.declaration.computeValue;
17872
- var shouldPreserveConstEnums = computedOptions.preserveConstEnums.computeValue;
17873
- var isIncrementalCompilation = computedOptions.incremental.computeValue;
17874
- var getAreDeclarationMapsEnabled = computedOptions.declarationMap.computeValue;
17875
- var getAllowJSCompilerOption = computedOptions.allowJs.computeValue;
17876
- var getUseDefineForClassFields = computedOptions.useDefineForClassFields.computeValue;
17948
+ var computedOptions = _computedOptions;
17949
+ var getEmitScriptTarget = _computedOptions.target.computeValue;
17950
+ var getEmitModuleKind = _computedOptions.module.computeValue;
17951
+ var getEmitModuleResolutionKind = _computedOptions.moduleResolution.computeValue;
17952
+ var getEmitModuleDetectionKind = _computedOptions.moduleDetection.computeValue;
17953
+ var getIsolatedModules = _computedOptions.isolatedModules.computeValue;
17954
+ var getESModuleInterop = _computedOptions.esModuleInterop.computeValue;
17955
+ var getAllowSyntheticDefaultImports = _computedOptions.allowSyntheticDefaultImports.computeValue;
17956
+ var getResolvePackageJsonExports = _computedOptions.resolvePackageJsonExports.computeValue;
17957
+ var getResolvePackageJsonImports = _computedOptions.resolvePackageJsonImports.computeValue;
17958
+ var getResolveJsonModule = _computedOptions.resolveJsonModule.computeValue;
17959
+ var getEmitDeclarations = _computedOptions.declaration.computeValue;
17960
+ var shouldPreserveConstEnums = _computedOptions.preserveConstEnums.computeValue;
17961
+ var isIncrementalCompilation = _computedOptions.incremental.computeValue;
17962
+ var getAreDeclarationMapsEnabled = _computedOptions.declarationMap.computeValue;
17963
+ var getAllowJSCompilerOption = _computedOptions.allowJs.computeValue;
17964
+ var getUseDefineForClassFields = _computedOptions.useDefineForClassFields.computeValue;
17877
17965
  function emitModuleKindIsNonNodeESM(moduleKind) {
17878
17966
  return moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */;
17879
17967
  }
@@ -18398,8 +18486,33 @@ function tryParsePattern(pattern) {
18398
18486
  suffix: pattern.substr(indexOfStar + 1)
18399
18487
  };
18400
18488
  }
18489
+ var parsedPatternsCache = /* @__PURE__ */ new WeakMap();
18401
18490
  function tryParsePatterns(paths) {
18402
- return mapDefined(getOwnKeys(paths), (path) => tryParsePattern(path));
18491
+ let result = parsedPatternsCache.get(paths);
18492
+ if (result !== void 0) {
18493
+ return result;
18494
+ }
18495
+ let matchableStringSet;
18496
+ let patterns;
18497
+ const pathList = getOwnKeys(paths);
18498
+ for (const path of pathList) {
18499
+ const patternOrStr = tryParsePattern(path);
18500
+ if (patternOrStr === void 0) {
18501
+ continue;
18502
+ } else if (typeof patternOrStr === "string") {
18503
+ (matchableStringSet ?? (matchableStringSet = /* @__PURE__ */ new Set())).add(patternOrStr);
18504
+ } else {
18505
+ (patterns ?? (patterns = [])).push(patternOrStr);
18506
+ }
18507
+ }
18508
+ parsedPatternsCache.set(
18509
+ paths,
18510
+ result = {
18511
+ matchableStringSet,
18512
+ patterns
18513
+ }
18514
+ );
18515
+ return result;
18403
18516
  }
18404
18517
  function positionIsSynthesized(pos) {
18405
18518
  return !(pos >= 0);
@@ -18424,15 +18537,13 @@ var emptyFileSystemEntries = {
18424
18537
  files: emptyArray,
18425
18538
  directories: emptyArray
18426
18539
  };
18427
- function matchPatternOrExact(patternOrStrings, candidate) {
18428
- const patterns = [];
18429
- for (const patternOrString of patternOrStrings) {
18430
- if (patternOrString === candidate) {
18431
- return candidate;
18432
- }
18433
- if (!isString(patternOrString)) {
18434
- patterns.push(patternOrString);
18435
- }
18540
+ function matchPatternOrExact(parsedPatterns, candidate) {
18541
+ const { matchableStringSet, patterns } = parsedPatterns;
18542
+ if (matchableStringSet == null ? void 0 : matchableStringSet.has(candidate)) {
18543
+ return candidate;
18544
+ }
18545
+ if (patterns === void 0 || patterns.length === 0) {
18546
+ return void 0;
18436
18547
  }
18437
18548
  return findBestPatternMatch(patterns, (_) => _, candidate);
18438
18549
  }
@@ -18509,6 +18620,7 @@ function isJsonEqual(a, b) {
18509
18620
  function parsePseudoBigInt(stringValue) {
18510
18621
  let log2Base;
18511
18622
  switch (stringValue.charCodeAt(1)) {
18623
+ // "x" in "0x123"
18512
18624
  case 98 /* b */:
18513
18625
  case 66 /* B */:
18514
18626
  log2Base = 1;
@@ -18746,7 +18858,7 @@ function getContainingNodeArray(node) {
18746
18858
  return parent.types;
18747
18859
  case 189 /* TupleType */:
18748
18860
  case 209 /* ArrayLiteralExpression */:
18749
- case 355 /* CommaListExpression */:
18861
+ case 356 /* CommaListExpression */:
18750
18862
  case 275 /* NamedImports */:
18751
18863
  case 279 /* NamedExports */:
18752
18864
  return parent.elements;
@@ -19179,6 +19291,7 @@ function createNameResolver({
19179
19291
  switch (location.kind) {
19180
19292
  case 307 /* SourceFile */:
19181
19293
  if (!isExternalOrCommonJsModule(location)) break;
19294
+ // falls through
19182
19295
  case 267 /* ModuleDeclaration */:
19183
19296
  const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
19184
19297
  if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
@@ -19262,6 +19375,14 @@ function createNameResolver({
19262
19375
  }
19263
19376
  }
19264
19377
  break;
19378
+ // It is not legal to reference a class's own type parameters from a computed property name that
19379
+ // belongs to the class. For example:
19380
+ //
19381
+ // function foo<T>() { return '' }
19382
+ // class C<T> { // <-- Class's own type parameter T
19383
+ // [foo<T>()]() { } // <-- Reference to T from class's own computed property
19384
+ // }
19385
+ //
19265
19386
  case 167 /* ComputedPropertyName */:
19266
19387
  grandparent = location.parent.parent;
19267
19388
  if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
@@ -19277,6 +19398,7 @@ function createNameResolver({
19277
19398
  if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
19278
19399
  break;
19279
19400
  }
19401
+ // falls through
19280
19402
  case 174 /* MethodDeclaration */:
19281
19403
  case 176 /* Constructor */:
19282
19404
  case 177 /* GetAccessor */:
@@ -19921,6 +20043,7 @@ function createParenthesizerRules(factory2) {
19921
20043
  function parenthesizeConstituentTypeOfUnionType(type) {
19922
20044
  switch (type.kind) {
19923
20045
  case 192 /* UnionType */:
20046
+ // Not strictly necessary, but a union containing a union should have been flattened
19924
20047
  case 193 /* IntersectionType */:
19925
20048
  return factory2.createParenthesizedType(type);
19926
20049
  }
@@ -20691,6 +20814,7 @@ function createNodeFactory(flags, baseFactory2) {
20691
20814
  createSyntheticExpression,
20692
20815
  createSyntaxList,
20693
20816
  createNotEmittedStatement,
20817
+ createNotEmittedTypeElement,
20694
20818
  createPartiallyEmittedExpression,
20695
20819
  updatePartiallyEmittedExpression,
20696
20820
  createCommaListExpression,
@@ -23717,7 +23841,7 @@ function createNodeFactory(flags, baseFactory2) {
23717
23841
  return node;
23718
23842
  }
23719
23843
  function createPartiallyEmittedExpression(expression, original) {
23720
- const node = createBaseNode(354 /* PartiallyEmittedExpression */);
23844
+ const node = createBaseNode(355 /* PartiallyEmittedExpression */);
23721
23845
  node.expression = expression;
23722
23846
  node.original = original;
23723
23847
  node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
@@ -23727,6 +23851,9 @@ function createNodeFactory(flags, baseFactory2) {
23727
23851
  function updatePartiallyEmittedExpression(node, expression) {
23728
23852
  return node.expression !== expression ? update(createPartiallyEmittedExpression(expression, node.original), node) : node;
23729
23853
  }
23854
+ function createNotEmittedTypeElement() {
23855
+ return createBaseNode(354 /* NotEmittedTypeElement */);
23856
+ }
23730
23857
  function flattenCommaElements(node) {
23731
23858
  if (nodeIsSynthesized(node) && !isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
23732
23859
  if (isCommaListExpression(node)) {
@@ -23739,7 +23866,7 @@ function createNodeFactory(flags, baseFactory2) {
23739
23866
  return node;
23740
23867
  }
23741
23868
  function createCommaListExpression(elements) {
23742
- const node = createBaseNode(355 /* CommaListExpression */);
23869
+ const node = createBaseNode(356 /* CommaListExpression */);
23743
23870
  node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
23744
23871
  node.transformFlags |= propagateChildrenFlags(node.elements);
23745
23872
  return node;
@@ -23748,7 +23875,7 @@ function createNodeFactory(flags, baseFactory2) {
23748
23875
  return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
23749
23876
  }
23750
23877
  function createSyntheticReferenceExpression(expression, thisArg) {
23751
- const node = createBaseNode(356 /* SyntheticReferenceExpression */);
23878
+ const node = createBaseNode(357 /* SyntheticReferenceExpression */);
23752
23879
  node.expression = expression;
23753
23880
  node.thisArg = thisArg;
23754
23881
  node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
@@ -23995,7 +24122,7 @@ function createNodeFactory(flags, baseFactory2) {
23995
24122
  return updateNonNullExpression(outerExpression, expression);
23996
24123
  case 233 /* ExpressionWithTypeArguments */:
23997
24124
  return updateExpressionWithTypeArguments(outerExpression, expression, outerExpression.typeArguments);
23998
- case 354 /* PartiallyEmittedExpression */:
24125
+ case 355 /* PartiallyEmittedExpression */:
23999
24126
  return updatePartiallyEmittedExpression(outerExpression, expression);
24000
24127
  }
24001
24128
  }
@@ -24540,7 +24667,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
24540
24667
  case 216 /* TypeAssertionExpression */:
24541
24668
  case 238 /* SatisfiesExpression */:
24542
24669
  case 234 /* AsExpression */:
24543
- case 354 /* PartiallyEmittedExpression */:
24670
+ case 355 /* PartiallyEmittedExpression */:
24544
24671
  case 217 /* ParenthesizedExpression */:
24545
24672
  case 108 /* SuperKeyword */:
24546
24673
  return -2147483648 /* OuterExpressionExcludes */;
@@ -26181,10 +26308,10 @@ function isMetaProperty(node) {
26181
26308
  return node.kind === 236 /* MetaProperty */;
26182
26309
  }
26183
26310
  function isPartiallyEmittedExpression(node) {
26184
- return node.kind === 354 /* PartiallyEmittedExpression */;
26311
+ return node.kind === 355 /* PartiallyEmittedExpression */;
26185
26312
  }
26186
26313
  function isCommaListExpression(node) {
26187
- return node.kind === 355 /* CommaListExpression */;
26314
+ return node.kind === 356 /* CommaListExpression */;
26188
26315
  }
26189
26316
  function isTemplateSpan(node) {
26190
26317
  return node.kind === 239 /* TemplateSpan */;
@@ -26313,7 +26440,7 @@ function isNotEmittedStatement(node) {
26313
26440
  return node.kind === 353 /* NotEmittedStatement */;
26314
26441
  }
26315
26442
  function isSyntheticReference(node) {
26316
- return node.kind === 356 /* SyntheticReferenceExpression */;
26443
+ return node.kind === 357 /* SyntheticReferenceExpression */;
26317
26444
  }
26318
26445
  function isExternalModuleReference(node) {
26319
26446
  return node.kind === 283 /* ExternalModuleReference */;
@@ -26894,7 +27021,7 @@ function isOuterExpression(node, kinds = 31 /* All */) {
26894
27021
  return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
26895
27022
  case 235 /* NonNullExpression */:
26896
27023
  return (kinds & 4 /* NonNullAssertions */) !== 0;
26897
- case 354 /* PartiallyEmittedExpression */:
27024
+ case 355 /* PartiallyEmittedExpression */:
26898
27025
  return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
26899
27026
  }
26900
27027
  return false;
@@ -26932,23 +27059,21 @@ function hasRecordedExternalHelpers(sourceFile) {
26932
27059
  }
26933
27060
  function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFactory, sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) {
26934
27061
  if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
26935
- let namedBindings;
26936
27062
  const moduleKind = getEmitModuleKind(compilerOptions);
26937
- if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
26938
- const helpers = getEmitHelpers(sourceFile);
27063
+ const impliedModuleKind = getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions);
27064
+ const helpers = getImportedHelpers(sourceFile);
27065
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || impliedModuleKind === 99 /* ESNext */ || impliedModuleKind === void 0 && moduleKind === 200 /* Preserve */) {
26939
27066
  if (helpers) {
26940
27067
  const helperNames = [];
26941
27068
  for (const helper of helpers) {
26942
- if (!helper.scoped) {
26943
- const importName = helper.importName;
26944
- if (importName) {
26945
- pushIfUnique(helperNames, importName);
26946
- }
27069
+ const importName = helper.importName;
27070
+ if (importName) {
27071
+ pushIfUnique(helperNames, importName);
26947
27072
  }
26948
27073
  }
26949
27074
  if (some(helperNames)) {
26950
27075
  helperNames.sort(compareStringsCaseSensitive);
26951
- namedBindings = nodeFactory.createNamedImports(
27076
+ const namedBindings = nodeFactory.createNamedImports(
26952
27077
  map(helperNames, (name) => isFileLevelUniqueName(sourceFile, name) ? nodeFactory.createImportSpecifier(
26953
27078
  /*isTypeOnly*/
26954
27079
  false,
@@ -26965,57 +27090,54 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
26965
27090
  const parseNode = getOriginalNode(sourceFile, isSourceFile);
26966
27091
  const emitNode = getOrCreateEmitNode(parseNode);
26967
27092
  emitNode.externalHelpers = true;
27093
+ const externalHelpersImportDeclaration = nodeFactory.createImportDeclaration(
27094
+ /*modifiers*/
27095
+ void 0,
27096
+ nodeFactory.createImportClause(
27097
+ /*isTypeOnly*/
27098
+ false,
27099
+ /*name*/
27100
+ void 0,
27101
+ namedBindings
27102
+ ),
27103
+ nodeFactory.createStringLiteral(externalHelpersModuleNameText),
27104
+ /*attributes*/
27105
+ void 0
27106
+ );
27107
+ addInternalEmitFlags(externalHelpersImportDeclaration, 2 /* NeverApplyImportHelper */);
27108
+ return externalHelpersImportDeclaration;
26968
27109
  }
26969
27110
  }
26970
27111
  } else {
26971
- const externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(nodeFactory, sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
27112
+ const externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(nodeFactory, sourceFile, compilerOptions, helpers, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
26972
27113
  if (externalHelpersModuleName) {
26973
- namedBindings = nodeFactory.createNamespaceImport(externalHelpersModuleName);
26974
- }
26975
- }
26976
- if (namedBindings) {
26977
- const externalHelpersImportDeclaration = nodeFactory.createImportDeclaration(
26978
- /*modifiers*/
26979
- void 0,
26980
- nodeFactory.createImportClause(
27114
+ const externalHelpersImportDeclaration = nodeFactory.createImportEqualsDeclaration(
27115
+ /*modifiers*/
27116
+ void 0,
26981
27117
  /*isTypeOnly*/
26982
27118
  false,
26983
- /*name*/
26984
- void 0,
26985
- namedBindings
26986
- ),
26987
- nodeFactory.createStringLiteral(externalHelpersModuleNameText),
26988
- /*attributes*/
26989
- void 0
26990
- );
26991
- addInternalEmitFlags(externalHelpersImportDeclaration, 2 /* NeverApplyImportHelper */);
26992
- return externalHelpersImportDeclaration;
27119
+ externalHelpersModuleName,
27120
+ nodeFactory.createExternalModuleReference(nodeFactory.createStringLiteral(externalHelpersModuleNameText))
27121
+ );
27122
+ addInternalEmitFlags(externalHelpersImportDeclaration, 2 /* NeverApplyImportHelper */);
27123
+ return externalHelpersImportDeclaration;
27124
+ }
26993
27125
  }
26994
27126
  }
26995
27127
  }
26996
- function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
26997
- if (compilerOptions.importHelpers && isEffectiveExternalModule(node, compilerOptions)) {
26998
- const externalHelpersModuleName = getExternalHelpersModuleName(node);
26999
- if (externalHelpersModuleName) {
27000
- return externalHelpersModuleName;
27001
- }
27002
- let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
27003
- if (!create) {
27004
- const helpers = getEmitHelpers(node);
27005
- if (helpers) {
27006
- for (const helper of helpers) {
27007
- if (!helper.scoped) {
27008
- create = true;
27009
- break;
27010
- }
27011
- }
27012
- }
27013
- }
27014
- if (create) {
27015
- const parseNode = getOriginalNode(node, isSourceFile);
27016
- const emitNode = getOrCreateEmitNode(parseNode);
27017
- return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = factory2.createUniqueName(externalHelpersModuleNameText));
27018
- }
27128
+ function getImportedHelpers(sourceFile) {
27129
+ return filter(getEmitHelpers(sourceFile), (helper) => !helper.scoped);
27130
+ }
27131
+ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOptions, helpers, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
27132
+ const externalHelpersModuleName = getExternalHelpersModuleName(node);
27133
+ if (externalHelpersModuleName) {
27134
+ return externalHelpersModuleName;
27135
+ }
27136
+ const create = some(helpers) || (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
27137
+ if (create) {
27138
+ const parseNode = getOriginalNode(node, isSourceFile);
27139
+ const emitNode = getOrCreateEmitNode(parseNode);
27140
+ return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = factory2.createUniqueName(externalHelpersModuleNameText));
27019
27141
  }
27020
27142
  }
27021
27143
  function getLocalNameForExternalImport(factory2, node, sourceFile) {
@@ -27334,10 +27456,13 @@ var BinaryExpressionState;
27334
27456
  switch (currentState) {
27335
27457
  case enter:
27336
27458
  if (machine.onLeft) return left;
27459
+ // falls through
27337
27460
  case left:
27338
27461
  if (machine.onOperator) return operator;
27462
+ // falls through
27339
27463
  case operator:
27340
27464
  if (machine.onRight) return right;
27465
+ // falls through
27341
27466
  case right:
27342
27467
  return exit;
27343
27468
  case exit:
@@ -27965,7 +28090,7 @@ var forEachChildTable = {
27965
28090
  [282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
27966
28091
  return visitNodes(cbNode, cbNodes, node.modifiers);
27967
28092
  },
27968
- [355 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
28093
+ [356 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
27969
28094
  return visitNodes(cbNode, cbNodes, node.elements);
27970
28095
  },
27971
28096
  [284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
@@ -28061,7 +28186,7 @@ var forEachChildTable = {
28061
28186
  [331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
28062
28187
  [337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
28063
28188
  [351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
28064
- [354 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
28189
+ [355 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
28065
28190
  };
28066
28191
  function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
28067
28192
  return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
@@ -28416,6 +28541,7 @@ var Parser;
28416
28541
  expression2 = parseLiteralNode();
28417
28542
  break;
28418
28543
  }
28544
+ // falls through
28419
28545
  default:
28420
28546
  expression2 = parseObjectLiteralExpression();
28421
28547
  break;
@@ -29337,6 +29463,7 @@ var Parser;
29337
29463
  case 25 /* DotToken */:
29338
29464
  return true;
29339
29465
  }
29466
+ // falls through
29340
29467
  case 11 /* ArgumentExpressions */:
29341
29468
  return token() === 26 /* DotDotDotToken */ || isStartOfExpression();
29342
29469
  case 16 /* Parameters */:
@@ -29370,6 +29497,7 @@ var Parser;
29370
29497
  return true;
29371
29498
  case 26 /* Count */:
29372
29499
  return Debug.fail("ParsingContext.Count used as a context");
29500
+ // Not a real context, only a marker.
29373
29501
  default:
29374
29502
  Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
29375
29503
  }
@@ -29686,6 +29814,7 @@ var Parser;
29686
29814
  case 3 /* SwitchClauseStatements */:
29687
29815
  return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
29688
29816
  case 18 /* RestProperties */:
29817
+ // fallthrough
29689
29818
  case 4 /* TypeMembers */:
29690
29819
  return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
29691
29820
  case 5 /* ClassMembers */:
@@ -29733,6 +29862,7 @@ var Parser;
29733
29862
  return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
29734
29863
  case 26 /* Count */:
29735
29864
  return Debug.fail("ParsingContext.Count used as a context");
29865
+ // Not a real context, only a marker.
29736
29866
  default:
29737
29867
  Debug.assertNever(context);
29738
29868
  }
@@ -30657,10 +30787,12 @@ var Parser;
30657
30787
  return tryParse(parseKeywordAndNoDot) || parseTypeReference();
30658
30788
  case 67 /* AsteriskEqualsToken */:
30659
30789
  scanner.reScanAsteriskEqualsToken();
30790
+ // falls through
30660
30791
  case 42 /* AsteriskToken */:
30661
30792
  return parseJSDocAllType();
30662
30793
  case 61 /* QuestionQuestionToken */:
30663
30794
  scanner.reScanQuestionToken();
30795
+ // falls through
30664
30796
  case 58 /* QuestionToken */:
30665
30797
  return parseJSDocUnknownOrNullableType();
30666
30798
  case 100 /* FunctionKeyword */:
@@ -31538,6 +31670,7 @@ var Parser;
31538
31670
  if (isAwaitExpression2()) {
31539
31671
  return parseAwaitExpression();
31540
31672
  }
31673
+ // falls through
31541
31674
  default:
31542
31675
  return parseUpdateExpression();
31543
31676
  }
@@ -31557,6 +31690,8 @@ var Parser;
31557
31690
  if (languageVariant !== 1 /* JSX */) {
31558
31691
  return false;
31559
31692
  }
31693
+ // We are in JSX context and the token is part of JSXElement.
31694
+ // falls through
31560
31695
  default:
31561
31696
  return true;
31562
31697
  }
@@ -32130,10 +32265,16 @@ var Parser;
32130
32265
  }
32131
32266
  function canFollowTypeArgumentsInExpression() {
32132
32267
  switch (token()) {
32268
+ // These tokens can follow a type argument list in a call expression.
32133
32269
  case 21 /* OpenParenToken */:
32270
+ // foo<x>(
32134
32271
  case 15 /* NoSubstitutionTemplateLiteral */:
32272
+ // foo<T> `...`
32135
32273
  case 16 /* TemplateHead */:
32136
32274
  return true;
32275
+ // A type argument list followed by `<` never makes sense, and a type argument list followed
32276
+ // by `>` is ambiguous with a (re-scanned) `>>` operator, so we disqualify both. Also, in
32277
+ // this context, `+` and `-` are unary operators, not binary operators.
32137
32278
  case 30 /* LessThanToken */:
32138
32279
  case 32 /* GreaterThanToken */:
32139
32280
  case 40 /* PlusToken */:
@@ -32151,6 +32292,7 @@ var Parser;
32151
32292
  false
32152
32293
  );
32153
32294
  }
32295
+ // falls through
32154
32296
  case 9 /* NumericLiteral */:
32155
32297
  case 10 /* BigIntLiteral */:
32156
32298
  case 11 /* StringLiteral */:
@@ -32654,6 +32796,27 @@ var Parser;
32654
32796
  return isUsingDeclaration();
32655
32797
  case 135 /* AwaitKeyword */:
32656
32798
  return isAwaitUsingDeclaration();
32799
+ // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
32800
+ // however, an identifier cannot be followed by another identifier on the same line. This is what we
32801
+ // count on to parse out the respective declarations. For instance, we exploit this to say that
32802
+ //
32803
+ // namespace n
32804
+ //
32805
+ // can be none other than the beginning of a namespace declaration, but need to respect that JavaScript sees
32806
+ //
32807
+ // namespace
32808
+ // n
32809
+ //
32810
+ // as the identifier 'namespace' on one line followed by the identifier 'n' on another.
32811
+ // We need to look one token ahead to see if it permissible to try parsing a declaration.
32812
+ //
32813
+ // *Note*: 'interface' is actually a strict mode reserved word. So while
32814
+ //
32815
+ // "use strict"
32816
+ // interface
32817
+ // I {}
32818
+ //
32819
+ // could be legal, it would add complexity for very little gain.
32657
32820
  case 120 /* InterfaceKeyword */:
32658
32821
  case 156 /* TypeKeyword */:
32659
32822
  return nextTokenIsIdentifierOnSameLine();
@@ -32726,6 +32889,9 @@ var Parser;
32726
32889
  case 111 /* ThrowKeyword */:
32727
32890
  case 113 /* TryKeyword */:
32728
32891
  case 89 /* DebuggerKeyword */:
32892
+ // 'catch' and 'finally' do not actually indicate that the code is part of a statement,
32893
+ // however, we say they are here so that we may gracefully parse them and error later.
32894
+ // falls through
32729
32895
  case 85 /* CatchKeyword */:
32730
32896
  case 98 /* FinallyKeyword */:
32731
32897
  return true;
@@ -32864,6 +33030,8 @@ var Parser;
32864
33030
  case 111 /* ThrowKeyword */:
32865
33031
  return parseThrowStatement();
32866
33032
  case 113 /* TryKeyword */:
33033
+ // Include 'catch' and 'finally' for error recovery.
33034
+ // falls through
32867
33035
  case 85 /* CatchKeyword */:
32868
33036
  case 98 /* FinallyKeyword */:
32869
33037
  return parseTryStatement();
@@ -33282,10 +33450,15 @@ var Parser;
33282
33450
  }
33283
33451
  switch (token()) {
33284
33452
  case 21 /* OpenParenToken */:
33453
+ // Method declaration
33285
33454
  case 30 /* LessThanToken */:
33455
+ // Generic Method declaration
33286
33456
  case 54 /* ExclamationToken */:
33457
+ // Non-null assertion on property name
33287
33458
  case 59 /* ColonToken */:
33459
+ // Type Annotation for declaration
33288
33460
  case 64 /* EqualsToken */:
33461
+ // Initializer for declaration
33289
33462
  case 58 /* QuestionToken */:
33290
33463
  return true;
33291
33464
  default:
@@ -34192,6 +34365,7 @@ var Parser;
34192
34365
  linkEnd = scanner.getTokenEnd();
34193
34366
  break;
34194
34367
  }
34368
+ // fallthrough if it's not a {@link sequence
34195
34369
  default:
34196
34370
  state = 2 /* SavingComments */;
34197
34371
  pushComment(scanner.getTokenText());
@@ -34450,6 +34624,8 @@ var Parser;
34450
34624
  indent2 += 1;
34451
34625
  break;
34452
34626
  }
34627
+ // record the * as a comment
34628
+ // falls through
34453
34629
  default:
34454
34630
  if (state !== 3 /* SavingBackticks */) {
34455
34631
  state = 2 /* SavingComments */;
@@ -35530,6 +35706,7 @@ function processPragmasIntoFields(context, reportDiagnostic) {
35530
35706
  case "jsximportsource":
35531
35707
  case "jsxruntime":
35532
35708
  return;
35709
+ // Accessed directly
35533
35710
  default:
35534
35711
  Debug.fail("Unhandled pragma kind");
35535
35712
  }
@@ -36118,15 +36295,6 @@ var commandOptionsWithoutBuild = [
36118
36295
  paramType: Diagnostics.FILE_OR_DIRECTORY,
36119
36296
  description: Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json
36120
36297
  },
36121
- {
36122
- name: "build",
36123
- type: "boolean",
36124
- shortName: "b",
36125
- showInSimplifiedHelpView: true,
36126
- category: Diagnostics.Command_line_Options,
36127
- description: Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date,
36128
- defaultValueDescription: false
36129
- },
36130
36298
  {
36131
36299
  name: "showConfig",
36132
36300
  type: "boolean",
@@ -37111,7 +37279,17 @@ var commandLineOptionOfCustomType = optionDeclarations.filter(isCommandLineOptio
37111
37279
  function isCommandLineOptionOfCustomType(option) {
37112
37280
  return !isString(option.type);
37113
37281
  }
37282
+ var tscBuildOption = {
37283
+ name: "build",
37284
+ type: "boolean",
37285
+ shortName: "b",
37286
+ showInSimplifiedHelpView: true,
37287
+ category: Diagnostics.Command_line_Options,
37288
+ description: Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date,
37289
+ defaultValueDescription: false
37290
+ };
37114
37291
  var optionsForBuild = [
37292
+ tscBuildOption,
37115
37293
  {
37116
37294
  name: "verbose",
37117
37295
  shortName: "v",
@@ -37247,8 +37425,14 @@ function getOptionName(option) {
37247
37425
  }
37248
37426
  function createUnknownOptionError(unknownOption, diagnostics, unknownOptionErrorText, node, sourceFile) {
37249
37427
  var _a;
37250
- if ((_a = diagnostics.alternateMode) == null ? void 0 : _a.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) {
37251
- return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.alternateMode.diagnostic, unknownOption);
37428
+ const otherOption = (_a = diagnostics.alternateMode) == null ? void 0 : _a.getOptionsNameMap().optionsNameMap.get(unknownOption.toLowerCase());
37429
+ if (otherOption) {
37430
+ return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(
37431
+ sourceFile,
37432
+ node,
37433
+ otherOption !== tscBuildOption ? diagnostics.alternateMode.diagnostic : Diagnostics.Option_build_must_be_the_first_command_line_argument,
37434
+ unknownOption
37435
+ );
37252
37436
  }
37253
37437
  const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
37254
37438
  return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
@@ -37383,6 +37567,7 @@ function parseOptionValue(args, i, diagnostics, opt, options, errors) {
37383
37567
  case "listOrElement":
37384
37568
  Debug.fail("listOrElement not supported here");
37385
37569
  break;
37570
+ // If not a primitive, the possible types are specified in what is effectively a map of options.
37386
37571
  default:
37387
37572
  options[opt.name] = parseCustomTypeOption(opt, args[i], errors);
37388
37573
  i++;
@@ -37433,10 +37618,10 @@ var buildOptionsDidYouMeanDiagnostics = {
37433
37618
  unknownDidYouMeanDiagnostic: Diagnostics.Unknown_build_option_0_Did_you_mean_1,
37434
37619
  optionTypeMismatchDiagnostic: Diagnostics.Build_option_0_requires_a_value_of_type_1
37435
37620
  };
37436
- function parseBuildCommand(args) {
37621
+ function parseBuildCommand(commandLine) {
37437
37622
  const { options, watchOptions, fileNames: projects, errors } = parseCommandLineWorker(
37438
37623
  buildOptionsDidYouMeanDiagnostics,
37439
- args
37624
+ commandLine
37440
37625
  );
37441
37626
  const buildOptions = options;
37442
37627
  if (projects.length === 0) {
@@ -37716,6 +37901,7 @@ function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConv
37716
37901
  return false;
37717
37902
  case 106 /* NullKeyword */:
37718
37903
  return null;
37904
+ // eslint-disable-line no-restricted-syntax
37719
37905
  case 11 /* StringLiteral */:
37720
37906
  if (!isDoubleQuotedString(valueExpression)) {
37721
37907
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
@@ -38180,8 +38366,6 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
38180
38366
  validatedFilesSpecBeforeSubstitution,
38181
38367
  validatedIncludeSpecsBeforeSubstitution,
38182
38368
  validatedExcludeSpecsBeforeSubstitution,
38183
- pathPatterns: void 0,
38184
- // Initialized on first use
38185
38369
  isDefaultIncludeSpec
38186
38370
  };
38187
38371
  }
@@ -38361,7 +38545,7 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
38361
38545
  if (ownConfig.raw.compileOnSave === void 0 && result.compileOnSave) ownConfig.raw.compileOnSave = result.compileOnSave;
38362
38546
  if (sourceFile && result.extendedSourceFiles) sourceFile.extendedSourceFiles = arrayFrom(result.extendedSourceFiles.keys());
38363
38547
  ownConfig.options = assign(result.options, ownConfig.options);
38364
- ownConfig.watchOptions = ownConfig.watchOptions && result.watchOptions ? assign(result.watchOptions, ownConfig.watchOptions) : ownConfig.watchOptions || result.watchOptions;
38548
+ ownConfig.watchOptions = ownConfig.watchOptions && result.watchOptions ? assignWatchOptions(result, ownConfig.watchOptions) : ownConfig.watchOptions || result.watchOptions;
38365
38549
  }
38366
38550
  return ownConfig;
38367
38551
  function applyExtendedConfig(result, extendedConfigPath) {
@@ -38385,9 +38569,14 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
38385
38569
  result.compileOnSave = extendsRaw.compileOnSave;
38386
38570
  }
38387
38571
  assign(result.options, extendedConfig.options);
38388
- result.watchOptions = result.watchOptions && extendedConfig.watchOptions ? assign({}, result.watchOptions, extendedConfig.watchOptions) : result.watchOptions || extendedConfig.watchOptions;
38572
+ result.watchOptions = result.watchOptions && extendedConfig.watchOptions ? assignWatchOptions(result, extendedConfig.watchOptions) : result.watchOptions || extendedConfig.watchOptions;
38389
38573
  }
38390
38574
  }
38575
+ function assignWatchOptions(result, watchOptions) {
38576
+ if (result.watchOptionsCopied) return assign(result.watchOptions, watchOptions);
38577
+ result.watchOptionsCopied = true;
38578
+ return assign({}, result.watchOptions, watchOptions);
38579
+ }
38391
38580
  }
38392
38581
  function parseOwnConfigOfJson(json, host, basePath, configFileName, errors) {
38393
38582
  if (hasProperty(json, "excludes")) {
@@ -39806,8 +39995,7 @@ function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, co
39806
39995
  }
39807
39996
  }
39808
39997
  function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state) {
39809
- var _a;
39810
- const { baseUrl, paths, configFile } = state.compilerOptions;
39998
+ const { baseUrl, paths } = state.compilerOptions;
39811
39999
  if (paths && !pathIsRelative(moduleName)) {
39812
40000
  if (state.traceEnabled) {
39813
40001
  if (baseUrl) {
@@ -39816,7 +40004,7 @@ function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state
39816
40004
  trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
39817
40005
  }
39818
40006
  const baseDirectory = getPathsBasePath(state.compilerOptions, state.host);
39819
- const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = tryParsePatterns(paths)) : void 0;
40007
+ const pathPatterns = tryParsePatterns(paths);
39820
40008
  return tryLoadModuleUsingPaths(
39821
40009
  extensions,
39822
40010
  moduleName,
@@ -40356,7 +40544,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
40356
40544
  };
40357
40545
  }
40358
40546
  function getPackageScopeForPath(directory, state) {
40359
- return forEachAncestorDirectory(
40547
+ return forEachAncestorDirectoryStoppingAtGlobalCache(
40548
+ state.host,
40360
40549
  directory,
40361
40550
  (dir) => getPackageJsonInfo(
40362
40551
  dir,
@@ -40488,17 +40677,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
40488
40677
  if (state.traceEnabled) {
40489
40678
  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);
40490
40679
  }
40491
- const result = tryLoadModuleUsingPaths(
40492
- extensions,
40493
- moduleName,
40494
- candidate,
40495
- versionPaths.paths,
40496
- /*pathPatterns*/
40497
- void 0,
40498
- loader,
40499
- onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex,
40500
- state
40501
- );
40680
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
40681
+ const result = tryLoadModuleUsingPaths(extensions, moduleName, candidate, versionPaths.paths, pathPatterns, loader, onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex, state);
40502
40682
  if (result) {
40503
40683
  return removeIgnoredPackageId(result.value);
40504
40684
  }
@@ -40670,13 +40850,13 @@ function comparePatternKeys(a, b) {
40670
40850
  const bPatternIndex = b.indexOf("*");
40671
40851
  const baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
40672
40852
  const baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
40673
- if (baseLenA > baseLenB) return -1;
40674
- if (baseLenB > baseLenA) return 1;
40675
- if (aPatternIndex === -1) return 1;
40676
- if (bPatternIndex === -1) return -1;
40677
- if (a.length > b.length) return -1;
40678
- if (b.length > a.length) return 1;
40679
- return 0;
40853
+ if (baseLenA > baseLenB) return -1 /* LessThan */;
40854
+ if (baseLenB > baseLenA) return 1 /* GreaterThan */;
40855
+ if (aPatternIndex === -1) return 1 /* GreaterThan */;
40856
+ if (bPatternIndex === -1) return -1 /* LessThan */;
40857
+ if (a.length > b.length) return -1 /* LessThan */;
40858
+ if (b.length > a.length) return 1 /* GreaterThan */;
40859
+ return 0 /* EqualTo */;
40680
40860
  }
40681
40861
  function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
40682
40862
  const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
@@ -41004,17 +41184,30 @@ function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName,
41004
41184
  return lookup(secondaryExtensions);
41005
41185
  }
41006
41186
  function lookup(extensions2) {
41007
- return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
41008
- if (getBaseFileName(ancestorDirectory) !== "node_modules") {
41009
- const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
41010
- if (resolutionFromCache) {
41011
- return resolutionFromCache;
41187
+ return forEachAncestorDirectoryStoppingAtGlobalCache(
41188
+ state.host,
41189
+ normalizeSlashes(directory),
41190
+ (ancestorDirectory) => {
41191
+ if (getBaseFileName(ancestorDirectory) !== "node_modules") {
41192
+ const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
41193
+ if (resolutionFromCache) {
41194
+ return resolutionFromCache;
41195
+ }
41196
+ return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions2, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
41012
41197
  }
41013
- return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions2, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
41014
41198
  }
41015
- });
41199
+ );
41016
41200
  }
41017
41201
  }
41202
+ function forEachAncestorDirectoryStoppingAtGlobalCache(host, directory, callback) {
41203
+ var _a;
41204
+ const globalCache = (_a = host == null ? void 0 : host.getGlobalTypingsCacheLocation) == null ? void 0 : _a.call(host);
41205
+ return forEachAncestorDirectory(directory, (ancestorDirectory) => {
41206
+ const result = callback(ancestorDirectory);
41207
+ if (result !== void 0) return result;
41208
+ if (ancestorDirectory === globalCache) return false;
41209
+ }) || void 0;
41210
+ }
41018
41211
  function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
41019
41212
  const nodeModulesFolder = combinePaths(directory, "node_modules");
41020
41213
  const nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);
@@ -41090,17 +41283,8 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
41090
41283
  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);
41091
41284
  }
41092
41285
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
41093
- const fromPaths = tryLoadModuleUsingPaths(
41094
- extensions,
41095
- rest,
41096
- packageDirectory,
41097
- versionPaths.paths,
41098
- /*pathPatterns*/
41099
- void 0,
41100
- loader,
41101
- !packageDirectoryExists,
41102
- state
41103
- );
41286
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
41287
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, pathPatterns, loader, !packageDirectoryExists, state);
41104
41288
  if (fromPaths) {
41105
41289
  return fromPaths.value;
41106
41290
  }
@@ -41108,7 +41292,6 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
41108
41292
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
41109
41293
  }
41110
41294
  function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
41111
- pathPatterns || (pathPatterns = tryParsePatterns(paths));
41112
41295
  const matchedPattern = matchPatternOrExact(pathPatterns, moduleName);
41113
41296
  if (matchedPattern) {
41114
41297
  const matchedStar = isString(matchedPattern) ? void 0 : matchedText(matchedPattern, moduleName);
@@ -41220,28 +41403,32 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
41220
41403
  return { value: resolvedUsingSettings };
41221
41404
  }
41222
41405
  if (!isExternalModuleNameRelative(moduleName)) {
41223
- const resolved2 = forEachAncestorDirectory(containingDirectory, (directory) => {
41224
- const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
41225
- cache,
41226
- moduleName,
41227
- /*mode*/
41228
- void 0,
41229
- directory,
41230
- redirectedReference,
41231
- state
41232
- );
41233
- if (resolutionFromCache) {
41234
- return resolutionFromCache;
41235
- }
41236
- const searchName = normalizePath(combinePaths(directory, moduleName));
41237
- return toSearchResult(loadModuleFromFileNoPackageId(
41238
- extensions,
41239
- searchName,
41240
- /*onlyRecordFailures*/
41241
- false,
41242
- state
41243
- ));
41244
- });
41406
+ const resolved2 = forEachAncestorDirectoryStoppingAtGlobalCache(
41407
+ state.host,
41408
+ containingDirectory,
41409
+ (directory) => {
41410
+ const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
41411
+ cache,
41412
+ moduleName,
41413
+ /*mode*/
41414
+ void 0,
41415
+ directory,
41416
+ redirectedReference,
41417
+ state
41418
+ );
41419
+ if (resolutionFromCache) {
41420
+ return resolutionFromCache;
41421
+ }
41422
+ const searchName = normalizePath(combinePaths(directory, moduleName));
41423
+ return toSearchResult(loadModuleFromFileNoPackageId(
41424
+ extensions,
41425
+ searchName,
41426
+ /*onlyRecordFailures*/
41427
+ false,
41428
+ state
41429
+ ));
41430
+ }
41431
+ );
41245
41432
  if (resolved2) return resolved2;
41246
41433
  if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
41247
41434
  let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
@@ -41284,7 +41471,7 @@ function resolveFromTypeRoot(moduleName, state) {
41284
41471
  }
41285
41472
  }
41286
41473
  function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
41287
- return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
41474
+ return !!compilerOptions.allowImportingTsExtensions || !!fromFileName && isDeclarationFileName(fromFileName);
41288
41475
  }
41289
41476
  function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
41290
41477
  const traceEnabled = isTraceEnabled(compilerOptions, host);
@@ -41369,20 +41556,24 @@ function getModuleInstanceStateCached(node, visited = /* @__PURE__ */ new Map())
41369
41556
  }
41370
41557
  function getModuleInstanceStateWorker(node, visited) {
41371
41558
  switch (node.kind) {
41559
+ // 1. interface declarations, type alias declarations
41372
41560
  case 264 /* InterfaceDeclaration */:
41373
41561
  case 265 /* TypeAliasDeclaration */:
41374
41562
  return 0 /* NonInstantiated */;
41563
+ // 2. const enum declarations
41375
41564
  case 266 /* EnumDeclaration */:
41376
41565
  if (isEnumConst(node)) {
41377
41566
  return 2 /* ConstEnumOnly */;
41378
41567
  }
41379
41568
  break;
41569
+ // 3. non-exported import declarations
41380
41570
  case 272 /* ImportDeclaration */:
41381
41571
  case 271 /* ImportEqualsDeclaration */:
41382
41572
  if (!hasSyntacticModifier(node, 32 /* Export */)) {
41383
41573
  return 0 /* NonInstantiated */;
41384
41574
  }
41385
41575
  break;
41576
+ // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain
41386
41577
  case 278 /* ExportDeclaration */:
41387
41578
  const exportDeclaration = node;
41388
41579
  if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 279 /* NamedExports */) {
@@ -41399,6 +41590,7 @@ function getModuleInstanceStateWorker(node, visited) {
41399
41590
  return state;
41400
41591
  }
41401
41592
  break;
41593
+ // 5. other uninstantiated module declarations.
41402
41594
  case 268 /* ModuleBlock */: {
41403
41595
  let state = 0 /* NonInstantiated */;
41404
41596
  forEachChild(node, (n) => {
@@ -41997,6 +42189,7 @@ function createBinder() {
41997
42189
  case 351 /* JSDocImportTag */:
41998
42190
  bindJSDocImportTag(node);
41999
42191
  break;
42192
+ // In source files and blocks, bind functions first to match hoisting that occurs at runtime
42000
42193
  case 307 /* SourceFile */: {
42001
42194
  bindEachFunctionsFirst(node.statements);
42002
42195
  bind(node.endOfFileToken);
@@ -42017,6 +42210,7 @@ function createBinder() {
42017
42210
  case 303 /* PropertyAssignment */:
42018
42211
  case 230 /* SpreadElement */:
42019
42212
  inAssignmentPattern = saveInAssignmentPattern;
42213
+ // falls through
42020
42214
  default:
42021
42215
  bindEachChild(node);
42022
42216
  break;
@@ -42038,6 +42232,7 @@ function createBinder() {
42038
42232
  if (isJSDocTypeAssertion(expr)) {
42039
42233
  return false;
42040
42234
  }
42235
+ // fallthrough
42041
42236
  case 235 /* NonNullExpression */:
42042
42237
  return isNarrowingExpression(expr.expression);
42043
42238
  case 226 /* BinaryExpression */:
@@ -42869,6 +43064,10 @@ function createBinder() {
42869
43064
  }
42870
43065
  function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
42871
43066
  switch (container.kind) {
43067
+ // Modules, source files, and classes need specialized handling for how their
43068
+ // members are declared (for example, a member of a class will go into a specific
43069
+ // symbol table depending on if it is static or not). We defer to specialized
43070
+ // handlers to take care of declaring these child members.
42872
43071
  case 267 /* ModuleDeclaration */:
42873
43072
  return declareModuleMember(node, symbolFlags, symbolExcludes);
42874
43073
  case 307 /* SourceFile */:
@@ -43010,6 +43209,7 @@ function createBinder() {
43010
43209
  declareModuleMember(node, symbolFlags, symbolExcludes);
43011
43210
  break;
43012
43211
  }
43212
+ // falls through
43013
43213
  default:
43014
43214
  Debug.assertNode(blockScopeContainer, canHaveLocals);
43015
43215
  if (!blockScopeContainer.locals) {
@@ -43330,6 +43530,7 @@ function createBinder() {
43330
43530
  }
43331
43531
  function bindWorker(node) {
43332
43532
  switch (node.kind) {
43533
+ /* Strict mode checks */
43333
43534
  case 80 /* Identifier */:
43334
43535
  if (node.flags & 4096 /* IdentifierIsInJSDocNamespace */) {
43335
43536
  let parentNode = node.parent;
@@ -43339,6 +43540,7 @@ function createBinder() {
43339
43540
  bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
43340
43541
  break;
43341
43542
  }
43543
+ // falls through
43342
43544
  case 110 /* ThisKeyword */:
43343
43545
  if (currentFlow && (isExpression(node) || parent.kind === 304 /* ShorthandPropertyAssignment */)) {
43344
43546
  node.flowNode = currentFlow;
@@ -43427,6 +43629,7 @@ function createBinder() {
43427
43629
  return;
43428
43630
  case 182 /* TypePredicate */:
43429
43631
  break;
43632
+ // Binding the children will handle everything
43430
43633
  case 168 /* TypeParameter */:
43431
43634
  return bindTypeParameter(node);
43432
43635
  case 169 /* Parameter */:
@@ -43491,6 +43694,7 @@ function createBinder() {
43491
43694
  return bindObjectDefinePrototypeProperty(node);
43492
43695
  case 0 /* None */:
43493
43696
  break;
43697
+ // Nothing to do
43494
43698
  default:
43495
43699
  return Debug.fail("Unknown call expression assignment declaration kind");
43496
43700
  }
@@ -43498,6 +43702,7 @@ function createBinder() {
43498
43702
  bindCallExpression(node);
43499
43703
  }
43500
43704
  break;
43705
+ // Members of classes, interfaces, and modules
43501
43706
  case 231 /* ClassExpression */:
43502
43707
  case 263 /* ClassDeclaration */:
43503
43708
  inStrictMode = true;
@@ -43510,10 +43715,12 @@ function createBinder() {
43510
43715
  return bindEnumDeclaration(node);
43511
43716
  case 267 /* ModuleDeclaration */:
43512
43717
  return bindModuleDeclaration(node);
43718
+ // Jsx-attributes
43513
43719
  case 292 /* JsxAttributes */:
43514
43720
  return bindJsxAttributes(node);
43515
43721
  case 291 /* JsxAttribute */:
43516
43722
  return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
43723
+ // Imports and exports
43517
43724
  case 271 /* ImportEqualsDeclaration */:
43518
43725
  case 274 /* NamespaceImport */:
43519
43726
  case 276 /* ImportSpecifier */:
@@ -43534,6 +43741,7 @@ function createBinder() {
43534
43741
  if (!isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) {
43535
43742
  return;
43536
43743
  }
43744
+ // falls through
43537
43745
  case 268 /* ModuleBlock */:
43538
43746
  return updateStrictModeStatementList(node.statements);
43539
43747
  case 341 /* JSDocParameterTag */:
@@ -43543,6 +43751,7 @@ function createBinder() {
43543
43751
  if (node.parent.kind !== 322 /* JSDocTypeLiteral */) {
43544
43752
  break;
43545
43753
  }
43754
+ // falls through
43546
43755
  case 348 /* JSDocPropertyTag */:
43547
43756
  const propTag = node;
43548
43757
  const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */;
@@ -43755,6 +43964,7 @@ function createBinder() {
43755
43964
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
43756
43965
  }
43757
43966
  break;
43967
+ // Namespaces are not allowed in javascript files, so do nothing here
43758
43968
  case 267 /* ModuleDeclaration */:
43759
43969
  break;
43760
43970
  default:
@@ -44251,6 +44461,7 @@ function getContainerFlags(node) {
44251
44461
  if (isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
44252
44462
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */;
44253
44463
  }
44464
+ // falls through
44254
44465
  case 176 /* Constructor */:
44255
44466
  case 262 /* FunctionDeclaration */:
44256
44467
  case 173 /* MethodSignature */:
@@ -44739,9 +44950,11 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
44739
44950
  if (host.getNearestAncestorDirectoryWithPackageJson) {
44740
44951
  return host.getNearestAncestorDirectoryWithPackageJson(fileName);
44741
44952
  }
44742
- return forEachAncestorDirectory(fileName, (directory) => {
44743
- return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
44744
- });
44953
+ return forEachAncestorDirectoryStoppingAtGlobalCache(
44954
+ host,
44955
+ fileName,
44956
+ (directory) => host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0
44957
+ );
44745
44958
  }
44746
44959
  function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
44747
44960
  var _a;
@@ -44759,25 +44972,29 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
44759
44972
  }
44760
44973
  const symlinkedDirectories = (_a = host.getSymlinkCache) == null ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
44761
44974
  const fullImportedFileName = getNormalizedAbsolutePath(importedFileName, cwd);
44762
- const result = symlinkedDirectories && forEachAncestorDirectory(getDirectoryPath(fullImportedFileName), (realPathDirectory) => {
44763
- const symlinkDirectories = symlinkedDirectories.get(ensureTrailingDirectorySeparator(toPath(realPathDirectory, cwd, getCanonicalFileName)));
44764
- if (!symlinkDirectories) return void 0;
44765
- if (startsWithDirectory(importingFileName, realPathDirectory, getCanonicalFileName)) {
44766
- return false;
44767
- }
44768
- return forEach(targets, (target) => {
44769
- if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
44770
- return;
44771
- }
44772
- const relative = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
44773
- for (const symlinkDirectory of symlinkDirectories) {
44774
- const option = resolvePath(symlinkDirectory, relative);
44775
- const result2 = cb(option, target === referenceRedirect);
44776
- shouldFilterIgnoredPaths = true;
44777
- if (result2) return result2;
44975
+ const result = symlinkedDirectories && forEachAncestorDirectoryStoppingAtGlobalCache(
44976
+ host,
44977
+ getDirectoryPath(fullImportedFileName),
44978
+ (realPathDirectory) => {
44979
+ const symlinkDirectories = symlinkedDirectories.get(ensureTrailingDirectorySeparator(toPath(realPathDirectory, cwd, getCanonicalFileName)));
44980
+ if (!symlinkDirectories) return void 0;
44981
+ if (startsWithDirectory(importingFileName, realPathDirectory, getCanonicalFileName)) {
44982
+ return false;
44778
44983
  }
44779
- });
44780
- });
44984
+ return forEach(targets, (target) => {
44985
+ if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
44986
+ return;
44987
+ }
44988
+ const relative = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
44989
+ for (const symlinkDirectory of symlinkDirectories) {
44990
+ const option = resolvePath(symlinkDirectory, relative);
44991
+ const result2 = cb(option, target === referenceRedirect);
44992
+ shouldFilterIgnoredPaths = true;
44993
+ if (result2) return result2;
44994
+ }
44995
+ });
44996
+ }
44997
+ );
44781
44998
  return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
44782
44999
  }
44783
45000
  var runtimeDependencyFields = ["dependencies", "peerDependencies", "optionalDependencies"];
@@ -45661,6 +45878,7 @@ function createTypeChecker(host) {
45661
45878
  getBaseTypeOfLiteralType,
45662
45879
  getWidenedType,
45663
45880
  getWidenedLiteralType,
45881
+ fillMissingTypeArguments,
45664
45882
  getTypeFromTypeNode: (nodeIn) => {
45665
45883
  const node = getParseTreeNode(nodeIn, isTypeNode);
45666
45884
  return node ? getTypeFromTypeNode(node) : errorType;
@@ -47304,6 +47522,7 @@ function createTypeChecker(host) {
47304
47522
  if (isEntityNameExpression(node.expression)) {
47305
47523
  return node.expression;
47306
47524
  }
47525
+ // falls through
47307
47526
  default:
47308
47527
  return void 0;
47309
47528
  }
@@ -49159,6 +49378,7 @@ function createTypeChecker(host) {
49159
49378
  if (!isExternalOrCommonJsModule(location)) {
49160
49379
  break;
49161
49380
  }
49381
+ // falls through
49162
49382
  case 267 /* ModuleDeclaration */:
49163
49383
  const sym = getSymbolOfDeclaration(location);
49164
49384
  if (result = callback(
@@ -50581,6 +50801,9 @@ function createTypeChecker(host) {
50581
50801
  }
50582
50802
  function createTypeNodesFromResolvedType(resolvedType) {
50583
50803
  if (checkTruncationLength(context)) {
50804
+ if (context.flags & 1 /* NoTruncation */) {
50805
+ return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, "elided")];
50806
+ }
50584
50807
  return [factory.createPropertySignature(
50585
50808
  /*modifiers*/
50586
50809
  void 0,
@@ -50618,15 +50841,20 @@ function createTypeChecker(host) {
50618
50841
  }
50619
50842
  }
50620
50843
  if (checkTruncationLength(context) && i + 2 < properties.length - 1) {
50621
- typeElements.push(factory.createPropertySignature(
50622
- /*modifiers*/
50623
- void 0,
50624
- `... ${properties.length - i} more ...`,
50625
- /*questionToken*/
50626
- void 0,
50627
- /*type*/
50628
- void 0
50629
- ));
50844
+ if (context.flags & 1 /* NoTruncation */) {
50845
+ const typeElement = typeElements.pop();
50846
+ typeElements.push(addSyntheticTrailingComment(typeElement, 3 /* MultiLineCommentTrivia */, `... ${properties.length - i} more elided ...`));
50847
+ } else {
50848
+ typeElements.push(factory.createPropertySignature(
50849
+ /*modifiers*/
50850
+ void 0,
50851
+ `... ${properties.length - i} more ...`,
50852
+ /*questionToken*/
50853
+ void 0,
50854
+ /*type*/
50855
+ void 0
50856
+ ));
50857
+ }
50630
50858
  addPropertyToElementList(properties[properties.length - 1], context, typeElements);
50631
50859
  break;
50632
50860
  }
@@ -50644,7 +50872,7 @@ function createTypeChecker(host) {
50644
50872
  void 0
50645
50873
  );
50646
50874
  }
50647
- return factory.createKeywordTypeNode(133 /* AnyKeyword */);
50875
+ return addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided");
50648
50876
  }
50649
50877
  function shouldUsePlaceholderForProperty(propertySymbol, context) {
50650
50878
  var _a;
@@ -50780,15 +51008,17 @@ function createTypeChecker(host) {
50780
51008
  if (some(types)) {
50781
51009
  if (checkTruncationLength(context)) {
50782
51010
  if (!isBareList) {
50783
- return [factory.createTypeReferenceNode(
50784
- "...",
50785
- /*typeArguments*/
50786
- void 0
50787
- )];
51011
+ return [
51012
+ context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided") : factory.createTypeReferenceNode(
51013
+ "...",
51014
+ /*typeArguments*/
51015
+ void 0
51016
+ )
51017
+ ];
50788
51018
  } else if (types.length > 2) {
50789
51019
  return [
50790
51020
  typeToTypeNodeHelper(types[0], context),
50791
- factory.createTypeReferenceNode(
51021
+ context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - 2} more elided ...`) : factory.createTypeReferenceNode(
50792
51022
  `... ${types.length - 2} more ...`,
50793
51023
  /*typeArguments*/
50794
51024
  void 0
@@ -50804,11 +51034,13 @@ function createTypeChecker(host) {
50804
51034
  for (const type of types) {
50805
51035
  i++;
50806
51036
  if (checkTruncationLength(context) && i + 2 < types.length - 1) {
50807
- result.push(factory.createTypeReferenceNode(
50808
- `... ${types.length - i} more ...`,
50809
- /*typeArguments*/
50810
- void 0
50811
- ));
51037
+ result.push(
51038
+ context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - i} more elided ...`) : factory.createTypeReferenceNode(
51039
+ `... ${types.length - i} more ...`,
51040
+ /*typeArguments*/
51041
+ void 0
51042
+ )
51043
+ );
50812
51044
  const typeNode2 = typeToTypeNodeHelper(types[types.length - 1], context);
50813
51045
  if (typeNode2) {
50814
51046
  result.push(typeNode2);
@@ -53403,6 +53635,7 @@ function createTypeChecker(host) {
53403
53635
  );
53404
53636
  break;
53405
53637
  }
53638
+ // else fall through and treat commonjs require just like import=
53406
53639
  case 271 /* ImportEqualsDeclaration */:
53407
53640
  if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, (d) => isSourceFile(d) && isJsonSourceFile(d))) {
53408
53641
  serializeMaybeAliasAssignment(symbol);
@@ -54175,6 +54408,7 @@ function createTypeChecker(host) {
54175
54408
  if (isBindingPattern(node.name) && !node.name.elements.length) {
54176
54409
  return false;
54177
54410
  }
54411
+ // falls through
54178
54412
  case 267 /* ModuleDeclaration */:
54179
54413
  case 263 /* ClassDeclaration */:
54180
54414
  case 264 /* InterfaceDeclaration */:
@@ -54199,6 +54433,8 @@ function createTypeChecker(host) {
54199
54433
  if (hasEffectiveModifier(node, 2 /* Private */ | 4 /* Protected */)) {
54200
54434
  return false;
54201
54435
  }
54436
+ // Public properties/methods are visible if its parents are visible, so:
54437
+ // falls through
54202
54438
  case 176 /* Constructor */:
54203
54439
  case 180 /* ConstructSignature */:
54204
54440
  case 179 /* CallSignature */:
@@ -54216,14 +54452,20 @@ function createTypeChecker(host) {
54216
54452
  case 196 /* ParenthesizedType */:
54217
54453
  case 202 /* NamedTupleMember */:
54218
54454
  return isDeclarationVisible(node.parent);
54455
+ // Default binding, import specifier and namespace import is visible
54456
+ // only on demand so by default it is not visible
54219
54457
  case 273 /* ImportClause */:
54220
54458
  case 274 /* NamespaceImport */:
54221
54459
  case 276 /* ImportSpecifier */:
54222
54460
  return false;
54461
+ // Type parameters are always visible
54223
54462
  case 168 /* TypeParameter */:
54463
+ // Source file and namespace export are always visible
54464
+ // falls through
54224
54465
  case 307 /* SourceFile */:
54225
54466
  case 270 /* NamespaceExportDeclaration */:
54226
54467
  return true;
54468
+ // Export assignments do not create name bindings outside the module
54227
54469
  case 277 /* ExportAssignment */:
54228
54470
  return false;
54229
54471
  default:
@@ -61773,6 +62015,9 @@ function createTypeChecker(host) {
61773
62015
  return getTypeFromTemplateTypeNode(node);
61774
62016
  case 205 /* ImportType */:
61775
62017
  return getTypeFromImportTypeNode(node);
62018
+ // This function assumes that an identifier, qualified name, or property access expression is a type expression
62019
+ // Callers should first ensure this by calling `isPartOfTypeNode`
62020
+ // 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.
61776
62021
  case 80 /* Identifier */:
61777
62022
  case 166 /* QualifiedName */:
61778
62023
  case 211 /* PropertyAccessExpression */:
@@ -62020,6 +62265,7 @@ function createTypeChecker(host) {
62020
62265
  return !!tp.isThisType;
62021
62266
  case 80 /* Identifier */:
62022
62267
  return !tp.isThisType && isPartOfTypeNode(node2) && maybeTypeParameterReference(node2) && getTypeFromTypeNodeWorker(node2) === tp;
62268
+ // use worker because we're looking for === equality
62023
62269
  case 186 /* TypeQuery */:
62024
62270
  const entityName = node2.exprName;
62025
62271
  const firstIdentifier = getFirstIdentifier(entityName);
@@ -62439,6 +62685,7 @@ function createTypeChecker(host) {
62439
62685
  if (!isConstAssertion(node)) {
62440
62686
  break;
62441
62687
  }
62688
+ // fallthrough
62442
62689
  case 294 /* JsxExpression */:
62443
62690
  case 217 /* ParenthesizedExpression */:
62444
62691
  return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
@@ -63534,7 +63781,7 @@ function createTypeChecker(host) {
63534
63781
  const [sourceType, targetType] = getTypeNamesForErrorDisplay(source2, target2);
63535
63782
  let generalizedSource = source2;
63536
63783
  let generalizedSourceType = sourceType;
63537
- if (isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) {
63784
+ if (!(target2.flags & 131072 /* Never */) && isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) {
63538
63785
  generalizedSource = getBaseTypeOfLiteralType(source2);
63539
63786
  Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
63540
63787
  generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
@@ -66704,7 +66951,8 @@ function createTypeChecker(host) {
66704
66951
  priority: void 0,
66705
66952
  topLevel: true,
66706
66953
  isFixed: false,
66707
- impliedArity: void 0
66954
+ impliedArity: void 0,
66955
+ indexes: void 0
66708
66956
  };
66709
66957
  }
66710
66958
  function cloneInferenceInfo(inference) {
@@ -66716,7 +66964,8 @@ function createTypeChecker(host) {
66716
66964
  priority: inference.priority,
66717
66965
  topLevel: inference.topLevel,
66718
66966
  isFixed: inference.isFixed,
66719
- impliedArity: inference.impliedArity
66967
+ impliedArity: inference.impliedArity,
66968
+ indexes: inference.indexes && inference.indexes.slice()
66720
66969
  };
66721
66970
  }
66722
66971
  function cloneInferredPartOfContext(context) {
@@ -66834,7 +67083,7 @@ function createTypeChecker(host) {
66834
67083
  const templateType = getTemplateTypeFromMappedType(target);
66835
67084
  const inference = createInferenceInfo(typeParameter);
66836
67085
  inferTypes([inference], sourceType, templateType);
66837
- return getTypeFromInference(inference) || unknownType;
67086
+ return getTypeFromInference(inference) || (inference.indexes ? getIntersectionType(inference.indexes) : unknownType);
66838
67087
  }
66839
67088
  function inferReverseMappedType(source, target, constraint) {
66840
67089
  const cacheKey = source.id + "," + target.id + "," + constraint.id;
@@ -67181,6 +67430,24 @@ function createTypeChecker(host) {
67181
67430
  } else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
67182
67431
  inferFromTypes(source.objectType, target.objectType);
67183
67432
  inferFromTypes(source.indexType, target.indexType);
67433
+ } else if (!(priority & 1 /* NakedTypeVariable */) && target.flags & 8388608 /* IndexedAccess */) {
67434
+ if (isFromInferenceBlockedSource(source)) {
67435
+ return;
67436
+ }
67437
+ const inference = getInferenceInfoForType(getActualTypeVariable(target.objectType));
67438
+ if (inference) {
67439
+ if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
67440
+ return;
67441
+ }
67442
+ if (!inference.isFixed) {
67443
+ const inferenceTypeSymbol = getGlobalSymbol("PartialInference", 788968 /* Type */, Diagnostics.Cannot_find_global_type_0);
67444
+ const inferenceType = inferenceTypeSymbol && getDeclaredTypeOfSymbol(inferenceTypeSymbol);
67445
+ if (inferenceType && inferenceType !== unknownType) {
67446
+ const mapper = createTypeMapper(getSymbolLinks(inferenceTypeSymbol).typeParameters, [source, target.indexType]);
67447
+ inference.indexes = append(inference.indexes, instantiateType(inferenceType, mapper));
67448
+ }
67449
+ }
67450
+ }
67184
67451
  } else if (source.flags & 268435456 /* StringMapping */ && target.flags & 268435456 /* StringMapping */) {
67185
67452
  if (source.symbol === target.symbol) {
67186
67453
  inferFromTypes(source.type, target.type);
@@ -67684,6 +67951,51 @@ function createTypeChecker(host) {
67684
67951
  const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 /* Never */ | 1 /* Any */)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType))));
67685
67952
  inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
67686
67953
  fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
67954
+ } else if (inference.indexes) {
67955
+ let aggregateInference = getIntersectionType(inference.indexes);
67956
+ const constraint2 = getConstraintOfTypeParameter(inference.typeParameter);
67957
+ if (constraint2) {
67958
+ const instantiatedConstraint = instantiateType(constraint2, context.nonFixingMapper);
67959
+ if (instantiatedConstraint.flags & 1048576 /* Union */ && !context.compareTypes(aggregateInference, getTypeWithThisArgument(instantiatedConstraint, aggregateInference))) {
67960
+ const discriminantProps = findDiscriminantProperties(getPropertiesOfType(aggregateInference), instantiatedConstraint);
67961
+ if (discriminantProps) {
67962
+ let match;
67963
+ findDiscriminant:
67964
+ for (const p of discriminantProps) {
67965
+ const candidatePropType = getTypeOfPropertyOfType(aggregateInference, p.escapedName);
67966
+ for (const type of instantiatedConstraint.types) {
67967
+ const propType = getTypeOfPropertyOfType(type, p.escapedName);
67968
+ if (propType && candidatePropType && checkTypeAssignableTo(
67969
+ candidatePropType,
67970
+ propType,
67971
+ /*errorNode*/
67972
+ void 0
67973
+ )) {
67974
+ if (match && match !== type) {
67975
+ match = void 0;
67976
+ break findDiscriminant;
67977
+ } else {
67978
+ match = type;
67979
+ }
67980
+ }
67981
+ }
67982
+ }
67983
+ if (match) {
67984
+ aggregateInference = getSpreadType(
67985
+ match,
67986
+ aggregateInference,
67987
+ /*symbol*/
67988
+ void 0,
67989
+ /*propegatedFlags*/
67990
+ 0,
67991
+ /*readonly*/
67992
+ false
67993
+ );
67994
+ }
67995
+ }
67996
+ }
67997
+ }
67998
+ inferredType = aggregateInference;
67687
67999
  } else if (context.flags & 1 /* NoDefault */) {
67688
68000
  inferredType = silentNeverType;
67689
68001
  } else {
@@ -67758,6 +68070,7 @@ function createTypeChecker(host) {
67758
68070
  if (isCallExpression(node.parent)) {
67759
68071
  return Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function;
67760
68072
  }
68073
+ // falls through
67761
68074
  default:
67762
68075
  if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) {
67763
68076
  return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
@@ -67791,6 +68104,7 @@ function createTypeChecker(host) {
67791
68104
  const symbol = getResolvedSymbol(node);
67792
68105
  return symbol !== unknownSymbol ? `${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}|${getSymbolId(symbol)}` : void 0;
67793
68106
  }
68107
+ // falls through
67794
68108
  case 110 /* ThisKeyword */:
67795
68109
  return `0|${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}`;
67796
68110
  case 235 /* NonNullExpression */:
@@ -69344,6 +69658,9 @@ function createTypeChecker(host) {
69344
69658
  break;
69345
69659
  case 28 /* CommaToken */:
69346
69660
  return narrowType(type, expr.right, assumeTrue);
69661
+ // Ordinarily we won't see && and || expressions in control flow analysis because the Binder breaks those
69662
+ // expressions down to individual conditional control flows. However, we may encounter them when analyzing
69663
+ // aliased conditional expressions.
69347
69664
  case 56 /* AmpersandAmpersandToken */:
69348
69665
  return assumeTrue ? narrowType(
69349
69666
  narrowType(
@@ -69787,6 +70104,7 @@ function createTypeChecker(host) {
69787
70104
  }
69788
70105
  }
69789
70106
  }
70107
+ // falls through
69790
70108
  case 110 /* ThisKeyword */:
69791
70109
  case 108 /* SuperKeyword */:
69792
70110
  case 211 /* PropertyAccessExpression */:
@@ -72257,7 +72575,7 @@ function createTypeChecker(host) {
72257
72575
  return globalRegExpType;
72258
72576
  }
72259
72577
  function checkSpreadExpression(node, checkMode) {
72260
- if (languageVersion < 2 /* SpreadElements */) {
72578
+ if (languageVersion < LanguageFeatureMinimumTarget.SpreadElements) {
72261
72579
  checkExternalEmitHelpers(node, compilerOptions.downlevelIteration ? 1536 /* SpreadIncludes */ : 1024 /* SpreadArray */);
72262
72580
  }
72263
72581
  const arrayOrIterableType = checkExpression(node.expression, checkMode);
@@ -72291,7 +72609,7 @@ function createTypeChecker(host) {
72291
72609
  for (let i = 0; i < elementCount; i++) {
72292
72610
  const e = elements[i];
72293
72611
  if (e.kind === 230 /* SpreadElement */) {
72294
- if (languageVersion < 2 /* SpreadElements */) {
72612
+ if (languageVersion < LanguageFeatureMinimumTarget.SpreadElements) {
72295
72613
  checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* SpreadIncludes */ : 1024 /* SpreadArray */);
72296
72614
  }
72297
72615
  const spreadType = checkExpression(e.expression, checkMode, forceTuple);
@@ -72516,7 +72834,7 @@ function createTypeChecker(host) {
72516
72834
  addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type);
72517
72835
  }
72518
72836
  } else if (memberDecl.kind === 305 /* SpreadAssignment */) {
72519
- if (languageVersion < 2 /* ObjectAssign */) {
72837
+ if (languageVersion < LanguageFeatureMinimumTarget.ObjectAssign) {
72520
72838
  checkExternalEmitHelpers(memberDecl, 2 /* Assign */);
72521
72839
  }
72522
72840
  if (propertiesArray.length > 0) {
@@ -73493,7 +73811,7 @@ function createTypeChecker(host) {
73493
73811
  const isAnyLike = isTypeAny(apparentType) || apparentType === silentNeverType;
73494
73812
  let prop;
73495
73813
  if (isPrivateIdentifier(right)) {
73496
- if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
73814
+ if (languageVersion < LanguageFeatureMinimumTarget.PrivateNamesAndClassStaticBlocks || languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators || !useDefineForClassFields) {
73497
73815
  if (assignmentKind !== 0 /* None */) {
73498
73816
  checkExternalEmitHelpers(node, 1048576 /* ClassPrivateFieldSet */);
73499
73817
  }
@@ -76110,7 +76428,7 @@ function createTypeChecker(host) {
76110
76428
  }
76111
76429
  function checkTaggedTemplateExpression(node) {
76112
76430
  if (!checkGrammarTaggedTemplateChain(node)) checkGrammarTypeArguments(node, node.typeArguments);
76113
- if (languageVersion < 2 /* TaggedTemplates */) {
76431
+ if (languageVersion < LanguageFeatureMinimumTarget.TaggedTemplates) {
76114
76432
  checkExternalEmitHelpers(node, 262144 /* MakeTemplateObject */);
76115
76433
  }
76116
76434
  const signature = getResolvedSignature(node);
@@ -77605,6 +77923,7 @@ function createTypeChecker(host) {
77605
77923
  hasError = true;
77606
77924
  break;
77607
77925
  }
77926
+ // fallthrough
77608
77927
  case 7 /* ES2022 */:
77609
77928
  case 99 /* ESNext */:
77610
77929
  case 200 /* Preserve */:
@@ -77612,6 +77931,7 @@ function createTypeChecker(host) {
77612
77931
  if (languageVersion >= 4 /* ES2017 */) {
77613
77932
  break;
77614
77933
  }
77934
+ // fallthrough
77615
77935
  default:
77616
77936
  span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
77617
77937
  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;
@@ -77820,7 +78140,7 @@ function createTypeChecker(host) {
77820
78140
  return silentNeverType;
77821
78141
  }
77822
78142
  if (isPrivateIdentifier(left)) {
77823
- if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
78143
+ if (languageVersion < LanguageFeatureMinimumTarget.PrivateNamesAndClassStaticBlocks || languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators || !useDefineForClassFields) {
77824
78144
  checkExternalEmitHelpers(left, 2097152 /* ClassPrivateFieldIn */);
77825
78145
  }
77826
78146
  if (!getNodeLinks(left).resolvedSymbol && getContainingClass(left)) {
@@ -77881,7 +78201,7 @@ function createTypeChecker(host) {
77881
78201
  if (propertyIndex < properties.length - 1) {
77882
78202
  error(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
77883
78203
  } else {
77884
- if (languageVersion < 5 /* ObjectSpreadRest */) {
78204
+ if (languageVersion < LanguageFeatureMinimumTarget.ObjectSpreadRest) {
77885
78205
  checkExternalEmitHelpers(property, 4 /* Rest */);
77886
78206
  }
77887
78207
  const nonRestNames = [];
@@ -77902,7 +78222,7 @@ function createTypeChecker(host) {
77902
78222
  }
77903
78223
  function checkArrayLiteralAssignment(node, sourceType, checkMode) {
77904
78224
  const elements = node.elements;
77905
- if (languageVersion < 2 /* DestructuringAssignment */ && compilerOptions.downlevelIteration) {
78225
+ if (languageVersion < LanguageFeatureMinimumTarget.DestructuringAssignment && compilerOptions.downlevelIteration) {
77906
78226
  checkExternalEmitHelpers(node, 512 /* Read */);
77907
78227
  }
77908
78228
  const possiblyOutOfBoundsType = checkIteratedTypeOrElementType(65 /* Destructuring */ | 128 /* PossiblyOutOfBounds */, sourceType, undefinedType, node) || errorType;
@@ -78029,9 +78349,13 @@ function createTypeChecker(host) {
78029
78349
  return true;
78030
78350
  }
78031
78351
  return false;
78352
+ // Some forms listed here for clarity
78032
78353
  case 222 /* VoidExpression */:
78354
+ // Explicit opt-out
78033
78355
  case 216 /* TypeAssertionExpression */:
78356
+ // Not SEF, but can produce useful type warnings
78034
78357
  case 234 /* AsExpression */:
78358
+ // Not SEF, but can produce useful type warnings
78035
78359
  default:
78036
78360
  return false;
78037
78361
  }
@@ -78672,10 +78996,10 @@ function createTypeChecker(host) {
78672
78996
  }
78673
78997
  const isAsync = (functionFlags & 2 /* Async */) !== 0;
78674
78998
  if (node.asteriskToken) {
78675
- if (isAsync && languageVersion < 5 /* AsyncGenerators */) {
78999
+ if (isAsync && languageVersion < LanguageFeatureMinimumTarget.AsyncGenerators) {
78676
79000
  checkExternalEmitHelpers(node, 26624 /* AsyncDelegatorIncludes */);
78677
79001
  }
78678
- if (!isAsync && languageVersion < 2 /* Generators */ && compilerOptions.downlevelIteration) {
79002
+ if (!isAsync && languageVersion < LanguageFeatureMinimumTarget.Generators && compilerOptions.downlevelIteration) {
78679
79003
  checkExternalEmitHelpers(node, 256 /* Values */);
78680
79004
  }
78681
79005
  }
@@ -79277,6 +79601,7 @@ function createTypeChecker(host) {
79277
79601
  if (node.expression.kind === 102 /* ImportKeyword */) {
79278
79602
  return checkImportCallExpression(node);
79279
79603
  }
79604
+ // falls through
79280
79605
  case 214 /* NewExpression */:
79281
79606
  return checkCallExpression(node, checkMode);
79282
79607
  case 215 /* TaggedTemplateExpression */:
@@ -79365,7 +79690,7 @@ function createTypeChecker(host) {
79365
79690
  const modifiers = getTypeParameterModifiers(typeParameter) & (8192 /* In */ | 16384 /* Out */);
79366
79691
  if (modifiers) {
79367
79692
  const symbol = getSymbolOfDeclaration(node.parent);
79368
- if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (4 /* Reference */ | 16 /* Anonymous */ | 32 /* Mapped */))) {
79693
+ if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
79369
79694
  error(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
79370
79695
  } else if (modifiers === 8192 /* In */ || modifiers === 16384 /* Out */) {
79371
79696
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
@@ -79504,13 +79829,13 @@ function createTypeChecker(host) {
79504
79829
  }
79505
79830
  const functionFlags = getFunctionFlags(node);
79506
79831
  if (!(functionFlags & 4 /* Invalid */)) {
79507
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 5 /* AsyncGenerators */) {
79832
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < LanguageFeatureMinimumTarget.AsyncGenerators) {
79508
79833
  checkExternalEmitHelpers(node, 6144 /* AsyncGeneratorIncludes */);
79509
79834
  }
79510
- if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */ && languageVersion < 4 /* AsyncFunctions */) {
79835
+ if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */ && languageVersion < LanguageFeatureMinimumTarget.AsyncFunctions) {
79511
79836
  checkExternalEmitHelpers(node, 64 /* Awaiter */);
79512
79837
  }
79513
- if ((functionFlags & 3 /* AsyncGenerator */) !== 0 /* Normal */ && languageVersion < 2 /* Generators */) {
79838
+ if ((functionFlags & 3 /* AsyncGenerator */) !== 0 /* Normal */ && languageVersion < LanguageFeatureMinimumTarget.Generators) {
79514
79839
  checkExternalEmitHelpers(node, 128 /* Generator */);
79515
79840
  }
79516
79841
  }
@@ -79646,6 +79971,7 @@ function createTypeChecker(host) {
79646
79971
  if (useDefineForClassFields) {
79647
79972
  break;
79648
79973
  }
79974
+ // fall through
79649
79975
  case "prototype":
79650
79976
  const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
79651
79977
  const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
@@ -79742,7 +80068,7 @@ function createTypeChecker(host) {
79742
80068
  }
79743
80069
  function setNodeLinksForPrivateIdentifierScope(node) {
79744
80070
  if (isPrivateIdentifier(node.name)) {
79745
- if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
80071
+ if (languageVersion < LanguageFeatureMinimumTarget.PrivateNamesAndClassStaticBlocks || languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators || !useDefineForClassFields) {
79746
80072
  for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) {
79747
80073
  getNodeLinks(lexicalScope).flags |= 1048576 /* ContainsClassWithPrivateIdentifiers */;
79748
80074
  }
@@ -80389,6 +80715,8 @@ function createTypeChecker(host) {
80389
80715
  switch (d.kind) {
80390
80716
  case 264 /* InterfaceDeclaration */:
80391
80717
  case 265 /* TypeAliasDeclaration */:
80718
+ // A jsdoc typedef and callback are, by definition, type aliases.
80719
+ // falls through
80392
80720
  case 346 /* JSDocTypedefTag */:
80393
80721
  case 338 /* JSDocCallbackTag */:
80394
80722
  case 340 /* JSDocEnumTag */:
@@ -80409,6 +80737,8 @@ function createTypeChecker(host) {
80409
80737
  return 1 /* ExportValue */;
80410
80738
  }
80411
80739
  d = expression;
80740
+ // The below options all declare an Alias, which is allowed to merge with other values within the importing module.
80741
+ // falls through
80412
80742
  case 271 /* ImportEqualsDeclaration */:
80413
80743
  case 274 /* NamespaceImport */:
80414
80744
  case 273 /* ImportClause */:
@@ -80422,6 +80752,7 @@ function createTypeChecker(host) {
80422
80752
  case 208 /* BindingElement */:
80423
80753
  case 262 /* FunctionDeclaration */:
80424
80754
  case 276 /* ImportSpecifier */:
80755
+ // https://github.com/Microsoft/TypeScript/pull/7591
80425
80756
  case 80 /* Identifier */:
80426
80757
  return 1 /* ExportValue */;
80427
80758
  case 173 /* MethodSignature */:
@@ -80770,6 +81101,7 @@ function createTypeChecker(host) {
80770
81101
  headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
80771
81102
  break;
80772
81103
  }
81104
+ // falls through
80773
81105
  case 169 /* Parameter */:
80774
81106
  headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
80775
81107
  break;
@@ -80876,7 +81208,7 @@ function createTypeChecker(host) {
80876
81208
  if (node.kind === 169 /* Parameter */) {
80877
81209
  checkExternalEmitHelpers(firstDecorator, 32 /* Param */);
80878
81210
  }
80879
- } else if (languageVersion < 99 /* ClassAndClassElementDecorators */) {
81211
+ } else if (languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators) {
80880
81212
  checkExternalEmitHelpers(firstDecorator, 8 /* ESDecorateAndRunInitializers */);
80881
81213
  if (isClassDeclaration(node)) {
80882
81214
  if (!node.name) {
@@ -81542,7 +81874,7 @@ function createTypeChecker(host) {
81542
81874
  potentialUnusedRenamedBindingElementsInTypes.push(node);
81543
81875
  return;
81544
81876
  }
81545
- if (isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5 /* ObjectSpreadRest */) {
81877
+ if (isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < LanguageFeatureMinimumTarget.ObjectSpreadRest) {
81546
81878
  checkExternalEmitHelpers(node, 4 /* Rest */);
81547
81879
  }
81548
81880
  if (node.propertyName && node.propertyName.kind === 167 /* ComputedPropertyName */) {
@@ -81578,7 +81910,7 @@ function createTypeChecker(host) {
81578
81910
  }
81579
81911
  }
81580
81912
  if (isBindingPattern(node.name)) {
81581
- if (node.name.kind === 207 /* ArrayBindingPattern */ && languageVersion < 2 /* BindingPatterns */ && compilerOptions.downlevelIteration) {
81913
+ if (node.name.kind === 207 /* ArrayBindingPattern */ && languageVersion < LanguageFeatureMinimumTarget.BindingPatterns && compilerOptions.downlevelIteration) {
81582
81914
  checkExternalEmitHelpers(node, 512 /* Read */);
81583
81915
  }
81584
81916
  forEach(node.name.elements, checkSourceElement);
@@ -81732,7 +82064,7 @@ function createTypeChecker(host) {
81732
82064
  }
81733
82065
  function checkVariableDeclarationList(node) {
81734
82066
  const blockScopeKind = getCombinedNodeFlags(node) & 7 /* BlockScoped */;
81735
- if ((blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */) && languageVersion < 99 /* UsingAndAwaitUsing */) {
82067
+ if ((blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */) && languageVersion < LanguageFeatureMinimumTarget.UsingAndAwaitUsing) {
81736
82068
  checkExternalEmitHelpers(node, 16777216 /* AddDisposableResourceAndDisposeResources */);
81737
82069
  }
81738
82070
  forEach(node.declarations, checkSourceElement);
@@ -81946,11 +82278,11 @@ function createTypeChecker(host) {
81946
82278
  grammarErrorOnNode(node.awaitModifier, Diagnostics.for_await_loops_cannot_be_used_inside_a_class_static_block);
81947
82279
  } else {
81948
82280
  const functionFlags = getFunctionFlags(container);
81949
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 5 /* ForAwaitOf */) {
82281
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < LanguageFeatureMinimumTarget.ForAwaitOf) {
81950
82282
  checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */);
81951
82283
  }
81952
82284
  }
81953
- } else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ForOf */) {
82285
+ } else if (compilerOptions.downlevelIteration && languageVersion < LanguageFeatureMinimumTarget.ForOf) {
81954
82286
  checkExternalEmitHelpers(node, 256 /* ForOfIncludes */);
81955
82287
  }
81956
82288
  if (node.initializer.kind === 261 /* VariableDeclarationList */) {
@@ -82991,12 +83323,12 @@ function createTypeChecker(host) {
82991
83323
  return true;
82992
83324
  }
82993
83325
  function getFirstTransformableStaticClassElement(node) {
82994
- const willTransformStaticElementsOfDecoratedClass = !legacyDecorators && languageVersion < 99 /* ClassAndClassElementDecorators */ && classOrConstructorParameterIsDecorated(
83326
+ const willTransformStaticElementsOfDecoratedClass = !legacyDecorators && languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators && classOrConstructorParameterIsDecorated(
82995
83327
  /*useLegacyDecorators*/
82996
83328
  false,
82997
83329
  node
82998
83330
  );
82999
- const willTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */;
83331
+ const willTransformPrivateElementsOrClassStaticBlocks = languageVersion < LanguageFeatureMinimumTarget.PrivateNamesAndClassStaticBlocks || languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators;
83000
83332
  const willTransformInitializers = !emitStandardClassFields;
83001
83333
  if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
83002
83334
  for (const member of node.members) {
@@ -83023,7 +83355,7 @@ function createTypeChecker(host) {
83023
83355
  if (node.name) return;
83024
83356
  const parent = walkUpOuterExpressions(node);
83025
83357
  if (!isNamedEvaluationSource(parent)) return;
83026
- const willTransformESDecorators = !legacyDecorators && languageVersion < 99 /* ClassAndClassElementDecorators */;
83358
+ const willTransformESDecorators = !legacyDecorators && languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators;
83027
83359
  let location;
83028
83360
  if (willTransformESDecorators && classOrConstructorParameterIsDecorated(
83029
83361
  /*useLegacyDecorators*/
@@ -83083,7 +83415,7 @@ function createTypeChecker(host) {
83083
83415
  const baseTypeNode = getEffectiveBaseTypeNode(node);
83084
83416
  if (baseTypeNode) {
83085
83417
  forEach(baseTypeNode.typeArguments, checkSourceElement);
83086
- if (languageVersion < 2 /* Classes */) {
83418
+ if (languageVersion < LanguageFeatureMinimumTarget.Classes) {
83087
83419
  checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */);
83088
83420
  }
83089
83421
  const extendsNode = getClassExtendsHeritageElement(node);
@@ -83991,6 +84323,7 @@ function createTypeChecker(host) {
83991
84323
  break;
83992
84324
  case 271 /* ImportEqualsDeclaration */:
83993
84325
  if (isInternalModuleImportEqualsDeclaration(node)) break;
84326
+ // falls through
83994
84327
  case 272 /* ImportDeclaration */:
83995
84328
  grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
83996
84329
  break;
@@ -84003,6 +84336,7 @@ function createTypeChecker(host) {
84003
84336
  }
84004
84337
  break;
84005
84338
  }
84339
+ // falls through
84006
84340
  case 263 /* ClassDeclaration */:
84007
84341
  case 266 /* EnumDeclaration */:
84008
84342
  case 262 /* FunctionDeclaration */:
@@ -84679,6 +85013,7 @@ function createTypeChecker(host) {
84679
85013
  return checkJSDocPropertyTag(node);
84680
85014
  case 317 /* JSDocFunctionType */:
84681
85015
  checkJSDocFunctionType(node);
85016
+ // falls through
84682
85017
  case 315 /* JSDocNonNullableType */:
84683
85018
  case 314 /* JSDocNullableType */:
84684
85019
  case 312 /* JSDocAllType */:
@@ -85102,6 +85437,7 @@ function createTypeChecker(host) {
85102
85437
  switch (location.kind) {
85103
85438
  case 307 /* SourceFile */:
85104
85439
  if (!isExternalModule(location)) break;
85440
+ // falls through
85105
85441
  case 267 /* ModuleDeclaration */:
85106
85442
  copyLocallyVisibleExportSymbols(getSymbolOfDeclaration(location).exports, meaning & 2623475 /* ModuleMember */);
85107
85443
  break;
@@ -85113,6 +85449,9 @@ function createTypeChecker(host) {
85113
85449
  if (className) {
85114
85450
  copySymbol(location.symbol, meaning);
85115
85451
  }
85452
+ // this fall-through is necessary because we would like to handle
85453
+ // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration.
85454
+ // falls through
85116
85455
  case 263 /* ClassDeclaration */:
85117
85456
  case 264 /* InterfaceDeclaration */:
85118
85457
  if (!isStaticSymbol) {
@@ -85221,6 +85560,7 @@ function createTypeChecker(host) {
85221
85560
  if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
85222
85561
  return void 0;
85223
85562
  }
85563
+ // falls through
85224
85564
  case 4 /* ThisProperty */:
85225
85565
  case 2 /* ModuleExports */:
85226
85566
  return getSymbolOfDeclaration(entityName.parent.parent);
@@ -85514,6 +85854,7 @@ function createTypeChecker(host) {
85514
85854
  if (!isThisInTypeQuery(node)) {
85515
85855
  return getSymbolOfNameOrPropertyAccessExpression(node);
85516
85856
  }
85857
+ // falls through
85517
85858
  case 110 /* ThisKeyword */:
85518
85859
  const container = getThisContainer(
85519
85860
  node,
@@ -85531,6 +85872,7 @@ function createTypeChecker(host) {
85531
85872
  if (isInExpressionContext(node)) {
85532
85873
  return checkExpression(node).symbol;
85533
85874
  }
85875
+ // falls through
85534
85876
  case 197 /* ThisType */:
85535
85877
  return getTypeFromThisTypeNode(node).symbol;
85536
85878
  case 108 /* SuperKeyword */:
@@ -85553,6 +85895,7 @@ function createTypeChecker(host) {
85553
85895
  if (isCallExpression(parent) && isBindableObjectDefinePropertyCall(parent) && parent.arguments[1] === node) {
85554
85896
  return getSymbolOfDeclaration(parent);
85555
85897
  }
85898
+ // falls through
85556
85899
  case 9 /* NumericLiteral */:
85557
85900
  const objectType = isElementAccessExpression(parent) ? parent.argumentExpression === node ? getTypeOfExpression(parent.expression) : void 0 : isLiteralTypeNode(parent) && isIndexedAccessTypeNode(grandParent) ? getTypeFromTypeNode(grandParent.objectType) : void 0;
85558
85901
  return objectType && getPropertyOfType(objectType, escapeLeadingUnderscores(node.text));
@@ -85582,6 +85925,7 @@ function createTypeChecker(host) {
85582
85925
  const symbol = getIntrinsicTagSymbol(node.parent);
85583
85926
  return symbol === unknownSymbol ? void 0 : symbol;
85584
85927
  }
85928
+ // falls through
85585
85929
  default:
85586
85930
  return void 0;
85587
85931
  }
@@ -87676,6 +88020,7 @@ function createTypeChecker(host) {
87676
88020
  );
87677
88021
  break;
87678
88022
  }
88023
+ // fallthrough
87679
88024
  case 7 /* ES2022 */:
87680
88025
  case 99 /* ESNext */:
87681
88026
  case 200 /* Preserve */:
@@ -87683,6 +88028,7 @@ function createTypeChecker(host) {
87683
88028
  if (languageVersion >= 4 /* ES2017 */) {
87684
88029
  break;
87685
88030
  }
88031
+ // fallthrough
87686
88032
  default:
87687
88033
  diagnostics.add(
87688
88034
  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)
@@ -88488,7 +88834,8 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
88488
88834
  getFileIncludeReasons: () => host.getFileIncludeReasons(),
88489
88835
  readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0,
88490
88836
  getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
88491
- getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
88837
+ getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index),
88838
+ getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation)
88492
88839
  };
88493
88840
  }
88494
88841
  var SymbolTrackerImpl = class _SymbolTrackerImpl {
@@ -89859,13 +90206,13 @@ var visitEachChildTable = {
89859
90206
  );
89860
90207
  },
89861
90208
  // Transformation nodes
89862
- [354 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
90209
+ [355 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
89863
90210
  return context.factory.updatePartiallyEmittedExpression(
89864
90211
  node,
89865
90212
  Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
89866
90213
  );
89867
90214
  },
89868
- [355 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
90215
+ [356 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
89869
90216
  return context.factory.updateCommaListExpression(
89870
90217
  node,
89871
90218
  nodesVisitor(node.elements, visitor, isExpression)
@@ -91789,6 +92136,8 @@ function transformTypeScript(context) {
91789
92136
  case 148 /* ReadonlyKeyword */:
91790
92137
  case 103 /* InKeyword */:
91791
92138
  case 147 /* OutKeyword */:
92139
+ // TypeScript accessibility and readonly modifiers are elided
92140
+ // falls through
91792
92141
  case 188 /* ArrayType */:
91793
92142
  case 189 /* TupleType */:
91794
92143
  case 190 /* OptionalType */:
@@ -91817,6 +92166,8 @@ function transformTypeScript(context) {
91817
92166
  case 199 /* IndexedAccessType */:
91818
92167
  case 200 /* MappedType */:
91819
92168
  case 201 /* LiteralType */:
92169
+ // TypeScript type nodes are elided.
92170
+ // falls through
91820
92171
  case 181 /* IndexSignature */:
91821
92172
  return void 0;
91822
92173
  case 265 /* TypeAliasDeclaration */:
@@ -93499,7 +93850,7 @@ function transformClassFields(context) {
93499
93850
  /*discarded*/
93500
93851
  true
93501
93852
  );
93502
- case 355 /* CommaListExpression */:
93853
+ case 356 /* CommaListExpression */:
93503
93854
  return visitCommaListExpression(
93504
93855
  node,
93505
93856
  /*discarded*/
@@ -95439,6 +95790,7 @@ function transformClassFields(context) {
95439
95790
  if (isArrowFunction(original) || getEmitFlags(node) & 524288 /* AsyncFunctionBody */) {
95440
95791
  break;
95441
95792
  }
95793
+ // falls through
95442
95794
  case 262 /* FunctionDeclaration */:
95443
95795
  case 176 /* Constructor */:
95444
95796
  case 177 /* GetAccessor */:
@@ -95714,6 +96066,7 @@ function createRuntimeTypeSerializer(context) {
95714
96066
  case 197 /* ThisType */:
95715
96067
  case 205 /* ImportType */:
95716
96068
  break;
96069
+ // handle JSDoc types from an invalid parse
95717
96070
  case 312 /* JSDocAllType */:
95718
96071
  case 313 /* JSDocUnknownType */:
95719
96072
  case 317 /* JSDocFunctionType */:
@@ -96559,6 +96912,7 @@ function transformESDecorators(context) {
96559
96912
  return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead.");
96560
96913
  case 169 /* Parameter */:
96561
96914
  return visitParameterDeclaration(node);
96915
+ // Support NamedEvaluation to ensure the correct class name for class expressions.
96562
96916
  case 226 /* BinaryExpression */:
96563
96917
  return visitBinaryExpression(
96564
96918
  node,
@@ -96579,7 +96933,7 @@ function transformESDecorators(context) {
96579
96933
  return visitForStatement(node);
96580
96934
  case 244 /* ExpressionStatement */:
96581
96935
  return visitExpressionStatement(node);
96582
- case 355 /* CommaListExpression */:
96936
+ case 356 /* CommaListExpression */:
96583
96937
  return visitCommaListExpression(
96584
96938
  node,
96585
96939
  /*discarded*/
@@ -96591,7 +96945,7 @@ function transformESDecorators(context) {
96591
96945
  /*discarded*/
96592
96946
  false
96593
96947
  );
96594
- case 354 /* PartiallyEmittedExpression */:
96948
+ case 355 /* PartiallyEmittedExpression */:
96595
96949
  return visitPartiallyEmittedExpression(
96596
96950
  node,
96597
96951
  /*discarded*/
@@ -96615,6 +96969,7 @@ function transformESDecorators(context) {
96615
96969
  case 167 /* ComputedPropertyName */:
96616
96970
  return visitComputedPropertyName(node);
96617
96971
  case 174 /* MethodDeclaration */:
96972
+ // object literal methods and accessors
96618
96973
  case 178 /* SetAccessor */:
96619
96974
  case 177 /* GetAccessor */:
96620
96975
  case 218 /* FunctionExpression */:
@@ -96677,7 +97032,7 @@ function transformESDecorators(context) {
96677
97032
  /*discarded*/
96678
97033
  true
96679
97034
  );
96680
- case 355 /* CommaListExpression */:
97035
+ case 356 /* CommaListExpression */:
96681
97036
  return visitCommaListExpression(
96682
97037
  node,
96683
97038
  /*discarded*/
@@ -99259,7 +99614,7 @@ function transformES2018(context) {
99259
99614
  return visitObjectLiteralExpression(node);
99260
99615
  case 226 /* BinaryExpression */:
99261
99616
  return visitBinaryExpression(node, expressionResultIsUnused2);
99262
- case 355 /* CommaListExpression */:
99617
+ case 356 /* CommaListExpression */:
99263
99618
  return visitCommaListExpression(node, expressionResultIsUnused2);
99264
99619
  case 299 /* CatchClause */:
99265
99620
  return visitCatchClause(node);
@@ -102399,6 +102754,7 @@ function transformES2015(context) {
102399
102754
  switch (node.kind) {
102400
102755
  case 126 /* StaticKeyword */:
102401
102756
  return void 0;
102757
+ // elide static keyword
102402
102758
  case 263 /* ClassDeclaration */:
102403
102759
  return visitClassDeclaration(node);
102404
102760
  case 231 /* ClassExpression */:
@@ -102477,7 +102833,7 @@ function transformES2015(context) {
102477
102833
  return visitParenthesizedExpression(node, expressionResultIsUnused2);
102478
102834
  case 226 /* BinaryExpression */:
102479
102835
  return visitBinaryExpression(node, expressionResultIsUnused2);
102480
- case 355 /* CommaListExpression */:
102836
+ case 356 /* CommaListExpression */:
102481
102837
  return visitCommaListExpression(node, expressionResultIsUnused2);
102482
102838
  case 15 /* NoSubstitutionTemplateLiteral */:
102483
102839
  case 16 /* TemplateHead */:
@@ -102861,12 +103217,14 @@ function transformES2015(context) {
102861
103217
  return false;
102862
103218
  }
102863
103219
  switch (node.kind) {
103220
+ // stop at function boundaries
102864
103221
  case 219 /* ArrowFunction */:
102865
103222
  case 218 /* FunctionExpression */:
102866
103223
  case 262 /* FunctionDeclaration */:
102867
103224
  case 176 /* Constructor */:
102868
103225
  case 175 /* ClassStaticBlockDeclaration */:
102869
103226
  return false;
103227
+ // only step into computed property names for class and object literal elements
102870
103228
  case 177 /* GetAccessor */:
102871
103229
  case 178 /* SetAccessor */:
102872
103230
  case 174 /* MethodDeclaration */:
@@ -103075,12 +103433,14 @@ function transformES2015(context) {
103075
103433
  return factory2.createPartiallyEmittedExpression(node.right, node);
103076
103434
  }
103077
103435
  switch (node.kind) {
103436
+ // stop at function boundaries
103078
103437
  case 219 /* ArrowFunction */:
103079
103438
  case 218 /* FunctionExpression */:
103080
103439
  case 262 /* FunctionDeclaration */:
103081
103440
  case 176 /* Constructor */:
103082
103441
  case 175 /* ClassStaticBlockDeclaration */:
103083
103442
  return node;
103443
+ // only step into computed property names for class and object literal elements
103084
103444
  case 177 /* GetAccessor */:
103085
103445
  case 178 /* SetAccessor */:
103086
103446
  case 174 /* MethodDeclaration */:
@@ -103126,12 +103486,14 @@ function transformES2015(context) {
103126
103486
  );
103127
103487
  }
103128
103488
  switch (node.kind) {
103489
+ // stop at function boundaries
103129
103490
  case 219 /* ArrowFunction */:
103130
103491
  case 218 /* FunctionExpression */:
103131
103492
  case 262 /* FunctionDeclaration */:
103132
103493
  case 176 /* Constructor */:
103133
103494
  case 175 /* ClassStaticBlockDeclaration */:
103134
103495
  return node;
103496
+ // only step into computed property names for class and object literal elements
103135
103497
  case 177 /* GetAccessor */:
103136
103498
  case 178 /* SetAccessor */:
103137
103499
  case 174 /* MethodDeclaration */:
@@ -105763,7 +106125,7 @@ function transformGenerators(context) {
105763
106125
  switch (node.kind) {
105764
106126
  case 226 /* BinaryExpression */:
105765
106127
  return visitBinaryExpression(node);
105766
- case 355 /* CommaListExpression */:
106128
+ case 356 /* CommaListExpression */:
105767
106129
  return visitCommaListExpression(node);
105768
106130
  case 227 /* ConditionalExpression */:
105769
106131
  return visitConditionalExpression(node);
@@ -108154,7 +108516,7 @@ function transformModule(context) {
108154
108516
  return visitExpressionStatement(node);
108155
108517
  case 217 /* ParenthesizedExpression */:
108156
108518
  return visitParenthesizedExpression(node, valueIsDiscarded);
108157
- case 354 /* PartiallyEmittedExpression */:
108519
+ case 355 /* PartiallyEmittedExpression */:
108158
108520
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
108159
108521
  case 213 /* CallExpression */:
108160
108522
  if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
@@ -109914,6 +110276,7 @@ function transformSystemModule(context) {
109914
110276
  if (!entry.importClause) {
109915
110277
  break;
109916
110278
  }
110279
+ // falls through
109917
110280
  case 271 /* ImportEqualsDeclaration */:
109918
110281
  Debug.assert(importVariableName !== void 0);
109919
110282
  statements.push(
@@ -110548,7 +110911,7 @@ function transformSystemModule(context) {
110548
110911
  return visitExpressionStatement(node);
110549
110912
  case 217 /* ParenthesizedExpression */:
110550
110913
  return visitParenthesizedExpression(node, valueIsDiscarded);
110551
- case 354 /* PartiallyEmittedExpression */:
110914
+ case 355 /* PartiallyEmittedExpression */:
110552
110915
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
110553
110916
  case 226 /* BinaryExpression */:
110554
110917
  if (isDestructuringAssignment(node)) {
@@ -110881,6 +111244,7 @@ function transformECMAScriptModule(context) {
110881
111244
  context.onSubstituteNode = onSubstituteNode;
110882
111245
  context.enableEmitNotification(307 /* SourceFile */);
110883
111246
  context.enableSubstitution(80 /* Identifier */);
111247
+ const noSubstitution = /* @__PURE__ */ new Set();
110884
111248
  let helperNameSubstitutions;
110885
111249
  let currentSourceFile;
110886
111250
  let importRequireStatements;
@@ -110915,7 +111279,7 @@ function transformECMAScriptModule(context) {
110915
111279
  if (externalHelpersImportDeclaration) {
110916
111280
  const statements = [];
110917
111281
  const statementOffset = factory2.copyPrologue(node.statements, statements);
110918
- append(statements, externalHelpersImportDeclaration);
111282
+ addRange(statements, visitArray([externalHelpersImportDeclaration], visitor, isStatement));
110919
111283
  addRange(statements, visitNodes2(node.statements, visitor, isStatement, statementOffset));
110920
111284
  return factory2.updateSourceFile(
110921
111285
  node,
@@ -111130,7 +111494,9 @@ function transformECMAScriptModule(context) {
111130
111494
  if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
111131
111495
  helperNameSubstitutions = /* @__PURE__ */ new Map();
111132
111496
  }
111497
+ currentSourceFile = node;
111133
111498
  previousOnEmitNode(hint, node, emitCallback);
111499
+ currentSourceFile = void 0;
111134
111500
  helperNameSubstitutions = void 0;
111135
111501
  } else {
111136
111502
  previousOnEmitNode(hint, node, emitCallback);
@@ -111138,18 +111504,29 @@ function transformECMAScriptModule(context) {
111138
111504
  }
111139
111505
  function onSubstituteNode(hint, node) {
111140
111506
  node = previousOnSubstituteNode(hint, node);
111141
- if (helperNameSubstitutions && isIdentifier(node) && getEmitFlags(node) & 8192 /* HelperName */) {
111507
+ if (node.id && noSubstitution.has(node.id)) {
111508
+ return node;
111509
+ }
111510
+ if (isIdentifier(node) && getEmitFlags(node) & 8192 /* HelperName */) {
111142
111511
  return substituteHelperName(node);
111143
111512
  }
111144
111513
  return node;
111145
111514
  }
111146
111515
  function substituteHelperName(node) {
111147
- const name = idText(node);
111148
- let substitution = helperNameSubstitutions.get(name);
111149
- if (!substitution) {
111150
- helperNameSubstitutions.set(name, substitution = factory2.createUniqueName(name, 16 /* Optimistic */ | 32 /* FileLevel */));
111516
+ const externalHelpersModuleName = currentSourceFile && getExternalHelpersModuleName(currentSourceFile);
111517
+ if (externalHelpersModuleName) {
111518
+ noSubstitution.add(getNodeId(node));
111519
+ return factory2.createPropertyAccessExpression(externalHelpersModuleName, node);
111520
+ }
111521
+ if (helperNameSubstitutions) {
111522
+ const name = idText(node);
111523
+ let substitution = helperNameSubstitutions.get(name);
111524
+ if (!substitution) {
111525
+ helperNameSubstitutions.set(name, substitution = factory2.createUniqueName(name, 16 /* Optimistic */ | 32 /* FileLevel */));
111526
+ }
111527
+ return substitution;
111151
111528
  }
111152
- return substitution;
111529
+ return node;
111153
111530
  }
111154
111531
  }
111155
111532
 
@@ -112147,6 +112524,7 @@ function transformDeclarations(context) {
112147
112524
  case 265 /* TypeAliasDeclaration */:
112148
112525
  case 266 /* EnumDeclaration */:
112149
112526
  return !resolver.isDeclarationVisible(node);
112527
+ // The following should be doing their own visibility checks based on filtering their members
112150
112528
  case 260 /* VariableDeclaration */:
112151
112529
  return !getBindingNameVisible(node);
112152
112530
  case 271 /* ImportEqualsDeclaration */:
@@ -113428,7 +113806,7 @@ function noEmitNotification(hint, node, callback) {
113428
113806
  }
113429
113807
  function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
113430
113808
  var _a, _b;
113431
- const enabledSyntaxKindFeatures = new Array(357 /* Count */);
113809
+ const enabledSyntaxKindFeatures = new Array(358 /* Count */);
113432
113810
  let lexicalEnvironmentVariableDeclarations;
113433
113811
  let lexicalEnvironmentFunctionDeclarations;
113434
113812
  let lexicalEnvironmentStatements;
@@ -114631,6 +115009,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114631
115009
  if (onEmitNode !== noEmitNotification && (!isEmitNotificationEnabled || isEmitNotificationEnabled(node))) {
114632
115010
  return pipelineEmitWithNotification;
114633
115011
  }
115012
+ // falls through
114634
115013
  case 1 /* Substitution */:
114635
115014
  if (substituteNode !== noEmitSubstitution && (lastSubstitution = substituteNode(emitHint, node) || node) !== node) {
114636
115015
  if (currentParenthesizerRule) {
@@ -114638,14 +115017,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114638
115017
  }
114639
115018
  return pipelineEmitWithSubstitution;
114640
115019
  }
115020
+ // falls through
114641
115021
  case 2 /* Comments */:
114642
115022
  if (shouldEmitComments(node)) {
114643
115023
  return pipelineEmitWithComments;
114644
115024
  }
115025
+ // falls through
114645
115026
  case 3 /* SourceMaps */:
114646
115027
  if (shouldEmitSourceMaps(node)) {
114647
115028
  return pipelineEmitWithSourceMaps;
114648
115029
  }
115030
+ // falls through
114649
115031
  case 4 /* Emit */:
114650
115032
  return pipelineEmitWithHint;
114651
115033
  default:
@@ -114697,6 +115079,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114697
115079
  }
114698
115080
  if (hint === 4 /* Unspecified */) {
114699
115081
  switch (node.kind) {
115082
+ // Pseudo-literals
114700
115083
  case 16 /* TemplateHead */:
114701
115084
  case 17 /* TemplateMiddle */:
114702
115085
  case 18 /* TemplateTail */:
@@ -114705,20 +115088,26 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114705
115088
  /*jsxAttributeEscape*/
114706
115089
  false
114707
115090
  );
115091
+ // Identifiers
114708
115092
  case 80 /* Identifier */:
114709
115093
  return emitIdentifier(node);
115094
+ // PrivateIdentifiers
114710
115095
  case 81 /* PrivateIdentifier */:
114711
115096
  return emitPrivateIdentifier(node);
115097
+ // Parse tree nodes
115098
+ // Names
114712
115099
  case 166 /* QualifiedName */:
114713
115100
  return emitQualifiedName(node);
114714
115101
  case 167 /* ComputedPropertyName */:
114715
115102
  return emitComputedPropertyName(node);
115103
+ // Signature elements
114716
115104
  case 168 /* TypeParameter */:
114717
115105
  return emitTypeParameter(node);
114718
115106
  case 169 /* Parameter */:
114719
115107
  return emitParameter(node);
114720
115108
  case 170 /* Decorator */:
114721
115109
  return emitDecorator(node);
115110
+ // Type members
114722
115111
  case 171 /* PropertySignature */:
114723
115112
  return emitPropertySignature(node);
114724
115113
  case 172 /* PropertyDeclaration */:
@@ -114740,6 +115129,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114740
115129
  return emitConstructSignature(node);
114741
115130
  case 181 /* IndexSignature */:
114742
115131
  return emitIndexSignature(node);
115132
+ // Types
114743
115133
  case 182 /* TypePredicate */:
114744
115134
  return emitTypePredicate(node);
114745
115135
  case 183 /* TypeReference */:
@@ -114758,6 +115148,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114758
115148
  return emitTupleType(node);
114759
115149
  case 190 /* OptionalType */:
114760
115150
  return emitOptionalType(node);
115151
+ // SyntaxKind.RestType is handled below
114761
115152
  case 192 /* UnionType */:
114762
115153
  return emitUnionType(node);
114763
115154
  case 193 /* IntersectionType */:
@@ -114788,16 +115179,19 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114788
115179
  return emitTemplateTypeSpan(node);
114789
115180
  case 205 /* ImportType */:
114790
115181
  return emitImportTypeNode(node);
115182
+ // Binding patterns
114791
115183
  case 206 /* ObjectBindingPattern */:
114792
115184
  return emitObjectBindingPattern(node);
114793
115185
  case 207 /* ArrayBindingPattern */:
114794
115186
  return emitArrayBindingPattern(node);
114795
115187
  case 208 /* BindingElement */:
114796
115188
  return emitBindingElement(node);
115189
+ // Misc
114797
115190
  case 239 /* TemplateSpan */:
114798
115191
  return emitTemplateSpan(node);
114799
115192
  case 240 /* SemicolonClassElement */:
114800
115193
  return emitSemicolonClassElement();
115194
+ // Statements
114801
115195
  case 241 /* Block */:
114802
115196
  return emitBlock(node);
114803
115197
  case 243 /* VariableStatement */:
@@ -114839,6 +115233,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114839
115233
  return emitTryStatement(node);
114840
115234
  case 259 /* DebuggerStatement */:
114841
115235
  return emitDebuggerStatement(node);
115236
+ // Declarations
114842
115237
  case 260 /* VariableDeclaration */:
114843
115238
  return emitVariableDeclaration(node);
114844
115239
  case 261 /* VariableDeclarationList */:
@@ -114889,8 +115284,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114889
115284
  return emitImportAttribute(node);
114890
115285
  case 282 /* MissingDeclaration */:
114891
115286
  return;
115287
+ // Module references
114892
115288
  case 283 /* ExternalModuleReference */:
114893
115289
  return emitExternalModuleReference(node);
115290
+ // JSX (non-expression)
114894
115291
  case 12 /* JsxText */:
114895
115292
  return emitJsxText(node);
114896
115293
  case 286 /* JsxOpeningElement */:
@@ -114909,6 +115306,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114909
115306
  return emitJsxExpression(node);
114910
115307
  case 295 /* JsxNamespacedName */:
114911
115308
  return emitJsxNamespacedName(node);
115309
+ // Clauses
114912
115310
  case 296 /* CaseClause */:
114913
115311
  return emitCaseClause(node);
114914
115312
  case 297 /* DefaultClause */:
@@ -114917,18 +115315,22 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114917
115315
  return emitHeritageClause(node);
114918
115316
  case 299 /* CatchClause */:
114919
115317
  return emitCatchClause(node);
115318
+ // Property assignments
114920
115319
  case 303 /* PropertyAssignment */:
114921
115320
  return emitPropertyAssignment(node);
114922
115321
  case 304 /* ShorthandPropertyAssignment */:
114923
115322
  return emitShorthandPropertyAssignment(node);
114924
115323
  case 305 /* SpreadAssignment */:
114925
115324
  return emitSpreadAssignment(node);
115325
+ // Enum
114926
115326
  case 306 /* EnumMember */:
114927
115327
  return emitEnumMember(node);
115328
+ // Top-level nodes
114928
115329
  case 307 /* SourceFile */:
114929
115330
  return emitSourceFile(node);
114930
115331
  case 308 /* Bundle */:
114931
115332
  return Debug.fail("Bundles should be printed using printBundle");
115333
+ // JSDoc nodes (only used in codefixes currently)
114932
115334
  case 309 /* JSDocTypeExpression */:
114933
115335
  return emitJSDocTypeExpression(node);
114934
115336
  case 310 /* JSDocNameReference */:
@@ -114966,6 +115368,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114966
115368
  case 330 /* JSDocAuthorTag */:
114967
115369
  case 331 /* JSDocDeprecatedTag */:
114968
115370
  return;
115371
+ // SyntaxKind.JSDocClassTag (see JSDocTag, above)
114969
115372
  case 333 /* JSDocPublicTag */:
114970
115373
  case 334 /* JSDocPrivateTag */:
114971
115374
  case 335 /* JSDocProtectedTag */:
@@ -114975,6 +115378,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114975
115378
  return emitJSDocCallbackTag(node);
114976
115379
  case 339 /* JSDocOverloadTag */:
114977
115380
  return emitJSDocOverloadTag(node);
115381
+ // SyntaxKind.JSDocEnumTag (see below)
114978
115382
  case 341 /* JSDocParameterTag */:
114979
115383
  case 348 /* JSDocPropertyTag */:
114980
115384
  return emitJSDocPropertyLikeTag(node);
@@ -114993,7 +115397,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114993
115397
  return emitJSDocSeeTag(node);
114994
115398
  case 351 /* JSDocImportTag */:
114995
115399
  return emitJSDocImportTag(node);
115400
+ // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above)
115401
+ // Transformation nodes
114996
115402
  case 353 /* NotEmittedStatement */:
115403
+ case 354 /* NotEmittedTypeElement */:
114997
115404
  return;
114998
115405
  }
114999
115406
  if (isExpression(node)) {
@@ -115011,6 +115418,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
115011
115418
  }
115012
115419
  if (hint === 1 /* Expression */) {
115013
115420
  switch (node.kind) {
115421
+ // Literals
115014
115422
  case 9 /* NumericLiteral */:
115015
115423
  case 10 /* BigIntLiteral */:
115016
115424
  return emitNumericOrBigIntLiteral(node);
@@ -115022,10 +115430,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
115022
115430
  /*jsxAttributeEscape*/
115023
115431
  false
115024
115432
  );
115433
+ // Identifiers
115025
115434
  case 80 /* Identifier */:
115026
115435
  return emitIdentifier(node);
115027
115436
  case 81 /* PrivateIdentifier */:
115028
115437
  return emitPrivateIdentifier(node);
115438
+ // Expressions
115029
115439
  case 209 /* ArrayLiteralExpression */:
115030
115440
  return emitArrayLiteralExpression(node);
115031
115441
  case 210 /* ObjectLiteralExpression */:
@@ -115088,21 +115498,24 @@ function createPrinter(printerOptions = {}, handlers = {}) {
115088
115498
  return Debug.fail("SyntheticExpression should never be printed.");
115089
115499
  case 282 /* MissingDeclaration */:
115090
115500
  return;
115501
+ // JSX
115091
115502
  case 284 /* JsxElement */:
115092
115503
  return emitJsxElement(node);
115093
115504
  case 285 /* JsxSelfClosingElement */:
115094
115505
  return emitJsxSelfClosingElement(node);
115095
115506
  case 288 /* JsxFragment */:
115096
115507
  return emitJsxFragment(node);
115508
+ // Synthesized list
115097
115509
  case 352 /* SyntaxList */:
115098
115510
  return Debug.fail("SyntaxList should not be printed");
115511
+ // Transformation nodes
115099
115512
  case 353 /* NotEmittedStatement */:
115100
115513
  return;
115101
- case 354 /* PartiallyEmittedExpression */:
115514
+ case 355 /* PartiallyEmittedExpression */:
115102
115515
  return emitPartiallyEmittedExpression(node);
115103
- case 355 /* CommaListExpression */:
115516
+ case 356 /* CommaListExpression */:
115104
115517
  return emitCommaList(node);
115105
- case 356 /* SyntheticReferenceExpression */:
115518
+ case 357 /* SyntheticReferenceExpression */:
115106
115519
  return Debug.fail("SyntheticReferenceExpression should not be printed");
115107
115520
  }
115108
115521
  }
@@ -120376,7 +120789,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120376
120789
  getCanonicalFileName,
120377
120790
  getFileIncludeReasons: () => fileReasons,
120378
120791
  structureIsReused,
120379
- writeFile: writeFile2
120792
+ writeFile: writeFile2,
120793
+ getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation)
120380
120794
  };
120381
120795
  onProgramCreateComplete();
120382
120796
  verifyCompilerOptions();
@@ -120942,7 +121356,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120942
121356
  getFileIncludeReasons: program.getFileIncludeReasons,
120943
121357
  createHash: maybeBind(host, host.createHash),
120944
121358
  getModuleResolutionCache: () => program.getModuleResolutionCache(),
120945
- trace: maybeBind(host, host.trace)
121359
+ trace: maybeBind(host, host.trace),
121360
+ getGlobalTypingsCacheLocation: program.getGlobalTypingsCacheLocation
120946
121361
  };
120947
121362
  }
120948
121363
  function writeFile2(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -121239,6 +121654,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121239
121654
  diagnostics.push(createDiagnosticForNode2(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
121240
121655
  return "skip";
121241
121656
  }
121657
+ // falls through
121242
121658
  case 173 /* MethodSignature */:
121243
121659
  case 176 /* Constructor */:
121244
121660
  case 177 /* GetAccessor */:
@@ -121370,6 +121786,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121370
121786
  diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
121371
121787
  return "skip";
121372
121788
  }
121789
+ // falls through
121373
121790
  case 243 /* VariableStatement */:
121374
121791
  if (nodes === parent.modifiers) {
121375
121792
  checkModifiers(parent.modifiers, parent.kind === 243 /* VariableStatement */);
@@ -121412,6 +121829,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121412
121829
  if (isConstValid) {
121413
121830
  continue;
121414
121831
  }
121832
+ // to report error,
121833
+ // falls through
121415
121834
  case 125 /* PublicKeyword */:
121416
121835
  case 123 /* PrivateKeyword */:
121417
121836
  case 124 /* ProtectedKeyword */:
@@ -121423,6 +121842,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121423
121842
  case 147 /* OutKeyword */:
121424
121843
  diagnostics.push(createDiagnosticForNode2(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
121425
121844
  break;
121845
+ // These are all legal modifiers.
121426
121846
  case 126 /* StaticKeyword */:
121427
121847
  case 95 /* ExportKeyword */:
121428
121848
  case 90 /* DefaultKeyword */:
@@ -125243,6 +125663,9 @@ function canWatchDirectoryOrFile(pathComponents2, length2) {
125243
125663
  const perceivedOsRootLength = perceivedOsRootLengthForWatching(pathComponents2, length2);
125244
125664
  return length2 > perceivedOsRootLength + 1;
125245
125665
  }
125666
+ function canWatchDirectoryOrFilePath(path) {
125667
+ return canWatchDirectoryOrFile(getPathComponents(path));
125668
+ }
125246
125669
  function canWatchAtTypes(atTypes) {
125247
125670
  return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(getDirectoryPath(atTypes));
125248
125671
  }
@@ -125254,12 +125677,12 @@ function isInDirectoryPath(dirComponents, fileOrDirComponents) {
125254
125677
  return true;
125255
125678
  }
125256
125679
  function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) {
125257
- return canWatchDirectoryOrFile(getPathComponents(fileOrDirPath));
125680
+ return canWatchDirectoryOrFilePath(fileOrDirPath);
125258
125681
  }
125259
125682
  function canWatchAffectingLocation(filePath) {
125260
125683
  return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(filePath);
125261
125684
  }
125262
- function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory, preferNonRecursiveWatch) {
125685
+ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, isRootWatchable, getCurrentDirectory, preferNonRecursiveWatch) {
125263
125686
  const failedLookupPathComponents = getPathComponents(failedLookupLocationPath);
125264
125687
  failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
125265
125688
  const failedLookupComponents = getPathComponents(failedLookupLocation);
@@ -125268,7 +125691,7 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
125268
125691
  const nodeModulesIndex = failedLookupPathComponents.indexOf("node_modules");
125269
125692
  if (nodeModulesIndex !== -1 && nodeModulesIndex + 1 <= perceivedOsRootLength + 1) return void 0;
125270
125693
  const lastNodeModulesIndex = failedLookupPathComponents.lastIndexOf("node_modules");
125271
- if (isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
125694
+ if (isRootWatchable && isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
125272
125695
  if (failedLookupPathComponents.length > rootPathComponents.length + 1) {
125273
125696
  return getDirectoryOfFailedLookupWatch(
125274
125697
  failedLookupComponents,
@@ -125340,9 +125763,9 @@ function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, lengt
125340
125763
  packageDirPath: packageDirLength !== void 0 ? getPathFromPathComponents(dirPathComponents, packageDirLength) : void 0
125341
125764
  };
125342
125765
  }
125343
- function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, preferNonRecursiveWatch, filterCustomPath) {
125766
+ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, isRootWatchable, getCurrentDirectory, preferNonRecursiveWatch, filterCustomPath) {
125344
125767
  const typeRootPathComponents = getPathComponents(typeRootPath);
125345
- if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
125768
+ if (isRootWatchable && isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
125346
125769
  return rootPath;
125347
125770
  }
125348
125771
  typeRoot = isRootedDiskPath(typeRoot) ? normalizePath(typeRoot) : getNormalizedAbsolutePath(typeRoot, getCurrentDirectory());
@@ -125383,10 +125806,10 @@ function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirected
125383
125806
  function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
125384
125807
  const host = getModuleResolutionHost(resolutionHost);
125385
125808
  const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
125386
- if (!resolutionHost.getGlobalCache) {
125809
+ if (!resolutionHost.getGlobalTypingsCacheLocation) {
125387
125810
  return primaryResult;
125388
125811
  }
125389
- const globalCache = resolutionHost.getGlobalCache();
125812
+ const globalCache = resolutionHost.getGlobalTypingsCacheLocation();
125390
125813
  if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
125391
125814
  const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
125392
125815
  Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
@@ -125450,6 +125873,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
125450
125873
  const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
125451
125874
  const rootPath = resolutionHost.toPath(rootDir);
125452
125875
  const rootPathComponents = getPathComponents(rootPath);
125876
+ const isRootWatchable = canWatchDirectoryOrFile(rootPathComponents);
125453
125877
  const isSymlinkCache = /* @__PURE__ */ new Map();
125454
125878
  const packageDirWatchers = /* @__PURE__ */ new Map();
125455
125879
  const dirPathToSymlinkPackageRefCount = /* @__PURE__ */ new Map();
@@ -125861,6 +126285,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
125861
126285
  rootDir,
125862
126286
  rootPath,
125863
126287
  rootPathComponents,
126288
+ isRootWatchable,
125864
126289
  getCurrentDirectory,
125865
126290
  resolutionHost.preferNonRecursiveWatch
125866
126291
  );
@@ -126049,6 +126474,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126049
126474
  rootDir,
126050
126475
  rootPath,
126051
126476
  rootPathComponents,
126477
+ isRootWatchable,
126052
126478
  getCurrentDirectory,
126053
126479
  resolutionHost.preferNonRecursiveWatch
126054
126480
  );
@@ -126192,6 +126618,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126192
126618
  return false;
126193
126619
  }
126194
126620
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
126621
+ (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
126195
126622
  const packagePath = parseNodeModuleFromPath(
126196
126623
  fileOrDirectoryPath,
126197
126624
  /*isFolder*/
@@ -126273,6 +126700,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126273
126700
  resolutionHost.toPath(typeRoot),
126274
126701
  rootPath,
126275
126702
  rootPathComponents,
126703
+ isRootWatchable,
126276
126704
  getCurrentDirectory,
126277
126705
  resolutionHost.preferNonRecursiveWatch,
126278
126706
  (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2) || dirPathToSymlinkPackageRefCount.has(dirPath2)
@@ -126828,6 +127256,7 @@ function getSourceFileVersionAsHashFromText(host, text) {
126828
127256
  if (pos && text.charCodeAt(pos - 1) === 13 /* carriageReturn */) {
126829
127257
  pos--;
126830
127258
  }
127259
+ // falls through
126831
127260
  case 13 /* carriageReturn */:
126832
127261
  break;
126833
127262
  default:
@@ -127004,6 +127433,7 @@ function createWatchProgram(host) {
127004
127433
  let updateLevel;
127005
127434
  let missingFilesMap;
127006
127435
  let watchedWildcardDirectories;
127436
+ let staleWatches = /* @__PURE__ */ new Map([[void 0, void 0]]);
127007
127437
  let timerToUpdateProgram;
127008
127438
  let timerToInvalidateFailedLookupResolutions;
127009
127439
  let parsedConfigs;
@@ -127092,8 +127522,6 @@ function createWatchProgram(host) {
127092
127522
  const customHasInvalidLibResolutions = host.resolveLibrary ? maybeBind(host, host.hasInvalidatedLibResolutions) || returnTrue : returnFalse;
127093
127523
  builderProgram = readBuilderProgram(compilerOptions, compilerHost);
127094
127524
  synchronizeProgram();
127095
- watchConfigFileWildCardDirectories();
127096
- if (configFileName) updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
127097
127525
  return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close, getResolutionCache } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close, getResolutionCache };
127098
127526
  function close() {
127099
127527
  clearInvalidateResolutionsOfFailedLookupLocations();
@@ -127196,6 +127624,16 @@ function createWatchProgram(host) {
127196
127624
  compilerHost.directoryExists = originalDirectoryExists;
127197
127625
  compilerHost.createDirectory = originalCreateDirectory;
127198
127626
  compilerHost.writeFile = originalWriteFile;
127627
+ staleWatches == null ? void 0 : staleWatches.forEach((configFile, configPath) => {
127628
+ if (!configPath) {
127629
+ watchConfigFileWildCardDirectories();
127630
+ if (configFileName) updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
127631
+ } else {
127632
+ const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
127633
+ if (config) watchReferencedProject(configFile, configPath, config);
127634
+ }
127635
+ });
127636
+ staleWatches = void 0;
127199
127637
  return builderProgram;
127200
127638
  }
127201
127639
  function createNewProgram(hasInvalidatedResolutions, hasInvalidatedLibResolutions) {
@@ -127402,9 +127840,8 @@ function createWatchProgram(host) {
127402
127840
  }
127403
127841
  parseConfigFile2();
127404
127842
  hasChangedCompilerOptions = true;
127843
+ (staleWatches ?? (staleWatches = /* @__PURE__ */ new Map())).set(void 0, void 0);
127405
127844
  synchronizeProgram();
127406
- watchConfigFileWildCardDirectories();
127407
- updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
127408
127845
  }
127409
127846
  function parseConfigFile2() {
127410
127847
  Debug.assert(configFileName);
@@ -127456,7 +127893,7 @@ function createWatchProgram(host) {
127456
127893
  } else {
127457
127894
  (parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath, config = { parsedCommandLine });
127458
127895
  }
127459
- watchReferencedProject(configFileName2, configPath, config);
127896
+ (staleWatches ?? (staleWatches = /* @__PURE__ */ new Map())).set(configPath, configFileName2);
127460
127897
  return parsedCommandLine;
127461
127898
  }
127462
127899
  function getParsedCommandLineFromConfigFileHost(configFileName2) {
@@ -128314,6 +128751,7 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
128314
128751
  queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
128315
128752
  step++;
128316
128753
  break;
128754
+ // Should never be done
128317
128755
  case 3 /* Done */:
128318
128756
  default:
128319
128757
  assertType(step);
@@ -128854,6 +129292,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
128854
129292
  status.type = 2 /* UpToDateWithUpstreamTypes */;
128855
129293
  break;
128856
129294
  }
129295
+ // falls through
128857
129296
  case 15 /* UpToDateWithInputFileText */:
128858
129297
  case 2 /* UpToDateWithUpstreamTypes */:
128859
129298
  if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
@@ -129371,6 +129810,8 @@ function reportUpToDateStatus(state, configFileName, status) {
129371
129810
  relName(state, configFileName)
129372
129811
  );
129373
129812
  case 16 /* ContainerOnly */:
129813
+ // Don't report status on "solution" projects
129814
+ // falls through
129374
129815
  case 13 /* ComputingUpstream */:
129375
129816
  break;
129376
129817
  default:
@@ -129437,7 +129878,7 @@ function shouldBePretty(sys2, options) {
129437
129878
  return options.pretty;
129438
129879
  }
129439
129880
  function getOptionsForHelp(commandLine) {
129440
- return !!commandLine.options.all ? toSorted(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(optionDeclarations.slice(), (v) => !!v.showInSimplifiedHelpView);
129881
+ return !!commandLine.options.all ? toSorted(optionDeclarations.concat(tscBuildOption), (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(optionDeclarations.concat(tscBuildOption), (v) => !!v.showInSimplifiedHelpView);
129441
129882
  }
129442
129883
  function printVersion(sys2) {
129443
129884
  sys2.write(getDiagnosticText(Diagnostics.Version_0, version) + sys2.newLine);
@@ -129761,7 +130202,7 @@ function printAllHelp(sys2, compilerOptions, buildOptions, watchOptions) {
129761
130202
  output = [...output, ...generateSectionOptionsOutput(
129762
130203
  sys2,
129763
130204
  getDiagnosticText(Diagnostics.BUILD_OPTIONS),
129764
- buildOptions,
130205
+ filter(buildOptions, (option) => option !== tscBuildOption),
129765
130206
  /*subCategory*/
129766
130207
  false,
129767
130208
  formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")
@@ -129775,7 +130216,7 @@ function printBuildHelp(sys2, buildOptions) {
129775
130216
  output = [...output, ...generateSectionOptionsOutput(
129776
130217
  sys2,
129777
130218
  getDiagnosticText(Diagnostics.BUILD_OPTIONS),
129778
- buildOptions,
130219
+ filter(buildOptions, (option) => option !== tscBuildOption),
129779
130220
  /*subCategory*/
129780
130221
  false,
129781
130222
  formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")
@@ -129812,10 +130253,6 @@ function printHelp(sys2, commandLine) {
129812
130253
  }
129813
130254
  function executeCommandLineWorker(sys2, cb, commandLine) {
129814
130255
  let reportDiagnostic = createDiagnosticReporter(sys2);
129815
- if (commandLine.options.build) {
129816
- reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_build_must_be_the_first_command_line_argument));
129817
- return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
129818
- }
129819
130256
  let configFileName;
129820
130257
  if (commandLine.options.locale) {
129821
130258
  validateLocaleAndSetLanguage(commandLine.options.locale, sys2, commandLine.errors);
@@ -129961,16 +130398,16 @@ function executeCommandLineWorker(sys2, cb, commandLine) {
129961
130398
  }
129962
130399
  }
129963
130400
  }
129964
- function isBuild(commandLineArgs) {
130401
+ function isBuildCommand(commandLineArgs) {
129965
130402
  if (commandLineArgs.length > 0 && commandLineArgs[0].charCodeAt(0) === 45 /* minus */) {
129966
130403
  const firstOption = commandLineArgs[0].slice(commandLineArgs[0].charCodeAt(1) === 45 /* minus */ ? 2 : 1).toLowerCase();
129967
- return firstOption === "build" || firstOption === "b";
130404
+ return firstOption === tscBuildOption.name || firstOption === tscBuildOption.shortName;
129968
130405
  }
129969
130406
  return false;
129970
130407
  }
129971
130408
  function executeCommandLine(system, cb, commandLineArgs) {
129972
- if (isBuild(commandLineArgs)) {
129973
- const { buildOptions, watchOptions, projects, errors } = parseBuildCommand(commandLineArgs.slice(1));
130409
+ if (isBuildCommand(commandLineArgs)) {
130410
+ const { buildOptions, watchOptions, projects, errors } = parseBuildCommand(commandLineArgs);
129974
130411
  if (buildOptions.generateCpuProfile && system.enableCPUProfiler) {
129975
130412
  system.enableCPUProfiler(buildOptions.generateCpuProfile, () => performBuild(
129976
130413
  system,