Skip to content

Commit 638cf5b

Browse files
committed
Ignore the directory watchers invoked in non polling watch mode with no relative file name information
Fixes #27326
1 parent 10edf6f commit 638cf5b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/compiler/sys.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -796,11 +796,10 @@ namespace ts {
796796
dirName,
797797
(_eventName: string, relativeFileName) => {
798798
// When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
799-
const fileName = !isString(relativeFileName)
800-
? undefined! // TODO: GH#18217
801-
: getNormalizedAbsolutePath(relativeFileName, dirName);
799+
if (!isString(relativeFileName)) { return; }
800+
const fileName = getNormalizedAbsolutePath(relativeFileName, dirName);
802801
// Some applications save a working file via rename operations
803-
const callbacks = fileWatcherCallbacks.get(toCanonicalName(fileName));
802+
const callbacks = fileName && fileWatcherCallbacks.get(toCanonicalName(fileName));
804803
if (callbacks) {
805804
for (const fileCallback of callbacks) {
806805
fileCallback(fileName, FileWatcherEventKind.Changed);

0 commit comments

Comments
 (0)