address CR feedback: use typeof check instead of checking undefined and null value
This commit is contained in:
parent
c2f453b8fb
commit
c244306514
1 changed files with 3 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue