1

Visual Studio 2017 does a great job of letting me debug directly in TypeScript and a lot of the time this is extremely helpful. That said, there are times when I REALLY need to debug the underlying Javascript and I can't see how to do it. Is there a way to tell Visual Studio to let me debug in Javascript?

Between the problem with "this" really being "_this" and screwing up the debugger and async / away functions generating very different underlying code it becomes critical to be able to access the Javascript to debug.

5
  • there are times when I REALLY need to debug the underlying Javascript <= Like when? Also just use the browser's debugging tools if you want to do that. Commented Nov 2, 2017 at 18:21
  • As I noted.. Visual Studio does NOT display values requiring "this" correctly. More specifically => screws up Visual Studios ability to access "this" as the code generated is using "_this". Commented Nov 2, 2017 at 18:27
  • That is not VS but that is how the arrow functions capture this when they are transpiled to javascript. Again, you can use the browser's debugging tools which I find preferable over VS when it comes to debugging script. Commented Nov 2, 2017 at 18:36
  • Its a bug that needs a work around. Commented Nov 2, 2017 at 19:07
  • 1
    Then use the browser's debugging tools. All major browsers have a debugger that you can step, do breakpoints, see the source, etc. In the worst case scenario, you need to disable sourcemaps. But to be honest, I've never ran into that situation, nor have ran into issues with transpilation that needed that kind of inspection. Commented Nov 2, 2017 at 21:53

1 Answer 1

2

it becomes critical to be able to access the Javascript to debug.

Disable sourcemaps.

  • In your debugger e.g. chrome options
  • In your tsconfig sourceMap: false
  • In your webpack config devtool : 'none'
  • Anywhere else you might have configured it
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.