Asagohan
Asagohan

Reputation: 593

Webstorm typescript single file compilation

I have a typescript module split over two files in Webstorm. I want to compile it into a single javascript file. However, when it is compiled, only one or the other typescript file has been compiled (it is not merging them, and probably overwriting one with the other). I will only see the methods from aClass OR bClass but not both. What settings are required to get the typescript module over 2 files merged and compiled into a single file?

Under Languages and Frameworks I have the following settings:

Command line options: --module amd --sourcemap $FileName$ --out script.js

Use output path: /public/Script

My typescript files are:

aClass.ts

module aModule{
  export class aClass implements IInterface{
      //Some methods
  }
}

bClass.ts

module aModule{
  export class bClass implements IInterface{
      //Some methods
  }
}

IInterface.ts

module aModule {
  export interface IInterface {

 }
}

Upvotes: 0

Views: 729

Answers (2)

anstarovoyt
anstarovoyt

Reputation: 8136

Just set 'Compile main file' option and specify a file name in the 'Output path' field + you need to specify in /// all referenced files.

The second way is to use 'tsconfig.json' as was suggested.

Upvotes: 1

basarat
basarat

Reputation: 276171

--module amd --sourcemap $FileName$ --out script.js

You cannot use --module and --out together. The compiler should error but it doesn't.

Upvotes: 2

Related Questions