typescript - 如何在 VS 代码上调试包含 Class 的打字稿文件?
问题描述
在 VS Code 中,我试图调试(在 Node.Js 环境中)一个包含类的打字稿文件。虽然我已经能够在没有类的情况下调试 .ts 文件。
样本.ts
class A {
value: string;
constructor() {
this.value = "some_value";
}
print() {
console.log(this.value)
}
}
let v = new A();
v.print();
尝试调试“sample.ts”时显示以下错误
Process exited with code 1
Uncaught f:\TS\sample.ts:2
value: string;
SyntaxError: Unexpected identifier
No debugger available, can not send 'variables'
SyntaxError: Unexpected identifier
at wrapSafe (internal/modules/cjs/loader.js:1047:16)
at Module._compile (internal/modules/cjs/loader.js:1097:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
解决方案
推荐阅读
- c# - 无法为 Dictionary 创建“set”访问器
- google-apps-script - Google Sheet 脚本运行不可靠
- c# - 在没有nuget的.net4.0项目中安装rx.net
- python - 用鼠标选择图像的一个区域并记录选择的尺寸
- symfony - Symfony 4 使用 Monolog 的 Redis 处理程序启用日志记录
- python - Altair 复选框默认值
- python - Opencv显示错误的图像宽度和高度
- node.js - 如何在节点 js 中将 HTTP 端点订阅到 SNS?
- python - 导入 pygame 时出现 ImportError
- chart.js - 是否可以在 x 轴上为折线图添加水平范围滑块控件以使用 chartJS 动态控制 x 轴数据