How do I debug typescript code in VS 2017?

前端 未结 5 1398
温柔的废话
温柔的废话 2020-12-06 17:12

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

Is it possible to debug TypeScript code in Visual Studio?

5条回答
  •  情歌与酒
    2020-12-06 17:45

    In prior versions of Visual Studio, this was not possible.

    In Visual Studio 2017 however, this has been fixed. Just set your breakpoint and run your project using IE (or Chrome) and your breakpoint will be hit in your ts file and you can step through the code in the VS environment (not in the browser code debug window). This is a huge step forward for Typescript development.

    The interesting things is that the code will transition to js if it jumps to another file for which there is no matching ts file, and then transition back again to ts again when it can.

提交回复
热议问题