From 8aaf923260b4920c21c087c4d8b3618639aed071 Mon Sep 17 00:00:00 2001 From: mihailik Date: Thu, 18 Feb 2016 21:43:10 +0000 Subject: [PATCH] Firefox has Object.prototype.watch --- src/compiler/tsc.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 59212ed849b..93be03398e1 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -415,7 +415,8 @@ namespace ts { const compileResult = compile(rootFileNames, compilerOptions, compilerHost); - if (!compilerOptions.watch) { + // Firefox has Object.prototype.watch + if (!compilerOptions.watch || !compilerOptions.hasOwnProperty("watch")) { return sys.exit(compileResult.exitStatus); } @@ -441,7 +442,8 @@ namespace ts { } // Use default host function const sourceFile = hostGetSourceFile(fileName, languageVersion, onError); - if (sourceFile && compilerOptions.watch) { + // Firefox has Object.prototype.watch + if (sourceFile && compilerOptions.watch && compilerOptions.hasOwnProperty("watch")) { // Attach a file watcher const filePath = toPath(sourceFile.fileName, sys.getCurrentDirectory(), createGetCanonicalFileName(sys.useCaseSensitiveFileNames)); sourceFile.fileWatcher = sys.watchFile(filePath, (fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed));