If you're running under node, you should use export
and import
to manage cross-file dependencies.
a.ts
export var x = 5;
b.ts
import a = require('./a');
console.log(a.x);
Compile with --module commonjs
If you were running on the web you could use --outFile
to concatenate into a single file, but that's usually not a good option under node.