Debugging TypeScript code
Browsers don't understand TypeScript; they can only execute JavaScript code. That's why in our index.html file, we have a reference to todo.js and not to todo.ts. Our application is very small in size and it would not be difficult to debug the JavaScript code in the browser, but real-world applications are often large-scale with many files, each with hundreds of lines of code, and it would not be easy to debug the JavaScript generated by the TypeScript compiler. TypeScript provides a workaround to help developers debug their TypeScript code directly in the browser by using a special file with a .map extension. These are called source map files and we need to enable a flag in our tsconfig.json to allow the compiler ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access