`this` is undefined in Dev Tools when using arrow function
This might be an issue because JS arrow functions don't have this
, the value of this
might be referencing the object containing your arrow function, per Arrow functions revisited and MDN's article on Arrow function expressions
The problem is that the chrome debugger believes that the this
in the source code refers to the run-time this
, but this
inside a arrow function in typescript source code is actually transformed to _this
, so it's showing you the wrong object.
This is why it's only a problem in the debugger and the code still works fine. When I need to debug something where this is a problem, I just copy it to the console and prepend it with an underscore.