Skip to content

Commit c244306

Browse files
author
zhengbli
committed
address CR feedback: use typeof check instead of checking undefined and null value
1 parent c2f453b commit c244306

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/compiler/sys.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,11 @@ namespace ts {
376376
/**
377377
* @param watcherPath is the path from which the watcher is triggered.
378378
*/
379-
function fileEventHandler(eventName: string, relativefileName: string, baseDirPath: Path) {
379+
function fileEventHandler(eventName: string, relativeFileName: string, baseDirPath: Path) {
380380
// When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
381-
/* tslint:disable:no-null */
382-
const filePath = relativefileName === undefined || relativefileName === null
381+
const filePath = typeof relativeFileName !== "string"
383382
? undefined
384-
: toPath(relativefileName, baseDirPath, createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
385-
/* tslint:enable:no-null */
383+
: toPath(relativeFileName, baseDirPath, createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
386384
if (eventName === "change" && fileWatcherCallbacks.contains(filePath)) {
387385
for (const fileCallback of fileWatcherCallbacks.get(filePath)) {
388386
fileCallback(filePath);

0 commit comments

Comments
 (0)