@typescript-deploys/pr-build 4.8.0-pr-49119-45 → 4.8.0-pr-48997-21

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
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220524";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220525";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -5295,11 +5295,6 @@ var ts;
5295
5295
  // Flags that require TypeFlags.Union
5296
5296
  /* @internal */
5297
5297
  ObjectFlags[ObjectFlags["ContainsIntersections"] = 16777216] = "ContainsIntersections";
5298
- /* @internal */
5299
- ObjectFlags[ObjectFlags["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
5300
- /* @internal */
5301
- ObjectFlags[ObjectFlags["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
5302
- /* @internal */
5303
5298
  // Flags that require TypeFlags.Intersection
5304
5299
  /* @internal */
5305
5300
  ObjectFlags[ObjectFlags["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
@@ -6518,7 +6513,7 @@ var ts;
6518
6513
  */
6519
6514
  /*@internal*/
6520
6515
  function createDirectoryWatcherSupportingRecursive(_a) {
6521
- var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, directoryExists = _a.directoryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
6516
+ var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
6522
6517
  var cache = new ts.Map();
6523
6518
  var callbackCache = ts.createMultiMap();
6524
6519
  var cacheToUpdateChildWatches = new ts.Map();
@@ -6618,7 +6613,7 @@ var ts;
6618
6613
  function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
6619
6614
  // Iterate through existing children and update the watches if needed
6620
6615
  var parentWatcher = cache.get(dirPath);
6621
- if (parentWatcher && directoryExists(dirName)) {
6616
+ if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
6622
6617
  // Schedule the update and postpone invoke for callbacks
6623
6618
  scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
6624
6619
  return;
@@ -6691,7 +6686,7 @@ var ts;
6691
6686
  if (!parentWatcher)
6692
6687
  return false;
6693
6688
  var newChildWatches;
6694
- var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6689
+ var hasChanges = ts.enumerateInsertsAndDeletes(fileSystemEntryExists(parentDir, 1 /* Directory */) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6695
6690
  var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
6696
6691
  // Filter our the symbolic link directories since those arent included in recursive watch
6697
6692
  // which is same behaviour when recursive: true is passed to fs.watch
@@ -6737,10 +6732,10 @@ var ts;
6737
6732
  return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6738
6733
  }
6739
6734
  ts.createFileWatcherCallback = createFileWatcherCallback;
6740
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6735
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists) {
6741
6736
  return function (eventName) {
6742
6737
  if (eventName === "rename") {
6743
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6738
+ callback(fileName, fileSystemEntryExists(fileName, 0 /* File */) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6744
6739
  }
6745
6740
  else {
6746
6741
  // Change
@@ -6768,11 +6763,12 @@ var ts;
6768
6763
  }
6769
6764
  /*@internal*/
6770
6765
  function createSystemWatchFunctions(_a) {
6771
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, fileExists = _a.fileExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, directoryExists = _a.directoryExists, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind;
6766
+ var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6772
6767
  var dynamicPollingWatchFile;
6773
6768
  var fixedChunkSizePollingWatchFile;
6774
6769
  var nonPollingWatchFile;
6775
6770
  var hostRecursiveDirectoryWatcher;
6771
+ var hitSystemWatcherLimit = false;
6776
6772
  return {
6777
6773
  watchFile: watchFile,
6778
6774
  watchDirectory: watchDirectory
@@ -6790,7 +6786,7 @@ var ts;
6790
6786
  case ts.WatchFileKind.FixedChunkSizePolling:
6791
6787
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6792
6788
  case ts.WatchFileKind.UseFsEvents:
6793
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6789
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists),
6794
6790
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6795
6791
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6796
6792
  if (!nonPollingWatchFile) {
@@ -6851,7 +6847,7 @@ var ts;
6851
6847
  hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
6852
6848
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6853
6849
  getCurrentDirectory: getCurrentDirectory,
6854
- directoryExists: directoryExists,
6850
+ fileSystemEntryExists: fileSystemEntryExists,
6855
6851
  getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
6856
6852
  watchDirectory: nonRecursiveWatchDirectory,
6857
6853
  realpath: realpath,
@@ -6902,6 +6898,114 @@ var ts;
6902
6898
  };
6903
6899
  }
6904
6900
  }
6901
+ function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6902
+ var lastDirectoryPartWithDirectorySeparator;
6903
+ var lastDirectoryPart;
6904
+ if (inodeWatching) {
6905
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substring(fileOrDirectory.lastIndexOf(ts.directorySeparator));
6906
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
6907
+ }
6908
+ /** Watcher for the file system entry depending on whether it is missing or present */
6909
+ var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
6910
+ watchMissingFileSystemEntry() :
6911
+ watchPresentFileSystemEntry();
6912
+ return {
6913
+ close: function () {
6914
+ // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
6915
+ watcher.close();
6916
+ watcher = undefined;
6917
+ }
6918
+ };
6919
+ function updateWatcher(createWatcher) {
6920
+ // If watcher is not closed, update it
6921
+ if (watcher) {
6922
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
6923
+ watcher.close();
6924
+ watcher = createWatcher();
6925
+ }
6926
+ }
6927
+ /**
6928
+ * Watch the file or directory that is currently present
6929
+ * and when the watched file or directory is deleted, switch to missing file system entry watcher
6930
+ */
6931
+ function watchPresentFileSystemEntry() {
6932
+ if (hitSystemWatcherLimit) {
6933
+ sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to watchFile");
6934
+ return watchPresentFileSystemEntryWithFsWatchFile();
6935
+ }
6936
+ try {
6937
+ var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ?
6938
+ callbackChangingToMissingFileSystemEntry :
6939
+ function (eventName, relativeFileName) {
6940
+ sysLog("sysLog:: watchPresentFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
6941
+ callback(eventName, relativeFileName);
6942
+ });
6943
+ // Watch the missing file or directory or error
6944
+ presentWatcher.on("error", function () {
6945
+ sysLog("sysLog:: watchPresentFileSystemEntry:: on Error " + fileOrDirectory + " " + entryKind + " rename, \"\"");
6946
+ callback("rename", "");
6947
+ updateWatcher(watchMissingFileSystemEntry);
6948
+ });
6949
+ return presentWatcher;
6950
+ }
6951
+ catch (e) {
6952
+ // Catch the exception and use polling instead
6953
+ // Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
6954
+ // so instead of throwing error, use fs.watchFile
6955
+ hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
6956
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing to watchFile");
6957
+ return watchPresentFileSystemEntryWithFsWatchFile();
6958
+ }
6959
+ }
6960
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
6961
+ sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + event + ":: " + relativeName + " " + inodeWatching + " " + lastDirectoryPart + " " + lastDirectoryPartWithDirectorySeparator);
6962
+ if (relativeName && ts.endsWith(relativeName, "~")) {
6963
+ relativeName = relativeName.slice(0, relativeName.length - 1);
6964
+ sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: changed the relative name to " + relativeName);
6965
+ }
6966
+ callback(event, relativeName);
6967
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
6968
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
6969
+ if (event === "rename" &&
6970
+ (!relativeName ||
6971
+ relativeName === lastDirectoryPart ||
6972
+ ts.endsWith(relativeName, lastDirectoryPartWithDirectorySeparator))) {
6973
+ if (inodeWatching) {
6974
+ updateWatcher(!fileSystemEntryExists(fileOrDirectory, entryKind) ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
6975
+ }
6976
+ else if (!fileSystemEntryExists(fileOrDirectory, entryKind)) {
6977
+ updateWatcher(watchMissingFileSystemEntry);
6978
+ }
6979
+ }
6980
+ }
6981
+ /**
6982
+ * Watch the file or directory using fs.watchFile since fs.watch threw exception
6983
+ * Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
6984
+ */
6985
+ function watchPresentFileSystemEntryWithFsWatchFile() {
6986
+ return watchFile(fileOrDirectory, createFileWatcherCallback(function (eventName, relativeFileName) {
6987
+ sysLog("sysLog:: watchPresentFileSystemEntryWithFsWatchFile:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
6988
+ callback(eventName, relativeFileName);
6989
+ }), fallbackPollingInterval, fallbackOptions);
6990
+ }
6991
+ /**
6992
+ * Watch the file or directory that is missing
6993
+ * and switch to existing file or directory when the missing filesystem entry is created
6994
+ */
6995
+ function watchMissingFileSystemEntry() {
6996
+ return watchFile(fileOrDirectory, function (_fileName, eventKind) {
6997
+ sysLog("sysLog:: watchMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + _fileName + ":: " + eventKind);
6998
+ if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
6999
+ sysLog("sysLog:: watchMissingFileSystemEntry:: Callback :: rename, \"\" and will update the watcher");
7000
+ callback("rename", "");
7001
+ // Call the callback for current file or directory
7002
+ // For now it could be callback for the inner directory creation,
7003
+ // but just return current directory, better than current no-op
7004
+ updateWatcher(watchPresentFileSystemEntry);
7005
+ }
7006
+ }, fallbackPollingInterval, fallbackOptions);
7007
+ }
7008
+ }
6905
7009
  }
6906
7010
  ts.createSystemWatchFunctions = createSystemWatchFunctions;
6907
7011
  /**
@@ -6954,7 +7058,6 @@ var ts;
6954
7058
  }
6955
7059
  var activeSession;
6956
7060
  var profilePath = "./profile.cpuprofile";
6957
- var hitSystemWatcherLimit = false;
6958
7061
  var Buffer = require("buffer").Buffer;
6959
7062
  var nodeVersion = getNodeMajorVersion();
6960
7063
  var isNode4OrLater = nodeVersion >= 4;
@@ -6969,20 +7072,21 @@ var ts;
6969
7072
  getModifiedTime: getModifiedTime,
6970
7073
  setTimeout: setTimeout,
6971
7074
  clearTimeout: clearTimeout,
6972
- fsWatch: fsWatch,
7075
+ fsWatchWorker: fsWatchWorker,
6973
7076
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6974
7077
  getCurrentDirectory: getCurrentDirectory,
6975
- fileExists: fileExists,
7078
+ fileSystemEntryExists: fileSystemEntryExists,
6976
7079
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6977
7080
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6978
7081
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
6979
- directoryExists: directoryExists,
6980
7082
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
6981
7083
  realpath: realpath,
6982
7084
  tscWatchFile: process.env.TSC_WATCHFILE,
6983
7085
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
6984
7086
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6985
7087
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
7088
+ inodeWatching: isLinuxOrMacOs,
7089
+ sysLog: sysLog,
6986
7090
  }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
6987
7091
  var nodeSystem = {
6988
7092
  args: process.argv.slice(2),
@@ -7235,107 +7339,11 @@ var ts;
7235
7339
  callback(fileName, eventKind);
7236
7340
  }
7237
7341
  }
7238
- function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
7239
- var options;
7240
- var lastDirectoryPartWithDirectorySeparator;
7241
- var lastDirectoryPart;
7242
- if (isLinuxOrMacOs) {
7243
- lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
7244
- lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
7245
- }
7246
- /** Watcher for the file system entry depending on whether it is missing or present */
7247
- var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7248
- watchMissingFileSystemEntry() :
7249
- watchPresentFileSystemEntry();
7250
- return {
7251
- close: function () {
7252
- // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
7253
- watcher.close();
7254
- watcher = undefined;
7255
- }
7256
- };
7257
- /**
7258
- * Invoke the callback with rename and update the watcher if not closed
7259
- * @param createWatcher
7260
- */
7261
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7262
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7263
- // Call the callback for current directory
7264
- callback("rename", "");
7265
- // If watcher is not closed, update it
7266
- if (watcher) {
7267
- watcher.close();
7268
- watcher = createWatcher();
7269
- }
7270
- }
7271
- /**
7272
- * Watch the file or directory that is currently present
7273
- * and when the watched file or directory is deleted, switch to missing file system entry watcher
7274
- */
7275
- function watchPresentFileSystemEntry() {
7276
- // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7277
- // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7278
- if (options === undefined) {
7279
- if (fsSupportsRecursiveFsWatch) {
7280
- options = { persistent: true, recursive: !!recursive };
7281
- }
7282
- else {
7283
- options = { persistent: true };
7284
- }
7285
- }
7286
- if (hitSystemWatcherLimit) {
7287
- sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
7288
- return watchPresentFileSystemEntryWithFsWatchFile();
7289
- }
7290
- try {
7291
- var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
7292
- callbackChangingToMissingFileSystemEntry :
7293
- callback);
7294
- // Watch the missing file or directory or error
7295
- presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
7296
- return presentWatcher;
7297
- }
7298
- catch (e) {
7299
- // Catch the exception and use polling instead
7300
- // Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
7301
- // so instead of throwing error, use fs.watchFile
7302
- hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
7303
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
7304
- return watchPresentFileSystemEntryWithFsWatchFile();
7305
- }
7306
- }
7307
- function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7308
- // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7309
- // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7310
- return event === "rename" &&
7311
- (!relativeName ||
7312
- relativeName === lastDirectoryPart ||
7313
- (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7314
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7315
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7316
- callback(event, relativeName);
7317
- }
7318
- /**
7319
- * Watch the file or directory using fs.watchFile since fs.watch threw exception
7320
- * Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
7321
- */
7322
- function watchPresentFileSystemEntryWithFsWatchFile() {
7323
- return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
7324
- }
7325
- /**
7326
- * Watch the file or directory that is missing
7327
- * and switch to existing file or directory when the missing filesystem entry is created
7328
- */
7329
- function watchMissingFileSystemEntry() {
7330
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7331
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7332
- // Call the callback for current file or directory
7333
- // For now it could be callback for the inner directory creation,
7334
- // but just return current directory, better than current no-op
7335
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7336
- }
7337
- }, fallbackPollingInterval, fallbackOptions);
7338
- }
7342
+ function fsWatchWorker(fileOrDirectory, recursive, callback) {
7343
+ // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7344
+ // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7345
+ return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
7346
+ { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
7339
7347
  }
7340
7348
  function readFileWorker(fileName, _encoding) {
7341
7349
  var buffer;
@@ -42242,7 +42250,7 @@ var ts;
42242
42250
  }
42243
42251
  if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
42244
42252
  return {
42245
- key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
42253
+ key: ts.removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec)),
42246
42254
  flags: 1 /* Recursive */
42247
42255
  };
42248
42256
  }
@@ -48737,7 +48745,6 @@ var ts;
48737
48745
  var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
48738
48746
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
48739
48747
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48740
- var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
48741
48748
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48742
48749
  emptyGenericType.instantiations = new ts.Map();
48743
48750
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -58907,7 +58914,7 @@ var ts;
58907
58914
  }
58908
58915
  }
58909
58916
  }
58910
- else if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
58917
+ else if (t.flags & 469892092 /* DisjointDomains */) {
58911
58918
  hasDisjointDomainType = true;
58912
58919
  }
58913
58920
  }
@@ -58919,7 +58926,7 @@ var ts;
58919
58926
  // intersection operation to reduce the union constraints.
58920
58927
  for (var _a = 0, types_6 = types; _a < types_6.length; _a++) {
58921
58928
  var t = types_6[_a];
58922
- if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
58929
+ if (t.flags & 469892092 /* DisjointDomains */) {
58923
58930
  constraints = ts.append(constraints, t);
58924
58931
  }
58925
58932
  }
@@ -61468,7 +61475,7 @@ var ts;
61468
61475
  }
61469
61476
  return includes;
61470
61477
  }
61471
- function removeRedundantSupertypes(types, includes) {
61478
+ function removeRedundantPrimitiveTypes(types, includes) {
61472
61479
  var i = types.length;
61473
61480
  while (i > 0) {
61474
61481
  i--;
@@ -61476,9 +61483,7 @@ var ts;
61476
61483
  var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61477
61484
  t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61478
61485
  t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61479
- t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61480
- t.flags & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61481
- isEmptyAnonymousObjectType(t) && includes & 470302716 /* DefinitelyNonNullable */;
61486
+ t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
61482
61487
  if (remove) {
61483
61488
  ts.orderedRemoveItemAt(types, i);
61484
61489
  }
@@ -61600,7 +61605,7 @@ var ts;
61600
61605
  // a type alias of the form "type List<T> = T & { next: List<T> }" cannot be reduced during its declaration.
61601
61606
  // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
61602
61607
  // for intersections of types with signatures can be deterministic.
61603
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
61608
+ function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
61604
61609
  var typeMembershipMap = new ts.Map();
61605
61610
  var includes = addTypesToIntersection(typeMembershipMap, 0, types);
61606
61611
  var typeSet = ts.arrayFrom(typeMembershipMap.values());
@@ -61637,11 +61642,11 @@ var ts;
61637
61642
  if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61638
61643
  includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61639
61644
  includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61640
- includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61641
- includes & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61642
- includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
61643
- if (!noSupertypeReduction)
61644
- removeRedundantSupertypes(typeSet, includes);
61645
+ includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
61646
+ removeRedundantPrimitiveTypes(typeSet, includes);
61647
+ }
61648
+ if (includes & 16777216 /* IncludesEmptyObject */ && includes & 524288 /* Object */) {
61649
+ ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
61645
61650
  }
61646
61651
  if (includes & 262144 /* IncludesMissingType */) {
61647
61652
  typeSet[typeSet.indexOf(undefinedType)] = missingType;
@@ -61680,9 +61685,8 @@ var ts;
61680
61685
  }
61681
61686
  var constituents = getCrossProductIntersections(typeSet);
61682
61687
  // We attach a denormalized origin type when at least one constituent of the cross-product union is an
61683
- // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions) and
61684
- // the denormalized origin has fewer constituents than the union itself.
61685
- var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61688
+ // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions).
61689
+ var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61686
61690
  result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
61687
61691
  }
61688
61692
  }
@@ -61725,21 +61729,11 @@ var ts;
61725
61729
  }
61726
61730
  return intersections;
61727
61731
  }
61728
- function getConstituentCount(type) {
61729
- return !(type.flags & 3145728 /* UnionOrIntersection */) || type.aliasSymbol ? 1 :
61730
- type.flags & 1048576 /* Union */ && type.origin ? getConstituentCount(type.origin) :
61731
- getConstituentCountOfTypes(type.types);
61732
- }
61733
- function getConstituentCountOfTypes(types) {
61734
- return ts.reduceLeft(types, function (n, t) { return n + getConstituentCount(t); }, 0);
61735
- }
61736
61732
  function getTypeFromIntersectionTypeNode(node) {
61737
61733
  var links = getNodeLinks(node);
61738
61734
  if (!links.resolvedType) {
61739
61735
  var aliasSymbol = getAliasSymbolForTypeNode(node);
61740
- var types = ts.map(node.types, getTypeFromTypeNode);
61741
- var noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && types[1] === emptyTypeLiteralType;
61742
- links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
61736
+ links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
61743
61737
  }
61744
61738
  return links.resolvedType;
61745
61739
  }
@@ -64525,17 +64519,6 @@ var ts;
64525
64519
  return !!(ts.getObjectFlags(type) & 16 /* Anonymous */ && (type.members && isEmptyResolvedType(type) ||
64526
64520
  type.symbol && type.symbol.flags & 2048 /* TypeLiteral */ && getMembersOfSymbol(type.symbol).size === 0));
64527
64521
  }
64528
- function isUnknownLikeUnionType(type) {
64529
- if (strictNullChecks && type.flags & 1048576 /* Union */) {
64530
- if (!(type.objectFlags & 33554432 /* IsUnknownLikeUnionComputed */)) {
64531
- var types = type.types;
64532
- type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 32768 /* Undefined */ &&
64533
- types[1].flags & 65536 /* Null */ && ts.some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0);
64534
- }
64535
- return !!(type.objectFlags & 67108864 /* IsUnknownLikeUnion */);
64536
- }
64537
- return false;
64538
- }
64539
64522
  function isStringIndexSignatureOnlyType(type) {
64540
64523
  return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
64541
64524
  type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
@@ -64615,7 +64598,7 @@ var ts;
64615
64598
  return true;
64616
64599
  if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
64617
64600
  return true;
64618
- if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source)))
64601
+ if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
64619
64602
  return true;
64620
64603
  if (relation === assignableRelation || relation === comparableRelation) {
64621
64604
  if (s & 1 /* Any */)
@@ -64625,9 +64608,6 @@ var ts;
64625
64608
  // bit-flag enum types sometimes look like literal enum types with numeric literal values.
64626
64609
  if (s & (8 /* Number */ | 256 /* NumberLiteral */) && !(s & 1024 /* EnumLiteral */) && (t & 32 /* Enum */ || relation === assignableRelation && t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */))
64627
64610
  return true;
64628
- // Anything is assignable to a union containing undefined, null, and {}
64629
- if (isUnknownLikeUnionType(target))
64630
- return true;
64631
64611
  }
64632
64612
  return false;
64633
64613
  }
@@ -64670,27 +64650,16 @@ var ts;
64670
64650
  function getNormalizedType(type, writing) {
64671
64651
  while (true) {
64672
64652
  var t = isFreshLiteralType(type) ? type.regularType :
64673
- ts.getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type :
64674
- type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) :
64653
+ ts.getObjectFlags(type) & 4 /* Reference */ && type.node ? createTypeReference(type.target, getTypeArguments(type)) :
64654
+ type.flags & 3145728 /* UnionOrIntersection */ ? getReducedType(type) :
64675
64655
  type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : type.substitute :
64676
64656
  type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) :
64677
64657
  type;
64658
+ t = getSingleBaseForNonAugmentingSubtype(t) || t;
64678
64659
  if (t === type)
64679
- return t;
64660
+ break;
64680
64661
  type = t;
64681
64662
  }
64682
- }
64683
- function getNormalizedUnionOrIntersectionType(type, writing) {
64684
- var reduced = getReducedType(type);
64685
- if (reduced !== type) {
64686
- return reduced;
64687
- }
64688
- if (type.flags & 2097152 /* Intersection */) {
64689
- var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
64690
- if (normalizedTypes !== type.types) {
64691
- return getIntersectionType(normalizedTypes);
64692
- }
64693
- }
64694
64663
  return type;
64695
64664
  }
64696
64665
  /**
@@ -67689,22 +67658,20 @@ var ts;
67689
67658
  return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
67690
67659
  }
67691
67660
  function getGlobalNonNullableTypeInstantiation(type) {
67661
+ // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67662
+ // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67663
+ // that isn't eliminated by a NonNullable<T> instantiation.
67664
+ var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
67692
67665
  if (!deferredGlobalNonNullableTypeAlias) {
67693
67666
  deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
67694
67667
  }
67668
+ // If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
67695
67669
  return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
67696
- getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]) :
67697
- getIntersectionType([type, emptyObjectType]);
67670
+ getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
67671
+ reducedType;
67698
67672
  }
67699
67673
  function getNonNullableType(type) {
67700
- if (strictNullChecks) {
67701
- // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67702
- // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67703
- // that isn't eliminated by a NonNullable<T> instantiation.
67704
- var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
67705
- return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
67706
- }
67707
- return type;
67674
+ return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
67708
67675
  }
67709
67676
  function addOptionalTypeMarker(type) {
67710
67677
  return strictNullChecks ? getUnionType([type, optionalType]) : type;
@@ -69735,24 +69702,6 @@ var ts;
69735
69702
  function getTypeWithFacts(type, include) {
69736
69703
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
69737
69704
  }
69738
- function getIntersectionWithFacts(type, facts) {
69739
- var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69740
- if (strictNullChecks) {
69741
- switch (facts) {
69742
- case 524288 /* NEUndefined */:
69743
- return mapType(reduced, function (t) { return getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t; });
69744
- case 1048576 /* NENull */:
69745
- return mapType(reduced, function (t) { return getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t; });
69746
- case 2097152 /* NEUndefinedOrNull */:
69747
- case 4194304 /* Truthy */:
69748
- return mapType(reduced, function (t) { return getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t; });
69749
- }
69750
- }
69751
- return reduced;
69752
- }
69753
- function recombineUnknownType(type) {
69754
- return type === unknownUnionType ? unknownType : type;
69755
- }
69756
69705
  function getTypeWithDefault(type, defaultExpression) {
69757
69706
  return defaultExpression ?
69758
69707
  getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
@@ -70810,7 +70759,7 @@ var ts;
70810
70759
  if (isEvolvingArrayTypeList(types)) {
70811
70760
  return getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType)));
70812
70761
  }
70813
- var result = recombineUnknownType(getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction));
70762
+ var result = getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
70814
70763
  if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && ts.arraysEqual(result.types, declaredType.types)) {
70815
70764
  return declaredType;
70816
70765
  }
@@ -70912,7 +70861,8 @@ var ts;
70912
70861
  }
70913
70862
  function narrowTypeByTruthiness(type, expr, assumeTrue) {
70914
70863
  if (isMatchingReference(reference, expr)) {
70915
- return getIntersectionWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70864
+ return type.flags & 2 /* Unknown */ && assumeTrue ? nonNullUnknownType :
70865
+ getTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70916
70866
  }
70917
70867
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
70918
70868
  type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
@@ -71065,6 +71015,9 @@ var ts;
71065
71015
  assumeTrue = !assumeTrue;
71066
71016
  }
71067
71017
  var valueType = getTypeOfExpression(value);
71018
+ if (assumeTrue && (type.flags & 2 /* Unknown */) && (operator === 34 /* EqualsEqualsToken */ || operator === 35 /* ExclamationEqualsToken */) && (valueType.flags & 65536 /* Null */)) {
71019
+ return getUnionType([nullType, undefinedType]);
71020
+ }
71068
71021
  if ((type.flags & 2 /* Unknown */) && assumeTrue && (operator === 36 /* EqualsEqualsEqualsToken */ || operator === 37 /* ExclamationEqualsEqualsToken */)) {
71069
71022
  if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
71070
71023
  return valueType;
@@ -71084,7 +71037,7 @@ var ts;
71084
71037
  valueType.flags & 65536 /* Null */ ?
71085
71038
  assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
71086
71039
  assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
71087
- return getIntersectionWithFacts(type, facts);
71040
+ return type.flags & 2 /* Unknown */ && facts & (1048576 /* NENull */ | 2097152 /* NEUndefinedOrNull */) ? nonNullUnknownType : getTypeWithFacts(type, facts);
71088
71041
  }
71089
71042
  if (assumeTrue) {
71090
71043
  var filterFn = operator === 34 /* EqualsEqualsToken */ ?
@@ -71112,11 +71065,17 @@ var ts;
71112
71065
  if (type.flags & 1 /* Any */ && literal.text === "function") {
71113
71066
  return type;
71114
71067
  }
71068
+ if (assumeTrue && type.flags & 2 /* Unknown */ && literal.text === "object") {
71069
+ // The non-null unknown type is used to track whether a previous narrowing operation has removed the null type
71070
+ // from the unknown type. For example, the expression `x && typeof x === 'object'` first narrows x to the non-null
71071
+ // unknown type, and then narrows that to the non-primitive type.
71072
+ return type === nonNullUnknownType ? nonPrimitiveType : getUnionType([nonPrimitiveType, nullType]);
71073
+ }
71115
71074
  var facts = assumeTrue ?
71116
71075
  typeofEQFacts.get(literal.text) || 128 /* TypeofEQHostObject */ :
71117
71076
  typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */;
71118
71077
  var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
71119
- return getTypeWithFacts(assumeTrue && impliedType ? narrowTypeByImpliedType(type, impliedType) : type, facts);
71078
+ return getTypeWithFacts(assumeTrue && impliedType ? mapType(type, narrowUnionMemberByTypeof(impliedType)) : type, facts);
71120
71079
  }
71121
71080
  function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
71122
71081
  var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -71165,10 +71124,10 @@ var ts;
71165
71124
  }
71166
71125
  function getImpliedTypeFromTypeofGuard(type, text) {
71167
71126
  switch (text) {
71168
- case "object":
71169
- return type.flags & 1 /* Any */ ? type : getUnionType([nullType, nonPrimitiveType]);
71170
71127
  case "function":
71171
71128
  return type.flags & 1 /* Any */ ? type : globalFunctionType;
71129
+ case "object":
71130
+ return type.flags & 2 /* Unknown */ ? getUnionType([nonPrimitiveType, nullType]) : type;
71172
71131
  default:
71173
71132
  return typeofTypesByName.get(text);
71174
71133
  }
@@ -71179,27 +71138,22 @@ var ts;
71179
71138
  // the guard. For example: narrowing `{} | undefined` by `"boolean"` should produce the type `boolean`, not
71180
71139
  // the filtered type `{}`. For this reason we narrow constituents of the union individually, in addition to
71181
71140
  // filtering by type-facts.
71182
- function narrowTypeByImpliedType(type, candidate) {
71183
- if (type.flags & 3 /* AnyOrUnknown */) {
71184
- return candidate;
71185
- }
71186
- return mapType(type, function (t) {
71187
- if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
71188
- return t;
71141
+ function narrowUnionMemberByTypeof(candidate) {
71142
+ return function (type) {
71143
+ if (isTypeSubtypeOf(type, candidate)) {
71144
+ return type;
71189
71145
  }
71190
- return mapType(candidate, function (c) {
71191
- if (!areTypesComparable(t, c)) {
71192
- return neverType;
71193
- }
71194
- if (c.flags & 131068 /* Primitive */ && t.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(t)) {
71195
- return isTypeSubtypeOf(c, t) ? c : neverType;
71196
- }
71197
- if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
71198
- return c;
71146
+ if (isTypeSubtypeOf(candidate, type)) {
71147
+ return candidate;
71148
+ }
71149
+ if (type.flags & 465829888 /* Instantiable */) {
71150
+ var constraint = getBaseConstraintOfType(type) || anyType;
71151
+ if (isTypeSubtypeOf(candidate, constraint)) {
71152
+ return getIntersectionType([type, candidate]);
71199
71153
  }
71200
- return getIntersectionType([t, c]);
71201
- });
71202
- });
71154
+ }
71155
+ return type;
71156
+ };
71203
71157
  }
71204
71158
  function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
71205
71159
  var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, /*retainDefault*/ true);
@@ -71258,7 +71212,7 @@ var ts;
71258
71212
  because it is caught in the first clause.
71259
71213
  */
71260
71214
  var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
71261
- return getTypeWithFacts(narrowTypeByImpliedType(type, impliedType), switchFacts);
71215
+ return getTypeWithFacts(mapType(type, narrowUnionMemberByTypeof(impliedType)), switchFacts);
71262
71216
  }
71263
71217
  function isMatchingConstructorReference(expr) {
71264
71218
  return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
@@ -71562,9 +71516,7 @@ var ts;
71562
71516
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
71563
71517
  }
71564
71518
  function isGenericTypeWithUnionConstraint(type) {
71565
- return type.flags & 2097152 /* Intersection */ ?
71566
- ts.some(type.types, isGenericTypeWithUnionConstraint) :
71567
- !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71519
+ return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71568
71520
  }
71569
71521
  function isGenericTypeWithoutNullableConstraint(type) {
71570
71522
  return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
@@ -71592,7 +71544,7 @@ var ts;
71592
71544
  var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
71593
71545
  someType(type, isGenericTypeWithUnionConstraint) &&
71594
71546
  (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
71595
- return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
71547
+ return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
71596
71548
  }
71597
71549
  function isExportOrExportExpression(location) {
71598
71550
  return !!ts.findAncestor(location, function (n) {
@@ -123902,6 +123854,7 @@ var ts;
123902
123854
  }
123903
123855
  function reloadFileNamesFromConfigFile() {
123904
123856
  writeLog("Reloading new file names and options");
123857
+ reloadLevel = ts.ConfigFileProgramReloadLevel.None;
123905
123858
  rootFileNames = ts.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
123906
123859
  if (ts.updateErrorForNoInputFiles(rootFileNames, ts.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
123907
123860
  hasChangedConfigFileParsingErrors = true;
@@ -144637,6 +144590,10 @@ var ts;
144637
144590
  }
144638
144591
  var typeDisplayString = printTypeInSingleLine(declarationType);
144639
144592
  if (typeDisplayString) {
144593
+ var isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && ts.equateStringsCaseInsensitive(decl.name.getText(), typeDisplayString);
144594
+ if (isVariableNameMatchesType) {
144595
+ return;
144596
+ }
144640
144597
  addTypeHints(typeDisplayString, decl.name.end);
144641
144598
  }
144642
144599
  }