Skip to content

Commit 8aaf923

Browse files
committed
Firefox has Object.prototype.watch
1 parent 8a050ea commit 8aaf923

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/compiler/tsc.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ namespace ts {
415415

416416
const compileResult = compile(rootFileNames, compilerOptions, compilerHost);
417417

418-
if (!compilerOptions.watch) {
418+
// Firefox has Object.prototype.watch
419+
if (!compilerOptions.watch || !compilerOptions.hasOwnProperty("watch")) {
419420
return sys.exit(compileResult.exitStatus);
420421
}
421422

@@ -441,7 +442,8 @@ namespace ts {
441442
}
442443
// Use default host function
443444
const sourceFile = hostGetSourceFile(fileName, languageVersion, onError);
444-
if (sourceFile && compilerOptions.watch) {
445+
// Firefox has Object.prototype.watch
446+
if (sourceFile && compilerOptions.watch && compilerOptions.hasOwnProperty("watch")) {
445447
// Attach a file watcher
446448
const filePath = toPath(sourceFile.fileName, sys.getCurrentDirectory(), createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
447449
sourceFile.fileWatcher = sys.watchFile(filePath, (fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed));

0 commit comments

Comments
 (0)