@typescript-deploys/pr-build 4.8.0-pr-49245-7 → 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/tsserver.js CHANGED
@@ -6319,7 +6319,7 @@ var ts;
6319
6319
  */
6320
6320
  /*@internal*/
6321
6321
  function createDirectoryWatcherSupportingRecursive(_a) {
6322
- 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;
6322
+ 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;
6323
6323
  var cache = new ts.Map();
6324
6324
  var callbackCache = ts.createMultiMap();
6325
6325
  var cacheToUpdateChildWatches = new ts.Map();
@@ -6419,7 +6419,7 @@ var ts;
6419
6419
  function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
6420
6420
  // Iterate through existing children and update the watches if needed
6421
6421
  var parentWatcher = cache.get(dirPath);
6422
- if (parentWatcher && directoryExists(dirName)) {
6422
+ if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
6423
6423
  // Schedule the update and postpone invoke for callbacks
6424
6424
  scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
6425
6425
  return;
@@ -6492,7 +6492,7 @@ var ts;
6492
6492
  if (!parentWatcher)
6493
6493
  return false;
6494
6494
  var newChildWatches;
6495
- var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6495
+ var hasChanges = ts.enumerateInsertsAndDeletes(fileSystemEntryExists(parentDir, 1 /* Directory */) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6496
6496
  var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
6497
6497
  // Filter our the symbolic link directories since those arent included in recursive watch
6498
6498
  // which is same behaviour when recursive: true is passed to fs.watch
@@ -6538,10 +6538,10 @@ var ts;
6538
6538
  return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6539
6539
  }
6540
6540
  ts.createFileWatcherCallback = createFileWatcherCallback;
6541
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6541
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists) {
6542
6542
  return function (eventName) {
6543
6543
  if (eventName === "rename") {
6544
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6544
+ callback(fileName, fileSystemEntryExists(fileName, 0 /* File */) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6545
6545
  }
6546
6546
  else {
6547
6547
  // Change
@@ -6569,11 +6569,12 @@ var ts;
6569
6569
  }
6570
6570
  /*@internal*/
6571
6571
  function createSystemWatchFunctions(_a) {
6572
- 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;
6572
+ 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;
6573
6573
  var dynamicPollingWatchFile;
6574
6574
  var fixedChunkSizePollingWatchFile;
6575
6575
  var nonPollingWatchFile;
6576
6576
  var hostRecursiveDirectoryWatcher;
6577
+ var hitSystemWatcherLimit = false;
6577
6578
  return {
6578
6579
  watchFile: watchFile,
6579
6580
  watchDirectory: watchDirectory
@@ -6591,7 +6592,7 @@ var ts;
6591
6592
  case ts.WatchFileKind.FixedChunkSizePolling:
6592
6593
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6593
6594
  case ts.WatchFileKind.UseFsEvents:
6594
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6595
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists),
6595
6596
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6596
6597
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6597
6598
  if (!nonPollingWatchFile) {
@@ -6652,7 +6653,7 @@ var ts;
6652
6653
  hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
6653
6654
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6654
6655
  getCurrentDirectory: getCurrentDirectory,
6655
- directoryExists: directoryExists,
6656
+ fileSystemEntryExists: fileSystemEntryExists,
6656
6657
  getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
6657
6658
  watchDirectory: nonRecursiveWatchDirectory,
6658
6659
  realpath: realpath,
@@ -6703,6 +6704,114 @@ var ts;
6703
6704
  };
6704
6705
  }
6705
6706
  }
6707
+ function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6708
+ var lastDirectoryPartWithDirectorySeparator;
6709
+ var lastDirectoryPart;
6710
+ if (inodeWatching) {
6711
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substring(fileOrDirectory.lastIndexOf(ts.directorySeparator));
6712
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
6713
+ }
6714
+ /** Watcher for the file system entry depending on whether it is missing or present */
6715
+ var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
6716
+ watchMissingFileSystemEntry() :
6717
+ watchPresentFileSystemEntry();
6718
+ return {
6719
+ close: function () {
6720
+ // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
6721
+ watcher.close();
6722
+ watcher = undefined;
6723
+ }
6724
+ };
6725
+ function updateWatcher(createWatcher) {
6726
+ // If watcher is not closed, update it
6727
+ if (watcher) {
6728
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
6729
+ watcher.close();
6730
+ watcher = createWatcher();
6731
+ }
6732
+ }
6733
+ /**
6734
+ * Watch the file or directory that is currently present
6735
+ * and when the watched file or directory is deleted, switch to missing file system entry watcher
6736
+ */
6737
+ function watchPresentFileSystemEntry() {
6738
+ if (hitSystemWatcherLimit) {
6739
+ sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to watchFile");
6740
+ return watchPresentFileSystemEntryWithFsWatchFile();
6741
+ }
6742
+ try {
6743
+ var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ?
6744
+ callbackChangingToMissingFileSystemEntry :
6745
+ function (eventName, relativeFileName) {
6746
+ sysLog("sysLog:: watchPresentFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
6747
+ callback(eventName, relativeFileName);
6748
+ });
6749
+ // Watch the missing file or directory or error
6750
+ presentWatcher.on("error", function () {
6751
+ sysLog("sysLog:: watchPresentFileSystemEntry:: on Error " + fileOrDirectory + " " + entryKind + " rename, \"\"");
6752
+ callback("rename", "");
6753
+ updateWatcher(watchMissingFileSystemEntry);
6754
+ });
6755
+ return presentWatcher;
6756
+ }
6757
+ catch (e) {
6758
+ // Catch the exception and use polling instead
6759
+ // 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
6760
+ // so instead of throwing error, use fs.watchFile
6761
+ hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
6762
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing to watchFile");
6763
+ return watchPresentFileSystemEntryWithFsWatchFile();
6764
+ }
6765
+ }
6766
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
6767
+ sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + event + ":: " + relativeName + " " + inodeWatching + " " + lastDirectoryPart + " " + lastDirectoryPartWithDirectorySeparator);
6768
+ if (relativeName && ts.endsWith(relativeName, "~")) {
6769
+ relativeName = relativeName.slice(0, relativeName.length - 1);
6770
+ sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: changed the relative name to " + relativeName);
6771
+ }
6772
+ callback(event, relativeName);
6773
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
6774
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
6775
+ if (event === "rename" &&
6776
+ (!relativeName ||
6777
+ relativeName === lastDirectoryPart ||
6778
+ ts.endsWith(relativeName, lastDirectoryPartWithDirectorySeparator))) {
6779
+ if (inodeWatching) {
6780
+ updateWatcher(!fileSystemEntryExists(fileOrDirectory, entryKind) ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
6781
+ }
6782
+ else if (!fileSystemEntryExists(fileOrDirectory, entryKind)) {
6783
+ updateWatcher(watchMissingFileSystemEntry);
6784
+ }
6785
+ }
6786
+ }
6787
+ /**
6788
+ * Watch the file or directory using fs.watchFile since fs.watch threw exception
6789
+ * 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
6790
+ */
6791
+ function watchPresentFileSystemEntryWithFsWatchFile() {
6792
+ return watchFile(fileOrDirectory, createFileWatcherCallback(function (eventName, relativeFileName) {
6793
+ sysLog("sysLog:: watchPresentFileSystemEntryWithFsWatchFile:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
6794
+ callback(eventName, relativeFileName);
6795
+ }), fallbackPollingInterval, fallbackOptions);
6796
+ }
6797
+ /**
6798
+ * Watch the file or directory that is missing
6799
+ * and switch to existing file or directory when the missing filesystem entry is created
6800
+ */
6801
+ function watchMissingFileSystemEntry() {
6802
+ return watchFile(fileOrDirectory, function (_fileName, eventKind) {
6803
+ sysLog("sysLog:: watchMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + _fileName + ":: " + eventKind);
6804
+ if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
6805
+ sysLog("sysLog:: watchMissingFileSystemEntry:: Callback :: rename, \"\" and will update the watcher");
6806
+ callback("rename", "");
6807
+ // Call the callback for current file or directory
6808
+ // For now it could be callback for the inner directory creation,
6809
+ // but just return current directory, better than current no-op
6810
+ updateWatcher(watchPresentFileSystemEntry);
6811
+ }
6812
+ }, fallbackPollingInterval, fallbackOptions);
6813
+ }
6814
+ }
6706
6815
  }
6707
6816
  ts.createSystemWatchFunctions = createSystemWatchFunctions;
6708
6817
  /**
@@ -6755,7 +6864,6 @@ var ts;
6755
6864
  }
6756
6865
  var activeSession;
6757
6866
  var profilePath = "./profile.cpuprofile";
6758
- var hitSystemWatcherLimit = false;
6759
6867
  var Buffer = require("buffer").Buffer;
6760
6868
  var nodeVersion = getNodeMajorVersion();
6761
6869
  var isNode4OrLater = nodeVersion >= 4;
@@ -6770,20 +6878,21 @@ var ts;
6770
6878
  getModifiedTime: getModifiedTime,
6771
6879
  setTimeout: setTimeout,
6772
6880
  clearTimeout: clearTimeout,
6773
- fsWatch: fsWatch,
6881
+ fsWatchWorker: fsWatchWorker,
6774
6882
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6775
6883
  getCurrentDirectory: getCurrentDirectory,
6776
- fileExists: fileExists,
6884
+ fileSystemEntryExists: fileSystemEntryExists,
6777
6885
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6778
6886
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6779
6887
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
6780
- directoryExists: directoryExists,
6781
6888
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
6782
6889
  realpath: realpath,
6783
6890
  tscWatchFile: process.env.TSC_WATCHFILE,
6784
6891
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
6785
6892
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6786
6893
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
6894
+ inodeWatching: isLinuxOrMacOs,
6895
+ sysLog: sysLog,
6787
6896
  }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
6788
6897
  var nodeSystem = {
6789
6898
  args: process.argv.slice(2),
@@ -7036,107 +7145,11 @@ var ts;
7036
7145
  callback(fileName, eventKind);
7037
7146
  }
7038
7147
  }
7039
- function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
7040
- var options;
7041
- var lastDirectoryPartWithDirectorySeparator;
7042
- var lastDirectoryPart;
7043
- if (isLinuxOrMacOs) {
7044
- lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
7045
- lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
7046
- }
7047
- /** Watcher for the file system entry depending on whether it is missing or present */
7048
- var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7049
- watchMissingFileSystemEntry() :
7050
- watchPresentFileSystemEntry();
7051
- return {
7052
- close: function () {
7053
- // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
7054
- watcher.close();
7055
- watcher = undefined;
7056
- }
7057
- };
7058
- /**
7059
- * Invoke the callback with rename and update the watcher if not closed
7060
- * @param createWatcher
7061
- */
7062
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7063
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7064
- // Call the callback for current directory
7065
- callback("rename", "");
7066
- // If watcher is not closed, update it
7067
- if (watcher) {
7068
- watcher.close();
7069
- watcher = createWatcher();
7070
- }
7071
- }
7072
- /**
7073
- * Watch the file or directory that is currently present
7074
- * and when the watched file or directory is deleted, switch to missing file system entry watcher
7075
- */
7076
- function watchPresentFileSystemEntry() {
7077
- // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7078
- // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7079
- if (options === undefined) {
7080
- if (fsSupportsRecursiveFsWatch) {
7081
- options = { persistent: true, recursive: !!recursive };
7082
- }
7083
- else {
7084
- options = { persistent: true };
7085
- }
7086
- }
7087
- if (hitSystemWatcherLimit) {
7088
- sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
7089
- return watchPresentFileSystemEntryWithFsWatchFile();
7090
- }
7091
- try {
7092
- var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
7093
- callbackChangingToMissingFileSystemEntry :
7094
- callback);
7095
- // Watch the missing file or directory or error
7096
- presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
7097
- return presentWatcher;
7098
- }
7099
- catch (e) {
7100
- // Catch the exception and use polling instead
7101
- // 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
7102
- // so instead of throwing error, use fs.watchFile
7103
- hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
7104
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
7105
- return watchPresentFileSystemEntryWithFsWatchFile();
7106
- }
7107
- }
7108
- function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7109
- // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7110
- // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7111
- return event === "rename" &&
7112
- (!relativeName ||
7113
- relativeName === lastDirectoryPart ||
7114
- (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7115
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7116
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7117
- callback(event, relativeName);
7118
- }
7119
- /**
7120
- * Watch the file or directory using fs.watchFile since fs.watch threw exception
7121
- * 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
7122
- */
7123
- function watchPresentFileSystemEntryWithFsWatchFile() {
7124
- return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
7125
- }
7126
- /**
7127
- * Watch the file or directory that is missing
7128
- * and switch to existing file or directory when the missing filesystem entry is created
7129
- */
7130
- function watchMissingFileSystemEntry() {
7131
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7132
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7133
- // Call the callback for current file or directory
7134
- // For now it could be callback for the inner directory creation,
7135
- // but just return current directory, better than current no-op
7136
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7137
- }
7138
- }, fallbackPollingInterval, fallbackOptions);
7139
- }
7148
+ function fsWatchWorker(fileOrDirectory, recursive, callback) {
7149
+ // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7150
+ // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7151
+ return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
7152
+ { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
7140
7153
  }
7141
7154
  function readFileWorker(fileName, _encoding) {
7142
7155
  var buffer;
@@ -42043,7 +42056,7 @@ var ts;
42043
42056
  }
42044
42057
  if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
42045
42058
  return {
42046
- key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
42059
+ key: ts.removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec)),
42047
42060
  flags: 1 /* Recursive */
42048
42061
  };
42049
42062
  }
@@ -78433,11 +78446,6 @@ var ts;
78433
78446
  ts.every(source.types, function (subType) { return allTypesAssignableToKind(subType, kind, strict); }) :
78434
78447
  isTypeAssignableToKind(source, kind, strict);
78435
78448
  }
78436
- function anyTypesAssignableToKind(source, kind, strict) {
78437
- return source.flags & 1048576 /* Union */ ?
78438
- ts.some(source.types, function (subType) { return allTypesAssignableToKind(subType, kind, strict); }) :
78439
- isTypeAssignableToKind(source, kind, strict);
78440
- }
78441
78449
  function isConstEnumObjectType(type) {
78442
78450
  return !!(ts.getObjectFlags(type) & 16 /* Anonymous */) && !!type.symbol && isConstEnumSymbol(type.symbol);
78443
78451
  }
@@ -82818,9 +82826,7 @@ var ts;
82818
82826
  }
82819
82827
  // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved
82820
82828
  // in this case error about missing name is already reported - do not report extra one
82821
- // TypeFlags.Nullable must be explicitly checked for in rightType for this check for non-strict modes, where
82822
- // `getNonNullableTypeIfNeeded` is a noop (and the nullable types as any-ish).
82823
- if (!isTypeAny(rightType) && !(rightType.flags & 98304 /* Nullable */) && anyTypesAssignableToKind(getBaseConstraintOrType(rightType), (131068 /* Primitive */ | 131072 /* Never */) & ~98304 /* Nullable */)) {
82829
+ if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
82824
82830
  error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType));
82825
82831
  }
82826
82832
  checkSourceElement(node.statement);
@@ -123654,6 +123660,7 @@ var ts;
123654
123660
  }
123655
123661
  function reloadFileNamesFromConfigFile() {
123656
123662
  writeLog("Reloading new file names and options");
123663
+ reloadLevel = ts.ConfigFileProgramReloadLevel.None;
123657
123664
  rootFileNames = ts.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
123658
123665
  if (ts.updateErrorForNoInputFiles(rootFileNames, ts.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
123659
123666
  hasChangedConfigFileParsingErrors = true;
@@ -143972,6 +143979,10 @@ var ts;
143972
143979
  }
143973
143980
  var typeDisplayString = printTypeInSingleLine(declarationType);
143974
143981
  if (typeDisplayString) {
143982
+ var isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && ts.equateStringsCaseInsensitive(decl.name.getText(), typeDisplayString);
143983
+ if (isVariableNameMatchesType) {
143984
+ return;
143985
+ }
143975
143986
  addTypeHints(typeDisplayString, decl.name.end);
143976
143987
  }
143977
143988
  }
@@ -4120,6 +4120,7 @@ declare namespace ts {
4120
4120
  readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean;
4121
4121
  readonly includeInlayFunctionParameterTypeHints?: boolean;
4122
4122
  readonly includeInlayVariableTypeHints?: boolean;
4123
+ readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean;
4123
4124
  readonly includeInlayPropertyDeclarationTypeHints?: boolean;
4124
4125
  readonly includeInlayFunctionLikeReturnTypeHints?: boolean;
4125
4126
  readonly includeInlayEnumMemberValueHints?: boolean;
@@ -9711,6 +9712,7 @@ declare namespace ts.server.protocol {
9711
9712
  readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean;
9712
9713
  readonly includeInlayFunctionParameterTypeHints?: boolean;
9713
9714
  readonly includeInlayVariableTypeHints?: boolean;
9715
+ readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean;
9714
9716
  readonly includeInlayPropertyDeclarationTypeHints?: boolean;
9715
9717
  readonly includeInlayFunctionLikeReturnTypeHints?: boolean;
9716
9718
  readonly includeInlayEnumMemberValueHints?: boolean;