Lasantha Basnayake Lasantha Basnayake - 1 year ago 137
TypeScript Question

How to debug Angular 2 Typescript application

How to debug Angular 2 Typescript application using visual code or with the developer tools?

Answer Source

What is important at this level is source maps. They allow you to link TypeScript source code to the transpiled JavaScript one.

There is a sourceMap option in your tsconfig.json file that must be set to true:

  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true, // <-----
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false

} }

You'll then be able to see your TypeScript files within the Sources tab of DevTools and to add breakpoints in them.

This article could also interest you:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download