如何在 VS 2017 中调试打字稿代码? [英] How do I debug typescript code in VS 2017?

查看:36
本文介绍了如何在 VS 2017 中调试打字稿代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 TypeScript 的 ASP.NET Core 项目.

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

是否可以在 Visual Studio 中调试 TypeScript 代码?

Is it possible to debug TypeScript code in Visual Studio?

推荐答案

在以前的 Visual Studio 版本中,这是不可能的.

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

但是,在 Visual Studio 2017 中,此问题已得到修复.只需设置您的断点并使用 IE(或 Chrome)运行您的项目,您的断点将在您的 ts 文件中被命中,您可以在 VS 环境中(而不是在浏览器代码调试窗口中)单步执行代码.这是 Typescript 开发向前迈出的一大步.

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.

有趣的是,如果代码跳转到另一个没有匹配 ts 文件的文件,代码将转换为 js,然后在可能的情况下再次转换回 ts.

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.

这篇关于如何在 VS 2017 中调试打字稿代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆