title: TypeScript mapping of 'this' is not working in Chrome debugger
body: <p>I am using VS 2015 and Chrome to develop my web application. My client side JavaScript code is written in TypeScript. When compiling .ts files VS generates the according .map files too. (In the project I <em>always</em> mark my .ts and .map files as <em>content</em> so it will be served in case the client requests for any. Of course I am going to change this practice in the release.)</p>
  
  <p>When debugging my client side code in Chrome dev tools (F12) then Chrome automatically detects/accepts both the .ts and .map files for a particular .js file. It is <em>so</em> integrated so I can not set a breakpoint in my .js, because when I try it, Chrome automatically switches to the corresponding .ts and sets the breakpoint to the according line there. </p>
  
  <p>This is nice so far, then what's the problem, one may ask. Well, when in the .ts file debugging then all my member variables in a TypeScript class are shown as undefined. (they are not) Those variables are accessed according the TypeScript syntax like <code>this.myMember</code>, so I suppose Chrome (or the .map file) misinterprets the <code>this</code> trick of TypeScript. (that is not the JavaScript <code>this</code>, we would call it in pure JavaScript as <code>_this</code> or <code>that</code> or <code>self</code>. So Chrome uses this <code>this</code> as the real JavaScript calling context, instead of the instance's <code>this</code>, and this context obviously do not have such members as my TypeScript object should have.</p>
  
  <p>To wrap it up, I do not know is it an issue in Chrome, or is it an issue in the .map file generated by VS, but it definitely <em>disables</em> debugging in many cases. (Note I can not debug the original .js when the .map and .ts files are available.)</p>
  
  <p>Of course there is a workaround to disable serving (and generating) the .ts and .map files, and debug the generated .js, but this sounds a bit depressing to have a mapping infrastructure both server and client side, then completly ignore it and debug a machine generated .js code.</p>
  
  <p><a href="https://i.stack.imgur.com/vIfVB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vIfVB.jpg" alt="enter image description here"></a></p>