PyCharm 2016.2 Help

Debugging TypeScript

TypeScript code is not processed by browsers that work with JavaScript code. Therefore to be executed, TypeScript code has to be translated into JavaScript. This operation is referred to as transpilation and the tools that perform it are called transpilers.

Because JavaScript debugging is supported only in Google Chrome and other browsers of the Chrome family, TypeScript can also be debugged only in these browsers.

For more details about using transpilers in PyCharm, see the section Using File Watchers.

To debug TypeScript code:

  1. Transpile the TypeScript code into Javascript using the built-in compiler or a TypeScript file watcher, see Transpiling TypeScript to JavaScript for details.
  2. In the editor, open the HTML files with the TypeScript references.
  3. Manually replace the references to the TypeScript files with the references to the JavaScript files that were generated through the transpilation.
  4. Configure the JavaScript debugger.
  5. Configure and set breakpoints in the TypeScript code. Although actually debugging will be performed against the generated JavaScript, PyCharm will emulate TypeScript debugging using the generated source-maps that set correspondence between lines in the TypeScript and in the JavaScript code.
  6. Proceed as if you were debugging JavaScript:
    1. Initiate a debugging session. For details about local and remote debugging, about debugging single files and entire applications, see Debugging JavaScript.
    2. If you are using Chrome, install and configure the JetBrains Chrome Extension. For details, see Using JetBrains Chrome Extension.
    3. Step through the program, stop and resume program execution, examine it when suspended, etc.

See Also

Last modified: 23 November 2016