引用TypeScript文件包括输出中的整个文件 [英] Referencing TypeScript file includes whole file in output

查看:589
本文介绍了引用TypeScript文件包括输出中的整个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个安装了TypeScript 0.8.1和Web Essentials的新Windows 8 JavaScript Blank应用程序。

I have created a new Windows 8 JavaScript Blank app with TypeScript 0.8.1 and Web Essentials installed.

我已经添加了一个文件 foo.ts bar.ts 到我的项目。

I have added both a file foo.ts and bar.ts to my project.

foo.ts 只包含一个简单的类:

foo.ts contains only a simple class:

class Foo
{ }

bar.ts 包含对<的引用code> foo.ts 和一个班级栏:

bar.ts contains a reference to foo.ts and a class bar:

/// <reference path="foo.ts" />

class Bar
{ }

奇怪的是, bar.js 包含Bar和Foo类:

The strange thing is that bar.js contains both the Bar and Foo class:

var Foo = (function () {
    function Foo() { }
    return Foo;
})();
var Bar = (function () {
    function Bar() { }
    return Bar;
})();

出了什么问题?我正在开发一个包含共享 reference.ts 文件的大型项目。突然我的所有ts文件都被编译到每个javascript文件中。

What is going wrong? I'm working on a larger project with a shared reference.ts file. Suddenly all my ts files are compiled to each javascript file.

推荐答案

我确实使用-out参数来控制编译器的文件展示位置。我刚刚将此修复程序发布到此位置进行测试: http://madskristensen.net/custom/webessentials2012.vsix

I do indeed use the -out parameter to control the compiler's file placements. I've just released the fix to this location for testing: http://madskristensen.net/custom/webessentials2012.vsix

请尝试一下,告诉我它是否有效。谢谢!

Please try it out and tell me if it worked. Thanks!

这篇关于引用TypeScript文件包括输出中的整个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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