@typescript-deploys/pr-build 5.1.0-pr-53420-2 → 5.1.0-pr-53489-6

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
@@ -53978,7 +53978,35 @@ function createTypeChecker(host) {
53978
53978
  return emptyArray;
53979
53979
  }
53980
53980
  function getSignaturesOfType(type, kind) {
53981
- return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
53981
+ const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
53982
+ if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
53983
+ if (type.arrayFallbackSignatures) {
53984
+ return type.arrayFallbackSignatures;
53985
+ }
53986
+ let memberName;
53987
+ if (everyType(type, (t) => {
53988
+ var _a2;
53989
+ return !!((_a2 = t.symbol) == null ? void 0 : _a2.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
53990
+ })) {
53991
+ const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
53992
+ const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
53993
+ return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
53994
+ }
53995
+ type.arrayFallbackSignatures = result;
53996
+ }
53997
+ return result;
53998
+ }
53999
+ function isArrayOrTupleSymbol(symbol) {
54000
+ if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
54001
+ return false;
54002
+ }
54003
+ return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
54004
+ }
54005
+ function isReadonlyArraySymbol(symbol) {
54006
+ if (!symbol || !globalReadonlyArrayType.symbol) {
54007
+ return false;
54008
+ }
54009
+ return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
53982
54010
  }
53983
54011
  function findIndexInfo(indexInfos, keyType) {
53984
54012
  return find(indexInfos, (info) => info.keyType === keyType);
@@ -118065,6 +118093,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118065
118093
  resolutionHost.getCompilationSettings(),
118066
118094
  moduleResolutionCache.getPackageJsonInfoCache()
118067
118095
  );
118096
+ const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
118097
+ const customFailedLookupPaths = /* @__PURE__ */ new Map();
118068
118098
  const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
118069
118099
  const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
118070
118100
  const rootDir = rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
@@ -118109,6 +118139,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118109
118139
  function clear2() {
118110
118140
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
118111
118141
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
118142
+ customFailedLookupPaths.clear();
118112
118143
  nonRelativeExternalModuleResolutions.clear();
118113
118144
  closeTypeRootsWatch();
118114
118145
  resolvedModuleNames.clear();
@@ -118418,7 +118449,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118418
118449
  dirPath = getDirectoryPath(dirPath);
118419
118450
  }
118420
118451
  if (isNodeModulesDirectory(dirPath)) {
118421
- return canWatchDirectoryOrFile(dirPath) ? { dir, dirPath } : void 0;
118452
+ return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
118422
118453
  }
118423
118454
  let nonRecursive = true;
118424
118455
  let subDirectoryPath, subDirectory;
@@ -118437,6 +118468,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118437
118468
  }
118438
118469
  return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
118439
118470
  }
118471
+ function isPathWithDefaultFailedLookupExtension(path) {
118472
+ return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
118473
+ }
118440
118474
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
118441
118475
  var _a2, _b;
118442
118476
  if (resolution.refCount) {
@@ -118475,6 +118509,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118475
118509
  const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
118476
118510
  if (toWatch) {
118477
118511
  const { dir, dirPath, nonRecursive } = toWatch;
118512
+ if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
118513
+ const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
118514
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
118515
+ }
118478
118516
  if (dirPath === rootPath) {
118479
118517
  Debug.assert(!nonRecursive);
118480
118518
  setAtRoot = true;
@@ -118509,10 +118547,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118509
118547
  );
118510
118548
  }
118511
118549
  }
118512
- function isInRootPathOrCanWatchDirectoryOrFile(locationToWatch) {
118513
- const path = resolutionHost.toPath(locationToWatch);
118514
- return isInDirectoryPath(rootPath, path) || canWatchDirectoryOrFile(path);
118515
- }
118516
118550
  function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
118517
118551
  const fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
118518
118552
  if (fileWatcher) {
@@ -118540,7 +118574,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118540
118574
  }
118541
118575
  const paths = /* @__PURE__ */ new Set();
118542
118576
  paths.add(locationToWatch);
118543
- let actualWatcher = isInRootPathOrCanWatchDirectoryOrFile(locationToWatch) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
118577
+ let actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
118544
118578
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
118545
118579
  const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
118546
118580
  paths.forEach((path) => {
@@ -118611,6 +118645,15 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118611
118645
  const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
118612
118646
  if (toWatch) {
118613
118647
  const { dirPath } = toWatch;
118648
+ const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
118649
+ if (refCount) {
118650
+ if (refCount === 1) {
118651
+ customFailedLookupPaths.delete(failedLookupLocationPath);
118652
+ } else {
118653
+ Debug.assert(refCount > 1);
118654
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
118655
+ }
118656
+ }
118614
118657
  if (dirPath === rootPath) {
118615
118658
  removeAtRoot = true;
118616
118659
  } else {
@@ -118708,10 +118751,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118708
118751
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
118709
118752
  (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
118710
118753
  } else {
118711
- if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
118754
+ if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
118712
118755
  return false;
118713
118756
  }
118714
- if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
118757
+ if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
118715
118758
  return false;
118716
118759
  }
118717
118760
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
@@ -118808,10 +118851,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118808
118851
  closeTypeRootsWatch();
118809
118852
  }
118810
118853
  }
118811
- function canWatchTypeRootPath(typeRoot) {
118812
- return !!resolutionHost.getCompilationSettings().typeRoots || // Otherwise we'll only watch this path if it falls within `rootDir` or
118813
- // the path is not disqualified by other criteria ("not `C:\Users\Name\Dir`").
118814
- isInRootPathOrCanWatchDirectoryOrFile(getDirectoryPath(typeRoot));
118854
+ function canWatchTypeRootPath(nodeTypesDirectory) {
118855
+ if (resolutionHost.getCompilationSettings().typeRoots)
118856
+ return true;
118857
+ const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
118858
+ const dirPath = resolutionHost.toPath(dir);
118859
+ return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
118815
118860
  }
118816
118861
  }
118817
118862
  function resolutionIsSymlink(resolution) {
package/lib/tsserver.js CHANGED
@@ -58605,7 +58605,35 @@ function createTypeChecker(host) {
58605
58605
  return emptyArray;
58606
58606
  }
58607
58607
  function getSignaturesOfType(type, kind) {
58608
- return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
58608
+ const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
58609
+ if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
58610
+ if (type.arrayFallbackSignatures) {
58611
+ return type.arrayFallbackSignatures;
58612
+ }
58613
+ let memberName;
58614
+ if (everyType(type, (t) => {
58615
+ var _a2;
58616
+ return !!((_a2 = t.symbol) == null ? void 0 : _a2.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
58617
+ })) {
58618
+ const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
58619
+ const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
58620
+ return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
58621
+ }
58622
+ type.arrayFallbackSignatures = result;
58623
+ }
58624
+ return result;
58625
+ }
58626
+ function isArrayOrTupleSymbol(symbol) {
58627
+ if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
58628
+ return false;
58629
+ }
58630
+ return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
58631
+ }
58632
+ function isReadonlyArraySymbol(symbol) {
58633
+ if (!symbol || !globalReadonlyArrayType.symbol) {
58634
+ return false;
58635
+ }
58636
+ return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
58609
58637
  }
58610
58638
  function findIndexInfo(indexInfos, keyType) {
58611
58639
  return find(indexInfos, (info) => info.keyType === keyType);
@@ -122960,6 +122988,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122960
122988
  resolutionHost.getCompilationSettings(),
122961
122989
  moduleResolutionCache.getPackageJsonInfoCache()
122962
122990
  );
122991
+ const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
122992
+ const customFailedLookupPaths = /* @__PURE__ */ new Map();
122963
122993
  const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
122964
122994
  const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
122965
122995
  const rootDir = rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
@@ -123004,6 +123034,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123004
123034
  function clear2() {
123005
123035
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
123006
123036
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
123037
+ customFailedLookupPaths.clear();
123007
123038
  nonRelativeExternalModuleResolutions.clear();
123008
123039
  closeTypeRootsWatch();
123009
123040
  resolvedModuleNames.clear();
@@ -123313,7 +123344,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123313
123344
  dirPath = getDirectoryPath(dirPath);
123314
123345
  }
123315
123346
  if (isNodeModulesDirectory(dirPath)) {
123316
- return canWatchDirectoryOrFile(dirPath) ? { dir, dirPath } : void 0;
123347
+ return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
123317
123348
  }
123318
123349
  let nonRecursive = true;
123319
123350
  let subDirectoryPath, subDirectory;
@@ -123332,6 +123363,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123332
123363
  }
123333
123364
  return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
123334
123365
  }
123366
+ function isPathWithDefaultFailedLookupExtension(path) {
123367
+ return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
123368
+ }
123335
123369
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
123336
123370
  var _a2, _b;
123337
123371
  if (resolution.refCount) {
@@ -123370,6 +123404,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123370
123404
  const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
123371
123405
  if (toWatch) {
123372
123406
  const { dir, dirPath, nonRecursive } = toWatch;
123407
+ if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
123408
+ const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
123409
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
123410
+ }
123373
123411
  if (dirPath === rootPath) {
123374
123412
  Debug.assert(!nonRecursive);
123375
123413
  setAtRoot = true;
@@ -123404,10 +123442,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123404
123442
  );
123405
123443
  }
123406
123444
  }
123407
- function isInRootPathOrCanWatchDirectoryOrFile(locationToWatch) {
123408
- const path = resolutionHost.toPath(locationToWatch);
123409
- return isInDirectoryPath(rootPath, path) || canWatchDirectoryOrFile(path);
123410
- }
123411
123445
  function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
123412
123446
  const fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
123413
123447
  if (fileWatcher) {
@@ -123435,7 +123469,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123435
123469
  }
123436
123470
  const paths = /* @__PURE__ */ new Set();
123437
123471
  paths.add(locationToWatch);
123438
- let actualWatcher = isInRootPathOrCanWatchDirectoryOrFile(locationToWatch) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
123472
+ let actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
123439
123473
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
123440
123474
  const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
123441
123475
  paths.forEach((path) => {
@@ -123506,6 +123540,15 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123506
123540
  const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
123507
123541
  if (toWatch) {
123508
123542
  const { dirPath } = toWatch;
123543
+ const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
123544
+ if (refCount) {
123545
+ if (refCount === 1) {
123546
+ customFailedLookupPaths.delete(failedLookupLocationPath);
123547
+ } else {
123548
+ Debug.assert(refCount > 1);
123549
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
123550
+ }
123551
+ }
123509
123552
  if (dirPath === rootPath) {
123510
123553
  removeAtRoot = true;
123511
123554
  } else {
@@ -123603,10 +123646,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123603
123646
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
123604
123647
  (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
123605
123648
  } else {
123606
- if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
123649
+ if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
123607
123650
  return false;
123608
123651
  }
123609
- if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
123652
+ if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
123610
123653
  return false;
123611
123654
  }
123612
123655
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
@@ -123703,10 +123746,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123703
123746
  closeTypeRootsWatch();
123704
123747
  }
123705
123748
  }
123706
- function canWatchTypeRootPath(typeRoot) {
123707
- return !!resolutionHost.getCompilationSettings().typeRoots || // Otherwise we'll only watch this path if it falls within `rootDir` or
123708
- // the path is not disqualified by other criteria ("not `C:\Users\Name\Dir`").
123709
- isInRootPathOrCanWatchDirectoryOrFile(getDirectoryPath(typeRoot));
123749
+ function canWatchTypeRootPath(nodeTypesDirectory) {
123750
+ if (resolutionHost.getCompilationSettings().typeRoots)
123751
+ return true;
123752
+ const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
123753
+ const dirPath = resolutionHost.toPath(dir);
123754
+ return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
123710
123755
  }
123711
123756
  }
123712
123757
  function resolutionIsSymlink(resolution) {
@@ -56413,7 +56413,35 @@ ${lanes.join("\n")}
56413
56413
  return emptyArray;
56414
56414
  }
56415
56415
  function getSignaturesOfType(type, kind) {
56416
- return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
56416
+ const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
56417
+ if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
56418
+ if (type.arrayFallbackSignatures) {
56419
+ return type.arrayFallbackSignatures;
56420
+ }
56421
+ let memberName;
56422
+ if (everyType(type, (t) => {
56423
+ var _a2;
56424
+ return !!((_a2 = t.symbol) == null ? void 0 : _a2.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
56425
+ })) {
56426
+ const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
56427
+ const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
56428
+ return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
56429
+ }
56430
+ type.arrayFallbackSignatures = result;
56431
+ }
56432
+ return result;
56433
+ }
56434
+ function isArrayOrTupleSymbol(symbol) {
56435
+ if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
56436
+ return false;
56437
+ }
56438
+ return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
56439
+ }
56440
+ function isReadonlyArraySymbol(symbol) {
56441
+ if (!symbol || !globalReadonlyArrayType.symbol) {
56442
+ return false;
56443
+ }
56444
+ return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
56417
56445
  }
56418
56446
  function findIndexInfo(indexInfos, keyType) {
56419
56447
  return find(indexInfos, (info) => info.keyType === keyType);
@@ -121131,6 +121159,8 @@ ${lanes.join("\n")}
121131
121159
  resolutionHost.getCompilationSettings(),
121132
121160
  moduleResolutionCache.getPackageJsonInfoCache()
121133
121161
  );
121162
+ const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
121163
+ const customFailedLookupPaths = /* @__PURE__ */ new Map();
121134
121164
  const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
121135
121165
  const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
121136
121166
  const rootDir = rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
@@ -121175,6 +121205,7 @@ ${lanes.join("\n")}
121175
121205
  function clear2() {
121176
121206
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
121177
121207
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
121208
+ customFailedLookupPaths.clear();
121178
121209
  nonRelativeExternalModuleResolutions.clear();
121179
121210
  closeTypeRootsWatch();
121180
121211
  resolvedModuleNames.clear();
@@ -121484,7 +121515,7 @@ ${lanes.join("\n")}
121484
121515
  dirPath = getDirectoryPath(dirPath);
121485
121516
  }
121486
121517
  if (isNodeModulesDirectory(dirPath)) {
121487
- return canWatchDirectoryOrFile(dirPath) ? { dir, dirPath } : void 0;
121518
+ return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
121488
121519
  }
121489
121520
  let nonRecursive = true;
121490
121521
  let subDirectoryPath, subDirectory;
@@ -121503,6 +121534,9 @@ ${lanes.join("\n")}
121503
121534
  }
121504
121535
  return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
121505
121536
  }
121537
+ function isPathWithDefaultFailedLookupExtension(path) {
121538
+ return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
121539
+ }
121506
121540
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
121507
121541
  var _a2, _b;
121508
121542
  if (resolution.refCount) {
@@ -121541,6 +121575,10 @@ ${lanes.join("\n")}
121541
121575
  const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
121542
121576
  if (toWatch) {
121543
121577
  const { dir, dirPath, nonRecursive } = toWatch;
121578
+ if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
121579
+ const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
121580
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
121581
+ }
121544
121582
  if (dirPath === rootPath) {
121545
121583
  Debug.assert(!nonRecursive);
121546
121584
  setAtRoot = true;
@@ -121575,10 +121613,6 @@ ${lanes.join("\n")}
121575
121613
  );
121576
121614
  }
121577
121615
  }
121578
- function isInRootPathOrCanWatchDirectoryOrFile(locationToWatch) {
121579
- const path = resolutionHost.toPath(locationToWatch);
121580
- return isInDirectoryPath(rootPath, path) || canWatchDirectoryOrFile(path);
121581
- }
121582
121616
  function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
121583
121617
  const fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
121584
121618
  if (fileWatcher) {
@@ -121606,7 +121640,7 @@ ${lanes.join("\n")}
121606
121640
  }
121607
121641
  const paths = /* @__PURE__ */ new Set();
121608
121642
  paths.add(locationToWatch);
121609
- let actualWatcher = isInRootPathOrCanWatchDirectoryOrFile(locationToWatch) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
121643
+ let actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
121610
121644
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
121611
121645
  const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
121612
121646
  paths.forEach((path) => {
@@ -121677,6 +121711,15 @@ ${lanes.join("\n")}
121677
121711
  const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
121678
121712
  if (toWatch) {
121679
121713
  const { dirPath } = toWatch;
121714
+ const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
121715
+ if (refCount) {
121716
+ if (refCount === 1) {
121717
+ customFailedLookupPaths.delete(failedLookupLocationPath);
121718
+ } else {
121719
+ Debug.assert(refCount > 1);
121720
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
121721
+ }
121722
+ }
121680
121723
  if (dirPath === rootPath) {
121681
121724
  removeAtRoot = true;
121682
121725
  } else {
@@ -121774,10 +121817,10 @@ ${lanes.join("\n")}
121774
121817
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
121775
121818
  (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
121776
121819
  } else {
121777
- if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
121820
+ if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
121778
121821
  return false;
121779
121822
  }
121780
- if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
121823
+ if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
121781
121824
  return false;
121782
121825
  }
121783
121826
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
@@ -121874,10 +121917,12 @@ ${lanes.join("\n")}
121874
121917
  closeTypeRootsWatch();
121875
121918
  }
121876
121919
  }
121877
- function canWatchTypeRootPath(typeRoot) {
121878
- return !!resolutionHost.getCompilationSettings().typeRoots || // Otherwise we'll only watch this path if it falls within `rootDir` or
121879
- // the path is not disqualified by other criteria ("not `C:\Users\Name\Dir`").
121880
- isInRootPathOrCanWatchDirectoryOrFile(getDirectoryPath(typeRoot));
121920
+ function canWatchTypeRootPath(nodeTypesDirectory) {
121921
+ if (resolutionHost.getCompilationSettings().typeRoots)
121922
+ return true;
121923
+ const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
121924
+ const dirPath = resolutionHost.toPath(dir);
121925
+ return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
121881
121926
  }
121882
121927
  }
121883
121928
  function resolutionIsSymlink(resolution) {
package/lib/typescript.js CHANGED
@@ -56413,7 +56413,35 @@ ${lanes.join("\n")}
56413
56413
  return emptyArray;
56414
56414
  }
56415
56415
  function getSignaturesOfType(type, kind) {
56416
- return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
56416
+ const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
56417
+ if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
56418
+ if (type.arrayFallbackSignatures) {
56419
+ return type.arrayFallbackSignatures;
56420
+ }
56421
+ let memberName;
56422
+ if (everyType(type, (t) => {
56423
+ var _a2;
56424
+ return !!((_a2 = t.symbol) == null ? void 0 : _a2.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
56425
+ })) {
56426
+ const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
56427
+ const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
56428
+ return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
56429
+ }
56430
+ type.arrayFallbackSignatures = result;
56431
+ }
56432
+ return result;
56433
+ }
56434
+ function isArrayOrTupleSymbol(symbol) {
56435
+ if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
56436
+ return false;
56437
+ }
56438
+ return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
56439
+ }
56440
+ function isReadonlyArraySymbol(symbol) {
56441
+ if (!symbol || !globalReadonlyArrayType.symbol) {
56442
+ return false;
56443
+ }
56444
+ return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
56417
56445
  }
56418
56446
  function findIndexInfo(indexInfos, keyType) {
56419
56447
  return find(indexInfos, (info) => info.keyType === keyType);
@@ -121131,6 +121159,8 @@ ${lanes.join("\n")}
121131
121159
  resolutionHost.getCompilationSettings(),
121132
121160
  moduleResolutionCache.getPackageJsonInfoCache()
121133
121161
  );
121162
+ const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
121163
+ const customFailedLookupPaths = /* @__PURE__ */ new Map();
121134
121164
  const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
121135
121165
  const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
121136
121166
  const rootDir = rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
@@ -121175,6 +121205,7 @@ ${lanes.join("\n")}
121175
121205
  function clear2() {
121176
121206
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
121177
121207
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
121208
+ customFailedLookupPaths.clear();
121178
121209
  nonRelativeExternalModuleResolutions.clear();
121179
121210
  closeTypeRootsWatch();
121180
121211
  resolvedModuleNames.clear();
@@ -121484,7 +121515,7 @@ ${lanes.join("\n")}
121484
121515
  dirPath = getDirectoryPath(dirPath);
121485
121516
  }
121486
121517
  if (isNodeModulesDirectory(dirPath)) {
121487
- return canWatchDirectoryOrFile(dirPath) ? { dir, dirPath } : void 0;
121518
+ return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
121488
121519
  }
121489
121520
  let nonRecursive = true;
121490
121521
  let subDirectoryPath, subDirectory;
@@ -121503,6 +121534,9 @@ ${lanes.join("\n")}
121503
121534
  }
121504
121535
  return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
121505
121536
  }
121537
+ function isPathWithDefaultFailedLookupExtension(path) {
121538
+ return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
121539
+ }
121506
121540
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
121507
121541
  var _a2, _b;
121508
121542
  if (resolution.refCount) {
@@ -121541,6 +121575,10 @@ ${lanes.join("\n")}
121541
121575
  const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
121542
121576
  if (toWatch) {
121543
121577
  const { dir, dirPath, nonRecursive } = toWatch;
121578
+ if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
121579
+ const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
121580
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
121581
+ }
121544
121582
  if (dirPath === rootPath) {
121545
121583
  Debug.assert(!nonRecursive);
121546
121584
  setAtRoot = true;
@@ -121575,10 +121613,6 @@ ${lanes.join("\n")}
121575
121613
  );
121576
121614
  }
121577
121615
  }
121578
- function isInRootPathOrCanWatchDirectoryOrFile(locationToWatch) {
121579
- const path = resolutionHost.toPath(locationToWatch);
121580
- return isInDirectoryPath(rootPath, path) || canWatchDirectoryOrFile(path);
121581
- }
121582
121616
  function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
121583
121617
  const fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
121584
121618
  if (fileWatcher) {
@@ -121606,7 +121640,7 @@ ${lanes.join("\n")}
121606
121640
  }
121607
121641
  const paths = /* @__PURE__ */ new Set();
121608
121642
  paths.add(locationToWatch);
121609
- let actualWatcher = isInRootPathOrCanWatchDirectoryOrFile(locationToWatch) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
121643
+ let actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
121610
121644
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
121611
121645
  const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
121612
121646
  paths.forEach((path) => {
@@ -121677,6 +121711,15 @@ ${lanes.join("\n")}
121677
121711
  const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
121678
121712
  if (toWatch) {
121679
121713
  const { dirPath } = toWatch;
121714
+ const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
121715
+ if (refCount) {
121716
+ if (refCount === 1) {
121717
+ customFailedLookupPaths.delete(failedLookupLocationPath);
121718
+ } else {
121719
+ Debug.assert(refCount > 1);
121720
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
121721
+ }
121722
+ }
121680
121723
  if (dirPath === rootPath) {
121681
121724
  removeAtRoot = true;
121682
121725
  } else {
@@ -121774,10 +121817,10 @@ ${lanes.join("\n")}
121774
121817
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
121775
121818
  (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
121776
121819
  } else {
121777
- if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
121820
+ if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
121778
121821
  return false;
121779
121822
  }
121780
- if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
121823
+ if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
121781
121824
  return false;
121782
121825
  }
121783
121826
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
@@ -121874,10 +121917,12 @@ ${lanes.join("\n")}
121874
121917
  closeTypeRootsWatch();
121875
121918
  }
121876
121919
  }
121877
- function canWatchTypeRootPath(typeRoot) {
121878
- return !!resolutionHost.getCompilationSettings().typeRoots || // Otherwise we'll only watch this path if it falls within `rootDir` or
121879
- // the path is not disqualified by other criteria ("not `C:\Users\Name\Dir`").
121880
- isInRootPathOrCanWatchDirectoryOrFile(getDirectoryPath(typeRoot));
121920
+ function canWatchTypeRootPath(nodeTypesDirectory) {
121921
+ if (resolutionHost.getCompilationSettings().typeRoots)
121922
+ return true;
121923
+ const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
121924
+ const dirPath = resolutionHost.toPath(dir);
121925
+ return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
121881
121926
  }
121882
121927
  }
121883
121928
  function resolutionIsSymlink(resolution) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.1.0-pr-53420-2",
5
+ "version": "5.1.0-pr-53489-6",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "14.21.1",
115
115
  "npm": "8.19.3"
116
116
  },
117
- "gitHead": "f0cfb564f63daaba42fe4e155cef57222d49577b"
117
+ "gitHead": "f71c3a89332bad335839d084408978a70aa8991d"
118
118
  }