Typescript无法在VS2012中正确编译 [英] Typescript will not properly compile in VS2012

查看:121
本文介绍了Typescript无法在VS2012中正确编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于不清楚的原因,Typescript突然停止可靠地编译为JS代码.

For no clear reason, Typescript has suddenly stopped reliably compiling into JS code.

使用VS2012,适用于VS版本0.8.3.1的Typescript和Web Essentials版本2.6(设置为保存时编译").

Using VS2012, Typescript for VS ver 0.8.3.1 and Web Essentials ver 2.6 (set to "Compile on Save").

我可以创建一个新的Typescript文件并对其进行简单的更改(例如导出一个简单的var或函数).我可以保存TS文件并查看JS翻译.

I can create a new Typescript file and make simple changes to it (such as export a simnple var or function). I can save TS file and see the JS translation.

但是,一旦我添加了一个或多个TS定义文件(我正在使用AMD),然后编辑了TS文件,相应的JS文件中就没有出现进一步的变化.对TS文件的编辑将不再更新JS. Typescript也不再检查错误.

HOWEVER, once I add one or more TS definition files (I'm using AMD) and then edit the TS file, NO FURTHER CHANGES APPEAR IN THE CORRESPONDING JS FILE. Edits to the TS file will no longer update the JS. Typescript no longer checks for errors either.

只有当我关闭并重新打开VS2012时,正确的JS文件才会最终出现.

Only when I close and reopen VS2012 will the proper JS file finally appear.

我已经卸载/重新安装了Typescript,Web Essentials和VS2012,但无济于事.

I've uninstalled/reinstalled Typescript, Web Essentials and VS2012 to no avail.

有人对我如何解决此问题有任何建议吗?我很茫然.

Does anyone have any suggestions on how I can fix this problem? I'm at a loss.

编辑

这是完全可复制的情况.今天,我格式化了驱动器并重新安装了VS2012.使用Windows 7的64位版本.创建了一个新的MVC4项目.创建了一个新的TS文件.添加了几个定义文件.尝试编辑默认的getDist()函数.已保存.没有更新JS文件.删除了定义文件.已保存. JS文件已按预期正确更新.

This is an entirely reproducible condition. Today, I formatted my drive and re-installed VS2012 anew. USING 64-bit version of Windows 7. Created a new MVC4 project. Created a new TS file. Added a couple of definition files. Attempted to edit the default getDist() function. Saved. No update to the JS file. Removed the definition files. Saved. JS file is properly updated as expected.

想像不到我是这个问题的唯一一个人!

IT'S IMPOSSIBLE TO IMAGINE THAT I'M THE ONLY ONE EXPERIENCING THIS PROBLEM!!

请帮助!

重新编辑 问题解决了.见下文.

RE-EDIT Problem solved. See below.

推荐答案

它发生在我身上

我通过将ts文件的构建操作设置为TypeScriptCompile来解决了这个问题

i solved this issue by setting the build action of the ts file to TypeScriptCompile

这篇关于Typescript无法在VS2012中正确编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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