typescript - 如何在 sublime Text 3 的一次构建中编译 TypeScript 并运行结果 .js 文件?

标签 typescript sublimetext3

我已经在 Sublime Text 3 上成功安装了 TypeScript 插件。插件安装后,它在菜单中添加了一个构建系统。

enter image description here

您可以只使用“Command + B”来构建 .ts 文件。

我想要的是将 .ts 编译为 .js 并在一个“Command + B”命令中使用“node xxx.js”运行结果 js 文件。

我如何配置 sublime text 3 构建系统来做到这一点?

最佳答案

假设 tscnode 都在您的系统 PATH 中,以下配置应该有效:

{
  "cmd": ["tsc $file && node $file_base_name.js"],
  "shell": true,
  "selector": "*.ts"
}

参见 Build Systems – Configuration有关这里发生的事情的更多信息。

关于typescript - 如何在 sublime Text 3 的一次构建中编译 TypeScript 并运行结果 .js 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39533946/

相关文章:

plugins - 如何设置 Sublime Text 3 鼠标事件来触发自定义行为和默认行为?

python - 如何修复 Sublime Text 3 Python 构建错误?

requirejs - 使用 TypeScript 和 AMD 模块时 "use strict"去了哪里

node.js - 打字安装不适用于已配置的 typescript 定义

reactjs - Material 用户界面 : Concise way to to define styled Components?

python - sublime 中的 Ipython 默认配色方案

css - 如何在 Sublime 3 中设置 scss 语法?

javascript - 如何在 TypeScript 中正确输入用作 map 的 JavaScript 对象

typescript - 如何处理 typescript 定义文件中的类型名称冲突

themes - 如何提高 Material 主题中行号的可见性?