在 VS Code 中,如何使用 Typescript 1.5 alpha 编译器 [英] In VS Code, how to use the Typescript 1.5 alpha compiler

查看:37
本文介绍了在 VS Code 中,如何使用 Typescript 1.5 alpha 编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看 VS Code 设置,似乎没有针对每个项目的选项来设置 Typescript 编译器.我可以将 VS Code 设置为使用我通过 NPM 安装的 1.5 alpha 编译器吗?在 tsconfig 文件中引用这个编译器会起作用吗?

Looking through the VS Code settings, there doesn't seem to be an option, on a per project basis, to set the Typescript compiler. Can I set VS Code to use the 1.5 alpha compiler I've installed via NPM? Would referencing this compiler in a tsconfig file work?

只是想补充一点,我想编译成 ES6,如果这有区别的话.

Just want to add that I'd like to compile to ES6, if that makes a difference.

推荐答案

我现在已经验证了这一点 - 您可以编辑您的 tasks.json 文件以指向您喜欢的任何版本.下面的例子指向 1.5 测试版,但你可以指向 1.4...或者我想如果你想要果味,甚至是 0.8.

I have now verified this - you can edit your tasks.json file to point to any version you like. The example below points at the 1.5 beta, but you can point at 1.4... or I suppose even 0.8 if you want to be fruity.

{
    "version": "0.1.0",

    // The command is tsc.
    "command": "C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.5\\tsc",

    // Show the output window only if unrecognized errors occur. 
    "showOutput": "silent",

    // Under windows use tsc.exe. This ensures we don't need a shell.
    "windows": {
        "command": "C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.5\\tsc.exe"
    },

    // args is the HelloWorld program to compile.
    "args": ["app.ts"],

    // use the standard tsc problem matcher to find compile problems
    // in the output.
    "problemMatcher": "$tsc"
}

这篇关于在 VS Code 中,如何使用 Typescript 1.5 alpha 编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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