mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-05 10:32:08 -05:00
address CR feedback: use typeof check instead of checking undefined and null value
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user