Add check for no match into fs watch rename event handler (#42651)

This commit is contained in:
Wesley Wigham 2021-02-04 13:20:38 -08:00 committed by GitHub
parent ab2729a99b
commit be18057792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1560,7 +1560,7 @@ namespace ts {
return event === "rename" &&
(!relativeName ||
relativeName === lastDirectoryPart ||
relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator!) === relativeName.length - lastDirectoryPartWithDirectorySeparator!.length) &&
(relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator!) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator!) === relativeName.length - lastDirectoryPartWithDirectorySeparator!.length)) &&
!fileSystemEntryExists(fileOrDirectory, entryKind) ?
invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
callback(event, relativeName);