This project is read-only.

tsc --out does not seem to work properly

Topics: General
Oct 18, 2012 at 10:22 PM
Edited Oct 18, 2012 at 10:26 PM


I am trying to use the --out option with the typescript compiler so that I can get just one output file with all the dependent files concatenated. Unfortunately, it does not seem to work. Firstly, according to the documentation:

Syntax:   tsc [options] [file ..]

Examples: tsc hello.ts
          tsc --out foo.js foo.ts
          tsc @args.txt

I should be able to use it like: tsc --out foo.js foo.ts, but doing that gives the following error: module emit collides with emitted script: 

So you cannot use the same filename for output as input. Now, I have two files: animal.ts and fox.ts:


export class Animal{
  legs : number;
  color : string;
    console.log("Processing an animal...")

and fox.ts

import AnimalModule = module("./animal");

export class Fox extends AnimalModule.Animal {
  legs = 4;
  bar : string;
    console.log("Processing Fox");

Now if I run tsc --out result.js fox.ts I get the following in result.js:

var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();

whereas fox.js and animal.js have been generated correctly (although I would expect no other outputs than result.js):


var AnimalModule = require("./animal")
var Fox = (function (_super) {
    __extends(Fox, _super);
    function Fox() {
        _super.apply(this, arguments);

        this.legs = 4;
    Fox.prototype.process = function () {
        console.log("Processing Fox");
    return Fox;
exports.Fox = Fox;


var Animal = (function () {
    function Animal() { }
    Animal.prototype.process = function () {
        console.log("Processing an animal...");
    return Animal;
exports.Animal = Animal;

So what is going in?

Thanks in advance,

Manuel Astudillo.

Oct 18, 2012 at 10:23 PM

I forgot to mention that I am using this with node js version 0.6.20 and typescript version 0.8.0

Oct 19, 2012 at 5:43 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Oct 19, 2012 at 8:18 PM
Edited Oct 19, 2012 at 8:18 PM


Oct 20, 2012 at 12:29 AM

I moved this over to the issue tracker to get feedback there whether or not this was expected (and if it's a bug, to help get it fixed).  Hope that helps.