2

Is there a way to find the corresponding line in a Typescript file to the (compiled) Javascript one that is causing an error?

I am using IntelliJ and Google Chrome.

1 Answer 1

3

You need to compile with the source map support. Is will create a .js.map file that matches the JavaScript files with the TypeScript source. Chrome (and all other browsers as well) will be able to use that to show .ts files while debugging.

For the command line compiler you can add the --sourceMap option (docs) to enable this.


To configure the built-in compiler, follow the instructions from jetbrains.com documentation:

Choose the Set options manually to configure compilation manually:

Select the Generate source maps check box to generate source maps that set correspondence between lines in your TypeScript code and in the generated JavaScript code, otherwise your breakpoints will not be recognised and processed correctly.

Sign up to request clarification or add additional context in comments.

1 Comment

Seems that enabling source maps solves issues with non working TS debugger. Thank you : )

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.