This project is read-only.

How to omit code generation for external referenced files?

Topics: General
Apr 17, 2013 at 7:49 AM

i am using tsc to compile multiple ts sources to individual js files in a defined output directory (using "--out dir").
When I then reference a source file (not a declaration file) in one of my sources using
/// <reference path="Util.ts" />
tsc produces an "Util.js" even when my Util.ts was not specified as source file in the tsc command.

How can this be prevented?

The background of my question is that I try to compile test sources separated from the real application sources. The tests need to reference the application sources but should not produce js files again...

Thanks for any help.

Apr 17, 2013 at 3:09 PM
One pattern you might want to try is to not mix /// reference .ts files while also importing external modules. The general rule of thumb is to use one or the other as much as possible, without mixing them.

You can always /// reference .d.ts files. One thing you might want to try is to convert your .ts files like Utils to .d.ts file, which would avoid the extra .js emit.