{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3648","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3648/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3648/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3648/events","html_url":"https://github.com/Microsoft/TypeScript/pull/3648","id":91197391,"number":3648,"title":"Conflict with Object.prototype.watch in FireFox/Gecko","user":{"login":"mihailik","id":4041967,"avatar_url":"https://avatars.githubusercontent.com/u/4041967?v=3","gravatar_id":"","url":"https://api.github.com/users/mihailik","html_url":"https://github.com/mihailik","followers_url":"https://api.github.com/users/mihailik/followers","following_url":"https://api.github.com/users/mihailik/following{/other_user}","gists_url":"https://api.github.com/users/mihailik/gists{/gist_id}","starred_url":"https://api.github.com/users/mihailik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mihailik/subscriptions","organizations_url":"https://api.github.com/users/mihailik/orgs","repos_url":"https://api.github.com/users/mihailik/repos","events_url":"https://api.github.com/users/mihailik/events{/privacy}","received_events_url":"https://api.github.com/users/mihailik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/cla-not-required","name":"cla-not-required","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-26T09:07:09Z","updated_at":"2015-06-26T15:50:33Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/3648","html_url":"https://github.com/Microsoft/TypeScript/pull/3648","diff_url":"https://github.com/Microsoft/TypeScript/pull/3648.diff","patch_url":"https://github.com/Microsoft/TypeScript/pull/3648.patch"},"body":"In Gecko engine `commandLine.options.watch` evaluates to a truthy value — [Object.prototype.watch](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch). That means running the compiler in Gecko (as opposed to V8/node) it effectively defaults --watch to true\r\n\r\nExtra hasOwnProperty check makes sure we're discounting prototype's `watch` function.\r\n\r\nAs an alternative to the suggested changes we can check `typeof != 'function'` or rename [CompilerOptions.watch](https://github.com/Microsoft/TypeScript/blob/master/src/compiler/types.ts#L1860) to say `watchFiles` to avoid the conflict altogether. Neither of those looks preferable.\r\n\r\nI've got a tool prototype that allows [running TypeScript compiler in a browser](https://cdn.rawgit.com/portabled/portabled/61ff51ead97882a7f8b202c0c5f4f06db180c0f4/mi-save.html). Surprisingly, **tsc.js** is able to compile a simple dummy file in virtually any old browser: Opera12, IE6, old Blackberry, iPhone 4. The only exception at the moment is FireFox/Gecko, because of 'watch'. When I delete Object.prototype.watch and run tsc.js, it succeeds in Gecko too.\r\n\r\nDespite browser compatibility is not an official goal, it's a nice to have feature. And the cost is a one-line change."},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/115737965","html_url":"https://github.com/Microsoft/TypeScript/pull/3648#issuecomment-115737965","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3648","id":115737965,"user":{"login":"DanielRosenwasser","id":972891,"avatar_url":"https://avatars.githubusercontent.com/u/972891?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielRosenwasser","html_url":"https://github.com/DanielRosenwasser","followers_url":"https://api.github.com/users/DanielRosenwasser/followers","following_url":"https://api.github.com/users/DanielRosenwasser/following{/other_user}","gists_url":"https://api.github.com/users/DanielRosenwasser/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielRosenwasser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielRosenwasser/subscriptions","organizations_url":"https://api.github.com/users/DanielRosenwasser/orgs","repos_url":"https://api.github.com/users/DanielRosenwasser/repos","events_url":"https://api.github.com/users/DanielRosenwasser/events{/privacy}","received_events_url":"https://api.github.com/users/DanielRosenwasser/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T15:50:33Z","updated_at":"2015-06-26T15:50:33Z","body":"Apart from the last feedback, :+1: "}}