For JavaScript I found the following solution for Internet Explorer to be able to deal with console.log without hitting F12.
'console' is undefined error for Internet Explorer
however when I use the following lines in Typescript I can’t compile.
if (!console) console = {log: function() {}};
Any ideas?
You are getting an error because the object literal you wrote doesn’t have all the same members as a regular
console. Simplest fix would just be to type-assert asany:Obviously you’ll need to not call anything off
consoleother thanlog.