Link to TypeScript file includes the entire output file

I created a new Windows 8 blogging application with TypeScript 0.8.1 and installed websites.

I added both foo.ts and bar.ts .

foo.ts contains only a simple class:

 class Foo { } 

bar.ts contains a link to foo.ts and a class line:

 /// <reference path="foo.ts" /> class Bar { } 

It is strange that bar.js contains the class Bar and Foo:

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

What is going wrong? I am working on a larger project with a common reference.ts file. Suddenly all my ts files are compiled into every javascript file.

+4
source share
2 answers

I really use the -out option to control the placement of compiler files. I just released a fix for this place to test: http://madskristensen.net/custom/webessentials2012.vsix

Please try and tell if this works. Thanks!

+6
source

This usually happens only if you provide the compiler with the --out flag:

 tsc --out bar.js foo.ts bar.ts 

Does this happen when saving or in assembly? If this happens when saving, it is related to Web Essentials, whereas if it happens during assembly, you should check the source of the project file to see if the --out flag has it.

+3
source

Source: https://habr.com/ru/post/1447062/


All Articles