The previous (1.0 or 1.1) compiler emitted a table of identifier renames into the source map. Principally this was for renames of "this" into "_this". The IE developer tools used this to make this scenario work
This feature was lost when the compiler was rewritten because the table is no longer emitted into the source map. We'd like it back so that our feature works again..
this is related, and partially covers #2617
Bug, @mhegazy?
it is a bug alright.. the scope is bigger than your normal bug-level changes though.
+1
This bug is really annoying when debugging TypeScript code in Chrome (or any other browser). It would be great if this could be fixed soon! Thanks!
+1 in arrow functions ( () => {} ) 'this' is captured as Window making debugging almost impossible... this is the kind of bug that makes an interesant lenguage less atractive
+1 this needs to be addressed, makes debugging Cordova apps very confusing as well.
A fix would be much appreciated.
this
is always undefined in browser dev tools. Easy to be perplexed.
One workaround for the lack of 'this' in the source map is to assign 'this' to another variable, such as 'self' and then use that variable (as a replacement for 'this') for the rest of the code in that function. In other words, "let self = this;"
Of course, this (or rather 'self') is a really annoying workaround because it needs to be applied to every function that you may wish to debug. I expect more from a modern development tool set.
Please fix!
I'm using Typescript 2.3.1 and seems to be fixed.
Proposal since it's been a while and browser support is better now: Target es2015 while debugging so the typescript compiler does need to translate the arrow functions into old es5. Then for production use es5 if one needs to.
Any update on this? It's still an issue with vs code with es5 and arrow function, it's really annoying should be addressed with a higher priority.
Still an issue, would be good to get it addressed
Most helpful comment
+1
This bug is really annoying when debugging TypeScript code in Chrome (or any other browser). It would be great if this could be fixed soon! Thanks!