0
我們一直在使用TypeScript一段時間,特別是這一行來克服IE的問題與控制檯。Web Essentials 2013已打破修復控制檯打字稿
if (typeof console == "undefined" || typeof console.log == "undefined") var console = <any>{ log: function() { } };
但是我最近升級了我的Web Essentials版本到最新的1.85,現在我得到了這行代碼沒有改變的錯誤。
Subsequent variable declarations must have the same type. Variable 'console' must be of type 'Console', but here has type 'any'.
我沒有嘗試這個頁面TypeScript: console is undefined in IE但我得到的錯誤試圖重新定義window.console上的一些解決方案。
其他人都遇到過這個問題,他們對此做了什麼?
它結束了是打字稿已經意識到Console對象的,所以我們用的解決辦法是做同一行但有了這個小小的變化:'if(typeof console ==「undefined」|| typeof console.log ==「undefined」)var console = {log:function(){}};'** ** any ** with **安慰** –