From c244306514a7e338a17c2a1b9f2e3959308435cb Mon Sep 17 00:00:00 2001 From: zhengbli Date: Fri, 15 Jan 2016 16:55:25 -0800 Subject: [PATCH] address CR feedback: use typeof check instead of checking undefined and null value --- src/compiler/sys.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 1a97e9c8d0a..bf25d39aa43 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -376,13 +376,11 @@ namespace ts { /** * @param watcherPath is the path from which the watcher is triggered. */ - function fileEventHandler(eventName: string, relativefileName: string, baseDirPath: Path) { + function fileEventHandler(eventName: string, relativeFileName: string, baseDirPath: Path) { // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined" - /* tslint:disable:no-null */ - const filePath = relativefileName === undefined || relativefileName === null + const filePath = typeof relativeFileName !== "string" ? undefined - : toPath(relativefileName, baseDirPath, createGetCanonicalFileName(sys.useCaseSensitiveFileNames)); - /* tslint:enable:no-null */ + : toPath(relativeFileName, baseDirPath, createGetCanonicalFileName(sys.useCaseSensitiveFileNames)); if (eventName === "change" && fileWatcherCallbacks.contains(filePath)) { for (const fileCallback of fileWatcherCallbacks.get(filePath)) { fileCallback(filePath);