@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/lib.es5.d.ts +1 -1
- package/lib/protocol.d.ts +1 -0
- package/lib/tsc.js +154 -193
- package/lib/tsserver.js +192 -235
- package/lib/tsserverlibrary.d.ts +2 -0
- package/lib/tsserverlibrary.js +192 -235
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +192 -235
- package/lib/typescriptServices.d.ts +1 -0
- package/lib/typescriptServices.js +192 -235
- package/lib/typingsInstaller.js +188 -235
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220525";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -5090,11 +5090,6 @@ var ts;
|
|
|
5090
5090
|
// Flags that require TypeFlags.Union
|
|
5091
5091
|
/* @internal */
|
|
5092
5092
|
ObjectFlags[ObjectFlags["ContainsIntersections"] = 16777216] = "ContainsIntersections";
|
|
5093
|
-
/* @internal */
|
|
5094
|
-
ObjectFlags[ObjectFlags["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
|
|
5095
|
-
/* @internal */
|
|
5096
|
-
ObjectFlags[ObjectFlags["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
|
5097
|
-
/* @internal */
|
|
5098
5093
|
// Flags that require TypeFlags.Intersection
|
|
5099
5094
|
/* @internal */
|
|
5100
5095
|
ObjectFlags[ObjectFlags["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
|
|
@@ -6313,7 +6308,7 @@ var ts;
|
|
|
6313
6308
|
*/
|
|
6314
6309
|
/*@internal*/
|
|
6315
6310
|
function createDirectoryWatcherSupportingRecursive(_a) {
|
|
6316
|
-
var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories,
|
|
6311
|
+
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;
|
|
6317
6312
|
var cache = new ts.Map();
|
|
6318
6313
|
var callbackCache = ts.createMultiMap();
|
|
6319
6314
|
var cacheToUpdateChildWatches = new ts.Map();
|
|
@@ -6413,7 +6408,7 @@ var ts;
|
|
|
6413
6408
|
function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
|
|
6414
6409
|
// Iterate through existing children and update the watches if needed
|
|
6415
6410
|
var parentWatcher = cache.get(dirPath);
|
|
6416
|
-
if (parentWatcher &&
|
|
6411
|
+
if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
|
|
6417
6412
|
// Schedule the update and postpone invoke for callbacks
|
|
6418
6413
|
scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
|
|
6419
6414
|
return;
|
|
@@ -6486,7 +6481,7 @@ var ts;
|
|
|
6486
6481
|
if (!parentWatcher)
|
|
6487
6482
|
return false;
|
|
6488
6483
|
var newChildWatches;
|
|
6489
|
-
var hasChanges = ts.enumerateInsertsAndDeletes(
|
|
6484
|
+
var hasChanges = ts.enumerateInsertsAndDeletes(fileSystemEntryExists(parentDir, 1 /* Directory */) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
|
|
6490
6485
|
var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
|
|
6491
6486
|
// Filter our the symbolic link directories since those arent included in recursive watch
|
|
6492
6487
|
// which is same behaviour when recursive: true is passed to fs.watch
|
|
@@ -6532,10 +6527,10 @@ var ts;
|
|
|
6532
6527
|
return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
|
|
6533
6528
|
}
|
|
6534
6529
|
ts.createFileWatcherCallback = createFileWatcherCallback;
|
|
6535
|
-
function createFsWatchCallbackForFileWatcherCallback(fileName, callback,
|
|
6530
|
+
function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists) {
|
|
6536
6531
|
return function (eventName) {
|
|
6537
6532
|
if (eventName === "rename") {
|
|
6538
|
-
callback(fileName,
|
|
6533
|
+
callback(fileName, fileSystemEntryExists(fileName, 0 /* File */) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
|
|
6539
6534
|
}
|
|
6540
6535
|
else {
|
|
6541
6536
|
// Change
|
|
@@ -6563,11 +6558,12 @@ var ts;
|
|
|
6563
6558
|
}
|
|
6564
6559
|
/*@internal*/
|
|
6565
6560
|
function createSystemWatchFunctions(_a) {
|
|
6566
|
-
var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout,
|
|
6561
|
+
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;
|
|
6567
6562
|
var dynamicPollingWatchFile;
|
|
6568
6563
|
var fixedChunkSizePollingWatchFile;
|
|
6569
6564
|
var nonPollingWatchFile;
|
|
6570
6565
|
var hostRecursiveDirectoryWatcher;
|
|
6566
|
+
var hitSystemWatcherLimit = false;
|
|
6571
6567
|
return {
|
|
6572
6568
|
watchFile: watchFile,
|
|
6573
6569
|
watchDirectory: watchDirectory
|
|
@@ -6585,7 +6581,7 @@ var ts;
|
|
|
6585
6581
|
case ts.WatchFileKind.FixedChunkSizePolling:
|
|
6586
6582
|
return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
|
|
6587
6583
|
case ts.WatchFileKind.UseFsEvents:
|
|
6588
|
-
return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback,
|
|
6584
|
+
return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists),
|
|
6589
6585
|
/*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
|
|
6590
6586
|
case ts.WatchFileKind.UseFsEventsOnParentDirectory:
|
|
6591
6587
|
if (!nonPollingWatchFile) {
|
|
@@ -6646,7 +6642,7 @@ var ts;
|
|
|
6646
6642
|
hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
|
|
6647
6643
|
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
|
6648
6644
|
getCurrentDirectory: getCurrentDirectory,
|
|
6649
|
-
|
|
6645
|
+
fileSystemEntryExists: fileSystemEntryExists,
|
|
6650
6646
|
getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
|
|
6651
6647
|
watchDirectory: nonRecursiveWatchDirectory,
|
|
6652
6648
|
realpath: realpath,
|
|
@@ -6697,6 +6693,114 @@ var ts;
|
|
|
6697
6693
|
};
|
|
6698
6694
|
}
|
|
6699
6695
|
}
|
|
6696
|
+
function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
|
|
6697
|
+
var lastDirectoryPartWithDirectorySeparator;
|
|
6698
|
+
var lastDirectoryPart;
|
|
6699
|
+
if (inodeWatching) {
|
|
6700
|
+
lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substring(fileOrDirectory.lastIndexOf(ts.directorySeparator));
|
|
6701
|
+
lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
|
|
6702
|
+
}
|
|
6703
|
+
/** Watcher for the file system entry depending on whether it is missing or present */
|
|
6704
|
+
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
|
|
6705
|
+
watchMissingFileSystemEntry() :
|
|
6706
|
+
watchPresentFileSystemEntry();
|
|
6707
|
+
return {
|
|
6708
|
+
close: function () {
|
|
6709
|
+
// Close the watcher (either existing file system entry watcher or missing file system entry watcher)
|
|
6710
|
+
watcher.close();
|
|
6711
|
+
watcher = undefined;
|
|
6712
|
+
}
|
|
6713
|
+
};
|
|
6714
|
+
function updateWatcher(createWatcher) {
|
|
6715
|
+
// If watcher is not closed, update it
|
|
6716
|
+
if (watcher) {
|
|
6717
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
|
|
6718
|
+
watcher.close();
|
|
6719
|
+
watcher = createWatcher();
|
|
6720
|
+
}
|
|
6721
|
+
}
|
|
6722
|
+
/**
|
|
6723
|
+
* Watch the file or directory that is currently present
|
|
6724
|
+
* and when the watched file or directory is deleted, switch to missing file system entry watcher
|
|
6725
|
+
*/
|
|
6726
|
+
function watchPresentFileSystemEntry() {
|
|
6727
|
+
if (hitSystemWatcherLimit) {
|
|
6728
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to watchFile");
|
|
6729
|
+
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
6730
|
+
}
|
|
6731
|
+
try {
|
|
6732
|
+
var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ?
|
|
6733
|
+
callbackChangingToMissingFileSystemEntry :
|
|
6734
|
+
function (eventName, relativeFileName) {
|
|
6735
|
+
sysLog("sysLog:: watchPresentFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
|
|
6736
|
+
callback(eventName, relativeFileName);
|
|
6737
|
+
});
|
|
6738
|
+
// Watch the missing file or directory or error
|
|
6739
|
+
presentWatcher.on("error", function () {
|
|
6740
|
+
sysLog("sysLog:: watchPresentFileSystemEntry:: on Error " + fileOrDirectory + " " + entryKind + " rename, \"\"");
|
|
6741
|
+
callback("rename", "");
|
|
6742
|
+
updateWatcher(watchMissingFileSystemEntry);
|
|
6743
|
+
});
|
|
6744
|
+
return presentWatcher;
|
|
6745
|
+
}
|
|
6746
|
+
catch (e) {
|
|
6747
|
+
// Catch the exception and use polling instead
|
|
6748
|
+
// 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
|
|
6749
|
+
// so instead of throwing error, use fs.watchFile
|
|
6750
|
+
hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
|
|
6751
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Changing to watchFile");
|
|
6752
|
+
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
6753
|
+
}
|
|
6754
|
+
}
|
|
6755
|
+
function callbackChangingToMissingFileSystemEntry(event, relativeName) {
|
|
6756
|
+
sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + event + ":: " + relativeName + " " + inodeWatching + " " + lastDirectoryPart + " " + lastDirectoryPartWithDirectorySeparator);
|
|
6757
|
+
if (relativeName && ts.endsWith(relativeName, "~")) {
|
|
6758
|
+
relativeName = relativeName.slice(0, relativeName.length - 1);
|
|
6759
|
+
sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: changed the relative name to " + relativeName);
|
|
6760
|
+
}
|
|
6761
|
+
callback(event, relativeName);
|
|
6762
|
+
// because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
|
|
6763
|
+
// Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
|
|
6764
|
+
if (event === "rename" &&
|
|
6765
|
+
(!relativeName ||
|
|
6766
|
+
relativeName === lastDirectoryPart ||
|
|
6767
|
+
ts.endsWith(relativeName, lastDirectoryPartWithDirectorySeparator))) {
|
|
6768
|
+
if (inodeWatching) {
|
|
6769
|
+
updateWatcher(!fileSystemEntryExists(fileOrDirectory, entryKind) ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
|
|
6770
|
+
}
|
|
6771
|
+
else if (!fileSystemEntryExists(fileOrDirectory, entryKind)) {
|
|
6772
|
+
updateWatcher(watchMissingFileSystemEntry);
|
|
6773
|
+
}
|
|
6774
|
+
}
|
|
6775
|
+
}
|
|
6776
|
+
/**
|
|
6777
|
+
* Watch the file or directory using fs.watchFile since fs.watch threw exception
|
|
6778
|
+
* 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
|
|
6779
|
+
*/
|
|
6780
|
+
function watchPresentFileSystemEntryWithFsWatchFile() {
|
|
6781
|
+
return watchFile(fileOrDirectory, createFileWatcherCallback(function (eventName, relativeFileName) {
|
|
6782
|
+
sysLog("sysLog:: watchPresentFileSystemEntryWithFsWatchFile:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
|
|
6783
|
+
callback(eventName, relativeFileName);
|
|
6784
|
+
}), fallbackPollingInterval, fallbackOptions);
|
|
6785
|
+
}
|
|
6786
|
+
/**
|
|
6787
|
+
* Watch the file or directory that is missing
|
|
6788
|
+
* and switch to existing file or directory when the missing filesystem entry is created
|
|
6789
|
+
*/
|
|
6790
|
+
function watchMissingFileSystemEntry() {
|
|
6791
|
+
return watchFile(fileOrDirectory, function (_fileName, eventKind) {
|
|
6792
|
+
sysLog("sysLog:: watchMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + _fileName + ":: " + eventKind);
|
|
6793
|
+
if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
|
|
6794
|
+
sysLog("sysLog:: watchMissingFileSystemEntry:: Callback :: rename, \"\" and will update the watcher");
|
|
6795
|
+
callback("rename", "");
|
|
6796
|
+
// Call the callback for current file or directory
|
|
6797
|
+
// For now it could be callback for the inner directory creation,
|
|
6798
|
+
// but just return current directory, better than current no-op
|
|
6799
|
+
updateWatcher(watchPresentFileSystemEntry);
|
|
6800
|
+
}
|
|
6801
|
+
}, fallbackPollingInterval, fallbackOptions);
|
|
6802
|
+
}
|
|
6803
|
+
}
|
|
6700
6804
|
}
|
|
6701
6805
|
ts.createSystemWatchFunctions = createSystemWatchFunctions;
|
|
6702
6806
|
/**
|
|
@@ -6749,7 +6853,6 @@ var ts;
|
|
|
6749
6853
|
}
|
|
6750
6854
|
var activeSession;
|
|
6751
6855
|
var profilePath = "./profile.cpuprofile";
|
|
6752
|
-
var hitSystemWatcherLimit = false;
|
|
6753
6856
|
var Buffer = require("buffer").Buffer;
|
|
6754
6857
|
var nodeVersion = getNodeMajorVersion();
|
|
6755
6858
|
var isNode4OrLater = nodeVersion >= 4;
|
|
@@ -6764,20 +6867,21 @@ var ts;
|
|
|
6764
6867
|
getModifiedTime: getModifiedTime,
|
|
6765
6868
|
setTimeout: setTimeout,
|
|
6766
6869
|
clearTimeout: clearTimeout,
|
|
6767
|
-
|
|
6870
|
+
fsWatchWorker: fsWatchWorker,
|
|
6768
6871
|
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
|
6769
6872
|
getCurrentDirectory: getCurrentDirectory,
|
|
6770
|
-
|
|
6873
|
+
fileSystemEntryExists: fileSystemEntryExists,
|
|
6771
6874
|
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
|
6772
6875
|
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
|
6773
6876
|
fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
|
|
6774
|
-
directoryExists: directoryExists,
|
|
6775
6877
|
getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
|
|
6776
6878
|
realpath: realpath,
|
|
6777
6879
|
tscWatchFile: process.env.TSC_WATCHFILE,
|
|
6778
6880
|
useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
|
|
6779
6881
|
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
|
6780
6882
|
defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
6883
|
+
inodeWatching: isLinuxOrMacOs,
|
|
6884
|
+
sysLog: sysLog,
|
|
6781
6885
|
}), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
|
|
6782
6886
|
var nodeSystem = {
|
|
6783
6887
|
args: process.argv.slice(2),
|
|
@@ -7030,107 +7134,11 @@ var ts;
|
|
|
7030
7134
|
callback(fileName, eventKind);
|
|
7031
7135
|
}
|
|
7032
7136
|
}
|
|
7033
|
-
function
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
|
|
7039
|
-
lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
|
|
7040
|
-
}
|
|
7041
|
-
/** Watcher for the file system entry depending on whether it is missing or present */
|
|
7042
|
-
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
|
|
7043
|
-
watchMissingFileSystemEntry() :
|
|
7044
|
-
watchPresentFileSystemEntry();
|
|
7045
|
-
return {
|
|
7046
|
-
close: function () {
|
|
7047
|
-
// Close the watcher (either existing file system entry watcher or missing file system entry watcher)
|
|
7048
|
-
watcher.close();
|
|
7049
|
-
watcher = undefined;
|
|
7050
|
-
}
|
|
7051
|
-
};
|
|
7052
|
-
/**
|
|
7053
|
-
* Invoke the callback with rename and update the watcher if not closed
|
|
7054
|
-
* @param createWatcher
|
|
7055
|
-
*/
|
|
7056
|
-
function invokeCallbackAndUpdateWatcher(createWatcher) {
|
|
7057
|
-
sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
|
|
7058
|
-
// Call the callback for current directory
|
|
7059
|
-
callback("rename", "");
|
|
7060
|
-
// If watcher is not closed, update it
|
|
7061
|
-
if (watcher) {
|
|
7062
|
-
watcher.close();
|
|
7063
|
-
watcher = createWatcher();
|
|
7064
|
-
}
|
|
7065
|
-
}
|
|
7066
|
-
/**
|
|
7067
|
-
* Watch the file or directory that is currently present
|
|
7068
|
-
* and when the watched file or directory is deleted, switch to missing file system entry watcher
|
|
7069
|
-
*/
|
|
7070
|
-
function watchPresentFileSystemEntry() {
|
|
7071
|
-
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
|
7072
|
-
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
|
7073
|
-
if (options === undefined) {
|
|
7074
|
-
if (fsSupportsRecursiveFsWatch) {
|
|
7075
|
-
options = { persistent: true, recursive: !!recursive };
|
|
7076
|
-
}
|
|
7077
|
-
else {
|
|
7078
|
-
options = { persistent: true };
|
|
7079
|
-
}
|
|
7080
|
-
}
|
|
7081
|
-
if (hitSystemWatcherLimit) {
|
|
7082
|
-
sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
|
|
7083
|
-
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
7084
|
-
}
|
|
7085
|
-
try {
|
|
7086
|
-
var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
|
|
7087
|
-
callbackChangingToMissingFileSystemEntry :
|
|
7088
|
-
callback);
|
|
7089
|
-
// Watch the missing file or directory or error
|
|
7090
|
-
presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
|
|
7091
|
-
return presentWatcher;
|
|
7092
|
-
}
|
|
7093
|
-
catch (e) {
|
|
7094
|
-
// Catch the exception and use polling instead
|
|
7095
|
-
// 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
|
|
7096
|
-
// so instead of throwing error, use fs.watchFile
|
|
7097
|
-
hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
|
|
7098
|
-
sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
|
|
7099
|
-
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
7100
|
-
}
|
|
7101
|
-
}
|
|
7102
|
-
function callbackChangingToMissingFileSystemEntry(event, relativeName) {
|
|
7103
|
-
// because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
|
|
7104
|
-
// Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
|
|
7105
|
-
return event === "rename" &&
|
|
7106
|
-
(!relativeName ||
|
|
7107
|
-
relativeName === lastDirectoryPart ||
|
|
7108
|
-
(relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
|
|
7109
|
-
!fileSystemEntryExists(fileOrDirectory, entryKind) ?
|
|
7110
|
-
invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
|
|
7111
|
-
callback(event, relativeName);
|
|
7112
|
-
}
|
|
7113
|
-
/**
|
|
7114
|
-
* Watch the file or directory using fs.watchFile since fs.watch threw exception
|
|
7115
|
-
* 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
|
|
7116
|
-
*/
|
|
7117
|
-
function watchPresentFileSystemEntryWithFsWatchFile() {
|
|
7118
|
-
return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
|
|
7119
|
-
}
|
|
7120
|
-
/**
|
|
7121
|
-
* Watch the file or directory that is missing
|
|
7122
|
-
* and switch to existing file or directory when the missing filesystem entry is created
|
|
7123
|
-
*/
|
|
7124
|
-
function watchMissingFileSystemEntry() {
|
|
7125
|
-
return watchFile(fileOrDirectory, function (_fileName, eventKind) {
|
|
7126
|
-
if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
|
|
7127
|
-
// Call the callback for current file or directory
|
|
7128
|
-
// For now it could be callback for the inner directory creation,
|
|
7129
|
-
// but just return current directory, better than current no-op
|
|
7130
|
-
invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
|
|
7131
|
-
}
|
|
7132
|
-
}, fallbackPollingInterval, fallbackOptions);
|
|
7133
|
-
}
|
|
7137
|
+
function fsWatchWorker(fileOrDirectory, recursive, callback) {
|
|
7138
|
+
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
|
7139
|
+
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
|
7140
|
+
return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
|
|
7141
|
+
{ persistent: true, recursive: !!recursive } : { persistent: true }, callback);
|
|
7134
7142
|
}
|
|
7135
7143
|
function readFileWorker(fileName, _encoding) {
|
|
7136
7144
|
var buffer;
|
|
@@ -42037,7 +42045,7 @@ var ts;
|
|
|
42037
42045
|
}
|
|
42038
42046
|
if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
|
|
42039
42047
|
return {
|
|
42040
|
-
key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
|
|
42048
|
+
key: ts.removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec)),
|
|
42041
42049
|
flags: 1 /* Recursive */
|
|
42042
42050
|
};
|
|
42043
42051
|
}
|
|
@@ -48532,7 +48540,6 @@ var ts;
|
|
|
48532
48540
|
var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
|
|
48533
48541
|
emptyTypeLiteralSymbol.members = ts.createSymbolTable();
|
|
48534
48542
|
var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
48535
|
-
var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
|
|
48536
48543
|
var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
48537
48544
|
emptyGenericType.instantiations = new ts.Map();
|
|
48538
48545
|
var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
@@ -58702,7 +58709,7 @@ var ts;
|
|
|
58702
58709
|
}
|
|
58703
58710
|
}
|
|
58704
58711
|
}
|
|
58705
|
-
else if (t.flags & 469892092 /* DisjointDomains */
|
|
58712
|
+
else if (t.flags & 469892092 /* DisjointDomains */) {
|
|
58706
58713
|
hasDisjointDomainType = true;
|
|
58707
58714
|
}
|
|
58708
58715
|
}
|
|
@@ -58714,7 +58721,7 @@ var ts;
|
|
|
58714
58721
|
// intersection operation to reduce the union constraints.
|
|
58715
58722
|
for (var _a = 0, types_6 = types; _a < types_6.length; _a++) {
|
|
58716
58723
|
var t = types_6[_a];
|
|
58717
|
-
if (t.flags & 469892092 /* DisjointDomains */
|
|
58724
|
+
if (t.flags & 469892092 /* DisjointDomains */) {
|
|
58718
58725
|
constraints = ts.append(constraints, t);
|
|
58719
58726
|
}
|
|
58720
58727
|
}
|
|
@@ -61263,7 +61270,7 @@ var ts;
|
|
|
61263
61270
|
}
|
|
61264
61271
|
return includes;
|
|
61265
61272
|
}
|
|
61266
|
-
function
|
|
61273
|
+
function removeRedundantPrimitiveTypes(types, includes) {
|
|
61267
61274
|
var i = types.length;
|
|
61268
61275
|
while (i > 0) {
|
|
61269
61276
|
i--;
|
|
@@ -61271,9 +61278,7 @@ var ts;
|
|
|
61271
61278
|
var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
|
|
61272
61279
|
t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
|
|
61273
61280
|
t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
|
|
61274
|
-
t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol
|
|
61275
|
-
t.flags & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
|
|
61276
|
-
isEmptyAnonymousObjectType(t) && includes & 470302716 /* DefinitelyNonNullable */;
|
|
61281
|
+
t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
|
|
61277
61282
|
if (remove) {
|
|
61278
61283
|
ts.orderedRemoveItemAt(types, i);
|
|
61279
61284
|
}
|
|
@@ -61395,7 +61400,7 @@ var ts;
|
|
|
61395
61400
|
// a type alias of the form "type List<T> = T & { next: List<T> }" cannot be reduced during its declaration.
|
|
61396
61401
|
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
|
|
61397
61402
|
// for intersections of types with signatures can be deterministic.
|
|
61398
|
-
function getIntersectionType(types, aliasSymbol, aliasTypeArguments
|
|
61403
|
+
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
61399
61404
|
var typeMembershipMap = new ts.Map();
|
|
61400
61405
|
var includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
61401
61406
|
var typeSet = ts.arrayFrom(typeMembershipMap.values());
|
|
@@ -61432,11 +61437,11 @@ var ts;
|
|
|
61432
61437
|
if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
|
|
61433
61438
|
includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
|
|
61434
61439
|
includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
|
|
61435
|
-
includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */
|
|
61436
|
-
|
|
61437
|
-
|
|
61438
|
-
|
|
61439
|
-
|
|
61440
|
+
includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
|
|
61441
|
+
removeRedundantPrimitiveTypes(typeSet, includes);
|
|
61442
|
+
}
|
|
61443
|
+
if (includes & 16777216 /* IncludesEmptyObject */ && includes & 524288 /* Object */) {
|
|
61444
|
+
ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
|
|
61440
61445
|
}
|
|
61441
61446
|
if (includes & 262144 /* IncludesMissingType */) {
|
|
61442
61447
|
typeSet[typeSet.indexOf(undefinedType)] = missingType;
|
|
@@ -61475,9 +61480,8 @@ var ts;
|
|
|
61475
61480
|
}
|
|
61476
61481
|
var constituents = getCrossProductIntersections(typeSet);
|
|
61477
61482
|
// We attach a denormalized origin type when at least one constituent of the cross-product union is an
|
|
61478
|
-
// intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions)
|
|
61479
|
-
|
|
61480
|
-
var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
|
|
61483
|
+
// intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions).
|
|
61484
|
+
var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
|
|
61481
61485
|
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
61482
61486
|
}
|
|
61483
61487
|
}
|
|
@@ -61520,21 +61524,11 @@ var ts;
|
|
|
61520
61524
|
}
|
|
61521
61525
|
return intersections;
|
|
61522
61526
|
}
|
|
61523
|
-
function getConstituentCount(type) {
|
|
61524
|
-
return !(type.flags & 3145728 /* UnionOrIntersection */) || type.aliasSymbol ? 1 :
|
|
61525
|
-
type.flags & 1048576 /* Union */ && type.origin ? getConstituentCount(type.origin) :
|
|
61526
|
-
getConstituentCountOfTypes(type.types);
|
|
61527
|
-
}
|
|
61528
|
-
function getConstituentCountOfTypes(types) {
|
|
61529
|
-
return ts.reduceLeft(types, function (n, t) { return n + getConstituentCount(t); }, 0);
|
|
61530
|
-
}
|
|
61531
61527
|
function getTypeFromIntersectionTypeNode(node) {
|
|
61532
61528
|
var links = getNodeLinks(node);
|
|
61533
61529
|
if (!links.resolvedType) {
|
|
61534
61530
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
61535
|
-
|
|
61536
|
-
var noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && types[1] === emptyTypeLiteralType;
|
|
61537
|
-
links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
|
|
61531
|
+
links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
61538
61532
|
}
|
|
61539
61533
|
return links.resolvedType;
|
|
61540
61534
|
}
|
|
@@ -64320,17 +64314,6 @@ var ts;
|
|
|
64320
64314
|
return !!(ts.getObjectFlags(type) & 16 /* Anonymous */ && (type.members && isEmptyResolvedType(type) ||
|
|
64321
64315
|
type.symbol && type.symbol.flags & 2048 /* TypeLiteral */ && getMembersOfSymbol(type.symbol).size === 0));
|
|
64322
64316
|
}
|
|
64323
|
-
function isUnknownLikeUnionType(type) {
|
|
64324
|
-
if (strictNullChecks && type.flags & 1048576 /* Union */) {
|
|
64325
|
-
if (!(type.objectFlags & 33554432 /* IsUnknownLikeUnionComputed */)) {
|
|
64326
|
-
var types = type.types;
|
|
64327
|
-
type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 32768 /* Undefined */ &&
|
|
64328
|
-
types[1].flags & 65536 /* Null */ && ts.some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0);
|
|
64329
|
-
}
|
|
64330
|
-
return !!(type.objectFlags & 67108864 /* IsUnknownLikeUnion */);
|
|
64331
|
-
}
|
|
64332
|
-
return false;
|
|
64333
|
-
}
|
|
64334
64317
|
function isStringIndexSignatureOnlyType(type) {
|
|
64335
64318
|
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
|
|
64336
64319
|
type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
|
|
@@ -64410,7 +64393,7 @@ var ts;
|
|
|
64410
64393
|
return true;
|
|
64411
64394
|
if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
|
|
64412
64395
|
return true;
|
|
64413
|
-
if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */
|
|
64396
|
+
if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
|
|
64414
64397
|
return true;
|
|
64415
64398
|
if (relation === assignableRelation || relation === comparableRelation) {
|
|
64416
64399
|
if (s & 1 /* Any */)
|
|
@@ -64420,9 +64403,6 @@ var ts;
|
|
|
64420
64403
|
// bit-flag enum types sometimes look like literal enum types with numeric literal values.
|
|
64421
64404
|
if (s & (8 /* Number */ | 256 /* NumberLiteral */) && !(s & 1024 /* EnumLiteral */) && (t & 32 /* Enum */ || relation === assignableRelation && t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */))
|
|
64422
64405
|
return true;
|
|
64423
|
-
// Anything is assignable to a union containing undefined, null, and {}
|
|
64424
|
-
if (isUnknownLikeUnionType(target))
|
|
64425
|
-
return true;
|
|
64426
64406
|
}
|
|
64427
64407
|
return false;
|
|
64428
64408
|
}
|
|
@@ -64465,27 +64445,16 @@ var ts;
|
|
|
64465
64445
|
function getNormalizedType(type, writing) {
|
|
64466
64446
|
while (true) {
|
|
64467
64447
|
var t = isFreshLiteralType(type) ? type.regularType :
|
|
64468
|
-
ts.getObjectFlags(type) & 4 /* Reference */
|
|
64469
|
-
type.flags & 3145728 /* UnionOrIntersection */ ?
|
|
64448
|
+
ts.getObjectFlags(type) & 4 /* Reference */ && type.node ? createTypeReference(type.target, getTypeArguments(type)) :
|
|
64449
|
+
type.flags & 3145728 /* UnionOrIntersection */ ? getReducedType(type) :
|
|
64470
64450
|
type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : type.substitute :
|
|
64471
64451
|
type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) :
|
|
64472
64452
|
type;
|
|
64453
|
+
t = getSingleBaseForNonAugmentingSubtype(t) || t;
|
|
64473
64454
|
if (t === type)
|
|
64474
|
-
|
|
64455
|
+
break;
|
|
64475
64456
|
type = t;
|
|
64476
64457
|
}
|
|
64477
|
-
}
|
|
64478
|
-
function getNormalizedUnionOrIntersectionType(type, writing) {
|
|
64479
|
-
var reduced = getReducedType(type);
|
|
64480
|
-
if (reduced !== type) {
|
|
64481
|
-
return reduced;
|
|
64482
|
-
}
|
|
64483
|
-
if (type.flags & 2097152 /* Intersection */) {
|
|
64484
|
-
var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
|
|
64485
|
-
if (normalizedTypes !== type.types) {
|
|
64486
|
-
return getIntersectionType(normalizedTypes);
|
|
64487
|
-
}
|
|
64488
|
-
}
|
|
64489
64458
|
return type;
|
|
64490
64459
|
}
|
|
64491
64460
|
/**
|
|
@@ -67484,22 +67453,20 @@ var ts;
|
|
|
67484
67453
|
return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
|
|
67485
67454
|
}
|
|
67486
67455
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
67456
|
+
// First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
|
|
67457
|
+
// 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
|
|
67458
|
+
// that isn't eliminated by a NonNullable<T> instantiation.
|
|
67459
|
+
var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
67487
67460
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
67488
67461
|
deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
|
|
67489
67462
|
}
|
|
67463
|
+
// If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
|
|
67490
67464
|
return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
|
|
67491
|
-
getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [
|
|
67492
|
-
|
|
67465
|
+
getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
|
|
67466
|
+
reducedType;
|
|
67493
67467
|
}
|
|
67494
67468
|
function getNonNullableType(type) {
|
|
67495
|
-
|
|
67496
|
-
// First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
|
|
67497
|
-
// 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
|
|
67498
|
-
// that isn't eliminated by a NonNullable<T> instantiation.
|
|
67499
|
-
var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
67500
|
-
return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
|
|
67501
|
-
}
|
|
67502
|
-
return type;
|
|
67469
|
+
return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
|
|
67503
67470
|
}
|
|
67504
67471
|
function addOptionalTypeMarker(type) {
|
|
67505
67472
|
return strictNullChecks ? getUnionType([type, optionalType]) : type;
|
|
@@ -69530,24 +69497,6 @@ var ts;
|
|
|
69530
69497
|
function getTypeWithFacts(type, include) {
|
|
69531
69498
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
69532
69499
|
}
|
|
69533
|
-
function getIntersectionWithFacts(type, facts) {
|
|
69534
|
-
var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
69535
|
-
if (strictNullChecks) {
|
|
69536
|
-
switch (facts) {
|
|
69537
|
-
case 524288 /* NEUndefined */:
|
|
69538
|
-
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; });
|
|
69539
|
-
case 1048576 /* NENull */:
|
|
69540
|
-
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; });
|
|
69541
|
-
case 2097152 /* NEUndefinedOrNull */:
|
|
69542
|
-
case 4194304 /* Truthy */:
|
|
69543
|
-
return mapType(reduced, function (t) { return getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t; });
|
|
69544
|
-
}
|
|
69545
|
-
}
|
|
69546
|
-
return reduced;
|
|
69547
|
-
}
|
|
69548
|
-
function recombineUnknownType(type) {
|
|
69549
|
-
return type === unknownUnionType ? unknownType : type;
|
|
69550
|
-
}
|
|
69551
69500
|
function getTypeWithDefault(type, defaultExpression) {
|
|
69552
69501
|
return defaultExpression ?
|
|
69553
69502
|
getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
|
|
@@ -70605,7 +70554,7 @@ var ts;
|
|
|
70605
70554
|
if (isEvolvingArrayTypeList(types)) {
|
|
70606
70555
|
return getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType)));
|
|
70607
70556
|
}
|
|
70608
|
-
var result =
|
|
70557
|
+
var result = getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
|
|
70609
70558
|
if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && ts.arraysEqual(result.types, declaredType.types)) {
|
|
70610
70559
|
return declaredType;
|
|
70611
70560
|
}
|
|
@@ -70707,7 +70656,8 @@ var ts;
|
|
|
70707
70656
|
}
|
|
70708
70657
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
70709
70658
|
if (isMatchingReference(reference, expr)) {
|
|
70710
|
-
return
|
|
70659
|
+
return type.flags & 2 /* Unknown */ && assumeTrue ? nonNullUnknownType :
|
|
70660
|
+
getTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
|
|
70711
70661
|
}
|
|
70712
70662
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
|
|
70713
70663
|
type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
@@ -70860,6 +70810,9 @@ var ts;
|
|
|
70860
70810
|
assumeTrue = !assumeTrue;
|
|
70861
70811
|
}
|
|
70862
70812
|
var valueType = getTypeOfExpression(value);
|
|
70813
|
+
if (assumeTrue && (type.flags & 2 /* Unknown */) && (operator === 34 /* EqualsEqualsToken */ || operator === 35 /* ExclamationEqualsToken */) && (valueType.flags & 65536 /* Null */)) {
|
|
70814
|
+
return getUnionType([nullType, undefinedType]);
|
|
70815
|
+
}
|
|
70863
70816
|
if ((type.flags & 2 /* Unknown */) && assumeTrue && (operator === 36 /* EqualsEqualsEqualsToken */ || operator === 37 /* ExclamationEqualsEqualsToken */)) {
|
|
70864
70817
|
if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
|
|
70865
70818
|
return valueType;
|
|
@@ -70879,7 +70832,7 @@ var ts;
|
|
|
70879
70832
|
valueType.flags & 65536 /* Null */ ?
|
|
70880
70833
|
assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
|
|
70881
70834
|
assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
|
|
70882
|
-
return
|
|
70835
|
+
return type.flags & 2 /* Unknown */ && facts & (1048576 /* NENull */ | 2097152 /* NEUndefinedOrNull */) ? nonNullUnknownType : getTypeWithFacts(type, facts);
|
|
70883
70836
|
}
|
|
70884
70837
|
if (assumeTrue) {
|
|
70885
70838
|
var filterFn = operator === 34 /* EqualsEqualsToken */ ?
|
|
@@ -70907,11 +70860,17 @@ var ts;
|
|
|
70907
70860
|
if (type.flags & 1 /* Any */ && literal.text === "function") {
|
|
70908
70861
|
return type;
|
|
70909
70862
|
}
|
|
70863
|
+
if (assumeTrue && type.flags & 2 /* Unknown */ && literal.text === "object") {
|
|
70864
|
+
// The non-null unknown type is used to track whether a previous narrowing operation has removed the null type
|
|
70865
|
+
// from the unknown type. For example, the expression `x && typeof x === 'object'` first narrows x to the non-null
|
|
70866
|
+
// unknown type, and then narrows that to the non-primitive type.
|
|
70867
|
+
return type === nonNullUnknownType ? nonPrimitiveType : getUnionType([nonPrimitiveType, nullType]);
|
|
70868
|
+
}
|
|
70910
70869
|
var facts = assumeTrue ?
|
|
70911
70870
|
typeofEQFacts.get(literal.text) || 128 /* TypeofEQHostObject */ :
|
|
70912
70871
|
typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */;
|
|
70913
70872
|
var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
|
|
70914
|
-
return getTypeWithFacts(assumeTrue && impliedType ?
|
|
70873
|
+
return getTypeWithFacts(assumeTrue && impliedType ? mapType(type, narrowUnionMemberByTypeof(impliedType)) : type, facts);
|
|
70915
70874
|
}
|
|
70916
70875
|
function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
|
|
70917
70876
|
var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
|
|
@@ -70960,10 +70919,10 @@ var ts;
|
|
|
70960
70919
|
}
|
|
70961
70920
|
function getImpliedTypeFromTypeofGuard(type, text) {
|
|
70962
70921
|
switch (text) {
|
|
70963
|
-
case "object":
|
|
70964
|
-
return type.flags & 1 /* Any */ ? type : getUnionType([nullType, nonPrimitiveType]);
|
|
70965
70922
|
case "function":
|
|
70966
70923
|
return type.flags & 1 /* Any */ ? type : globalFunctionType;
|
|
70924
|
+
case "object":
|
|
70925
|
+
return type.flags & 2 /* Unknown */ ? getUnionType([nonPrimitiveType, nullType]) : type;
|
|
70967
70926
|
default:
|
|
70968
70927
|
return typeofTypesByName.get(text);
|
|
70969
70928
|
}
|
|
@@ -70974,27 +70933,22 @@ var ts;
|
|
|
70974
70933
|
// the guard. For example: narrowing `{} | undefined` by `"boolean"` should produce the type `boolean`, not
|
|
70975
70934
|
// the filtered type `{}`. For this reason we narrow constituents of the union individually, in addition to
|
|
70976
70935
|
// filtering by type-facts.
|
|
70977
|
-
function
|
|
70978
|
-
|
|
70979
|
-
|
|
70980
|
-
|
|
70981
|
-
return mapType(type, function (t) {
|
|
70982
|
-
if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
|
|
70983
|
-
return t;
|
|
70936
|
+
function narrowUnionMemberByTypeof(candidate) {
|
|
70937
|
+
return function (type) {
|
|
70938
|
+
if (isTypeSubtypeOf(type, candidate)) {
|
|
70939
|
+
return type;
|
|
70984
70940
|
}
|
|
70985
|
-
|
|
70986
|
-
|
|
70987
|
-
|
|
70988
|
-
|
|
70989
|
-
|
|
70990
|
-
|
|
70991
|
-
|
|
70992
|
-
if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
|
|
70993
|
-
return c;
|
|
70941
|
+
if (isTypeSubtypeOf(candidate, type)) {
|
|
70942
|
+
return candidate;
|
|
70943
|
+
}
|
|
70944
|
+
if (type.flags & 465829888 /* Instantiable */) {
|
|
70945
|
+
var constraint = getBaseConstraintOfType(type) || anyType;
|
|
70946
|
+
if (isTypeSubtypeOf(candidate, constraint)) {
|
|
70947
|
+
return getIntersectionType([type, candidate]);
|
|
70994
70948
|
}
|
|
70995
|
-
|
|
70996
|
-
|
|
70997
|
-
}
|
|
70949
|
+
}
|
|
70950
|
+
return type;
|
|
70951
|
+
};
|
|
70998
70952
|
}
|
|
70999
70953
|
function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
|
|
71000
70954
|
var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, /*retainDefault*/ true);
|
|
@@ -71053,7 +71007,7 @@ var ts;
|
|
|
71053
71007
|
because it is caught in the first clause.
|
|
71054
71008
|
*/
|
|
71055
71009
|
var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
|
|
71056
|
-
return getTypeWithFacts(
|
|
71010
|
+
return getTypeWithFacts(mapType(type, narrowUnionMemberByTypeof(impliedType)), switchFacts);
|
|
71057
71011
|
}
|
|
71058
71012
|
function isMatchingConstructorReference(expr) {
|
|
71059
71013
|
return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
|
|
@@ -71357,9 +71311,7 @@ var ts;
|
|
|
71357
71311
|
!(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
71358
71312
|
}
|
|
71359
71313
|
function isGenericTypeWithUnionConstraint(type) {
|
|
71360
|
-
return type.flags &
|
|
71361
|
-
ts.some(type.types, isGenericTypeWithUnionConstraint) :
|
|
71362
|
-
!!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
71314
|
+
return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
71363
71315
|
}
|
|
71364
71316
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
71365
71317
|
return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
@@ -71387,7 +71339,7 @@ var ts;
|
|
|
71387
71339
|
var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
|
|
71388
71340
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
71389
71341
|
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
71390
|
-
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
|
71342
|
+
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
|
|
71391
71343
|
}
|
|
71392
71344
|
function isExportOrExportExpression(location) {
|
|
71393
71345
|
return !!ts.findAncestor(location, function (n) {
|
|
@@ -123697,6 +123649,7 @@ var ts;
|
|
|
123697
123649
|
}
|
|
123698
123650
|
function reloadFileNamesFromConfigFile() {
|
|
123699
123651
|
writeLog("Reloading new file names and options");
|
|
123652
|
+
reloadLevel = ts.ConfigFileProgramReloadLevel.None;
|
|
123700
123653
|
rootFileNames = ts.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
|
|
123701
123654
|
if (ts.updateErrorForNoInputFiles(rootFileNames, ts.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
|
|
123702
123655
|
hasChangedConfigFileParsingErrors = true;
|