typescript 5.6.0-dev.20240617 → 5.6.0-dev.20240619

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -225,7 +225,6 @@ __export(typescript_exports, {
225
225
  arrayToMap: () => arrayToMap,
226
226
  arrayToMultiMap: () => arrayToMultiMap,
227
227
  arrayToNumericMap: () => arrayToNumericMap,
228
- arraysEqual: () => arraysEqual,
229
228
  assertType: () => assertType,
230
229
  assign: () => assign,
231
230
  assignHelper: () => assignHelper,
@@ -828,6 +827,7 @@ __export(typescript_exports, {
828
827
  getInterfaceBaseTypeNodes: () => getInterfaceBaseTypeNodes,
829
828
  getInternalEmitFlags: () => getInternalEmitFlags,
830
829
  getInvokedExpression: () => getInvokedExpression,
830
+ getIsFileExcluded: () => getIsFileExcluded,
831
831
  getIsolatedModules: () => getIsolatedModules,
832
832
  getJSDocAugmentsTag: () => getJSDocAugmentsTag,
833
833
  getJSDocClassTag: () => getJSDocClassTag,
@@ -1906,7 +1906,6 @@ __export(typescript_exports, {
1906
1906
  map: () => map,
1907
1907
  mapAllOrFail: () => mapAllOrFail,
1908
1908
  mapDefined: () => mapDefined,
1909
- mapDefinedEntries: () => mapDefinedEntries,
1910
1909
  mapDefinedIterator: () => mapDefinedIterator,
1911
1910
  mapEntries: () => mapEntries,
1912
1911
  mapIterator: () => mapIterator,
@@ -1916,6 +1915,7 @@ __export(typescript_exports, {
1916
1915
  matchPatternOrExact: () => matchPatternOrExact,
1917
1916
  matchedText: () => matchedText,
1918
1917
  matchesExclude: () => matchesExclude,
1918
+ maxBy: () => maxBy,
1919
1919
  maybeBind: () => maybeBind,
1920
1920
  maybeSetLocalizedDiagnosticMessages: () => maybeSetLocalizedDiagnosticMessages,
1921
1921
  memoize: () => memoize,
@@ -2377,7 +2377,7 @@ module.exports = __toCommonJS(typescript_exports);
2377
2377
 
2378
2378
  // src/compiler/corePublic.ts
2379
2379
  var versionMajorMinor = "5.6";
2380
- var version = `${versionMajorMinor}.0-dev.20240617`;
2380
+ var version = `${versionMajorMinor}.0-dev.20240619`;
2381
2381
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2382
2382
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2383
2383
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -2390,10 +2390,10 @@ var emptyArray = [];
2390
2390
  var emptyMap = /* @__PURE__ */ new Map();
2391
2391
  var emptySet = /* @__PURE__ */ new Set();
2392
2392
  function length(array) {
2393
- return array ? array.length : 0;
2393
+ return array !== void 0 ? array.length : 0;
2394
2394
  }
2395
2395
  function forEach(array, callback) {
2396
- if (array) {
2396
+ if (array !== void 0) {
2397
2397
  for (let i = 0; i < array.length; i++) {
2398
2398
  const result = callback(array[i], i);
2399
2399
  if (result) {
@@ -2404,7 +2404,7 @@ function forEach(array, callback) {
2404
2404
  return void 0;
2405
2405
  }
2406
2406
  function forEachRight(array, callback) {
2407
- if (array) {
2407
+ if (array !== void 0) {
2408
2408
  for (let i = array.length - 1; i >= 0; i--) {
2409
2409
  const result = callback(array[i], i);
2410
2410
  if (result) {
@@ -2460,13 +2460,13 @@ function intersperse(input, element) {
2460
2460
  }
2461
2461
  const result = [];
2462
2462
  for (let i = 0, n = input.length; i < n; i++) {
2463
- if (i) result.push(element);
2463
+ if (i !== 0) result.push(element);
2464
2464
  result.push(input[i]);
2465
2465
  }
2466
2466
  return result;
2467
2467
  }
2468
2468
  function every(array, callback) {
2469
- if (array) {
2469
+ if (array !== void 0) {
2470
2470
  for (let i = 0; i < array.length; i++) {
2471
2471
  if (!callback(array[i], i)) {
2472
2472
  return false;
@@ -2523,20 +2523,17 @@ function findMap(array, callback) {
2523
2523
  return Debug.fail();
2524
2524
  }
2525
2525
  function contains(array, value, equalityComparer = equateValues) {
2526
- if (array) {
2527
- for (const v of array) {
2528
- if (equalityComparer(v, value)) {
2526
+ if (array !== void 0) {
2527
+ for (let i = 0; i < array.length; i++) {
2528
+ if (equalityComparer(array[i], value)) {
2529
2529
  return true;
2530
2530
  }
2531
2531
  }
2532
2532
  }
2533
2533
  return false;
2534
2534
  }
2535
- function arraysEqual(a, b, equalityComparer = equateValues) {
2536
- return a.length === b.length && a.every((x, i) => equalityComparer(x, b[i]));
2537
- }
2538
2535
  function indexOfAnyCharCode(text, charCodes, start) {
2539
- for (let i = start || 0; i < text.length; i++) {
2536
+ for (let i = start ?? 0; i < text.length; i++) {
2540
2537
  if (contains(charCodes, text.charCodeAt(i))) {
2541
2538
  return i;
2542
2539
  }
@@ -2545,7 +2542,7 @@ function indexOfAnyCharCode(text, charCodes, start) {
2545
2542
  }
2546
2543
  function countWhere(array, predicate) {
2547
2544
  let count = 0;
2548
- if (array) {
2545
+ if (array !== void 0) {
2549
2546
  for (let i = 0; i < array.length; i++) {
2550
2547
  const v = array[i];
2551
2548
  if (predicate(v, i)) {
@@ -2556,7 +2553,7 @@ function countWhere(array, predicate) {
2556
2553
  return count;
2557
2554
  }
2558
2555
  function filter(array, f) {
2559
- if (array) {
2556
+ if (array !== void 0) {
2560
2557
  const len = array.length;
2561
2558
  let i = 0;
2562
2559
  while (i < len && f(array[i])) i++;
@@ -2590,7 +2587,7 @@ function clear(array) {
2590
2587
  }
2591
2588
  function map(array, f) {
2592
2589
  let result;
2593
- if (array) {
2590
+ if (array !== void 0) {
2594
2591
  result = [];
2595
2592
  for (let i = 0; i < array.length; i++) {
2596
2593
  result.push(f(array[i], i));
@@ -2604,7 +2601,7 @@ function* mapIterator(iter, mapFn) {
2604
2601
  }
2605
2602
  }
2606
2603
  function sameMap(array, f) {
2607
- if (array) {
2604
+ if (array !== void 0) {
2608
2605
  for (let i = 0; i < array.length; i++) {
2609
2606
  const item = array[i];
2610
2607
  const mapped = f(item, i);
@@ -2622,7 +2619,8 @@ function sameMap(array, f) {
2622
2619
  }
2623
2620
  function flatten(array) {
2624
2621
  const result = [];
2625
- for (const v of array) {
2622
+ for (let i = 0; i < array.length; i++) {
2623
+ const v = array[i];
2626
2624
  if (v) {
2627
2625
  if (isArray(v)) {
2628
2626
  addRange(result, v);
@@ -2635,7 +2633,7 @@ function flatten(array) {
2635
2633
  }
2636
2634
  function flatMap(array, mapfn) {
2637
2635
  let result;
2638
- if (array) {
2636
+ if (array !== void 0) {
2639
2637
  for (let i = 0; i < array.length; i++) {
2640
2638
  const v = mapfn(array[i], i);
2641
2639
  if (v) {
@@ -2647,11 +2645,11 @@ function flatMap(array, mapfn) {
2647
2645
  }
2648
2646
  }
2649
2647
  }
2650
- return result || emptyArray;
2648
+ return result ?? emptyArray;
2651
2649
  }
2652
2650
  function flatMapToMutable(array, mapfn) {
2653
2651
  const result = [];
2654
- if (array) {
2652
+ if (array !== void 0) {
2655
2653
  for (let i = 0; i < array.length; i++) {
2656
2654
  const v = mapfn(array[i], i);
2657
2655
  if (v) {
@@ -2674,7 +2672,7 @@ function* flatMapIterator(iter, mapfn) {
2674
2672
  }
2675
2673
  function sameFlatMap(array, mapfn) {
2676
2674
  let result;
2677
- if (array) {
2675
+ if (array !== void 0) {
2678
2676
  for (let i = 0; i < array.length; i++) {
2679
2677
  const item = array[i];
2680
2678
  const mapped = mapfn(item, i);
@@ -2690,7 +2688,7 @@ function sameFlatMap(array, mapfn) {
2690
2688
  }
2691
2689
  }
2692
2690
  }
2693
- return result || array;
2691
+ return result ?? array;
2694
2692
  }
2695
2693
  function mapAllOrFail(array, mapFn) {
2696
2694
  const result = [];
@@ -2705,7 +2703,7 @@ function mapAllOrFail(array, mapFn) {
2705
2703
  }
2706
2704
  function mapDefined(array, mapFn) {
2707
2705
  const result = [];
2708
- if (array) {
2706
+ if (array !== void 0) {
2709
2707
  for (let i = 0; i < array.length; i++) {
2710
2708
  const mapped = mapFn(array[i], i);
2711
2709
  if (mapped !== void 0) {
@@ -2723,22 +2721,6 @@ function* mapDefinedIterator(iter, mapFn) {
2723
2721
  }
2724
2722
  }
2725
2723
  }
2726
- function mapDefinedEntries(map2, f) {
2727
- if (!map2) {
2728
- return void 0;
2729
- }
2730
- const result = /* @__PURE__ */ new Map();
2731
- map2.forEach((value, key) => {
2732
- const entry = f(key, value);
2733
- if (entry !== void 0) {
2734
- const [newKey, newValue] = entry;
2735
- if (newKey !== void 0 && newValue !== void 0) {
2736
- result.set(newKey, newValue);
2737
- }
2738
- }
2739
- });
2740
- return result;
2741
- }
2742
2724
  function getOrUpdate(map2, key, callback) {
2743
2725
  if (map2.has(key)) {
2744
2726
  return map2.get(key);
@@ -2759,7 +2741,7 @@ function* singleIterator(value) {
2759
2741
  }
2760
2742
  function spanMap(array, keyfn, mapfn) {
2761
2743
  let result;
2762
- if (array) {
2744
+ if (array !== void 0) {
2763
2745
  result = [];
2764
2746
  const len = array.length;
2765
2747
  let previousKey;
@@ -2791,7 +2773,7 @@ function spanMap(array, keyfn, mapfn) {
2791
2773
  return result;
2792
2774
  }
2793
2775
  function mapEntries(map2, f) {
2794
- if (!map2) {
2776
+ if (map2 === void 0) {
2795
2777
  return void 0;
2796
2778
  }
2797
2779
  const result = /* @__PURE__ */ new Map();
@@ -2802,10 +2784,10 @@ function mapEntries(map2, f) {
2802
2784
  return result;
2803
2785
  }
2804
2786
  function some(array, predicate) {
2805
- if (array) {
2806
- if (predicate) {
2807
- for (const v of array) {
2808
- if (predicate(v)) {
2787
+ if (array !== void 0) {
2788
+ if (predicate !== void 0) {
2789
+ for (let i = 0; i < array.length; i++) {
2790
+ if (predicate(array[i])) {
2809
2791
  return true;
2810
2792
  }
2811
2793
  }
@@ -2830,8 +2812,8 @@ function getRangesWhere(arr, pred, cb) {
2830
2812
  if (start !== void 0) cb(start, arr.length);
2831
2813
  }
2832
2814
  function concatenate(array1, array2) {
2833
- if (!some(array2)) return array1;
2834
- if (!some(array1)) return array2;
2815
+ if (array2 === void 0 || array2.length === 0) return array1;
2816
+ if (array1 === void 0 || array1.length === 0) return array2;
2835
2817
  return [...array1, ...array2];
2836
2818
  }
2837
2819
  function selectIndex(_, i) {
@@ -2858,8 +2840,8 @@ function deduplicateRelational(array, equalityComparer, comparer) {
2858
2840
  }
2859
2841
  function deduplicateEquality(array, equalityComparer) {
2860
2842
  const result = [];
2861
- for (const item of array) {
2862
- pushIfUnique(result, item, equalityComparer);
2843
+ for (let i = 0; i < array.length; i++) {
2844
+ pushIfUnique(result, array[i], equalityComparer);
2863
2845
  }
2864
2846
  return result;
2865
2847
  }
@@ -2913,7 +2895,7 @@ function insertSorted(array, insert, compare, equalityComparer, allowDuplicates)
2913
2895
  return false;
2914
2896
  }
2915
2897
  function sortAndDeduplicate(array, comparer, equalityComparer) {
2916
- return deduplicateSorted(sort(array, comparer), equalityComparer || comparer || compareStringsCaseSensitive);
2898
+ return deduplicateSorted(sort(array, comparer), equalityComparer ?? comparer ?? compareStringsCaseSensitive);
2917
2899
  }
2918
2900
  function arrayIsSorted(array, comparer) {
2919
2901
  if (array.length < 2) return true;
@@ -2925,7 +2907,7 @@ function arrayIsSorted(array, comparer) {
2925
2907
  return true;
2926
2908
  }
2927
2909
  function arrayIsEqualTo(array1, array2, equalityComparer = equateValues) {
2928
- if (!array1 || !array2) {
2910
+ if (array1 === void 0 || array2 === void 0) {
2929
2911
  return array1 === array2;
2930
2912
  }
2931
2913
  if (array1.length !== array2.length) {
@@ -2940,20 +2922,18 @@ function arrayIsEqualTo(array1, array2, equalityComparer = equateValues) {
2940
2922
  }
2941
2923
  function compact(array) {
2942
2924
  let result;
2943
- if (array) {
2925
+ if (array !== void 0) {
2944
2926
  for (let i = 0; i < array.length; i++) {
2945
2927
  const v = array[i];
2946
- if (result || !v) {
2947
- if (!result) {
2948
- result = array.slice(0, i);
2949
- }
2928
+ if (result ?? !v) {
2929
+ result ?? (result = array.slice(0, i));
2950
2930
  if (v) {
2951
2931
  result.push(v);
2952
2932
  }
2953
2933
  }
2954
2934
  }
2955
2935
  }
2956
- return result || array;
2936
+ return result ?? array;
2957
2937
  }
2958
2938
  function relativeComplement(arrayA, arrayB, comparer) {
2959
2939
  if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0) return arrayB;
@@ -3018,7 +2998,7 @@ function pushIfUnique(array, toAdd, equalityComparer) {
3018
2998
  }
3019
2999
  }
3020
3000
  function appendIfUnique(array, toAdd, equalityComparer) {
3021
- if (array) {
3001
+ if (array !== void 0) {
3022
3002
  pushIfUnique(array, toAdd, equalityComparer);
3023
3003
  return array;
3024
3004
  } else {
@@ -3051,7 +3031,7 @@ function rangeEquals(array1, array2, pos, end) {
3051
3031
  return true;
3052
3032
  }
3053
3033
  var elementAt = !!Array.prototype.at ? (array, offset) => array == null ? void 0 : array.at(offset) : (array, offset) => {
3054
- if (array) {
3034
+ if (array !== void 0) {
3055
3035
  offset = toOffset(array, offset);
3056
3036
  if (offset < array.length) {
3057
3037
  return array[offset];
@@ -3063,7 +3043,7 @@ function firstOrUndefined(array) {
3063
3043
  return array === void 0 || array.length === 0 ? void 0 : array[0];
3064
3044
  }
3065
3045
  function firstOrUndefinedIterator(iter) {
3066
- if (iter) {
3046
+ if (iter !== void 0) {
3067
3047
  for (const value of iter) {
3068
3048
  return value;
3069
3049
  }
@@ -3088,13 +3068,13 @@ function last(array) {
3088
3068
  return array[array.length - 1];
3089
3069
  }
3090
3070
  function singleOrUndefined(array) {
3091
- return array && array.length === 1 ? array[0] : void 0;
3071
+ return array !== void 0 && array.length === 1 ? array[0] : void 0;
3092
3072
  }
3093
3073
  function single(array) {
3094
3074
  return Debug.checkDefined(singleOrUndefined(array));
3095
3075
  }
3096
3076
  function singleOrMany(array) {
3097
- return array && array.length === 1 ? array[0] : array;
3077
+ return array !== void 0 && array.length === 1 ? array[0] : array;
3098
3078
  }
3099
3079
  function replaceElement(array, index, value) {
3100
3080
  const result = array.slice(0);
@@ -3108,7 +3088,7 @@ function binarySearchKey(array, key, keySelector, keyComparer, offset) {
3108
3088
  if (!some(array)) {
3109
3089
  return -1;
3110
3090
  }
3111
- let low = offset || 0;
3091
+ let low = offset ?? 0;
3112
3092
  let high = array.length - 1;
3113
3093
  while (low <= high) {
3114
3094
  const middle = low + (high - low >> 1);
@@ -3226,7 +3206,8 @@ function equalOwnProperties(left, right, equalityComparer = equateValues) {
3226
3206
  }
3227
3207
  function arrayToMap(array, makeKey, makeValue = identity) {
3228
3208
  const result = /* @__PURE__ */ new Map();
3229
- for (const value of array) {
3209
+ for (let i = 0; i < array.length; i++) {
3210
+ const value = array[i];
3230
3211
  const key = makeKey(value);
3231
3212
  if (key !== void 0) result.set(key, makeValue(value));
3232
3213
  }
@@ -3234,14 +3215,16 @@ function arrayToMap(array, makeKey, makeValue = identity) {
3234
3215
  }
3235
3216
  function arrayToNumericMap(array, makeKey, makeValue = identity) {
3236
3217
  const result = [];
3237
- for (const value of array) {
3218
+ for (let i = 0; i < array.length; i++) {
3219
+ const value = array[i];
3238
3220
  result[makeKey(value)] = makeValue(value);
3239
3221
  }
3240
3222
  return result;
3241
3223
  }
3242
3224
  function arrayToMultiMap(values, makeKey, makeValue = identity) {
3243
3225
  const result = createMultiMap();
3244
- for (const value of values) {
3226
+ for (let i = 0; i < values.length; i++) {
3227
+ const value = values[i];
3245
3228
  result.add(makeKey(value), makeValue(value));
3246
3229
  }
3247
3230
  return result;
@@ -3251,8 +3234,9 @@ function group(values, getGroupId, resultSelector = identity) {
3251
3234
  }
3252
3235
  function groupBy(values, keySelector) {
3253
3236
  const result = {};
3254
- if (values) {
3255
- for (const value of values) {
3237
+ if (values !== void 0) {
3238
+ for (let i = 0; i < values.length; i++) {
3239
+ const value = values[i];
3256
3240
  const key = `${keySelector(value)}`;
3257
3241
  const array = result[key] ?? (result[key] = []);
3258
3242
  array.push(value);
@@ -3291,7 +3275,7 @@ function copyProperties(first2, second) {
3291
3275
  }
3292
3276
  }
3293
3277
  function maybeBind(obj, fn) {
3294
- return fn ? fn.bind(obj) : void 0;
3278
+ return fn == null ? void 0 : fn.bind(obj);
3295
3279
  }
3296
3280
  function createMultiMap() {
3297
3281
  const map2 = /* @__PURE__ */ new Map();
@@ -3301,7 +3285,7 @@ function createMultiMap() {
3301
3285
  }
3302
3286
  function multiMapAdd(key, value) {
3303
3287
  let values = this.get(key);
3304
- if (values) {
3288
+ if (values !== void 0) {
3305
3289
  values.push(value);
3306
3290
  } else {
3307
3291
  this.set(key, values = [value]);
@@ -3310,7 +3294,7 @@ function multiMapAdd(key, value) {
3310
3294
  }
3311
3295
  function multiMapRemove(key, value) {
3312
3296
  const values = this.get(key);
3313
- if (values) {
3297
+ if (values !== void 0) {
3314
3298
  unorderedRemoveItem(values, value);
3315
3299
  if (!values.length) {
3316
3300
  this.delete(key);
@@ -3318,7 +3302,7 @@ function multiMapRemove(key, value) {
3318
3302
  }
3319
3303
  }
3320
3304
  function createQueue(items) {
3321
- const elements = (items == null ? void 0 : items.slice()) || [];
3305
+ const elements = (items == null ? void 0 : items.slice()) ?? [];
3322
3306
  let headIndex = 0;
3323
3307
  function isEmpty() {
3324
3308
  return headIndex === elements.length;
@@ -3369,13 +3353,8 @@ function createSet(getHashCode, equals) {
3369
3353
  const hash = getHashCode(element);
3370
3354
  if (!multiMap.has(hash)) return false;
3371
3355
  const candidates = multiMap.get(hash);
3372
- if (!isArray(candidates)) return equals(candidates, element);
3373
- for (const candidate of candidates) {
3374
- if (equals(candidate, element)) {
3375
- return true;
3376
- }
3377
- }
3378
- return false;
3356
+ if (isArray(candidates)) return contains(candidates, element, equals);
3357
+ return equals(candidates, element);
3379
3358
  },
3380
3359
  add(element) {
3381
3360
  const hash = getHashCode(element);
@@ -3594,6 +3573,12 @@ function compareValues(a, b) {
3594
3573
  function compareTextSpans(a, b) {
3595
3574
  return compareValues(a == null ? void 0 : a.start, b == null ? void 0 : b.start) || compareValues(a == null ? void 0 : a.length, b == null ? void 0 : b.length);
3596
3575
  }
3576
+ function maxBy(arr, init, mapper) {
3577
+ for (let i = 0; i < arr.length; i++) {
3578
+ init = Math.max(init, mapper(arr[i]));
3579
+ }
3580
+ return init;
3581
+ }
3597
3582
  function min(items, compare) {
3598
3583
  return reduceLeft(items, (x, y) => compare(x, y) === -1 /* LessThan */ ? x : y);
3599
3584
  }
@@ -3645,8 +3630,8 @@ function setUILocale(value) {
3645
3630
  }
3646
3631
  }
3647
3632
  function compareStringsCaseSensitiveUI(a, b) {
3648
- const comparer = uiComparerCaseSensitive || (uiComparerCaseSensitive = createUIStringComparer(uiLocale));
3649
- return comparer(a, b);
3633
+ uiComparerCaseSensitive ?? (uiComparerCaseSensitive = createUIStringComparer(uiLocale));
3634
+ return uiComparerCaseSensitive(a, b);
3650
3635
  }
3651
3636
  function compareProperties(a, b, key, comparer) {
3652
3637
  return a === b ? 0 /* EqualTo */ : a === void 0 ? -1 /* LessThan */ : b === void 0 ? 1 /* GreaterThan */ : comparer(a[key], b[key]);
@@ -3806,7 +3791,8 @@ function matchedText(pattern, candidate) {
3806
3791
  function findBestPatternMatch(values, getPattern, candidate) {
3807
3792
  let matchedValue;
3808
3793
  let longestMatchPrefixLength = -1;
3809
- for (const v of values) {
3794
+ for (let i = 0; i < values.length; i++) {
3795
+ const v = values[i];
3810
3796
  const pattern = getPattern(v);
3811
3797
  if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
3812
3798
  longestMatchPrefixLength = pattern.prefix.length;
@@ -3851,7 +3837,7 @@ function singleElementArray(t) {
3851
3837
  return t === void 0 ? void 0 : [t];
3852
3838
  }
3853
3839
  function enumerateInsertsAndDeletes(newItems, oldItems, comparer, inserted, deleted, unchanged) {
3854
- unchanged = unchanged || noop;
3840
+ unchanged ?? (unchanged = noop);
3855
3841
  let newIndex = 0;
3856
3842
  let oldIndex = 0;
3857
3843
  const newLen = newItems.length;
@@ -3913,7 +3899,7 @@ function cartesianProductWorker(arrays, result, outer, index) {
3913
3899
  }
3914
3900
  }
3915
3901
  function takeWhile(array, predicate) {
3916
- if (array) {
3902
+ if (array !== void 0) {
3917
3903
  const len = array.length;
3918
3904
  let index = 0;
3919
3905
  while (index < len && predicate(array[index])) {
@@ -3923,7 +3909,7 @@ function takeWhile(array, predicate) {
3923
3909
  }
3924
3910
  }
3925
3911
  function skipWhile(array, predicate) {
3926
- if (array) {
3912
+ if (array !== void 0) {
3927
3913
  const len = array.length;
3928
3914
  let index = 0;
3929
3915
  while (index < len && predicate(array[index])) {
@@ -4848,7 +4834,7 @@ m2: ${this.mapper2.__debugToString().split("\n").join("\n ")}`;
4848
4834
  }
4849
4835
  function renderGraph() {
4850
4836
  const columnCount = columnWidths.length;
4851
- const laneCount = nodes.reduce((x, n) => Math.max(x, n.lane), 0) + 1;
4837
+ const laneCount = maxBy(nodes, 0, (n) => n.lane) + 1;
4852
4838
  const lanes = fill(Array(laneCount), "");
4853
4839
  const grid = columnWidths.map(() => Array(laneCount));
4854
4840
  const connectors = columnWidths.map(() => fill(Array(laneCount), 0));
@@ -11707,7 +11693,7 @@ function computePositionOfLineAndCharacter(lineStarts, line, character, debugTex
11707
11693
  if (allowEdits) {
11708
11694
  line = line < 0 ? 0 : line >= lineStarts.length ? lineStarts.length - 1 : line;
11709
11695
  } else {
11710
- Debug.fail(`Bad line number. Line: ${line}, lineStarts.length: ${lineStarts.length} , line map is correct? ${debugText !== void 0 ? arraysEqual(lineStarts, computeLineStarts(debugText)) : "unknown"}`);
11696
+ Debug.fail(`Bad line number. Line: ${line}, lineStarts.length: ${lineStarts.length} , line map is correct? ${debugText !== void 0 ? arrayIsEqualTo(lineStarts, computeLineStarts(debugText)) : "unknown"}`);
11711
11697
  }
11712
11698
  }
11713
11699
  const res = lineStarts[line] + character;
@@ -16253,6 +16239,9 @@ function createSymbolTable(symbols) {
16253
16239
  function isTransientSymbol(symbol) {
16254
16240
  return (symbol.flags & 33554432 /* Transient */) !== 0;
16255
16241
  }
16242
+ function isExternalModuleSymbol(moduleSymbol) {
16243
+ return !!(moduleSymbol.flags & 1536 /* Module */) && moduleSymbol.escapedName.charCodeAt(0) === 34 /* doubleQuote */;
16244
+ }
16256
16245
  var stringWriter = createSingleLineStringWriter();
16257
16246
  function createSingleLineStringWriter() {
16258
16247
  var str = "";
@@ -42074,9 +42063,7 @@ function convertToTSConfig(configParseResult, configFileName, host) {
42074
42063
  return config;
42075
42064
  }
42076
42065
  function optionMapToObject(optionMap) {
42077
- return {
42078
- ...arrayFrom(optionMap.entries()).reduce((prev, cur) => ({ ...prev, [cur[0]]: cur[1] }), {})
42079
- };
42066
+ return Object.fromEntries(optionMap);
42080
42067
  }
42081
42068
  function filterSameAsDefaultInclude(specs) {
42082
42069
  if (!length(specs)) return void 0;
@@ -50355,6 +50342,7 @@ function createTypeChecker(host) {
50355
50342
  getNumberType: () => numberType,
50356
50343
  getNumberLiteralType,
50357
50344
  getBigIntType: () => bigintType,
50345
+ getBigIntLiteralType,
50358
50346
  createPromiseType,
50359
50347
  createArrayType,
50360
50348
  getElementTypeOfArrayType,
@@ -56909,7 +56897,7 @@ function createTypeChecker(host) {
56909
56897
  /*yieldModuleSymbol*/
56910
56898
  true
56911
56899
  )[0];
56912
- if (parentSymbol && parentSymbol.flags & 1536 /* Module */) {
56900
+ if (parentSymbol && isExternalModuleSymbol(parentSymbol)) {
56913
56901
  name = getSpecifierForModuleSymbol(parentSymbol, context);
56914
56902
  } else {
56915
56903
  const targetFile = getExternalModuleFileFromDeclaration(parent2);
@@ -65090,7 +65078,7 @@ function createTypeChecker(host) {
65090
65078
  }
65091
65079
  if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
65092
65080
  const index = +propName;
65093
- if (accessNode && everyType(objectType, (t) => !t.target.hasRestElement) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
65081
+ if (accessNode && everyType(objectType, (t) => !(t.target.combinedFlags & 12 /* Variable */)) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
65094
65082
  const indexNode = getIndexNodeForAccessExpression(accessNode);
65095
65083
  if (isTupleType(objectType)) {
65096
65084
  if (index < 0) {
@@ -71230,7 +71218,7 @@ function createTypeChecker(host) {
71230
71218
  return firstOrUndefinedIterator(getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties));
71231
71219
  }
71232
71220
  function tupleTypesDefinitelyUnrelated(source, target) {
71233
- return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength);
71221
+ return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !(target.target.combinedFlags & 12 /* Variable */) && (!!(source.target.combinedFlags & 12 /* Variable */) || target.target.fixedLength < source.target.fixedLength);
71234
71222
  }
71235
71223
  function typesDefinitelyUnrelated(source, target) {
71236
71224
  return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) : !!getUnmatchedProperty(
@@ -71319,7 +71307,7 @@ function createTypeChecker(host) {
71319
71307
  return false;
71320
71308
  }
71321
71309
  function inferTypesFromTemplateLiteralType(source, target) {
71322
- return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types, (s, i) => {
71310
+ return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arrayIsEqualTo(source.texts, target.texts) ? map(source.types, (s, i) => {
71323
71311
  return isTypeAssignableTo(getBaseConstraintOrType(s), getBaseConstraintOrType(target.types[i])) ? s : getStringLikeTypeForType(s);
71324
71312
  }) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
71325
71313
  }
@@ -71848,7 +71836,7 @@ function createTypeChecker(host) {
71848
71836
  return;
71849
71837
  }
71850
71838
  const startLength = isTupleType(source) ? Math.min(source.target.fixedLength, target.target.fixedLength) : 0;
71851
- const endLength = Math.min(isTupleType(source) ? getEndElementCount(source.target, 3 /* Fixed */) : 0, target.target.hasRestElement ? getEndElementCount(target.target, 3 /* Fixed */) : 0);
71839
+ const endLength = Math.min(isTupleType(source) ? getEndElementCount(source.target, 3 /* Fixed */) : 0, target.target.combinedFlags & 12 /* Variable */ ? getEndElementCount(target.target, 3 /* Fixed */) : 0);
71852
71840
  for (let i = 0; i < startLength; i++) {
71853
71841
  inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
71854
71842
  }
@@ -71869,7 +71857,7 @@ function createTypeChecker(host) {
71869
71857
  } else if (elementFlags[startLength] & 8 /* Variadic */ && elementFlags[startLength + 1] & 4 /* Rest */) {
71870
71858
  const param = (_a = getInferenceInfoForType(elementTypes[startLength])) == null ? void 0 : _a.typeParameter;
71871
71859
  const constraint = param && getBaseConstraintOfType(param);
71872
- if (constraint && isTupleType(constraint) && !constraint.target.hasRestElement) {
71860
+ if (constraint && isTupleType(constraint) && !(constraint.target.combinedFlags & 12 /* Variable */)) {
71873
71861
  const impliedArity = constraint.target.fixedLength;
71874
71862
  inferFromTypes(sliceTupleType(source, startLength, sourceArity - (startLength + impliedArity)), elementTypes[startLength]);
71875
71863
  inferFromTypes(getElementTypeOfSliceOfTupleType(source, startLength + impliedArity, endLength), elementTypes[startLength + 1]);
@@ -71877,7 +71865,7 @@ function createTypeChecker(host) {
71877
71865
  } else if (elementFlags[startLength] & 4 /* Rest */ && elementFlags[startLength + 1] & 8 /* Variadic */) {
71878
71866
  const param = (_b = getInferenceInfoForType(elementTypes[startLength + 1])) == null ? void 0 : _b.typeParameter;
71879
71867
  const constraint = param && getBaseConstraintOfType(param);
71880
- if (constraint && isTupleType(constraint) && !constraint.target.hasRestElement) {
71868
+ if (constraint && isTupleType(constraint) && !(constraint.target.combinedFlags & 12 /* Variable */)) {
71881
71869
  const impliedArity = constraint.target.fixedLength;
71882
71870
  const endIndex = sourceArity - getEndElementCount(target.target, 3 /* Fixed */);
71883
71871
  const startIndex = endIndex - impliedArity;
@@ -72029,7 +72017,7 @@ function createTypeChecker(host) {
72029
72017
  const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0;
72030
72018
  const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0;
72031
72019
  if (inferredCovariantType || inferredContravariantType) {
72032
- const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType))));
72020
+ 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))));
72033
72021
  inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
72034
72022
  fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
72035
72023
  } else if (context.flags & 1 /* NoDefault */) {
@@ -73483,7 +73471,7 @@ function createTypeChecker(host) {
73483
73471
  return getEvolvingArrayType(getUnionType(map(types, getElementTypeOfEvolvingArrayType)));
73484
73472
  }
73485
73473
  const result = recombineUnknownType(getUnionType(sameMap(types, finalizeEvolvingArrayType), subtypeReduction));
73486
- if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && arraysEqual(result.types, declaredType.types)) {
73474
+ if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && arrayIsEqualTo(result.types, declaredType.types)) {
73487
73475
  return declaredType;
73488
73476
  }
73489
73477
  return result;
@@ -75888,7 +75876,7 @@ function createTypeChecker(host) {
75888
75876
  return removeMissingType(getTypeArguments(t)[index], !!(t.target.elementFlags[index] && 2 /* Optional */));
75889
75877
  }
75890
75878
  const offset = length2 !== void 0 && (lastSpreadIndex === void 0 || index > lastSpreadIndex) ? length2 - index : 0;
75891
- const fixedEndLength = offset > 0 && t.target.hasRestElement ? getEndElementCount(t.target, 3 /* Fixed */) : 0;
75879
+ const fixedEndLength = offset > 0 && t.target.combinedFlags & 12 /* Variable */ ? getEndElementCount(t.target, 3 /* Fixed */) : 0;
75892
75880
  if (offset > 0 && offset <= fixedEndLength) {
75893
75881
  return getTypeArguments(t)[getTypeReferenceArity(t) - offset];
75894
75882
  }
@@ -80718,7 +80706,7 @@ function createTypeChecker(host) {
80718
80706
  if (signatureHasRestParameter(signature)) {
80719
80707
  const restType = getTypeOfSymbol(signature.parameters[paramCount]);
80720
80708
  const index = pos - paramCount;
80721
- if (!isTupleType(restType) || restType.target.hasRestElement || index < restType.target.fixedLength) {
80709
+ if (!isTupleType(restType) || restType.target.combinedFlags & 12 /* Variable */ || index < restType.target.fixedLength) {
80722
80710
  return getIndexedAccessType(restType, getNumberLiteralType(index));
80723
80711
  }
80724
80712
  }
@@ -80756,7 +80744,7 @@ function createTypeChecker(host) {
80756
80744
  if (signatureHasRestParameter(signature)) {
80757
80745
  const restType = getTypeOfSymbol(signature.parameters[length2 - 1]);
80758
80746
  if (isTupleType(restType)) {
80759
- return length2 + restType.target.fixedLength - (restType.target.hasRestElement ? 0 : 1);
80747
+ return length2 + restType.target.fixedLength - (restType.target.combinedFlags & 12 /* Variable */ ? 0 : 1);
80760
80748
  }
80761
80749
  }
80762
80750
  return length2;
@@ -80799,7 +80787,7 @@ function createTypeChecker(host) {
80799
80787
  function hasEffectiveRestParameter(signature) {
80800
80788
  if (signatureHasRestParameter(signature)) {
80801
80789
  const restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
80802
- return !isTupleType(restType) || restType.target.hasRestElement;
80790
+ return !isTupleType(restType) || !!(restType.target.combinedFlags & 12 /* Variable */);
80803
80791
  }
80804
80792
  return false;
80805
80793
  }
@@ -80809,7 +80797,7 @@ function createTypeChecker(host) {
80809
80797
  if (!isTupleType(restType)) {
80810
80798
  return isTypeAny(restType) ? anyArrayType : restType;
80811
80799
  }
80812
- if (restType.target.hasRestElement) {
80800
+ if (restType.target.combinedFlags & 12 /* Variable */) {
80813
80801
  return sliceTupleType(restType, restType.target.fixedLength);
80814
80802
  }
80815
80803
  }
@@ -83014,7 +83002,7 @@ function createTypeChecker(host) {
83014
83002
  void 0,
83015
83003
  checkMode || 0 /* Normal */
83016
83004
  ) : checkExpressionCached(initializer, checkMode));
83017
- return isParameter(declaration) && declaration.name.kind === 207 /* ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type;
83005
+ return isParameter(declaration) && declaration.name.kind === 207 /* ArrayBindingPattern */ && isTupleType(type) && !(type.target.combinedFlags & 12 /* Variable */) && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type;
83018
83006
  }
83019
83007
  function padTupleType(type, pattern) {
83020
83008
  const patternElements = pattern.elements;
@@ -125267,7 +125255,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125267
125255
  if (file.hasNoDefaultLib) {
125268
125256
  return true;
125269
125257
  }
125270
- if (!options.noLib) {
125258
+ if (options.noLib) {
125271
125259
  return false;
125272
125260
  }
125273
125261
  const equalityComparer = host.useCaseSensitiveFileNames() ? equateStringsCaseSensitive : equateStringsCaseInsensitive;
@@ -130646,7 +130634,7 @@ function createTabularErrorsDisplay(filesInError, host) {
130646
130634
  if (distinctFiles.length === 0) return "";
130647
130635
  const numberLength = (num) => Math.log(num) * Math.LOG10E + 1;
130648
130636
  const fileToErrorCount = distinctFiles.map((file) => [file, countWhere(filesInError, (fileInError) => fileInError.fileName === file.fileName)]);
130649
- const maxErrors = fileToErrorCount.reduce((acc, value) => Math.max(acc, value[1] || 0), 0);
130637
+ const maxErrors = maxBy(fileToErrorCount, 0, (value) => value[1]);
130650
130638
  const headerRow = Diagnostics.Errors_Files.message;
130651
130639
  const leftColumnHeadingLength = headerRow.split(" ")[0].length;
130652
130640
  const leftPaddingGoal = Math.max(leftColumnHeadingLength, numberLength(maxErrors));
@@ -137179,9 +137167,6 @@ function isTypeKeywordToken(node) {
137179
137167
  function isTypeKeywordTokenOrIdentifier(node) {
137180
137168
  return isTypeKeywordToken(node) || isIdentifier(node) && node.text === "type";
137181
137169
  }
137182
- function isExternalModuleSymbol(moduleSymbol) {
137183
- return !!(moduleSymbol.flags & 1536 /* Module */) && moduleSymbol.name.charCodeAt(0) === 34 /* doubleQuote */;
137184
- }
137185
137170
  function nodeSeenTracker() {
137186
137171
  const seen = [];
137187
137172
  return (node) => {
@@ -138831,10 +138816,7 @@ function isImportablePath(fromPath, toPath3, getCanonicalFileName, globalCachePa
138831
138816
  function forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, cb) {
138832
138817
  var _a, _b;
138833
138818
  const useCaseSensitiveFileNames2 = hostUsesCaseSensitiveFileNames(host);
138834
- const excludePatterns = preferences.autoImportFileExcludePatterns && mapDefined(preferences.autoImportFileExcludePatterns, (spec) => {
138835
- const pattern = getSubPatternFromSpec(spec, "", "exclude");
138836
- return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames2) : void 0;
138837
- });
138819
+ const excludePatterns = preferences.autoImportFileExcludePatterns && getIsExcludedPatterns(preferences, useCaseSensitiveFileNames2);
138838
138820
  forEachExternalModule(program.getTypeChecker(), program.getSourceFiles(), excludePatterns, host, (module2, file) => cb(
138839
138821
  module2,
138840
138822
  file,
@@ -138867,25 +138849,17 @@ function forEachExternalModuleToImportFrom(program, host, preferences, useAutoIm
138867
138849
  (_b = host.log) == null ? void 0 : _b.call(host, `forEachExternalModuleToImportFrom autoImportProvider: ${timestamp() - start}`);
138868
138850
  }
138869
138851
  }
138870
- function forEachExternalModule(checker, allSourceFiles, excludePatterns, host, cb) {
138871
- var _a, _b;
138872
- const realpathsWithSymlinks = (_a = host.getSymlinkCache) == null ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
138873
- const isExcluded = excludePatterns && (({ fileName, path }) => {
138874
- if (excludePatterns.some((p) => p.test(fileName))) return true;
138875
- if ((realpathsWithSymlinks == null ? void 0 : realpathsWithSymlinks.size) && pathContainsNodeModules(fileName)) {
138876
- let dir = getDirectoryPath(fileName);
138877
- return forEachAncestorDirectory(getDirectoryPath(path), (dirPath) => {
138878
- const symlinks = realpathsWithSymlinks.get(ensureTrailingDirectorySeparator(dirPath));
138879
- if (symlinks) {
138880
- return symlinks.some((s) => excludePatterns.some((p) => p.test(fileName.replace(dir, s))));
138881
- }
138882
- dir = getDirectoryPath(dir);
138883
- }) ?? false;
138884
- }
138885
- return false;
138852
+ function getIsExcludedPatterns(preferences, useCaseSensitiveFileNames2) {
138853
+ return mapDefined(preferences.autoImportFileExcludePatterns, (spec) => {
138854
+ const pattern = getSubPatternFromSpec(spec, "", "exclude");
138855
+ return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames2) : void 0;
138886
138856
  });
138857
+ }
138858
+ function forEachExternalModule(checker, allSourceFiles, excludePatterns, host, cb) {
138859
+ var _a;
138860
+ const isExcluded = excludePatterns && getIsExcluded(excludePatterns, host);
138887
138861
  for (const ambient of checker.getAmbientModules()) {
138888
- if (!ambient.name.includes("*") && !(excludePatterns && ((_b = ambient.declarations) == null ? void 0 : _b.every((d) => isExcluded(d.getSourceFile()))))) {
138862
+ if (!ambient.name.includes("*") && !(excludePatterns && ((_a = ambient.declarations) == null ? void 0 : _a.every((d) => isExcluded(d.getSourceFile()))))) {
138889
138863
  cb(
138890
138864
  ambient,
138891
138865
  /*sourceFile*/
@@ -138899,6 +138873,28 @@ function forEachExternalModule(checker, allSourceFiles, excludePatterns, host, c
138899
138873
  }
138900
138874
  }
138901
138875
  }
138876
+ function getIsExcluded(excludePatterns, host) {
138877
+ var _a;
138878
+ const realpathsWithSymlinks = (_a = host.getSymlinkCache) == null ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
138879
+ return ({ fileName, path }) => {
138880
+ if (excludePatterns.some((p) => p.test(fileName))) return true;
138881
+ if ((realpathsWithSymlinks == null ? void 0 : realpathsWithSymlinks.size) && pathContainsNodeModules(fileName)) {
138882
+ let dir = getDirectoryPath(fileName);
138883
+ return forEachAncestorDirectory(getDirectoryPath(path), (dirPath) => {
138884
+ const symlinks = realpathsWithSymlinks.get(ensureTrailingDirectorySeparator(dirPath));
138885
+ if (symlinks) {
138886
+ return symlinks.some((s) => excludePatterns.some((p) => p.test(fileName.replace(dir, s))));
138887
+ }
138888
+ dir = getDirectoryPath(dir);
138889
+ }) ?? false;
138890
+ }
138891
+ return false;
138892
+ };
138893
+ }
138894
+ function getIsFileExcluded(host, preferences) {
138895
+ if (!preferences.autoImportFileExcludePatterns) return () => false;
138896
+ return getIsExcluded(getIsExcludedPatterns(preferences, hostUsesCaseSensitiveFileNames(host)), host);
138897
+ }
138902
138898
  function getExportInfoMap(importingFile, host, program, preferences, cancellationToken) {
138903
138899
  var _a, _b, _c, _d, _e;
138904
138900
  const start = timestamp();
@@ -144233,7 +144229,7 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR
144233
144229
  const unusedImportsFromOldFile = /* @__PURE__ */ new Set();
144234
144230
  for (const statement of toMove) {
144235
144231
  forEachReference(statement, checker, (symbol, isValidTypeOnlyUseSite) => {
144236
- if (!symbol.declarations) {
144232
+ if (!symbol.declarations || isGlobalType(checker, symbol)) {
144237
144233
  return;
144238
144234
  }
144239
144235
  if (existingTargetLocals.has(skipAlias(symbol, checker))) {
@@ -144283,6 +144279,16 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR
144283
144279
  return !!jsxNamespaceSymbol2 && some(jsxNamespaceSymbol2.declarations, isInImport) ? jsxNamespaceSymbol2 : void 0;
144284
144280
  }
144285
144281
  }
144282
+ function isGlobalType(checker, symbol) {
144283
+ return !!checker.resolveName(
144284
+ symbol.name,
144285
+ /*location*/
144286
+ void 0,
144287
+ 788968 /* Type */,
144288
+ /*excludeGlobals*/
144289
+ false
144290
+ );
144291
+ }
144286
144292
  function makeUniqueFilename(proposedFilename, extension, inDirectory, host) {
144287
144293
  let newFilename = proposedFilename;
144288
144294
  for (let i = 1; ; i++) {
@@ -154550,7 +154556,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
154550
154556
  addImport(first(info));
154551
154557
  }
154552
154558
  function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite, referenceImport) {
154553
- var _a;
154559
+ var _a, _b;
154554
154560
  const moduleSymbol = Debug.checkDefined(exportedSymbol.parent);
154555
154561
  const symbolName2 = getNameForExportedSymbol(exportedSymbol, getEmitScriptTarget(compilerOptions));
154556
154562
  const checker = program.getTypeChecker();
@@ -154567,10 +154573,14 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
154567
154573
  preferences,
154568
154574
  cancellationToken
154569
154575
  );
154576
+ if (!exportInfo) {
154577
+ Debug.assert((_a = preferences.autoImportFileExcludePatterns) == null ? void 0 : _a.length);
154578
+ return;
154579
+ }
154570
154580
  const useRequire = shouldUseRequire(sourceFile, program);
154571
154581
  let fix = getImportFixForSymbol(
154572
154582
  sourceFile,
154573
- Debug.checkDefined(exportInfo),
154583
+ exportInfo,
154574
154584
  program,
154575
154585
  /*position*/
154576
154586
  void 0,
@@ -154580,7 +154590,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
154580
154590
  preferences
154581
154591
  );
154582
154592
  if (fix) {
154583
- const localName = ((_a = tryCast(referenceImport == null ? void 0 : referenceImport.name, isIdentifier)) == null ? void 0 : _a.text) ?? symbolName2;
154593
+ const localName = ((_b = tryCast(referenceImport == null ? void 0 : referenceImport.name, isIdentifier)) == null ? void 0 : _b.text) ?? symbolName2;
154584
154594
  if (referenceImport && isTypeOnlyImportDeclaration(referenceImport) && (fix.kind === 3 /* AddNew */ || fix.kind === 2 /* AddToExisting */) && fix.addAsTypeOnly === 1 /* Allowed */) {
154585
154595
  fix = { ...fix, addAsTypeOnly: 2 /* Required */ };
154586
154596
  }
@@ -155029,8 +155039,12 @@ function codeFixActionToCodeAction({ description: description3, changes, command
155029
155039
  }
155030
155040
  function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) {
155031
155041
  const getChecker = createGetChecker(program, host);
155042
+ const isFileExcluded = preferences.autoImportFileExcludePatterns && getIsFileExcluded(host, preferences);
155043
+ const mergedModuleSymbol = program.getTypeChecker().getMergedSymbol(moduleSymbol);
155044
+ const moduleSourceFile = isFileExcluded && mergedModuleSymbol.declarations && getDeclarationOfKind(mergedModuleSymbol, 307 /* SourceFile */);
155045
+ const moduleSymbolExcluded = moduleSourceFile && isFileExcluded(moduleSourceFile);
155032
155046
  return getExportInfoMap(importingFile, host, program, preferences, cancellationToken).search(importingFile.path, preferCapitalized, (name) => name === symbolName2, (info) => {
155033
- if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol && info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol)) {
155047
+ if (getChecker(info[0].isFromPackageJson).getMergedSymbol(skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson))) === symbol && (moduleSymbolExcluded || info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol))) {
155034
155048
  return info;
155035
155049
  }
155036
155050
  });
@@ -171362,7 +171376,7 @@ function getJsDocCommentsFromDeclarations(declarations, checker) {
171362
171376
  return flatten(intersperse(parts, [lineBreakPart()]));
171363
171377
  }
171364
171378
  function isIdenticalListOfDisplayParts(parts1, parts2) {
171365
- return arraysEqual(parts1, parts2, (p1, p2) => p1.kind === p2.kind && p1.text === p2.text);
171379
+ return arrayIsEqualTo(parts1, parts2, (p1, p2) => p1.kind === p2.kind && p1.text === p2.text);
171366
171380
  }
171367
171381
  function getCommentHavingNodes(declaration) {
171368
171382
  switch (declaration.kind) {
@@ -178772,7 +178786,6 @@ __export(ts_exports2, {
178772
178786
  arrayToMap: () => arrayToMap,
178773
178787
  arrayToMultiMap: () => arrayToMultiMap,
178774
178788
  arrayToNumericMap: () => arrayToNumericMap,
178775
- arraysEqual: () => arraysEqual,
178776
178789
  assertType: () => assertType,
178777
178790
  assign: () => assign,
178778
178791
  assignHelper: () => assignHelper,
@@ -179375,6 +179388,7 @@ __export(ts_exports2, {
179375
179388
  getInterfaceBaseTypeNodes: () => getInterfaceBaseTypeNodes,
179376
179389
  getInternalEmitFlags: () => getInternalEmitFlags,
179377
179390
  getInvokedExpression: () => getInvokedExpression,
179391
+ getIsFileExcluded: () => getIsFileExcluded,
179378
179392
  getIsolatedModules: () => getIsolatedModules,
179379
179393
  getJSDocAugmentsTag: () => getJSDocAugmentsTag,
179380
179394
  getJSDocClassTag: () => getJSDocClassTag,
@@ -180453,7 +180467,6 @@ __export(ts_exports2, {
180453
180467
  map: () => map,
180454
180468
  mapAllOrFail: () => mapAllOrFail,
180455
180469
  mapDefined: () => mapDefined,
180456
- mapDefinedEntries: () => mapDefinedEntries,
180457
180470
  mapDefinedIterator: () => mapDefinedIterator,
180458
180471
  mapEntries: () => mapEntries,
180459
180472
  mapIterator: () => mapIterator,
@@ -180463,6 +180476,7 @@ __export(ts_exports2, {
180463
180476
  matchPatternOrExact: () => matchPatternOrExact,
180464
180477
  matchedText: () => matchedText,
180465
180478
  matchesExclude: () => matchesExclude,
180479
+ maxBy: () => maxBy,
180466
180480
  maybeBind: () => maybeBind,
180467
180481
  maybeSetLocalizedDiagnosticMessages: () => maybeSetLocalizedDiagnosticMessages,
180468
180482
  memoize: () => memoize,
@@ -181187,7 +181201,6 @@ var TypingsInstaller = class {
181187
181201
  this.missingTypingsSet = /* @__PURE__ */ new Set();
181188
181202
  this.knownCachesSet = /* @__PURE__ */ new Set();
181189
181203
  this.projectWatchers = /* @__PURE__ */ new Map();
181190
- /** @internal */
181191
181204
  this.pendingRunRequests = [];
181192
181205
  this.installRunCount = 1;
181193
181206
  this.inFlightRequestCount = 0;
@@ -182606,9 +182619,7 @@ var Project3 = class _Project {
182606
182619
  * @internal
182607
182620
  */
182608
182621
  this.cachedUnresolvedImportsPerFile = /* @__PURE__ */ new Map();
182609
- /** @internal */
182610
182622
  this.hasAddedorRemovedFiles = false;
182611
- /** @internal */
182612
182623
  this.hasAddedOrRemovedSymlinks = false;
182613
182624
  /**
182614
182625
  * Last version that was reported.
@@ -182633,7 +182644,6 @@ var Project3 = class _Project {
182633
182644
  this.dirty = false;
182634
182645
  /** @internal */
182635
182646
  this.typingFiles = emptyArray2;
182636
- /** @internal */
182637
182647
  this.moduleSpecifierCache = createModuleSpecifierCache(this);
182638
182648
  /** @internal */
182639
182649
  this.createHash = maybeBind(this.projectService.host, this.projectService.host.createHash);
@@ -183463,12 +183473,10 @@ var Project3 = class _Project {
183463
183473
  this.projectService.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(this);
183464
183474
  }
183465
183475
  }
183466
- /** @internal */
183467
183476
  closeWatchingTypingLocations() {
183468
183477
  if (this.typingWatchers) clearMap(this.typingWatchers, closeFileWatcher);
183469
183478
  this.typingWatchers = void 0;
183470
183479
  }
183471
- /** @internal */
183472
183480
  onTypingInstallerWatchInvoke() {
183473
183481
  this.typingWatchers.isInvoked = true;
183474
183482
  this.projectService.updateTypingsForProject({ projectName: this.getProjectName(), kind: ActionInvalidate });
@@ -183824,7 +183832,6 @@ var Project3 = class _Project {
183824
183832
  false
183825
183833
  );
183826
183834
  }
183827
- /** @internal */
183828
183835
  filesToStringWorker(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
183829
183836
  if (this.isInitialLoadPending()) return " Files (0) InitialLoadPending\n";
183830
183837
  if (!this.program) return " Files (0) NoProgram\n";
@@ -184158,7 +184165,6 @@ var Project3 = class _Project {
184158
184165
  (_c = tracing) == null ? void 0 : _c.pop();
184159
184166
  }
184160
184167
  }
184161
- /** @internal */
184162
184168
  isDefaultProjectForOpenFiles() {
184163
184169
  return !!forEachEntry(
184164
184170
  this.projectService.openFiles,
@@ -184199,7 +184205,6 @@ var Project3 = class _Project {
184199
184205
  (_d = this.getScriptInfo(rootFile)) == null ? void 0 : _d.editContent(0, this.program.getSourceFile(rootFile).getText().length, originalText);
184200
184206
  }
184201
184207
  }
184202
- /** @internal */
184203
184208
  getCompilerOptionsForNoDtsResolutionProject() {
184204
184209
  return {
184205
184210
  ...this.getCompilerOptions(),
@@ -184617,7 +184622,6 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
184617
184622
  return (_a = this.hostProject.getCurrentProgram()) == null ? void 0 : _a.getModuleResolutionCache();
184618
184623
  }
184619
184624
  };
184620
- /** @internal */
184621
184625
  _AutoImportProviderProject.maxDependencies = 10;
184622
184626
  /** @internal */
184623
184627
  _AutoImportProviderProject.compilerOptionsOverrides = {
@@ -184692,7 +184696,6 @@ var ConfiguredProject2 = class extends Project3 {
184692
184696
  onReleaseParsedCommandLine(fileName) {
184693
184697
  this.releaseParsedConfig(asNormalizedPath(this.projectService.toCanonicalFileName(asNormalizedPath(normalizePath(fileName)))));
184694
184698
  }
184695
- /** @internal */
184696
184699
  releaseParsedConfig(canonicalConfigFilePath) {
184697
184700
  this.projectService.stopWatchingWildCards(canonicalConfigFilePath, this);
184698
184701
  this.projectService.releaseParsedConfig(canonicalConfigFilePath, this);
@@ -185418,9 +185421,7 @@ var _ProjectService = class _ProjectService {
185418
185421
  this.pendingEnsureProjectForOpenFiles = false;
185419
185422
  /** Tracks projects that we have already sent telemetry for. */
185420
185423
  this.seenProjects = /* @__PURE__ */ new Map();
185421
- /** @internal */
185422
185424
  this.sharedExtendedConfigFileWatchers = /* @__PURE__ */ new Map();
185423
- /** @internal */
185424
185425
  this.extendedConfigCache = /* @__PURE__ */ new Map();
185425
185426
  /** @internal */
185426
185427
  this.baseline = noop;
@@ -185875,8 +185876,6 @@ var _ProjectService = class _ProjectService {
185875
185876
  }
185876
185877
  /**
185877
185878
  * This is to watch whenever files are added or removed to the wildcard directories
185878
- *
185879
- * @internal
185880
185879
  */
185881
185880
  watchWildcardDirectory(directory, flags, configFileName, config) {
185882
185881
  let watcher = this.watchFactory.watchDirectory(
@@ -185956,7 +185955,6 @@ var _ProjectService = class _ProjectService {
185956
185955
  };
185957
185956
  return result;
185958
185957
  }
185959
- /** @internal */
185960
185958
  delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
185961
185959
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
185962
185960
  if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config)) return false;
@@ -185984,7 +185982,6 @@ var _ProjectService = class _ProjectService {
185984
185982
  });
185985
185983
  return scheduledAnyProjectUpdate;
185986
185984
  }
185987
- /** @internal */
185988
185985
  onConfigFileChanged(configFileName, canonicalConfigFilePath, eventKind) {
185989
185986
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
185990
185987
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath);
@@ -186206,7 +186203,6 @@ var _ProjectService = class _ProjectService {
186206
186203
  this.configFileExistenceInfoCache.set(canonicalConfigFilePath, { exists, openFilesImpactedByConfigFile });
186207
186204
  return exists;
186208
186205
  }
186209
- /** @internal */
186210
186206
  createConfigFileWatcherForParsedConfig(configFileName, canonicalConfigFilePath, forProject) {
186211
186207
  var _a, _b;
186212
186208
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
@@ -186565,8 +186561,6 @@ var _ProjectService = class _ProjectService {
186565
186561
  }
186566
186562
  /**
186567
186563
  * Read the config file of the project, and update the project root file names.
186568
- *
186569
- * @internal
186570
186564
  */
186571
186565
  loadConfiguredProject(project, reason) {
186572
186566
  var _a, _b;
@@ -186818,7 +186812,6 @@ var _ProjectService = class _ProjectService {
186818
186812
  project.markAsDirty();
186819
186813
  return project.updateGraph();
186820
186814
  }
186821
- /** @internal */
186822
186815
  reloadFileNamesOfParsedConfig(configFileName, config) {
186823
186816
  if (config.updateLevel === void 0) return config.parsedCommandLine.fileNames;
186824
186817
  Debug.assert(config.updateLevel === 1 /* RootNamesAndUpdate */);
@@ -186863,7 +186856,6 @@ var _ProjectService = class _ProjectService {
186863
186856
  true
186864
186857
  );
186865
186858
  }
186866
- /** @internal */
186867
186859
  clearSemanticCache(project) {
186868
186860
  project.originalConfiguredProjects = void 0;
186869
186861
  project.resolutionCache.clear();
@@ -187440,7 +187432,6 @@ Dynamic files must always be opened with service's current directory or service
187440
187432
  getWatchOptions(project) {
187441
187433
  return this.getWatchOptionsFromProjectWatchOptions(project.getWatchOptions(), project.getCurrentDirectory());
187442
187434
  }
187443
- /** @internal */
187444
187435
  getWatchOptionsFromProjectWatchOptions(projectOptions, basePath) {
187445
187436
  const hostWatchOptions = !this.hostConfiguration.beforeSubstitution ? this.hostConfiguration.watchOptions : handleWatchOptionsConfigDirTemplateSubstitution(
187446
187437
  this.hostConfiguration.beforeSubstitution,
@@ -187829,12 +187820,12 @@ Dynamic files must always be opened with service's current directory or service
187829
187820
  }
187830
187821
  /** @internal */
187831
187822
  loadAncestorProjectTree(forProjects) {
187832
- forProjects = forProjects || mapDefinedEntries(
187833
- this.configuredProjects,
187834
- (key, project) => !project.isInitialLoadPending() ? [key, true] : void 0
187835
- );
187823
+ forProjects ?? (forProjects = new Set(
187824
+ mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.isInitialLoadPending() ? key : void 0)
187825
+ ));
187836
187826
  const seenProjects = /* @__PURE__ */ new Set();
187837
- for (const project of arrayFrom(this.configuredProjects.values())) {
187827
+ const currentConfiguredProjects = arrayFrom(this.configuredProjects.values());
187828
+ for (const project of currentConfiguredProjects) {
187838
187829
  if (forEachPotentialProjectReference(project, (potentialRefPath) => forProjects.has(potentialRefPath))) {
187839
187830
  updateProjectIfDirty(project);
187840
187831
  }
@@ -188330,7 +188321,6 @@ Dynamic files must always be opened with service's current directory or service
188330
188321
  }
188331
188322
  /**
188332
188323
  * Performs the remaining steps of enabling a plugin after its module has been instantiated.
188333
- * @internal
188334
188324
  */
188335
188325
  endEnablePlugin(project, { pluginConfigEntry, resolvedModule, errorLogs }) {
188336
188326
  var _a;
@@ -188446,7 +188436,6 @@ Dynamic files must always be opened with service's current directory or service
188446
188436
  }
188447
188437
  });
188448
188438
  }
188449
- /** @internal */
188450
188439
  watchPackageJsonFile(file, path, project) {
188451
188440
  Debug.assert(project !== void 0);
188452
188441
  let result = (this.packageJsonFilesMap ?? (this.packageJsonFilesMap = /* @__PURE__ */ new Map())).get(path);
@@ -188487,7 +188476,6 @@ Dynamic files must always be opened with service's current directory or service
188487
188476
  result.projects.add(project);
188488
188477
  (project.packageJsonWatches ?? (project.packageJsonWatches = /* @__PURE__ */ new Set())).add(result);
188489
188478
  }
188490
- /** @internal */
188491
188479
  onPackageJsonChange(result) {
188492
188480
  result.projects.forEach((project) => {
188493
188481
  var _a;
@@ -193307,7 +193295,6 @@ if (typeof console !== "undefined") {
193307
193295
  arrayToMap,
193308
193296
  arrayToMultiMap,
193309
193297
  arrayToNumericMap,
193310
- arraysEqual,
193311
193298
  assertType,
193312
193299
  assign,
193313
193300
  assignHelper,
@@ -193910,6 +193897,7 @@ if (typeof console !== "undefined") {
193910
193897
  getInterfaceBaseTypeNodes,
193911
193898
  getInternalEmitFlags,
193912
193899
  getInvokedExpression,
193900
+ getIsFileExcluded,
193913
193901
  getIsolatedModules,
193914
193902
  getJSDocAugmentsTag,
193915
193903
  getJSDocClassTag,
@@ -194988,7 +194976,6 @@ if (typeof console !== "undefined") {
194988
194976
  map,
194989
194977
  mapAllOrFail,
194990
194978
  mapDefined,
194991
- mapDefinedEntries,
194992
194979
  mapDefinedIterator,
194993
194980
  mapEntries,
194994
194981
  mapIterator,
@@ -194998,6 +194985,7 @@ if (typeof console !== "undefined") {
194998
194985
  matchPatternOrExact,
194999
194986
  matchedText,
195000
194987
  matchesExclude,
194988
+ maxBy,
195001
194989
  maybeBind,
195002
194990
  maybeSetLocalizedDiagnosticMessages,
195003
194991
  memoize,
@@ -195455,6 +195443,5 @@ if (typeof console !== "undefined") {
195455
195443
  writeFileEnsuringDirectories,
195456
195444
  zipWith
195457
195445
  });
195458
- })(typeof module !== "undefined" && module.exports ? module : { exports: ts });
195459
- if (typeof module !== "undefined" && module.exports) { ts = module.exports; }
195446
+ })({ get exports() { return ts; }, set exports(v) { ts = v; if (typeof module !== "undefined" && module.exports) { module.exports = v; } } })
195460
195447
  //# sourceMappingURL=typescript.js.map