如何在 VS Code 中使用“compileOnSave”?

Kok*_*oko 2 typescript visual-studio-code

Typescript 有一个用于自动编译 Typescript 的配置选项,如此处所述

{
   "compileOnSave": true,
   "compilerOptions": {
       "noImplicitAny" : true
   }
}
Run Code Online (Sandbox Code Playgroud)

但仅将其包含在我的 tsconfig.json 文件中不足以触发自动编译。我使用 MS Visual Studio Code 作为我的 IDE。如何触发“保存时编译”行为?

rgv*_*sar 5

根据TypeScript 网站

“此功能目前在带有 TypeScript 1.8.4 及更高版本和atom-typescript 插件的 Visual Studio 2015 中受支持。”

因此,Visual Studio Code 目前不支持它。我在使用 Visual Studio 2015 工作时使用此选项,在家里使用 Atom,效果很好。这实际上是我从 Visual Studio Code 切换到 Atom 的原因之一。