Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I debug typescript code in VS 2017?

I have a ASP.NET Core project which uses TypeScript.

Is it possible to debug TypeScript code in Visual Studio?

like image 294
Greg Gum Avatar asked Dec 03 '16 05:12

Greg Gum


People also ask

Is it possible to debug any TypeScript file?

TypeScript is great for writing client-side code as well as Node. js applications and you can debug client-side source code with the built-in Edge and Chrome debugger.


2 Answers

I was attempting to convert the dotnetcore ReactRedux template to Typescript and could not get breakpoints to hit my typescript files.

I was able to determine that in your tsconfig.json file you need to have the options inlineSourceMap:true and inlineSources:true set.

like image 180
NA Slacker Avatar answered Oct 14 '22 02:10

NA Slacker


Make sure you enable browser link in order to see TS break points being hit. The option is the blue arrow circle to the right of the browser selection drop-down in VS2017 and it seems to default to disabled.

enter image description here

like image 34
Andy M Avatar answered Oct 14 '22 00:10

Andy M